File size: 1,809 Bytes
cfb0fa4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | <script lang="ts">
import { DropdownMenu } from 'bits-ui';
import { createEventDispatcher, getContext, onMount } from 'svelte';
import { showSettings, mobile, showSidebar, user } from '$lib/stores';
import { fade, slide } from 'svelte/transition';
import PencilSquare from '../icons/PencilSquare.svelte';
import ChatBubbleOval from '../icons/ChatBubbleOval.svelte';
import Sparkles from '../icons/Sparkles.svelte';
const i18n = getContext('i18n');
export let show = false;
export let className = 'max-w-[170px]';
export let onEdit = () => {};
export let onChat = () => {};
export let onChange = () => {};
</script>
<DropdownMenu.Root bind:open={show} onOpenChange={onChange}>
<DropdownMenu.Trigger>
<slot />
</DropdownMenu.Trigger>
<slot name="content">
<DropdownMenu.Content
class="w-full {className} text-sm rounded-xl p-1 z-50 bg-white dark:bg-gray-850 dark:text-white shadow-lg font-primary"
sideOffset={8}
side="bottom"
align="end"
transition={(e) => fade(e, { duration: 100 })}
>
<button
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition"
on:click={async () => {
onEdit();
show = false;
}}
>
<div class=" self-center mr-2">
<Sparkles className="size-4" strokeWidth="2" />
</div>
<div class=" self-center truncate">{$i18n.t('Enhance')}</div>
</button>
<button
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition"
on:click={() => {
onChat();
show = false;
}}
>
<div class=" self-center mr-2">
<ChatBubbleOval className="size-4" strokeWidth="2" />
</div>
<div class=" self-center truncate">{$i18n.t('Chat')}</div>
</button>
</DropdownMenu.Content>
</slot>
</DropdownMenu.Root>
|