only show categorys wich have scripts in it
This commit is contained in:
parent
ad0607361a
commit
3f3d967a2c
@ -12,7 +12,9 @@ const Sidebar = ({
|
|||||||
selectedScript: string | null;
|
selectedScript: string | null;
|
||||||
setSelectedScript: (script: string | null) => void;
|
setSelectedScript: (script: string | null) => void;
|
||||||
}) => {
|
}) => {
|
||||||
const uniqueScripts = items.reduce((acc, category) => {
|
const filteredItems = items.filter(category => category.scripts && category.scripts.length > 0);
|
||||||
|
|
||||||
|
const uniqueScripts = filteredItems.reduce((acc, category) => {
|
||||||
for (const script of category.scripts) {
|
for (const script of category.scripts) {
|
||||||
if (!acc.some((s) => s.name === script.name)) {
|
if (!acc.some((s) => s.name === script.name)) {
|
||||||
acc.push(script);
|
acc.push(script);
|
||||||
@ -31,7 +33,7 @@ const Sidebar = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className="rounded-lg">
|
<div className="rounded-lg">
|
||||||
<ScriptAccordion
|
<ScriptAccordion
|
||||||
items={items}
|
items={filteredItems}
|
||||||
selectedScript={selectedScript}
|
selectedScript={selectedScript}
|
||||||
setSelectedScript={setSelectedScript}
|
setSelectedScript={setSelectedScript}
|
||||||
/>
|
/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user