diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index 88433df..baa3c27 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -12,6 +12,8 @@ let fileRecords = $state([]); let confirmDeleteId = $state(null); + let selectedFileId = $state(null); + let previewFile = $state(null); let search = $state(''); let loading = $state(true); @@ -29,6 +31,12 @@ const res = await fetch('http://localhost:3000/api/files', { credentials: 'include' }); + + if (res.status === 401) { + window.location.href = '/auth'; + return; + } + fileRecords = await res.json(); loading = false; } @@ -91,10 +99,30 @@ if (bytes < 1000 * 1000 * 1000) return (bytes / 1000 / 1000).toFixed(1) + 'MB'; return (bytes / 1000 / 1000 / 1000).toFixed(1) + 'GB'; } + + async function handleLogout() { + await fetch('http://localhost:3000/api/auth/logout', { + method: 'POST', + credentials: 'include', + }); + window.location.href = '/auth'; + }
-

rafi

+
+

loft

+ +
selectedFileId = fileRecord.id} + ondblclick={() => previewFile = fileRecord} + class="flex items-stretch border-l hover:bg-white/2 transition-all {selectedFileId === fileRecord.id ? 'border-sky-400/50 bg-white/2 ring-1 ring-inset ring-sky-400/50' : 'border-sky-200/20 border-l-transparent hover:border-l-sky-400/50'}" > {formatName(fileRecord.name)} {formatSize(fileRecord.size)} @@ -188,3 +218,29 @@ {/each}
+ +{#if previewFile} +
previewFile = null} + transition:fade={{ duration: 150 }} + > +
e.stopPropagation()} + > +
+ {previewFile.name} + +
+
+ preview coming soon +
+
+
+{/if} diff --git a/frontend/src/routes/auth/+page.svelte b/frontend/src/routes/auth/+page.svelte new file mode 100644 index 0000000..d0ae1ac --- /dev/null +++ b/frontend/src/routes/auth/+page.svelte @@ -0,0 +1,74 @@ + + +
+
+

loft

+ +
+ + +
+ +
+
+ + +
+
+ + +
+ {#if error}

{error}

{/if} + +
+
+
diff --git a/frontend/src/routes/layout.css b/frontend/src/routes/layout.css index 3c49f42..cfc49f8 100644 --- a/frontend/src/routes/layout.css +++ b/frontend/src/routes/layout.css @@ -75,6 +75,21 @@ button { font-family: inherit; } +input:-webkit-autofill, +input:-webkit-autofill:hover, +input:-webkit-autofill:focus, +input:-webkit-autofill:active { + -webkit-box-shadow: 0 0 0 1000px #0f1117 inset !important; + -webkit-text-fill-color: #ffffffcc !important; + font-size: 16px !important; +} + +input:-moz-autofill { + background-color: #0f1117 !important; + color: #ffffffcc !important; + filter: none !important; +} + button:focus:not(:focus-visible) { outline: none; }