From 73e28c9393bec214ea1ec613e3475abfae673cf9 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sun, 19 Apr 2026 23:49:23 +0900 Subject: [PATCH] refac --- src/lib/components/layout/Sidebar.svelte | 196 +++++------------------ 1 file changed, 41 insertions(+), 155 deletions(-) diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index 97be64113a..10243df067 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -856,161 +856,47 @@ - {#if pinnedItems.includes('notes') && ($config?.features?.enable_notes ?? false) && ($user?.role === 'admin' || ($user?.permissions?.features?.notes ?? true))} -
- - { - e.stopImmediatePropagation(); - e.preventDefault(); - - goto('/notes'); - itemClickHandler(); - }} - draggable="false" - aria-label={$i18n.t('Notes')} - > -
- -
-
-
-
- {/if} - - {#if pinnedItems.includes('workspace') && ($user?.role === 'admin' || $user?.permissions?.workspace?.models || $user?.permissions?.workspace?.knowledge || $user?.permissions?.workspace?.prompts || $user?.permissions?.workspace?.tools)} -
- - { - e.stopImmediatePropagation(); - e.preventDefault(); - - goto('/workspace'); - itemClickHandler(); - }} - aria-label={$i18n.t('Workspace')} - draggable="false" - > -
- - - -
-
-
-
- {/if} - - {#if pinnedItems.includes('automations') && $config?.features?.enable_automations && ($user?.role === 'admin' || $user?.permissions?.features?.automations)} -
- - { - e.stopImmediatePropagation(); - e.preventDefault(); - goto('/automations'); - itemClickHandler(); - }} - draggable="false" - aria-label={$i18n.t('Automations')} - > -
- - - -
-
-
-
- {/if} - - {#if pinnedItems.includes('calendar') && $config?.features?.enable_calendar && ($user?.role === 'admin' || $user?.permissions?.features?.calendar)} -
- - { - e.stopImmediatePropagation(); - e.preventDefault(); - goto('/calendar'); - itemClickHandler(); - }} - draggable="false" - aria-label={$i18n.t('Calendar')} - > -
- - - -
-
-
-
- {/if} - - {#if pinnedItems.includes('playground') && $user?.role === 'admin'} -
- - { - e.stopImmediatePropagation(); - e.preventDefault(); - goto('/playground'); - itemClickHandler(); - }} - draggable="false" - aria-label={$i18n.t('Playground')} - > -
- -
-
-
-
- {/if} + {#each pinnedItems as itemId (itemId)} + {@const meta = getMenuItemMeta(itemId)} + {#if meta && isMenuItemVisible(itemId)} +
+ + { + e.stopImmediatePropagation(); + e.preventDefault(); + goto(meta.href); + itemClickHandler(); + }} + draggable="false" + aria-label={$i18n.t(meta.label)} + > +
+ {#if itemId === 'notes'} + + {:else if itemId === 'workspace'} + + + + {:else if itemId === 'automations'} + + + + {:else if itemId === 'calendar'} + + + + {:else if itemId === 'playground'} + + {/if} +
+
+
+
+ {/if} + {/each}