diff --git a/src/routes/console/[project]/storage/bucket/[bucket]/file/[file]/__layout.svelte b/src/routes/console/[project]/storage/bucket/[bucket]/file/[file]/__layout.svelte new file mode 100644 index 000000000..f8813a0b4 --- /dev/null +++ b/src/routes/console/[project]/storage/bucket/[bucket]/file/[file]/__layout.svelte @@ -0,0 +1,36 @@ + + + + Appwrite - File + + + diff --git a/src/routes/console/[project]/storage/bucket/[bucket]/file/[file]/_deleteFile.svelte b/src/routes/console/[project]/storage/bucket/[bucket]/file/[file]/_deleteFile.svelte new file mode 100644 index 000000000..0057507d1 --- /dev/null +++ b/src/routes/console/[project]/storage/bucket/[bucket]/file/[file]/_deleteFile.svelte @@ -0,0 +1,36 @@ + + +
+ + Delete File +

Are you sure you want to delete {$file.name}?

+ + + + +
+
diff --git a/src/routes/console/[project]/storage/bucket/[bucket]/file/[file]/index.svelte b/src/routes/console/[project]/storage/bucket/[bucket]/file/[file]/index.svelte new file mode 100644 index 000000000..5cad7589c --- /dev/null +++ b/src/routes/console/[project]/storage/bucket/[bucket]/file/[file]/index.svelte @@ -0,0 +1,172 @@ + + + + {#if $file} + +
+
+ {$file.name} +
+

{$file.name}

+ copy(getView($file.$id))} + >File URL + +
+
+
+

MIME Type: {$file.mimeType}

+

Size: {$file.sizeOriginal}

+

Created: {toLocaleDate($file.dateCreated)}

+

Last Updated: {toLocaleDate($file?.dateUpdated)}

+
+
+ +
+ +
+
+ + +
+
+
Update Permissions
+

+ Assign read or write permissions at the Bucket Level or File Level. If + Bucket Level permissions are enabled, file permissions will be ignored. +

+
+
+ + + You have Bucket Level permissions enabled + +

+ If you want to assign permissions specific to this file, you will need + to update your Bucket Settings to enable File + Level permissions. +

+
+
    + + +
+
+
+
+ +
+
+ + +
+
+
Delete file
+

+ The file will be permanently deleted, including all the files within it. + This action is irreversible. +

+
+
+ +
+
+
+ +
+
+ {/if} +
+ + diff --git a/src/routes/console/[project]/storage/bucket/[bucket]/file/[file]/store.ts b/src/routes/console/[project]/storage/bucket/[bucket]/file/[file]/store.ts new file mode 100644 index 000000000..b49f3ffba --- /dev/null +++ b/src/routes/console/[project]/storage/bucket/[bucket]/file/[file]/store.ts @@ -0,0 +1,17 @@ +import { sdkForProject } from '$lib/stores/sdk'; +import type { Models } from 'src/sdk'; +import { writable } from 'svelte/store'; + +function createFileStore() { + const { subscribe, set } = writable(); + + return { + subscribe, + set, + load: async (bucketId: string, fileId: string) => { + set(await sdkForProject.storage.getFile(bucketId, fileId)); + } + }; +} + +export const file = createFileStore();