mirror of
https://github.com/open-webui/open-webui
synced 2025-05-15 11:06:15 +00:00
71 lines
2.0 KiB
Svelte
71 lines
2.0 KiB
Svelte
<script lang="ts">
|
|
import { DropdownMenu } from 'bits-ui';
|
|
import { flyAndScale } from '$lib/utils/transitions';
|
|
import { getContext, createEventDispatcher } from 'svelte';
|
|
|
|
const i18n = getContext('i18n');
|
|
const dispatch = createEventDispatcher();
|
|
|
|
import Dropdown from '$lib/components/common/Dropdown.svelte';
|
|
import GarbageBin from '$lib/components/icons/GarbageBin.svelte';
|
|
import Pencil from '$lib/components/icons/Pencil.svelte';
|
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
|
import Download from '$lib/components/icons/Download.svelte';
|
|
|
|
let show = false;
|
|
</script>
|
|
|
|
<Dropdown
|
|
bind:show
|
|
on:change={(e) => {
|
|
if (e.detail === false) {
|
|
dispatch('close');
|
|
}
|
|
}}
|
|
>
|
|
<Tooltip content={$i18n.t('More')}>
|
|
<slot />
|
|
</Tooltip>
|
|
|
|
<div slot="content">
|
|
<DropdownMenu.Content
|
|
class="w-full max-w-[160px] rounded-lg px-1 py-1.5 z-50 bg-white dark:bg-gray-850 dark:text-white shadow-lg"
|
|
sideOffset={-2}
|
|
side="bottom"
|
|
align="start"
|
|
transition={flyAndScale}
|
|
>
|
|
<DropdownMenu.Item
|
|
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
|
|
on:click={() => {
|
|
dispatch('rename');
|
|
}}
|
|
>
|
|
<Pencil strokeWidth="2" />
|
|
<div class="flex items-center">{$i18n.t('Rename')}</div>
|
|
</DropdownMenu.Item>
|
|
|
|
<DropdownMenu.Item
|
|
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
|
|
on:click={() => {
|
|
dispatch('export');
|
|
}}
|
|
>
|
|
<Download strokeWidth="2" />
|
|
|
|
<div class="flex items-center">{$i18n.t('Export')}</div>
|
|
</DropdownMenu.Item>
|
|
|
|
<DropdownMenu.Item
|
|
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
|
|
on:click={() => {
|
|
dispatch('delete');
|
|
}}
|
|
>
|
|
<GarbageBin strokeWidth="2" />
|
|
<div class="flex items-center">{$i18n.t('Delete')}</div>
|
|
</DropdownMenu.Item>
|
|
</DropdownMenu.Content>
|
|
</div>
|
|
</Dropdown>
|