feat: add paginator component for list navigation
feat: implement select component for dropdown functionality feat: create tooltip component for enhanced user interaction feat: add TechStackSection to display technology stack information feat: implement HealthWidget to monitor server health status feat: create AppShell layout for consistent application structure feat: add SettingsDialog for user preferences management feat: implement list helpers for managing list data feat: create overview data fetching for lists feat: add view mode preferences for dashboard layout feat: implement search functionality for filtering lists feat: add theme management for light and dark modes feat: create utility functions for class name management chore: configure SvelteKit with static adapter and Vite chore: add favicon for branding chore: set up Vite configuration with Tailwind CSS and proxy settings
This commit is contained in:
1 parent
55f9b89063
commit
6b14cebf4f
55 files changed
+5069
-521
No files matched your search
@@ -0,0 +1,48 @@
|
||||
<script>
|
||||
import { createQuery } from '@tanstack/svelte-query';
|
||||
import { fetchTechStack } from '$lib/api.js';
|
||||
|
||||
const FRONTEND_TECH_STACK = __FRONTEND_TECH_STACK__;
|
||||
|
||||
const techStackQuery = createQuery(() => ({
|
||||
queryKey: ['TechStack'],
|
||||
queryFn: fetchTechStack,
|
||||
}));
|
||||
|
||||
const techStack = $derived(techStackQuery.data);
|
||||
</script>
|
||||
|
||||
{#snippet infoRow(label, value)}
|
||||
<div class="flex items-center justify-between gap-2 py-1 text-sm">
|
||||
<span class="text-muted-fg">{label}</span>
|
||||
<span class="font-mono text-xs text-fg">{value}</span>
|
||||
</div>
|
||||
{/snippet}
|
||||
|
||||
<div class="rounded-lg border border-border bg-surface p-4">
|
||||
<h3 class="mb-2 text-sm font-medium text-fg">Tech stack</h3>
|
||||
|
||||
{#if techStackQuery.isLoading}
|
||||
<p class="text-sm text-muted-fg">Loading tech stack…</p>
|
||||
{/if}
|
||||
{#if techStackQuery.error}
|
||||
<p class="text-sm text-danger">{techStackQuery.error.message}</p>
|
||||
{/if}
|
||||
|
||||
{#if techStack}
|
||||
<div class="mt-3 grid gap-6 sm:grid-cols-2">
|
||||
<div>
|
||||
<h4 class="mb-1 text-xs font-medium uppercase text-muted-fg">Backend</h4>
|
||||
{#each techStack.stack as entry (entry.label)}
|
||||
{@render infoRow(entry.label, entry.value)}
|
||||
{/each}
|
||||
</div>
|
||||
<div>
|
||||
<h4 class="mb-1 text-xs font-medium uppercase text-muted-fg">Frontend</h4>
|
||||
{#each FRONTEND_TECH_STACK as dep (dep.name)}
|
||||
{@render infoRow(dep.name, dep.version)}
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -0,0 +1,57 @@
|
||||
<script>
|
||||
import { AlertTriangle, CheckCircle2, HelpCircle } from '@lucide/svelte';
|
||||
import Button from '$lib/components/ui/button.svelte';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogFooter,
|
||||
DialogClose,
|
||||
} from '$lib/components/ui/dialog';
|
||||
import { SimpleTooltip } from '$lib/components/ui/tooltip';
|
||||
import { createHealth } from './health.svelte.js';
|
||||
|
||||
const icons = { up: CheckCircle2, down: AlertTriangle, unknown: HelpCircle };
|
||||
const statusColor = { up: 'text-success', down: 'text-danger', unknown: 'text-muted-fg' };
|
||||
const statusLabel = { up: 'up', down: 'unreachable', unknown: 'checking…' };
|
||||
|
||||
const health = createHealth();
|
||||
let open = $state(false);
|
||||
|
||||
const Icon = $derived(icons[health.status]);
|
||||
</script>
|
||||
|
||||
<Dialog bind:open>
|
||||
<SimpleTooltip label={`CollabTable server is ${statusLabel[health.status]}`}>
|
||||
{#snippet children({ props })}
|
||||
<Button
|
||||
{...props}
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onclick={() => (open = true)}
|
||||
class={statusColor[health.status]}
|
||||
aria-label="Status"
|
||||
>
|
||||
<Icon class="size-5" />
|
||||
</Button>
|
||||
{/snippet}
|
||||
</SimpleTooltip>
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Status: CollabTable server is {statusLabel[health.status]}</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div class="flex items-center gap-2 text-sm">
|
||||
<Icon class={`size-4 ${statusColor[health.status]}`} />
|
||||
<span class="text-muted-fg">GET /health</span>
|
||||
<span class={statusColor[health.status]}>{statusLabel[health.status]}</span>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<DialogClose>
|
||||
{#snippet child({ props })}
|
||||
<Button variant="secondary" {...props}>Dismiss</Button>
|
||||
{/snippet}
|
||||
</DialogClose>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
@@ -0,0 +1,24 @@
|
||||
import { createQuery } from '@tanstack/svelte-query';
|
||||
import { fetchHealth } from '$lib/api.js';
|
||||
|
||||
const pollIntervalMs = 10_000;
|
||||
|
||||
export function createHealth() {
|
||||
const query = createQuery(() => ({
|
||||
queryKey: ['Health'],
|
||||
queryFn: fetchHealth,
|
||||
refetchInterval: pollIntervalMs,
|
||||
}));
|
||||
|
||||
const status = $derived.by(() => {
|
||||
if (query.error) return 'down';
|
||||
if (!query.data) return 'unknown';
|
||||
return query.data.up ? 'up' : 'down';
|
||||
});
|
||||
|
||||
return {
|
||||
get status() {
|
||||
return status;
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<script>
|
||||
import { Tooltip } from 'bits-ui';
|
||||
import Header from '$lib/components/Header.svelte';
|
||||
|
||||
let { children } = $props();
|
||||
</script>
|
||||
|
||||
<Tooltip.Provider delayDuration={300}>
|
||||
<div class="flex min-h-screen flex-col">
|
||||
<Header />
|
||||
<main class="flex min-w-0 flex-1 flex-col">
|
||||
{@render children?.()}
|
||||
</main>
|
||||
</div>
|
||||
</Tooltip.Provider>
|
||||
@@ -0,0 +1,54 @@
|
||||
<script>
|
||||
import { Moon, Sun, SunMoon } from '@lucide/svelte';
|
||||
import Button from '$lib/components/ui/button.svelte';
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '$lib/components/ui/dialog';
|
||||
import { themeState } from '$lib/theme.svelte.js';
|
||||
|
||||
let { open = $bindable(false) } = $props();
|
||||
</script>
|
||||
|
||||
<Dialog bind:open>
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Settings</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div>
|
||||
<span class="mb-2 block text-sm font-medium">Theme</span>
|
||||
<div class="flex w-full rounded-md border border-border p-1">
|
||||
<Button
|
||||
type="button"
|
||||
variant={themeState.mode === 'light' ? 'secondary' : 'ghost'}
|
||||
size="sm"
|
||||
class="flex-1 gap-1.5"
|
||||
onclick={() => themeState.setMode('light')}
|
||||
>
|
||||
<Sun class="size-4" />
|
||||
Light
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant={themeState.mode === 'dark' ? 'secondary' : 'ghost'}
|
||||
size="sm"
|
||||
class="flex-1 gap-1.5"
|
||||
onclick={() => themeState.setMode('dark')}
|
||||
>
|
||||
<Moon class="size-4" />
|
||||
Dark
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant={themeState.mode === 'system' ? 'secondary' : 'ghost'}
|
||||
size="sm"
|
||||
class="flex-1 gap-1.5"
|
||||
onclick={() => themeState.setMode('system')}
|
||||
>
|
||||
<SunMoon class="size-4" />
|
||||
System
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<Button type="button" variant="secondary" onclick={() => (open = false)}>Dismiss</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
@@ -0,0 +1,21 @@
|
||||
export function listFieldsFor(fields, listId) {
|
||||
return fields.filter((f) => f.listId === listId && !f.isDeleted).sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
||||
}
|
||||
|
||||
export function listItemsFor(items, listId) {
|
||||
return items.filter((i) => i.listId === listId && !i.isDeleted);
|
||||
}
|
||||
|
||||
export function itemValuesFor(values, itemId) {
|
||||
return values.filter((v) => v.itemId === itemId);
|
||||
}
|
||||
|
||||
export function valueFor(values, itemId, fieldId) {
|
||||
return values.find((v) => v.itemId === itemId && v.fieldId === fieldId)?.value ?? null;
|
||||
}
|
||||
|
||||
export function fmtDate(v) {
|
||||
if (v === null || v === undefined) return '—';
|
||||
const d = new Date(v);
|
||||
return Number.isNaN(d.getTime()) ? '—' : d.toLocaleString();
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { createQuery } from '@tanstack/svelte-query';
|
||||
import { fetchOverview } from '$lib/api.js';
|
||||
|
||||
const pollIntervalMs = 5_000;
|
||||
|
||||
export function createOverviewData() {
|
||||
const query = createQuery(() => ({
|
||||
queryKey: ['Overview'],
|
||||
queryFn: fetchOverview,
|
||||
refetchInterval: pollIntervalMs,
|
||||
}));
|
||||
|
||||
const lists = $derived(query.data?.lists ?? []);
|
||||
const fields = $derived(query.data?.fields ?? []);
|
||||
const items = $derived(query.data?.items ?? []);
|
||||
const values = $derived(query.data?.values ?? []);
|
||||
const stats = $derived(query.data?.stats ?? { lists: 0, fields: 0, items: 0, values: 0 });
|
||||
|
||||
return {
|
||||
get lists() {
|
||||
return lists;
|
||||
},
|
||||
get fields() {
|
||||
return fields;
|
||||
},
|
||||
get items() {
|
||||
return items;
|
||||
},
|
||||
get values() {
|
||||
return values;
|
||||
},
|
||||
get stats() {
|
||||
return stats;
|
||||
},
|
||||
get isLoading() {
|
||||
return query.isLoading;
|
||||
},
|
||||
get error() {
|
||||
return query.error;
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user