Skip to content

Commit 7057db8

Browse files
committed
resolve file deletion navigation issue and improve delete modal
1 parent b1a5d77 commit 7057db8

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

src/routes/(console)/project-[region]-[project]/storage/bucket-[bucket]/+page.svelte

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,15 @@
169169
</Table.Cell>
170170
<Table.Cell column="actions" {root}>
171171
<Popover let:toggle placement="bottom-start" padding="none">
172-
<Button text icon ariaLabel="more options" on:click={toggle}>
172+
<Button
173+
text
174+
icon
175+
ariaLabel="more options"
176+
on:click={(e) => {
177+
e.stopPropagation();
178+
e.preventDefault();
179+
toggle();
180+
}}>
173181
<Icon icon={IconDotsHorizontal} size="s" />
174182
</Button>
175183
<ActionMenu.Root slot="tooltip">
@@ -178,7 +186,9 @@
178186
</ActionMenu.Item.Anchor>
179187
<ActionMenu.Item.Button
180188
leadingIcon={IconTrash}
181-
on:click={() => {
189+
on:click={(e) => {
190+
e.stopPropagation();
191+
e.preventDefault();
182192
selectedFile = file;
183193
showDelete = true;
184194
}}>

src/routes/(console)/project-[region]-[project]/storage/bucket-[bucket]/deleteFile.svelte

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import { createEventDispatcher } from 'svelte';
77
import { page } from '$app/state';
88
import type { Models } from '@appwrite.io/console';
9+
import { calculateSize } from '$lib/helpers/sizeConvertion';
10+
import { Typography, Layout } from '@appwrite.io/pink-svelte';
911
1012
export let file: Models.File;
1113
export let showDelete = false;
@@ -32,5 +34,30 @@
3234
</script>
3335

3436
<Confirm {onSubmit} title="Delete file" bind:open={showDelete} bind:error>
35-
Are you sure you want to delete <b>{file.name}</b>?
37+
<Layout.Stack gap="l">
38+
<Typography.Text variant="m-400">
39+
Are you sure you want to delete the following file?
40+
</Typography.Text>
41+
42+
<div
43+
class="u-flex u-flex-wrap u-gap-8 u-main-space-between u-cross-center u-padding-16 u-border u-radius">
44+
<Layout.Stack gap="xs">
45+
<Typography.Text variant="m-600" data-private>{file.name}</Typography.Text>
46+
<Layout.Stack direction="row" gap="s" alignItems="center">
47+
<Typography.Text variant="m-400" class="u-color-text-secondary">
48+
{file.mimeType}
49+
</Typography.Text>
50+
<span class="u-color-text-secondary">•</span>
51+
<Typography.Text variant="m-400" class="u-color-text-secondary">
52+
{calculateSize(file.sizeOriginal)}
53+
</Typography.Text>
54+
</Layout.Stack>
55+
</Layout.Stack>
56+
</div>
57+
58+
<Typography.Text variant="m-400" class="u-color-text-secondary">
59+
This action cannot be undone. The file will be permanently deleted from your storage
60+
bucket.
61+
</Typography.Text>
62+
</Layout.Stack>
3663
</Confirm>

0 commit comments

Comments
 (0)