refac
This commit is contained in:
@@ -856,161 +856,47 @@
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if pinnedItems.includes('notes') && ($config?.features?.enable_notes ?? false) && ($user?.role === 'admin' || ($user?.permissions?.features?.notes ?? true))}
|
{#each pinnedItems as itemId (itemId)}
|
||||||
<div class="">
|
{@const meta = getMenuItemMeta(itemId)}
|
||||||
<Tooltip content={$i18n.t('Notes')} placement="right">
|
{#if meta && isMenuItemVisible(itemId)}
|
||||||
<a
|
<div class="">
|
||||||
class=" cursor-pointer flex rounded-xl hover:bg-gray-100 dark:hover:bg-gray-850 transition group"
|
<Tooltip content={$i18n.t(meta.label)} placement="right">
|
||||||
href="/notes"
|
<a
|
||||||
on:click={async (e) => {
|
class=" cursor-pointer flex rounded-xl hover:bg-gray-100 dark:hover:bg-gray-850 transition group"
|
||||||
e.stopImmediatePropagation();
|
href={meta.href}
|
||||||
e.preventDefault();
|
on:click={async (e) => {
|
||||||
|
e.stopImmediatePropagation();
|
||||||
goto('/notes');
|
e.preventDefault();
|
||||||
itemClickHandler();
|
goto(meta.href);
|
||||||
}}
|
itemClickHandler();
|
||||||
draggable="false"
|
}}
|
||||||
aria-label={$i18n.t('Notes')}
|
draggable="false"
|
||||||
>
|
aria-label={$i18n.t(meta.label)}
|
||||||
<div class=" self-center flex items-center justify-center size-9">
|
>
|
||||||
<Note className="size-4.5" />
|
<div class=" self-center flex items-center justify-center size-9">
|
||||||
</div>
|
{#if itemId === 'notes'}
|
||||||
</a>
|
<Note className="size-4.5" />
|
||||||
</Tooltip>
|
{:else if itemId === 'workspace'}
|
||||||
</div>
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4.5">
|
||||||
{/if}
|
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 0 0 2.25-2.25V6a2.25 2.25 0 0 0-2.25-2.25H6A2.25 2.25 0 0 0 3.75 6v2.25A2.25 2.25 0 0 0 6 10.5Zm0 9.75h2.25A2.25 2.25 0 0 0 10.5 18v-2.25a2.25 2.25 0 0 0-2.25-2.25H6a2.25 2.25 0 0 0-2.25 2.25V18A2.25 2.25 0 0 0 6 20.25Zm9.75-9.75H18a2.25 2.25 0 0 0 2.25-2.25V6A2.25 2.25 0 0 0 18 3.75h-2.25A2.25 2.25 0 0 0 13.5 6v2.25a2.25 2.25 0 0 0 2.25 2.25Z" />
|
||||||
|
</svg>
|
||||||
{#if pinnedItems.includes('workspace') && ($user?.role === 'admin' || $user?.permissions?.workspace?.models || $user?.permissions?.workspace?.knowledge || $user?.permissions?.workspace?.prompts || $user?.permissions?.workspace?.tools)}
|
{:else if itemId === 'automations'}
|
||||||
<div class="">
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4.5">
|
||||||
<Tooltip content={$i18n.t('Workspace')} placement="right">
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
|
||||||
<a
|
</svg>
|
||||||
class=" cursor-pointer flex rounded-xl hover:bg-gray-100 dark:hover:bg-gray-850 transition group"
|
{:else if itemId === 'calendar'}
|
||||||
href="/workspace"
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4.5">
|
||||||
on:click={async (e) => {
|
<path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5" />
|
||||||
e.stopImmediatePropagation();
|
</svg>
|
||||||
e.preventDefault();
|
{:else if itemId === 'playground'}
|
||||||
|
<Code className="size-4.5" />
|
||||||
goto('/workspace');
|
{/if}
|
||||||
itemClickHandler();
|
</div>
|
||||||
}}
|
</a>
|
||||||
aria-label={$i18n.t('Workspace')}
|
</Tooltip>
|
||||||
draggable="false"
|
</div>
|
||||||
>
|
{/if}
|
||||||
<div class=" self-center flex items-center justify-center size-9">
|
{/each}
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke="currentColor"
|
|
||||||
class="size-4.5"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
d="M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 0 0 2.25-2.25V6a2.25 2.25 0 0 0-2.25-2.25H6A2.25 2.25 0 0 0 3.75 6v2.25A2.25 2.25 0 0 0 6 10.5Zm0 9.75h2.25A2.25 2.25 0 0 0 10.5 18v-2.25a2.25 2.25 0 0 0-2.25-2.25H6a2.25 2.25 0 0 0-2.25 2.25V18A2.25 2.25 0 0 0 6 20.25Zm9.75-9.75H18a2.25 2.25 0 0 0 2.25-2.25V6A2.25 2.25 0 0 0 18 3.75h-2.25A2.25 2.25 0 0 0 13.5 6v2.25a2.25 2.25 0 0 0 2.25 2.25Z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if pinnedItems.includes('automations') && $config?.features?.enable_automations && ($user?.role === 'admin' || $user?.permissions?.features?.automations)}
|
|
||||||
<div class="">
|
|
||||||
<Tooltip content={$i18n.t('Automations')} placement="right">
|
|
||||||
<a
|
|
||||||
class=" cursor-pointer flex rounded-xl hover:bg-gray-100 dark:hover:bg-gray-850 transition group"
|
|
||||||
href="/automations"
|
|
||||||
on:click={async (e) => {
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
goto('/automations');
|
|
||||||
itemClickHandler();
|
|
||||||
}}
|
|
||||||
draggable="false"
|
|
||||||
aria-label={$i18n.t('Automations')}
|
|
||||||
>
|
|
||||||
<div class=" self-center flex items-center justify-center size-9">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke="currentColor"
|
|
||||||
class="size-4.5"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if pinnedItems.includes('calendar') && $config?.features?.enable_calendar && ($user?.role === 'admin' || $user?.permissions?.features?.calendar)}
|
|
||||||
<div class="">
|
|
||||||
<Tooltip content={$i18n.t('Calendar')} placement="right">
|
|
||||||
<a
|
|
||||||
class=" cursor-pointer flex rounded-xl hover:bg-gray-100 dark:hover:bg-gray-850 transition group"
|
|
||||||
href="/calendar"
|
|
||||||
on:click={async (e) => {
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
goto('/calendar');
|
|
||||||
itemClickHandler();
|
|
||||||
}}
|
|
||||||
draggable="false"
|
|
||||||
aria-label={$i18n.t('Calendar')}
|
|
||||||
>
|
|
||||||
<div class=" self-center flex items-center justify-center size-9">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke="currentColor"
|
|
||||||
class="size-4.5"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if pinnedItems.includes('playground') && $user?.role === 'admin'}
|
|
||||||
<div class="">
|
|
||||||
<Tooltip content={$i18n.t('Playground')} placement="right">
|
|
||||||
<a
|
|
||||||
class=" cursor-pointer flex rounded-xl hover:bg-gray-100 dark:hover:bg-gray-850 transition group"
|
|
||||||
href="/playground"
|
|
||||||
on:click={async (e) => {
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
goto('/playground');
|
|
||||||
itemClickHandler();
|
|
||||||
}}
|
|
||||||
draggable="false"
|
|
||||||
aria-label={$i18n.t('Playground')}
|
|
||||||
>
|
|
||||||
<div class=" self-center flex items-center justify-center size-9">
|
|
||||||
<Code className="size-4.5" />
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user