diff --git a/frontend/src/routes/edit/files/+page.svelte b/frontend/src/routes/edit/files/+page.svelte new file mode 100644 index 0000000..d4226ae --- /dev/null +++ b/frontend/src/routes/edit/files/+page.svelte @@ -0,0 +1,109 @@ + + + + +
+
+ {#each images as image} +
+ {image.alt_text +
+

Size: {(image.size / (1024 * 1024)).toFixed(2)} Mib

+

Caption: {image.alt_text ?? 'MISSING!'}

+

Filename: {image.filename ?? 'Unset'}

+

Uploaded: {new Date(image.uploaded_at).toLocaleString()}

+

Imported: {image.imported ? 'Yes' : 'No'}

+ { + edit_popup = image; + }}>Edit Details +
+
+ {/each} +
+
+ +{#if edit_popup} +
+
+

Edit the image

+
+
+
+ + +
+
+ + +
+
+
+ Save +
+
+
+
+{/if} diff --git a/frontend/src/routes/edit/files/+page.ts b/frontend/src/routes/edit/files/+page.ts new file mode 100644 index 0000000..e663cff --- /dev/null +++ b/frontend/src/routes/edit/files/+page.ts @@ -0,0 +1,30 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ +import type { PageLoad } from './$types'; + +export interface ImageData { + id: string; + uploaded_at: string; + mime_type: string; + hash?: string; + size?: number; + deleted_at?: string; + alt_text?: string; + filename?: string; + thumbhash?: string; + server?: string; + imported: boolean; + quizzes: { id: string }[]; + quiztivities: { id: string }[]; +} + +export const load = (async ({ fetch }) => { + const res = await fetch('/api/v1/storage/list'); + const json: ImageData[] = await res.json(); + return { + images: json + }; +}) satisfies PageLoad;