open-webui/src/lib/components/layout/Sidebar/ChatMenu.svelte

55 lines
1.3 KiB
Svelte
Raw Normal View History

2024-03-16 08:57:26 +00:00
<script lang="ts">
import { DropdownMenu } from 'bits-ui';
import Dropdown from '$lib/components/common/Dropdown.svelte';
import GarbageBin from '$lib/components/icons/GarbageBin.svelte';
import Pencil from '$lib/components/icons/Pencil.svelte';
2024-03-16 09:35:40 +00:00
import Tooltip from '$lib/components/common/Tooltip.svelte';
2024-03-16 08:57:26 +00:00
export let renameHandler: Function;
export let deleteHandler: Function;
2024-03-16 09:43:51 +00:00
export let onClose: Function;
2024-03-16 08:57:26 +00:00
</script>
2024-03-16 09:43:51 +00:00
<Dropdown
on:change={(e) => {
if (e.detail === false) {
onClose();
}
}}
>
2024-03-16 09:35:40 +00:00
<Tooltip content="More">
<slot />
</Tooltip>
2024-03-16 08:57:26 +00:00
<div slot="content">
<DropdownMenu.Content
2024-03-16 09:34:27 +00:00
class="w-full max-w-[130px] rounded-lg px-1 py-1.5 border border-gray-700/50 z-50 bg-gray-850 text-white"
2024-03-18 17:49:39 +00:00
sideOffset={-2}
2024-03-16 08:57:26 +00:00
side="bottom"
align="start"
>
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer"
on:click={() => {
renameHandler();
}}
>
<Pencil strokeWidth="2" />
<div class="flex items-center">Rename</div>
</DropdownMenu.Item>
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer"
on:click={() => {
deleteHandler();
}}
>
<GarbageBin strokeWidth="2" />
<div class="flex items-center">Delete</div>
</DropdownMenu.Item>
</DropdownMenu.Content>
</div>
</Dropdown>