Improve toolbox reorder and checklist editing UX
All checks were successful
Deploy Sokko G / deploy (push) Successful in 8s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 8s
This commit is contained in:
parent
1e4ac4259b
commit
8eb622e05d
11 changed files with 695 additions and 140 deletions
|
|
@ -553,9 +553,10 @@ export function CombosModule({ toolboxId, moduleId, context, editing }) {
|
|||
);
|
||||
}
|
||||
|
||||
function renderCategory(group) {
|
||||
function renderCategory(group, index, groupCount) {
|
||||
const category = group.category;
|
||||
const isCollapsed = data.collapsedCategories.includes(category);
|
||||
const isLastCategory = index === groupCount - 1;
|
||||
const categoryClassName = [
|
||||
"combos-category checklist-section is-grouped",
|
||||
isCollapsed ? "is-collapsed" : "",
|
||||
|
|
@ -614,10 +615,19 @@ export function CombosModule({ toolboxId, moduleId, context, editing }) {
|
|||
</div>
|
||||
)}
|
||||
</section>,
|
||||
afterDropZone
|
||||
showBoundaryDropZones && isLastCategory ? afterDropZone : null
|
||||
];
|
||||
}
|
||||
|
||||
const categoryCount = entries.filter((entry) => entry.type === "group").length;
|
||||
let renderedCategoryIndex = -1;
|
||||
|
||||
function renderEntry(entry) {
|
||||
if (entry.type !== "group") return renderCombo(entry.item);
|
||||
renderedCategoryIndex += 1;
|
||||
return renderCategory(entry.group, renderedCategoryIndex, categoryCount);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="combos-module">
|
||||
{(editing || editingComboId) && (
|
||||
|
|
@ -738,7 +748,7 @@ export function CombosModule({ toolboxId, moduleId, context, editing }) {
|
|||
)}
|
||||
|
||||
<div className="combos-category-list">
|
||||
{entries.map((entry) => entry.type === "group" ? renderCategory(entry.group) : renderCombo(entry.item))}
|
||||
{entries.map(renderEntry)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue