style(frontend): format codebase with prettier
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"useTabs": true,
|
||||
"useTabs": false,
|
||||
"tabWidth": 4,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"printWidth": 100,
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Caveat:wght@700&display=swap" rel="stylesheet" />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Caveat:wght@700&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<meta name="text-scale" content="scale" />
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { FileRecord } from "$lib/types";
|
||||
import type { FileRecord } from '$lib/types';
|
||||
|
||||
export async function loadFiles(): Promise<FileRecord[]> {
|
||||
const res = await fetch('/api/files', {
|
||||
@@ -14,10 +14,9 @@ export async function loadFiles(): Promise<FileRecord[]> {
|
||||
throw new Error(`Failed to load files: ${res.status}`);
|
||||
}
|
||||
|
||||
return await res.json()
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
|
||||
export async function uploadFile(file: File): Promise<FileRecord> {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
@@ -28,10 +27,10 @@ export async function uploadFile(file: File): Promise<FileRecord> {
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`Upload failed: ${res.status}`)
|
||||
throw new Error(`Upload failed: ${res.status}`);
|
||||
}
|
||||
|
||||
return await res.json()
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
export async function downloadFile(fileId: number): Promise<Blob> {
|
||||
@@ -39,10 +38,10 @@ export async function downloadFile(fileId: number): Promise<Blob> {
|
||||
credentials: 'include'
|
||||
});
|
||||
if (!res.ok) {
|
||||
throw new Error(`Download failed: ${res.status}`)
|
||||
throw new Error(`Download failed: ${res.status}`);
|
||||
}
|
||||
|
||||
return await res.blob()
|
||||
return await res.blob();
|
||||
}
|
||||
|
||||
export async function deleteFile(fileId: number): Promise<void> {
|
||||
|
||||
@@ -1,33 +1,50 @@
|
||||
<script lang="ts">
|
||||
import type { FileRecord } from "$lib/types";
|
||||
import { fade } from "svelte/transition";
|
||||
import type { FileRecord } from '$lib/types';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
let { file, onclose }: { file: FileRecord; onclose: () => void } = $props();
|
||||
</script>
|
||||
|
||||
<svelte:window onkeydown={(e) => { if (e.key === 'Escape') onclose(); }} />
|
||||
<svelte:window
|
||||
onkeydown={(e) => {
|
||||
if (e.key === 'Escape') onclose();
|
||||
}}
|
||||
/>
|
||||
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="fixed inset-0 bg-black/60 flex items-center justify-center z-50"
|
||||
class="fixed inset-0 z-50 flex items-center justify-center bg-black/60"
|
||||
onclick={onclose}
|
||||
transition:fade={{ duration: 150 }}
|
||||
>
|
||||
<div
|
||||
class="bg-[#0f1117] border border-sky-200/20 rounded-sm w-2/3 h-2/3 flex flex-col p-6"
|
||||
class="flex h-2/3 w-2/3 flex-col rounded-sm border border-sky-200/20 bg-[#0f1117] p-6"
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<span class="text-white text-sm font-medium">{file.name}</span>
|
||||
<button class="text-white/40 hover:text-white transition-colors cursor-pointer" onclick={onclose} aria-label="Close">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<line x1="18" y1="6" x2="6" y2="18"/>
|
||||
<line x1="6" y1="6" x2="18" y2="18"/>
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<span class="text-sm font-medium text-white">{file.name}</span>
|
||||
<button
|
||||
class="cursor-pointer text-white/40 transition-colors hover:text-white"
|
||||
onclick={onclose}
|
||||
aria-label="Close"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-4 w-4"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<line x1="18" y1="6" x2="6" y2="18" />
|
||||
<line x1="6" y1="6" x2="18" y2="18" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex-1 flex items-center justify-center text-white/20 text-sm">
|
||||
<div class="flex flex-1 items-center justify-center text-sm text-white/20">
|
||||
preview coming soon
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
onselect,
|
||||
onpreview,
|
||||
ondownload,
|
||||
ondelete,
|
||||
ondelete
|
||||
}: {
|
||||
file: FileRecord;
|
||||
selected: boolean;
|
||||
@@ -28,59 +28,135 @@
|
||||
if (e.key === 'Enter') {
|
||||
onpreview();
|
||||
} else if (e.key === ' ') {
|
||||
e.preventDefault(); onselect();
|
||||
}
|
||||
}
|
||||
e.preventDefault();
|
||||
onselect();
|
||||
}
|
||||
}}
|
||||
onclick={onselect}
|
||||
ondblclick={onpreview}
|
||||
class="flex items-stretch border-l hover:bg-white/2 transition-all {selected ? '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'}"
|
||||
class="flex items-stretch border-l transition-all hover:bg-white/2 {selected
|
||||
? 'border-sky-400/50 bg-white/2 ring-1 ring-sky-400/50 ring-inset'
|
||||
: 'border-sky-200/20 border-l-transparent hover:border-l-sky-400/50'}"
|
||||
>
|
||||
<span class="font-medium text-white text-sm flex-1 truncate py-2 pl-6">{formatName(file.name)}</span>
|
||||
<span class="text-sm text-white/40 w-40 py-2">{formatSize(file.size)}</span>
|
||||
<span class="text-sm text-white/40 w-48 py-2">{new Date(file.uploadedAt).toLocaleString()}</span>
|
||||
<div class="w-px bg-sky-200/20 self-stretch"></div>
|
||||
<div class="flex items-center gap-4 w-32 justify-center relative">
|
||||
<span class="flex-1 truncate py-2 pl-6 text-sm font-medium text-white"
|
||||
>{formatName(file.name)}</span
|
||||
>
|
||||
<span class="w-40 py-2 text-sm text-white/40">{formatSize(file.size)}</span>
|
||||
<span class="w-48 py-2 text-sm text-white/40">{new Date(file.uploadedAt).toLocaleString()}</span
|
||||
>
|
||||
<div class="w-px self-stretch bg-sky-200/20"></div>
|
||||
<div class="relative flex w-32 items-center justify-center gap-4">
|
||||
<!-- Download -->
|
||||
<button class="text-white/40 hover:text-emerald-400 hover:scale-110 transition-all cursor-pointer" title="Download" onclick={ondownload}>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
||||
<polyline points="7 10 12 15 17 10"/>
|
||||
<line x1="12" y1="15" x2="12" y2="3"/>
|
||||
<button
|
||||
class="cursor-pointer text-white/40 transition-all hover:scale-110 hover:text-emerald-400"
|
||||
title="Download"
|
||||
onclick={ondownload}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-4 w-4"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
|
||||
<polyline points="7 10 12 15 17 10" />
|
||||
<line x1="12" y1="15" x2="12" y2="3" />
|
||||
</svg>
|
||||
</button>
|
||||
<!-- TODO: Copy -->
|
||||
<button class="text-white/40 hover:text-blue-400 hover:scale-110 transition-all cursor-pointer" title="Copy link">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/>
|
||||
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>
|
||||
<button
|
||||
class="cursor-pointer text-white/40 transition-all hover:scale-110 hover:text-blue-400"
|
||||
title="Copy link"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-4 w-4"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
|
||||
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />
|
||||
</svg>
|
||||
</button>
|
||||
<!-- Delete -->
|
||||
<div class="relative">
|
||||
<button class="text-white/40 hover:text-red-400 hover:scale-110 transition-all cursor-pointer" title="Delete" onclick={() => confirming = true}>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<polyline points="3 6 5 6 21 6"/>
|
||||
<path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/>
|
||||
<path d="M10 11v6"/>
|
||||
<path d="M14 11v6"/>
|
||||
<path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/>
|
||||
<button
|
||||
class="cursor-pointer text-white/40 transition-all hover:scale-110 hover:text-red-400"
|
||||
title="Delete"
|
||||
onclick={() => (confirming = true)}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-4 w-4"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<polyline points="3 6 5 6 21 6" />
|
||||
<path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" />
|
||||
<path d="M10 11v6" />
|
||||
<path d="M14 11v6" />
|
||||
<path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2" />
|
||||
</svg>
|
||||
</button>
|
||||
{#if confirming}
|
||||
<div class="absolute left-6 top-1/2 -translate-y-1/2 flex items-center z-10">
|
||||
<div class="w-0 h-0 border-t-4 border-b-4 border-r-4 border-t-transparent border-b-transparent border-r-sky-200/20"></div>
|
||||
<div class="bg-[#0f1117] border border-sky-200/20 rounded px-3 py-2 flex items-center gap-2 whitespace-nowrap">
|
||||
<span class="text-white/40 text-xs">Confirm action</span>
|
||||
<button class="text-white/60 hover:text-white transition-colors cursor-pointer" title="Confirm" onclick={() => { ondelete(); confirming = false; }}>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<polyline points="20 6 9 17 4 12"/>
|
||||
<div class="absolute top-1/2 left-6 z-10 flex -translate-y-1/2 items-center">
|
||||
<div
|
||||
class="h-0 w-0 border-t-4 border-r-4 border-b-4 border-t-transparent border-r-sky-200/20 border-b-transparent"
|
||||
></div>
|
||||
<div
|
||||
class="flex items-center gap-2 rounded border border-sky-200/20 bg-[#0f1117] px-3 py-2 whitespace-nowrap"
|
||||
>
|
||||
<span class="text-xs text-white/40">Confirm action</span>
|
||||
<button
|
||||
class="cursor-pointer text-white/60 transition-colors hover:text-white"
|
||||
title="Confirm"
|
||||
onclick={() => {
|
||||
ondelete();
|
||||
confirming = false;
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-4 w-4"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<polyline points="20 6 9 17 4 12" />
|
||||
</svg>
|
||||
</button>
|
||||
<button class="text-white/60 hover:text-white transition-colors cursor-pointer" title="Cancel" onclick={() => confirming = false}>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<line x1="18" y1="6" x2="6" y2="18"/>
|
||||
<line x1="6" y1="6" x2="18" y2="18"/>
|
||||
<button
|
||||
class="cursor-pointer text-white/60 transition-colors hover:text-white"
|
||||
title="Cancel"
|
||||
onclick={() => (confirming = false)}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-4 w-4"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<line x1="18" y1="6" x2="6" y2="18" />
|
||||
<line x1="6" y1="6" x2="18" y2="18" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
export function formatName(name: string): string {
|
||||
if (name.length > 65) {
|
||||
name = name.slice(0, 65).concat("...");
|
||||
name = name.slice(0, 65).concat('...');
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
export function formatSize(bytes: number): string {
|
||||
if (bytes < 1000) return bytes + 'B';
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
<div class="app">
|
||||
<main>{@render children()}</main>
|
||||
|
||||
<footer>
|
||||
</footer>
|
||||
<footer></footer>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
import { flip } from 'svelte/animate'
|
||||
import { flip } from 'svelte/animate';
|
||||
import type { FileRecord } from '$lib/types';
|
||||
import { deleteFile, downloadFile, loadFiles, logout, uploadFile } from '$lib/api';
|
||||
import FileRow from '$lib/components/FileRow.svelte';
|
||||
@@ -18,9 +18,9 @@
|
||||
loading = false;
|
||||
}
|
||||
|
||||
let filteredFileRecords = $derived(fileRecords.filter(f =>
|
||||
f.name.toLowerCase().includes(search.toLowerCase())
|
||||
));
|
||||
let filteredFileRecords = $derived(
|
||||
fileRecords.filter((f) => f.name.toLowerCase().includes(search.toLowerCase()))
|
||||
);
|
||||
|
||||
let fileInput: HTMLInputElement;
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
const file = input.files?.[0];
|
||||
if (!file) return;
|
||||
|
||||
await uploadFile(file)
|
||||
await uploadFile(file);
|
||||
input.value = '';
|
||||
await refresh()
|
||||
await refresh();
|
||||
}
|
||||
|
||||
async function handleDownload(fileId: number, fileName: string) {
|
||||
@@ -54,7 +54,7 @@
|
||||
window.location.href = '/auth';
|
||||
}
|
||||
|
||||
onMount(refresh)
|
||||
onMount(refresh);
|
||||
</script>
|
||||
|
||||
<div class="w-full px-4 py-8">
|
||||
@@ -62,28 +62,41 @@
|
||||
<h1 class="text-4xl text-white" style="font-family: 'Caveat', cursive;">loft</h1>
|
||||
<button
|
||||
onclick={handleLogout}
|
||||
class="fixed top-4 right-4 flex items-center gap-1.5 px-2 py-1 border border-sky-200/20 text-white/60 hover:border-sky-200/40 text-sm transition-colors rounded-sm cursor-pointer">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/>
|
||||
<polyline points="16 17 21 12 16 7"/>
|
||||
<line x1="21" y1="12" x2="9" y2="12"/>
|
||||
class="fixed top-4 right-4 flex cursor-pointer items-center gap-1.5 rounded-sm border border-sky-200/20 px-2 py-1 text-sm text-white/60 transition-colors hover:border-sky-200/40"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-3.5 w-3.5"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
|
||||
<polyline points="16 17 21 12 16 7" />
|
||||
<line x1="21" y1="12" x2="9" y2="12" />
|
||||
</svg>
|
||||
Sign out
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-center mb-4">
|
||||
<div class="mb-4 flex justify-center">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Search files..."
|
||||
bind:value={search}
|
||||
class="w-96 px-4 py-1.5 rounded-xl bg-white/5 border border-sky-200/20 transition-colors hover:border-sky-200/40 text-white placeholder-white/30 text-sm focus:outline-none focus:ring-1 focus:ring-white/10"
|
||||
class="w-96 rounded-xl border border-sky-200/20 bg-white/5 px-4 py-1.5 text-sm text-white placeholder-white/30 transition-colors hover:border-sky-200/40 focus:ring-1 focus:ring-white/10 focus:outline-none"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<input type="file" bind:this={fileInput} onchange={handleUpload} class="hidden" />
|
||||
<div class="mb-1">
|
||||
<button class="px-2 py-1 border border-sky-200/20 text-white/60 hover:border-sky-200/40 text-sm transition-colors rounded-sm cursor-pointer" onclick={() => fileInput.click()}>
|
||||
<button
|
||||
class="cursor-pointer rounded-sm border border-sky-200/20 px-2 py-1 text-sm text-white/60 transition-colors hover:border-sky-200/40"
|
||||
onclick={() => fileInput.click()}
|
||||
>
|
||||
Import
|
||||
</button>
|
||||
</div>
|
||||
@@ -91,11 +104,11 @@
|
||||
<div class="rounded-sm border border-sky-200/20">
|
||||
<!-- Header row -->
|
||||
<div class="flex items-stretch border-b border-sky-200/20 bg-white/5">
|
||||
<span class="font-medium text-white/40 text-sm flex-1 py-2 pl-6">Name</span>
|
||||
<span class="text-sm text-white/40 w-40 py-2">Size</span>
|
||||
<span class="text-sm text-white/40 w-48 py-2">Uploaded at</span>
|
||||
<div class="w-px bg-sky-200/20 self-stretch"></div>
|
||||
<span class="text-sm text-white/40 w-32 text-center py-2">Actions</span>
|
||||
<span class="flex-1 py-2 pl-6 text-sm font-medium text-white/40">Name</span>
|
||||
<span class="w-40 py-2 text-sm text-white/40">Size</span>
|
||||
<span class="w-48 py-2 text-sm text-white/40">Uploaded at</span>
|
||||
<div class="w-px self-stretch bg-sky-200/20"></div>
|
||||
<span class="w-32 py-2 text-center text-sm text-white/40">Actions</span>
|
||||
</div>
|
||||
|
||||
{#each filteredFileRecords as fileRecord (fileRecord.id)}
|
||||
@@ -103,8 +116,8 @@
|
||||
<FileRow
|
||||
file={fileRecord}
|
||||
selected={selectedFileId === fileRecord.id}
|
||||
onselect={() => selectedFileId = fileRecord.id}
|
||||
onpreview={() => previewFile = fileRecord}
|
||||
onselect={() => (selectedFileId = fileRecord.id)}
|
||||
onpreview={() => (previewFile = fileRecord)}
|
||||
ondownload={() => handleDownload(fileRecord.id, fileRecord.name)}
|
||||
ondelete={() => handleDelete(fileRecord.id)}
|
||||
/>
|
||||
@@ -116,5 +129,5 @@
|
||||
</div>
|
||||
|
||||
{#if previewFile}
|
||||
<FilePreview file={previewFile} onclose={() => previewFile = null} />
|
||||
<FilePreview file={previewFile} onclose={() => (previewFile = null)} />
|
||||
{/if}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { submit } from "$lib/api";
|
||||
import { submit } from '$lib/api';
|
||||
|
||||
let activeTab = $state<'login' | 'register'>('login');
|
||||
let username = $state('');
|
||||
@@ -16,20 +16,25 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="flex-1 flex items-center justify-center -mt-16">
|
||||
<div class="-mt-16 flex flex-1 items-center justify-center">
|
||||
<div class="w-full max-w-xs">
|
||||
<h1 class="text-4xl text-white mb-8" style="font-family: 'Caveat', cursive;">loft</h1>
|
||||
<h1 class="mb-8 text-4xl text-white" style="font-family: 'Caveat', cursive;">loft</h1>
|
||||
|
||||
<div class="flex mb-6 border-b border-sky-200/20">
|
||||
<div class="mb-6 flex border-b border-sky-200/20">
|
||||
<button
|
||||
onclick={() => activeTab = 'login'}
|
||||
class="flex-1 py-2 text-sm transition-colors cursor-pointer {activeTab === 'login' ? 'text-white border-b border-white -mb-px' : 'text-white/40 hover:text-white/60'}"
|
||||
onclick={() => (activeTab = 'login')}
|
||||
class="flex-1 cursor-pointer py-2 text-sm transition-colors {activeTab === 'login'
|
||||
? '-mb-px border-b border-white text-white'
|
||||
: 'text-white/40 hover:text-white/60'}"
|
||||
>
|
||||
Login
|
||||
</button>
|
||||
<button
|
||||
onclick={() => activeTab = 'register'}
|
||||
class="flex-1 py-2 text-sm transition-colors cursor-pointer {activeTab === 'register' ? 'text-white border-b border-white -mb-px' : 'text-white/40 hover:text-white/60'}"
|
||||
onclick={() => (activeTab = 'register')}
|
||||
class="flex-1 cursor-pointer py-2 text-sm transition-colors {activeTab ===
|
||||
'register'
|
||||
? '-mb-px border-b border-white text-white'
|
||||
: 'text-white/40 hover:text-white/60'}"
|
||||
>
|
||||
Register
|
||||
</button>
|
||||
@@ -37,29 +42,30 @@
|
||||
|
||||
<div class="flex flex-col gap-3">
|
||||
<div class="flex flex-col gap-1">
|
||||
<label for="username" class="text-white/30 text-xs">Username</label>
|
||||
<label for="username" class="text-xs text-white/30">Username</label>
|
||||
<input
|
||||
id="username"
|
||||
bind:value={username}
|
||||
type="text"
|
||||
autocomplete="username"
|
||||
class="px-4 py-2 rounded-sm bg-[#0f1117]! border border-sky-200/15 transition-colors hover:bg-black/20 hover:border-sky-200/30 text-white/80 text-sm focus:outline-none focus:border-sky-200/40"
|
||||
class="rounded-sm border border-sky-200/15 bg-[#0f1117]! px-4 py-2 text-sm text-white/80 transition-colors hover:border-sky-200/30 hover:bg-black/20 focus:border-sky-200/40 focus:outline-none"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<label for="password" class="text-white/30 text-xs">Password</label>
|
||||
<label for="password" class="text-xs text-white/30">Password</label>
|
||||
<input
|
||||
id="password"
|
||||
bind:value={password}
|
||||
type="password"
|
||||
autocomplete="current-password"
|
||||
class="px-4 py-2 rounded-sm bg-[#0f1117]! border border-sky-200/15 transition-colors hover:bg-black/20 hover:border-sky-200/30 text-white/80 text-sm focus:outline-none focus:border-sky-200/40"
|
||||
class="rounded-sm border border-sky-200/15 bg-[#0f1117]! px-4 py-2 text-sm text-white/80 transition-colors hover:border-sky-200/30 hover:bg-black/20 focus:border-sky-200/40 focus:outline-none"
|
||||
/>
|
||||
</div>
|
||||
{#if error}<p class="text-red-400/60 text-xs">{error}</p>{/if}
|
||||
{#if error}<p class="text-xs text-red-400/60">{error}</p>{/if}
|
||||
<button
|
||||
onclick={handleSubmit}
|
||||
class="mt-1 px-4 py-2 border border-sky-200/15 text-white/40 hover:border-sky-200/30 hover:text-white/60 text-sm transition-colors rounded-sm cursor-pointer">
|
||||
class="mt-1 cursor-pointer rounded-sm border border-sky-200/15 px-4 py-2 text-sm text-white/40 transition-colors hover:border-sky-200/30 hover:text-white/60"
|
||||
>
|
||||
{activeTab === 'login' ? 'Login' : 'Register'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
7
package.json
Normal file
7
package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"prettier": "^3.8.3",
|
||||
"prettier-plugin-svelte": "^4.1.0",
|
||||
"prettier-plugin-tailwindcss": "^0.8.0"
|
||||
}
|
||||
}
|
||||
253
pnpm-lock.yaml
generated
Normal file
253
pnpm-lock.yaml
generated
Normal file
@@ -0,0 +1,253 @@
|
||||
lockfileVersion: '9.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
importers:
|
||||
|
||||
.:
|
||||
devDependencies:
|
||||
prettier:
|
||||
specifier: ^3.8.3
|
||||
version: 3.8.3
|
||||
prettier-plugin-svelte:
|
||||
specifier: ^4.1.0
|
||||
version: 4.1.0(prettier@3.8.3)(svelte@5.56.0)
|
||||
prettier-plugin-tailwindcss:
|
||||
specifier: ^0.8.0
|
||||
version: 0.8.0(prettier-plugin-svelte@4.1.0(prettier@3.8.3)(svelte@5.56.0))(prettier@3.8.3)
|
||||
|
||||
packages:
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.13':
|
||||
resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}
|
||||
|
||||
'@jridgewell/remapping@2.3.5':
|
||||
resolution: {integrity: sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==}
|
||||
|
||||
'@jridgewell/resolve-uri@3.1.2':
|
||||
resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
|
||||
'@jridgewell/sourcemap-codec@1.5.5':
|
||||
resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==}
|
||||
|
||||
'@jridgewell/trace-mapping@0.3.31':
|
||||
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
|
||||
|
||||
'@sveltejs/acorn-typescript@1.0.10':
|
||||
resolution: {integrity: sha512-4WfKk68eTih+MiJD4fSbxN7E8kVBmTMPWHUPYjvl2N0rMs53YLTT8/YjKU5Dtnz5LqDjl7LEw4U7lXR2W3J5WA==}
|
||||
peerDependencies:
|
||||
acorn: ^8.9.0
|
||||
|
||||
'@types/estree@1.0.9':
|
||||
resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==}
|
||||
|
||||
'@types/trusted-types@2.0.7':
|
||||
resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==}
|
||||
|
||||
acorn@8.16.0:
|
||||
resolution: {integrity: sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
hasBin: true
|
||||
|
||||
aria-query@5.3.1:
|
||||
resolution: {integrity: sha512-Z/ZeOgVl7bcSYZ/u/rh0fOpvEpq//LZmdbkXyc7syVzjPAhfOa9ebsdTSjEBDU4vs5nC98Kfduj1uFo0qyET3g==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
axobject-query@4.1.0:
|
||||
resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
clsx@2.1.1:
|
||||
resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
devalue@5.8.1:
|
||||
resolution: {integrity: sha512-4CXDYRBGqN+57wVJkuXBYmpAVUSg3L6JAQa/DFqm238G73E1wuyc/JhGQJzN7vUf/CMphYau2zXbfWzDR5aTEw==}
|
||||
|
||||
esm-env@1.2.2:
|
||||
resolution: {integrity: sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==}
|
||||
|
||||
esrap@2.2.9:
|
||||
resolution: {integrity: sha512-4KijP+NxCWthMCUC3qHbE6n4vCjqgJS1uAYKhuT/GWfFTf1Qyive2TgOjep+gzbSzRfnNyaN/UU9YmdOt8Eg0A==}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/types': ^8.2.0
|
||||
peerDependenciesMeta:
|
||||
'@typescript-eslint/types':
|
||||
optional: true
|
||||
|
||||
is-reference@3.0.3:
|
||||
resolution: {integrity: sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==}
|
||||
|
||||
locate-character@3.0.0:
|
||||
resolution: {integrity: sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==}
|
||||
|
||||
magic-string@0.30.21:
|
||||
resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
|
||||
|
||||
prettier-plugin-svelte@4.1.0:
|
||||
resolution: {integrity: sha512-YZkhA2Q9oOerFFG9tq+2f98WYT7Z2JgrybJrAyrB78jpsH9i/DdgplXemehuFPgsldetFNCcR/yCcYlDjPy94Q==}
|
||||
engines: {node: '>=20'}
|
||||
peerDependencies:
|
||||
prettier: ^3.0.0
|
||||
svelte: ^5.0.0
|
||||
|
||||
prettier-plugin-tailwindcss@0.8.0:
|
||||
resolution: {integrity: sha512-V8ITGH87yuBDF6JpEZTOVlUz/saAwqb8f3HRgUj8Lh+tGCcrmorhsLpYqzygwFwK0PE2Ib6Mv3M7T/uE2tZV1g==}
|
||||
engines: {node: '>=20.19'}
|
||||
peerDependencies:
|
||||
'@ianvs/prettier-plugin-sort-imports': '*'
|
||||
'@prettier/plugin-hermes': '*'
|
||||
'@prettier/plugin-oxc': '*'
|
||||
'@prettier/plugin-pug': '*'
|
||||
'@shopify/prettier-plugin-liquid': '*'
|
||||
'@trivago/prettier-plugin-sort-imports': '*'
|
||||
'@zackad/prettier-plugin-twig': '*'
|
||||
prettier: ^3.0
|
||||
prettier-plugin-astro: '*'
|
||||
prettier-plugin-css-order: '*'
|
||||
prettier-plugin-jsdoc: '*'
|
||||
prettier-plugin-marko: '*'
|
||||
prettier-plugin-multiline-arrays: '*'
|
||||
prettier-plugin-organize-attributes: '*'
|
||||
prettier-plugin-organize-imports: '*'
|
||||
prettier-plugin-sort-imports: '*'
|
||||
prettier-plugin-svelte: '*'
|
||||
peerDependenciesMeta:
|
||||
'@ianvs/prettier-plugin-sort-imports':
|
||||
optional: true
|
||||
'@prettier/plugin-hermes':
|
||||
optional: true
|
||||
'@prettier/plugin-oxc':
|
||||
optional: true
|
||||
'@prettier/plugin-pug':
|
||||
optional: true
|
||||
'@shopify/prettier-plugin-liquid':
|
||||
optional: true
|
||||
'@trivago/prettier-plugin-sort-imports':
|
||||
optional: true
|
||||
'@zackad/prettier-plugin-twig':
|
||||
optional: true
|
||||
prettier-plugin-astro:
|
||||
optional: true
|
||||
prettier-plugin-css-order:
|
||||
optional: true
|
||||
prettier-plugin-jsdoc:
|
||||
optional: true
|
||||
prettier-plugin-marko:
|
||||
optional: true
|
||||
prettier-plugin-multiline-arrays:
|
||||
optional: true
|
||||
prettier-plugin-organize-attributes:
|
||||
optional: true
|
||||
prettier-plugin-organize-imports:
|
||||
optional: true
|
||||
prettier-plugin-sort-imports:
|
||||
optional: true
|
||||
prettier-plugin-svelte:
|
||||
optional: true
|
||||
|
||||
prettier@3.8.3:
|
||||
resolution: {integrity: sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==}
|
||||
engines: {node: '>=14'}
|
||||
hasBin: true
|
||||
|
||||
svelte@5.56.0:
|
||||
resolution: {integrity: sha512-kTXr26t1bchFp28ROrb957LtbujpBmBDibmqMGziVpUs7awBi96TGgX6SovrA8BNoEUDVRK2Fb9FkeYlGspoVg==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
zimmerframe@1.1.4:
|
||||
resolution: {integrity: sha512-B58NGBEoc8Y9MWWCQGl/gq9xBCe4IiKM0a2x7GZdQKOW5Exr8S1W24J6OgM1njK8xCRGvAJIL/MxXHf6SkmQKQ==}
|
||||
|
||||
snapshots:
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.13':
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
'@jridgewell/trace-mapping': 0.3.31
|
||||
|
||||
'@jridgewell/remapping@2.3.5':
|
||||
dependencies:
|
||||
'@jridgewell/gen-mapping': 0.3.13
|
||||
'@jridgewell/trace-mapping': 0.3.31
|
||||
|
||||
'@jridgewell/resolve-uri@3.1.2': {}
|
||||
|
||||
'@jridgewell/sourcemap-codec@1.5.5': {}
|
||||
|
||||
'@jridgewell/trace-mapping@0.3.31':
|
||||
dependencies:
|
||||
'@jridgewell/resolve-uri': 3.1.2
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
|
||||
'@sveltejs/acorn-typescript@1.0.10(acorn@8.16.0)':
|
||||
dependencies:
|
||||
acorn: 8.16.0
|
||||
|
||||
'@types/estree@1.0.9': {}
|
||||
|
||||
'@types/trusted-types@2.0.7': {}
|
||||
|
||||
acorn@8.16.0: {}
|
||||
|
||||
aria-query@5.3.1: {}
|
||||
|
||||
axobject-query@4.1.0: {}
|
||||
|
||||
clsx@2.1.1: {}
|
||||
|
||||
devalue@5.8.1: {}
|
||||
|
||||
esm-env@1.2.2: {}
|
||||
|
||||
esrap@2.2.9:
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
|
||||
is-reference@3.0.3:
|
||||
dependencies:
|
||||
'@types/estree': 1.0.9
|
||||
|
||||
locate-character@3.0.0: {}
|
||||
|
||||
magic-string@0.30.21:
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
|
||||
prettier-plugin-svelte@4.1.0(prettier@3.8.3)(svelte@5.56.0):
|
||||
dependencies:
|
||||
prettier: 3.8.3
|
||||
svelte: 5.56.0
|
||||
|
||||
prettier-plugin-tailwindcss@0.8.0(prettier-plugin-svelte@4.1.0(prettier@3.8.3)(svelte@5.56.0))(prettier@3.8.3):
|
||||
dependencies:
|
||||
prettier: 3.8.3
|
||||
optionalDependencies:
|
||||
prettier-plugin-svelte: 4.1.0(prettier@3.8.3)(svelte@5.56.0)
|
||||
|
||||
prettier@3.8.3: {}
|
||||
|
||||
svelte@5.56.0:
|
||||
dependencies:
|
||||
'@jridgewell/remapping': 2.3.5
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
'@sveltejs/acorn-typescript': 1.0.10(acorn@8.16.0)
|
||||
'@types/estree': 1.0.9
|
||||
'@types/trusted-types': 2.0.7
|
||||
acorn: 8.16.0
|
||||
aria-query: 5.3.1
|
||||
axobject-query: 4.1.0
|
||||
clsx: 2.1.1
|
||||
devalue: 5.8.1
|
||||
esm-env: 1.2.2
|
||||
esrap: 2.2.9
|
||||
is-reference: 3.0.3
|
||||
locate-character: 3.0.0
|
||||
magic-string: 0.30.21
|
||||
zimmerframe: 1.1.4
|
||||
transitivePeerDependencies:
|
||||
- '@typescript-eslint/types'
|
||||
|
||||
zimmerframe@1.1.4: {}
|
||||
Reference in New Issue
Block a user