fix(library): auto-expand all bins on load so nested children visible by default
This commit is contained in:
parent
4e6142f455
commit
99bd6a8c9c
1 changed files with 4 additions and 1 deletions
|
|
@ -17,6 +17,8 @@ function Library({ navigate, onOpenAsset, openProject, onClearProject }) {
|
||||||
var normalized = (list || []).map(function(b) { return { ...b, count: b.asset_count != null ? b.asset_count : (b.count || 0), icon: b.type || 'grid' }; });
|
var normalized = (list || []).map(function(b) { return { ...b, count: b.asset_count != null ? b.asset_count : (b.count || 0), icon: b.type || 'grid' }; });
|
||||||
if (!openProject) window.ZAMPP_DATA.BINS = normalized;
|
if (!openProject) window.ZAMPP_DATA.BINS = normalized;
|
||||||
setBins(normalized);
|
setBins(normalized);
|
||||||
|
// Auto-expand all bins so nested children are always visible
|
||||||
|
setExpandedBins(function(prev) { var s = new Set(prev); normalized.forEach(function(b){ s.add(b.id); }); return s; });
|
||||||
})
|
})
|
||||||
.catch(function() {});
|
.catch(function() {});
|
||||||
}, [openProject]);
|
}, [openProject]);
|
||||||
|
|
@ -29,7 +31,8 @@ function Library({ navigate, onOpenAsset, openProject, onClearProject }) {
|
||||||
}, [refreshBins]);
|
}, [refreshBins]);
|
||||||
|
|
||||||
const [creatingChildOf, setCreatingChildOf] = React.useState(null);
|
const [creatingChildOf, setCreatingChildOf] = React.useState(null);
|
||||||
const [expandedBins, setExpandedBins] = React.useState(new Set());
|
// Start with all bins expanded so nested children are visible immediately
|
||||||
|
const [expandedBins, setExpandedBins] = React.useState(() => new Set((window.ZAMPP_DATA?.BINS||[]).map(b=>b.id)));
|
||||||
|
|
||||||
const createBin = () => {
|
const createBin = () => {
|
||||||
if (!openProject) { window.alert('Open a project first (Projects → click a project), then create a bin inside it.'); return; }
|
if (!openProject) { window.alert('Open a project first (Projects → click a project), then create a bin inside it.'); return; }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue