Skip to content

Commit bd35809

Browse files
committed
refac
1 parent 2e52ad8 commit bd35809

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/lib/components/chat/FileNav/FileEntryRow.svelte

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import { toast } from 'svelte-sonner';
23
import { getContext, tick, onDestroy } from 'svelte';
34
import { formatFileSize } from '$lib/utils';
45
import type { FileEntry } from '$lib/apis/terminal';
@@ -8,6 +9,7 @@
89
import EllipsisHorizontal from '../../icons/EllipsisHorizontal.svelte';
910
import GarbageBin from '../../icons/GarbageBin.svelte';
1011
import Pencil from '../../icons/Pencil.svelte';
12+
import Clipboard from '../../icons/Clipboard.svelte';
1113
1214
const i18n = getContext('i18n');
1315
@@ -315,6 +317,24 @@
315317
<div class="flex items-center">{$i18n.t('Download')}</div>
316318
</button>
317319

320+
<button
321+
type="button"
322+
class="select-none flex rounded-xl py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition items-center gap-2 text-sm"
323+
on:click={(e) => {
324+
e.stopPropagation();
325+
const path =
326+
entry.type === 'directory'
327+
? `${currentPath}${entry.name}/`
328+
: `${currentPath}${entry.name}`;
329+
navigator.clipboard.writeText(path).then(() => {
330+
toast.success($i18n.t('Path copied'));
331+
});
332+
}}
333+
>
334+
<Clipboard className="size-4" strokeWidth="1.5" />
335+
<div class="flex items-center">{$i18n.t('Copy Path')}</div>
336+
</button>
337+
318338
<button
319339
type="button"
320340
class="select-none flex rounded-xl py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition items-center gap-2 text-sm"

0 commit comments

Comments
 (0)