2025-05-03 20:14:19 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import { DropdownMenu } from 'bits-ui';
|
|
|
|
|
import { createEventDispatcher, getContext, onMount } from 'svelte';
|
|
|
|
|
|
2025-06-16 06:42:34 +00:00
|
|
|
import { showSettings, mobile, showSidebar, user } from '$lib/stores';
|
2025-05-03 20:14:19 +00:00
|
|
|
import { fade, slide } from 'svelte/transition';
|
|
|
|
|
|
|
|
|
|
import Mic from '../icons/Mic.svelte';
|
|
|
|
|
import CursorArrowRays from '../icons/CursorArrowRays.svelte';
|
2025-05-04 14:26:33 +00:00
|
|
|
import DocumentArrowUp from '../icons/DocumentArrowUp.svelte';
|
|
|
|
|
import CloudArrowUp from '../icons/CloudArrowUp.svelte';
|
2025-05-03 20:14:19 +00:00
|
|
|
|
|
|
|
|
const i18n = getContext('i18n');
|
|
|
|
|
|
|
|
|
|
export let show = false;
|
2025-06-10 09:57:13 +00:00
|
|
|
export let className = 'max-w-[170px]';
|
2025-05-03 20:14:19 +00:00
|
|
|
|
|
|
|
|
export let onRecord = () => {};
|
|
|
|
|
export let onCaptureAudio = () => {};
|
2025-05-04 14:26:33 +00:00
|
|
|
export let onUpload = () => {};
|
2025-05-03 20:14:19 +00:00
|
|
|
|
|
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<DropdownMenu.Root
|
|
|
|
|
bind:open={show}
|
|
|
|
|
onOpenChange={(state) => {
|
|
|
|
|
dispatch('change', state);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<DropdownMenu.Trigger>
|
|
|
|
|
<slot />
|
|
|
|
|
</DropdownMenu.Trigger>
|
|
|
|
|
|
|
|
|
|
<slot name="content">
|
|
|
|
|
<DropdownMenu.Content
|
2025-09-15 20:54:35 +00:00
|
|
|
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"
|
2025-05-03 20:14:19 +00:00
|
|
|
sideOffset={8}
|
|
|
|
|
side="bottom"
|
|
|
|
|
align="start"
|
|
|
|
|
transition={(e) => fade(e, { duration: 100 })}
|
|
|
|
|
>
|
|
|
|
|
<button
|
2025-05-26 19:22:37 +00:00
|
|
|
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition"
|
2025-05-03 20:14:19 +00:00
|
|
|
on:click={async () => {
|
|
|
|
|
onRecord();
|
|
|
|
|
show = false;
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<div class=" self-center mr-2">
|
2025-07-12 18:14:41 +00:00
|
|
|
<Mic className="size-4" strokeWidth="2" />
|
2025-05-03 20:14:19 +00:00
|
|
|
</div>
|
|
|
|
|
<div class=" self-center truncate">{$i18n.t('Record')}</div>
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<button
|
2025-05-26 19:22:37 +00:00
|
|
|
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition"
|
2025-05-03 20:14:19 +00:00
|
|
|
on:click={() => {
|
|
|
|
|
onCaptureAudio();
|
|
|
|
|
show = false;
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<div class=" self-center mr-2">
|
2025-07-12 18:14:41 +00:00
|
|
|
<CursorArrowRays className="size-4" strokeWidth="2" />
|
2025-05-03 20:14:19 +00:00
|
|
|
</div>
|
|
|
|
|
<div class=" self-center truncate">{$i18n.t('Capture Audio')}</div>
|
|
|
|
|
</button>
|
2025-05-04 14:26:33 +00:00
|
|
|
|
|
|
|
|
<button
|
2025-05-26 19:22:37 +00:00
|
|
|
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition"
|
2025-05-04 14:26:33 +00:00
|
|
|
on:click={() => {
|
|
|
|
|
onUpload();
|
|
|
|
|
show = false;
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<div class=" self-center mr-2">
|
2025-07-12 18:14:41 +00:00
|
|
|
<CloudArrowUp className="size-4" strokeWidth="2" />
|
2025-05-04 14:26:33 +00:00
|
|
|
</div>
|
|
|
|
|
<div class=" self-center truncate">{$i18n.t('Upload Audio')}</div>
|
|
|
|
|
</button>
|
2025-05-03 20:14:19 +00:00
|
|
|
</DropdownMenu.Content>
|
|
|
|
|
</slot>
|
|
|
|
|
</DropdownMenu.Root>
|