refac
This commit is contained in:
1 parent
ec9c066961
commit
4198f36c01
1 file changed
+65
-65
@@ -234,50 +234,6 @@
|
|||||||
<hr class=" border-gray-50/30 dark:border-gray-800/30 my-1.5 p-0" />
|
<hr class=" border-gray-50/30 dark:border-gray-800/30 my-1.5 p-0" />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if ($config?.features?.enable_notes ?? false) && ($user?.role === 'admin' || ($user?.permissions?.features?.notes ?? true))}
|
|
||||||
<div class="flex items-center w-full">
|
|
||||||
<a
|
|
||||||
href="/notes"
|
|
||||||
draggable="false"
|
|
||||||
class="flex flex-1 rounded-xl py-1.5 px-3 hover:bg-gray-50 dark:hover:bg-gray-800 transition cursor-pointer select-none"
|
|
||||||
on:click={async (e) => {
|
|
||||||
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) return;
|
|
||||||
e.preventDefault();
|
|
||||||
show = false;
|
|
||||||
goto('/notes');
|
|
||||||
if ($mobile) {
|
|
||||||
await tick();
|
|
||||||
showSidebar.set(false);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div class="self-center mr-3">
|
|
||||||
<Note className="size-5" strokeWidth="1.5" />
|
|
||||||
</div>
|
|
||||||
<div class="self-center truncate">{$i18n.t('Notes')}</div>
|
|
||||||
</a>
|
|
||||||
{#if shiftKey}
|
|
||||||
<Tooltip
|
|
||||||
content={isPinned('notes')
|
|
||||||
? $i18n.t('Unpin from Sidebar')
|
|
||||||
: $i18n.t('Pin to Sidebar')}
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="p-1 mr-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition"
|
|
||||||
on:click|preventDefault|stopPropagation={() => togglePin('notes')}
|
|
||||||
>
|
|
||||||
{#if isPinned('notes')}
|
|
||||||
<PinSlash className="size-3.5" strokeWidth="1.5" />
|
|
||||||
{:else}
|
|
||||||
<Pin className="size-3.5" strokeWidth="1.5" />
|
|
||||||
{/if}
|
|
||||||
</button>
|
|
||||||
</Tooltip>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if $user?.role === 'admin' || $user?.permissions?.workspace?.models || $user?.permissions?.workspace?.knowledge || $user?.permissions?.workspace?.prompts || $user?.permissions?.workspace?.tools}
|
{#if $user?.role === 'admin' || $user?.permissions?.workspace?.models || $user?.permissions?.workspace?.knowledge || $user?.permissions?.workspace?.prompts || $user?.permissions?.workspace?.tools}
|
||||||
<div class="flex items-center w-full">
|
<div class="flex items-center w-full">
|
||||||
<a
|
<a
|
||||||
@@ -335,17 +291,17 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if $config?.features?.enable_automations && ($user?.role === 'admin' || $user?.permissions?.features?.automations)}
|
{#if ($config?.features?.enable_notes ?? false) && ($user?.role === 'admin' || ($user?.permissions?.features?.notes ?? true))}
|
||||||
<div class="flex items-center w-full">
|
<div class="flex items-center w-full">
|
||||||
<a
|
<a
|
||||||
href="/automations"
|
href="/notes"
|
||||||
draggable="false"
|
draggable="false"
|
||||||
class="flex flex-1 rounded-xl py-1.5 px-3 hover:bg-gray-50 dark:hover:bg-gray-800 transition cursor-pointer select-none"
|
class="flex flex-1 rounded-xl py-1.5 px-3 hover:bg-gray-50 dark:hover:bg-gray-800 transition cursor-pointer select-none"
|
||||||
on:click={async (e) => {
|
on:click={async (e) => {
|
||||||
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) return;
|
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
show = false;
|
show = false;
|
||||||
goto('/automations');
|
goto('/notes');
|
||||||
if ($mobile) {
|
if ($mobile) {
|
||||||
await tick();
|
await tick();
|
||||||
showSidebar.set(false);
|
showSidebar.set(false);
|
||||||
@@ -353,35 +309,22 @@
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class="self-center mr-3">
|
<div class="self-center mr-3">
|
||||||
<svg
|
<Note className="size-5" strokeWidth="1.5" />
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke="currentColor"
|
|
||||||
class="size-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>
|
</div>
|
||||||
<div class="self-center truncate">{$i18n.t('Automations')}</div>
|
<div class="self-center truncate">{$i18n.t('Notes')}</div>
|
||||||
</a>
|
</a>
|
||||||
{#if shiftKey}
|
{#if shiftKey}
|
||||||
<Tooltip
|
<Tooltip
|
||||||
content={isPinned('automations')
|
content={isPinned('notes')
|
||||||
? $i18n.t('Unpin from Sidebar')
|
? $i18n.t('Unpin from Sidebar')
|
||||||
: $i18n.t('Pin to Sidebar')}
|
: $i18n.t('Pin to Sidebar')}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="p-1 mr-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition"
|
class="p-1 mr-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition"
|
||||||
on:click|preventDefault|stopPropagation={() => togglePin('automations')}
|
on:click|preventDefault|stopPropagation={() => togglePin('notes')}
|
||||||
>
|
>
|
||||||
{#if isPinned('automations')}
|
{#if isPinned('notes')}
|
||||||
<PinSlash className="size-3.5" strokeWidth="1.5" />
|
<PinSlash className="size-3.5" strokeWidth="1.5" />
|
||||||
{:else}
|
{:else}
|
||||||
<Pin className="size-3.5" strokeWidth="1.5" />
|
<Pin className="size-3.5" strokeWidth="1.5" />
|
||||||
@@ -445,6 +388,63 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{#if $config?.features?.enable_automations && ($user?.role === 'admin' || $user?.permissions?.features?.automations)}
|
||||||
|
<div class="flex items-center w-full">
|
||||||
|
<a
|
||||||
|
href="/automations"
|
||||||
|
draggable="false"
|
||||||
|
class="flex flex-1 rounded-xl py-1.5 px-3 hover:bg-gray-50 dark:hover:bg-gray-800 transition cursor-pointer select-none"
|
||||||
|
on:click={async (e) => {
|
||||||
|
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) return;
|
||||||
|
e.preventDefault();
|
||||||
|
show = false;
|
||||||
|
goto('/automations');
|
||||||
|
if ($mobile) {
|
||||||
|
await tick();
|
||||||
|
showSidebar.set(false);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div class="self-center mr-3">
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
class="size-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>
|
||||||
|
<div class="self-center truncate">{$i18n.t('Automations')}</div>
|
||||||
|
</a>
|
||||||
|
{#if shiftKey}
|
||||||
|
<Tooltip
|
||||||
|
content={isPinned('automations')
|
||||||
|
? $i18n.t('Unpin from Sidebar')
|
||||||
|
: $i18n.t('Pin to Sidebar')}
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="p-1 mr-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition"
|
||||||
|
on:click|preventDefault|stopPropagation={() => togglePin('automations')}
|
||||||
|
>
|
||||||
|
{#if isPinned('automations')}
|
||||||
|
<PinSlash className="size-3.5" strokeWidth="1.5" />
|
||||||
|
{:else}
|
||||||
|
<Pin className="size-3.5" strokeWidth="1.5" />
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
|
</Tooltip>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#if role === 'admin'}
|
{#if role === 'admin'}
|
||||||
<div class="flex items-center w-full">
|
<div class="flex items-center w-full">
|
||||||
<a
|
<a
|
||||||
|
|||||||
Reference in new issue
Block a user