diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index 5b94ad951..37c8d70e4 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -1,6 +1,7 @@ + { + if (e.key === 'Shift') shiftKey = true; + }} + on:keyup={(e) => { + if (e.key === 'Shift') shiftKey = false; + }} +/> + {/if} - { - show = false; - - await showSettings.set(true); - - if ($mobile) { - await tick(); - showSidebar.set(false); - } - }} - > - - + {#if ($config?.features?.enable_notes ?? false) && ($user?.role === 'admin' || ($user?.permissions?.features?.notes ?? true))} + + { + if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) return; + e.preventDefault(); + show = false; + goto('/notes'); + if ($mobile) { + await tick(); + showSidebar.set(false); + } + }} + > + + + + {$i18n.t('Notes')} + + {#if shiftKey} + + togglePin('notes')} + > + {#if isPinned('notes')} + + {:else} + + {/if} + + + {/if} - {$i18n.t('Settings')} - + {/if} + + {#if $user?.role === 'admin' || $user?.permissions?.workspace?.models || $user?.permissions?.workspace?.knowledge || $user?.permissions?.workspace?.prompts || $user?.permissions?.workspace?.tools} + + { + if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) return; + e.preventDefault(); + show = false; + goto('/workspace'); + if ($mobile) { + await tick(); + showSidebar.set(false); + } + }} + > + + + + + + {$i18n.t('Workspace')} + + {#if shiftKey} + + togglePin('workspace')} + > + {#if isPinned('workspace')} + + {:else} + + {/if} + + + {/if} + + {/if} {#if $config?.features?.enable_automations && ($user?.role === 'admin' || $user?.permissions?.features?.automations)} - { - if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) return; - e.preventDefault(); - show = false; - goto('/automations'); - if ($mobile) { - await tick(); - showSidebar.set(false); - } - }} - > - - + { + if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) return; + e.preventDefault(); + show = false; + goto('/automations'); + if ($mobile) { + await tick(); + showSidebar.set(false); + } + }} + > + + + + + + {$i18n.t('Automations')} + + {#if shiftKey} + - - - - {$i18n.t('Automations')} - + togglePin('automations')} + > + {#if isPinned('automations')} + + {:else} + + {/if} + + + {/if} + {/if} {#if $config?.features?.enable_calendar && ($user?.role === 'admin' || $user?.permissions?.features?.calendar)} - { - if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) return; - e.preventDefault(); - show = false; - goto('/calendar'); - }} - > - - + { + if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) return; + e.preventDefault(); + show = false; + goto('/calendar'); + }} + > + + + + + + {$i18n.t('Calendar')} + + {#if shiftKey} + - - - - {$i18n.t('Calendar')} - + togglePin('calendar')} + > + {#if isPinned('calendar')} + + {:else} + + {/if} + + + {/if} + {/if} {#if role === 'admin'} - { - if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) { - return; - } - e.preventDefault(); - show = false; - goto('/playground'); - if ($mobile) { - await tick(); - showSidebar.set(false); - } - }} - > - - - - {$i18n.t('Playground')} - + + { + if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) return; + e.preventDefault(); + show = false; + goto('/playground'); + if ($mobile) { + await tick(); + showSidebar.set(false); + } + }} + > + + + + {$i18n.t('Playground')} + + {#if shiftKey} + + togglePin('playground')} + > + {#if isPinned('playground')} + + {:else} + + {/if} + + + {/if} + {/if} + + {$i18n.t('Archived Chats')} + { + show = false; + + await showSettings.set(true); + + if ($mobile) { + await tick(); + showSidebar.set(false); + } + }} + > + + + + {$i18n.t('Settings')} + + {#if role === 'admin'}