feat(webapp): redesign dashboard with shadcn-style UI shell
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import './layout.css';
|
||||
import '../app.css';
|
||||
import { onMount } from 'svelte';
|
||||
import favicon from '$lib/assets/favicon.svg';
|
||||
import { appController } from '$lib/app/controller';
|
||||
@@ -7,26 +7,16 @@
|
||||
let { children } = $props();
|
||||
|
||||
onMount(() => {
|
||||
const bodyClasses = ['h-screen', 'bg-[#0a0a0c]', 'text-gray-200', 'overflow-hidden', 'flex'];
|
||||
document.body.classList.add(...bodyClasses);
|
||||
document.documentElement.dataset.theme = 'black';
|
||||
void appController.init();
|
||||
|
||||
return () => {
|
||||
void appController.destroy();
|
||||
document.body.classList.remove(...bodyClasses);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>SecureCam Web Dashboard</title>
|
||||
<title>PhoneCam Web Dashboard</title>
|
||||
<link rel="icon" href={favicon} />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous" />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
</svelte:head>
|
||||
{@render children()}
|
||||
|
||||
@@ -3,75 +3,93 @@
|
||||
import AppChrome from '$lib/sim/ui/AppChrome.svelte';
|
||||
import { appController } from '$lib/app/controller';
|
||||
import { appState } from '$lib/app/store';
|
||||
import { Button } from '$lib/components/ui/button/index.js';
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '$lib/components/ui/card/index.js';
|
||||
import { Input } from '$lib/components/ui/input/index.js';
|
||||
import { Label } from '$lib/components/ui/label/index.js';
|
||||
import { Separator } from '$lib/components/ui/separator/index.js';
|
||||
</script>
|
||||
|
||||
<AppChrome pageKey="auth">
|
||||
<section id="screen-auth" class="flex flex-col items-center justify-center min-h-[70vh] animate-fade-in max-w-sm mx-auto">
|
||||
<div class="text-center space-y-3 mb-8">
|
||||
<div
|
||||
class="w-20 h-20 bg-gradient-to-tr from-blue-600 to-indigo-600 rounded-3xl mx-auto flex items-center justify-center shadow-lg shadow-blue-900/20"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="text-3xl font-bold text-white tracking-tight">SecureCam Web</h2>
|
||||
<p class="text-gray-400 text-sm">Sign in to manage visual security from your browser.</p>
|
||||
</div>
|
||||
|
||||
<div class="w-full glass-card p-6 md:p-8 rounded-3xl space-y-4 shadow-2xl">
|
||||
<div class="form-control">
|
||||
<label class="label hidden" for="authEmail"><span class="label-text text-gray-400">Email</span></label>
|
||||
<input
|
||||
id="authEmail"
|
||||
type="email"
|
||||
placeholder="Email address"
|
||||
class="input bg-black/40 border-white/10 text-sm focus:border-blue-500 focus:outline-none transition-colors w-full h-12 rounded-xl"
|
||||
value={$appState.authForm.email}
|
||||
oninput={(event) => appController.setAuthField('email', (event.currentTarget as HTMLInputElement).value)}
|
||||
/>
|
||||
</div>
|
||||
<div class="form-control">
|
||||
<input
|
||||
id="authPassword"
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
class="input bg-black/40 border-white/10 text-sm focus:border-blue-500 focus:outline-none transition-colors w-full h-12 rounded-xl"
|
||||
value={$appState.authForm.password}
|
||||
oninput={(event) => appController.setAuthField('password', (event.currentTarget as HTMLInputElement).value)}
|
||||
/>
|
||||
</div>
|
||||
{#if $appState.isRegistering}
|
||||
<div id="authNameField" class="form-control">
|
||||
<input
|
||||
id="authName"
|
||||
type="text"
|
||||
placeholder="Your Name"
|
||||
class="input bg-black/40 border-white/10 text-sm focus:border-blue-500 focus:outline-none transition-colors w-full h-12 rounded-xl"
|
||||
value={$appState.authForm.name}
|
||||
oninput={(event) => appController.setAuthField('name', (event.currentTarget as HTMLInputElement).value)}
|
||||
<Card class="glass-card w-full rounded-3xl border-white/10 bg-[#16161d]/80 shadow-2xl">
|
||||
<CardHeader class="items-center gap-4 px-6 pt-6 text-center">
|
||||
<div
|
||||
class="flex size-20 items-center justify-center rounded-3xl bg-gradient-to-tr from-blue-600 to-indigo-600 shadow-lg shadow-blue-900/20"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<CardTitle class="text-3xl font-bold tracking-tight text-white">PhoneCam Web</CardTitle>
|
||||
<CardDescription class="text-sm text-gray-400">Sign in to manage visual security from your browser.</CardDescription>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent class="flex flex-col gap-4 px-6">
|
||||
<div class="flex flex-col gap-2">
|
||||
<Label class="sr-only" for="authEmail">Email</Label>
|
||||
<Input
|
||||
id="authEmail"
|
||||
type="email"
|
||||
placeholder="Email address"
|
||||
class="h-12 rounded-xl border-white/10 bg-black/40 text-sm text-white placeholder:text-gray-500"
|
||||
value={$appState.authForm.email}
|
||||
oninput={(event) => appController.setAuthField('email', (event.currentTarget as HTMLInputElement).value)}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="pt-4 space-y-4">
|
||||
<button id="signInBtn" class="btn btn-premium w-full h-12 rounded-xl shadow-lg shadow-blue-900/20 text-base" onclick={() => appController.submitAuth()}>
|
||||
<div class="flex flex-col gap-2">
|
||||
<Label class="sr-only" for="authPassword">Password</Label>
|
||||
<Input
|
||||
id="authPassword"
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
class="h-12 rounded-xl border-white/10 bg-black/40 text-sm text-white placeholder:text-gray-500"
|
||||
value={$appState.authForm.password}
|
||||
oninput={(event) => appController.setAuthField('password', (event.currentTarget as HTMLInputElement).value)}
|
||||
/>
|
||||
</div>
|
||||
{#if $appState.isRegistering}
|
||||
<div id="authNameField" class="flex flex-col gap-2">
|
||||
<Label class="sr-only" for="authName">Name</Label>
|
||||
<Input
|
||||
id="authName"
|
||||
type="text"
|
||||
placeholder="Your Name"
|
||||
class="h-12 rounded-xl border-white/10 bg-black/40 text-sm text-white placeholder:text-gray-500"
|
||||
value={$appState.authForm.name}
|
||||
oninput={(event) => appController.setAuthField('name', (event.currentTarget as HTMLInputElement).value)}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</CardContent>
|
||||
<CardFooter class="flex flex-col items-stretch gap-4 border-0 bg-transparent px-6 pb-6 pt-2">
|
||||
<Button
|
||||
id="signInBtn"
|
||||
class="btn-premium h-12 w-full rounded-xl text-base text-white shadow-lg shadow-blue-900/20"
|
||||
onclick={() => appController.submitAuth()}
|
||||
>
|
||||
{$appState.isRegistering ? 'Create Account' : 'Sign In'}
|
||||
</button>
|
||||
<div class="divider text-xs text-gray-600">OR</div>
|
||||
<button
|
||||
</Button>
|
||||
<div class="flex w-full items-center gap-3 text-xs text-gray-600">
|
||||
<Separator class="flex-1 bg-white/10" />
|
||||
<span>OR</span>
|
||||
<Separator class="flex-1 bg-white/10" />
|
||||
</div>
|
||||
<Button
|
||||
id="toggleAuthModeBtn"
|
||||
class="btn btn-ghost w-full text-gray-400 hover:text-white hover:bg-white/5 rounded-xl border border-white/5"
|
||||
variant="ghost"
|
||||
class="h-12 w-full rounded-xl border border-white/5 text-gray-400 hover:bg-white/5 hover:text-white"
|
||||
onclick={() => appController.toggleAuthMode()}
|
||||
>
|
||||
{$appState.isRegistering ? 'I already have an account' : 'Create an account'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</Button>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</section>
|
||||
</AppChrome>
|
||||
|
||||
@@ -3,25 +3,35 @@
|
||||
import AppChrome from '$lib/sim/ui/AppChrome.svelte';
|
||||
import { appController } from '$lib/app/controller';
|
||||
import { appState } from '$lib/app/store';
|
||||
import { Alert, AlertDescription, AlertTitle } from '$lib/components/ui/alert/index.js';
|
||||
import { Button } from '$lib/components/ui/button/index.js';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '$lib/components/ui/card/index.js';
|
||||
import { ScrollArea } from '$lib/components/ui/scroll-area/index.js';
|
||||
</script>
|
||||
|
||||
<AppChrome pageKey="activity">
|
||||
<section id="screen-activity" class="flex flex-col gap-6 max-w-4xl mx-auto py-4">
|
||||
<div class="flex items-center justify-between">
|
||||
<h2 class="text-2xl font-bold text-white tracking-tight">Activity History</h2>
|
||||
<button
|
||||
<Button
|
||||
id="clearActivityBtn"
|
||||
class="btn btn-ghost text-gray-400 hover:bg-white/5 hover:text-white rounded-xl border border-transparent"
|
||||
variant="ghost"
|
||||
class="rounded-xl border border-transparent text-gray-400 hover:bg-white/5 hover:text-white"
|
||||
onclick={() => appController.clearNotifications()}
|
||||
>
|
||||
Clear Read
|
||||
</button>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div class="glass-card rounded-3xl border border-white/5 p-2 overflow-hidden">
|
||||
<div id="activityFeedList" class="divide-y divide-white/5">
|
||||
<Card class="glass-card rounded-3xl border-white/10 bg-[#16161d]/80">
|
||||
<CardHeader>
|
||||
<CardTitle class="text-sm font-semibold tracking-wide text-white">Motion Alerts</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ScrollArea class="max-h-[32rem] pr-3">
|
||||
<div id="activityFeedList" class="flex flex-col gap-3">
|
||||
{#if $appState.motionNotifications.length === 0}
|
||||
<div class="text-center py-16 opacity-50">
|
||||
<Alert class="border-white/10 bg-black/20 text-center opacity-70">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 mx-auto mb-4 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
@@ -30,21 +40,27 @@
|
||||
d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
|
||||
/>
|
||||
</svg>
|
||||
<p class="text-sm font-medium text-gray-400">All quiet. No notifications yet.</p>
|
||||
</div>
|
||||
<AlertTitle class="justify-self-center text-sm text-gray-200">All quiet</AlertTitle>
|
||||
<AlertDescription class="justify-self-center text-sm text-gray-400">
|
||||
No notifications yet.
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
{:else}
|
||||
{#each $appState.motionNotifications as notification (notification.id)}
|
||||
<button
|
||||
type="button"
|
||||
class="w-full text-left p-3 rounded-lg border border-white/5 {notification.isRead ? 'bg-gray-900/30' : 'bg-blue-900/20'}"
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
class="h-auto w-full flex-col items-start gap-1 rounded-xl border border-white/5 px-4 py-3 text-left {notification.isRead ? 'bg-gray-900/30 text-gray-200' : 'bg-blue-900/20 text-white'}"
|
||||
onclick={() => appController.openMotionNotificationTarget(notification.id, notification.cameraDeviceId)}
|
||||
>
|
||||
<p class="text-xs font-medium text-gray-200">{notification.message}</p>
|
||||
<p class="text-[10px] text-gray-500 mt-1">{new Date(notification.createdAt).toLocaleString()}</p>
|
||||
</button>
|
||||
<p class="text-xs font-medium">{notification.message}</p>
|
||||
<p class="text-[10px] text-gray-500">{new Date(notification.createdAt).toLocaleString()}</p>
|
||||
</Button>
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ScrollArea>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</section>
|
||||
</AppChrome>
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
</script>
|
||||
|
||||
<AppChrome pageKey="camera">
|
||||
<section id="screen-home-camera" class="flex flex-col gap-6 max-w-7xl mx-auto h-full min-h-0">
|
||||
<div class="flex-1 min-h-0 flex flex-col gap-6">
|
||||
<Card class="glass-card relative flex min-h-[260px] flex-[3] overflow-hidden rounded-3xl border-white/10 bg-[#16161d]/80">
|
||||
<section id="screen-home-camera" class="mx-auto flex h-full min-h-0 max-w-7xl flex-col gap-4 lg:gap-6">
|
||||
<div class="flex flex-col gap-4 lg:gap-6 xl:flex-1 xl:min-h-0">
|
||||
<Card class="glass-card relative flex min-h-[220px] overflow-hidden rounded-3xl border-white/10 bg-[#16161d]/80 sm:min-h-[260px] xl:flex-[3]">
|
||||
<div id="cameraPreview" class="flex-1 bg-black relative flex items-center justify-center {$appState.isMotionActive ? 'bg-red-900/20' : ''}">
|
||||
<video
|
||||
id="cameraVideo"
|
||||
@@ -90,16 +90,16 @@
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<div class="flex-[2] min-h-0 grid grid-cols-1 xl:grid-cols-[2fr_1fr] gap-6">
|
||||
<Card class="glass-card min-h-[220px] overflow-hidden rounded-3xl border-white/10 bg-[#16161d]/80">
|
||||
<div class="grid grid-cols-1 gap-4 lg:gap-6 xl:min-h-0 xl:flex-[2] xl:grid-cols-[2fr_1fr]">
|
||||
<Card class="glass-card min-h-[220px] overflow-hidden rounded-3xl border-white/10 bg-[#16161d]/80 xl:min-h-0">
|
||||
<CardHeader class="pb-2">
|
||||
<CardTitle class="text-xs font-bold uppercase tracking-wider text-gray-500">Logs</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent class="flex-1">
|
||||
<CardContent class="flex-1 xl:min-h-0">
|
||||
<ScrollArea
|
||||
id="cameraLogs"
|
||||
class="min-h-[220px] rounded-xl border border-white/5 bg-black/40 p-4 text-xs font-mono text-gray-400"
|
||||
>
|
||||
id="cameraLogs"
|
||||
class="h-[220px] rounded-xl border border-white/5 bg-black/40 p-4 text-xs font-mono text-gray-400 xl:h-full xl:min-h-[220px]"
|
||||
>
|
||||
{#if $appState.activityLog.length === 0}
|
||||
<div class="text-gray-600 italic">Awaiting connection...</div>
|
||||
{:else}
|
||||
@@ -111,11 +111,11 @@
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card class="glass-card min-h-[220px] rounded-3xl border-white/10 bg-[#16161d]/80">
|
||||
<Card class="glass-card min-h-[220px] overflow-hidden rounded-3xl border-white/10 bg-[#16161d]/80 xl:min-h-0">
|
||||
<CardHeader class="pb-2">
|
||||
<CardTitle class="text-xs font-bold uppercase tracking-wider text-gray-500">Actions / Options</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent class="space-y-4">
|
||||
<CardContent class="space-y-4 xl:min-h-0 xl:overflow-y-auto">
|
||||
<div class="space-y-2">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<Label for="cameraInputSelect" class="text-[11px] font-semibold uppercase tracking-wider text-gray-400">
|
||||
@@ -150,8 +150,8 @@
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-white/10 bg-black/30 p-4 space-y-4">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="space-y-3 rounded-2xl border border-white/10 bg-black/30 p-3 sm:p-4 sm:space-y-4">
|
||||
<div class="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
|
||||
<div class="space-y-1">
|
||||
<p class="text-[11px] font-semibold uppercase tracking-wider text-gray-400">Automatic Detection</p>
|
||||
<p class="text-sm text-gray-200">
|
||||
@@ -163,7 +163,7 @@
|
||||
</div>
|
||||
<Button
|
||||
variant={$appState.motionDetection.enabled ? 'secondary' : 'outline'}
|
||||
class="min-w-[112px] rounded-xl"
|
||||
class="min-w-[112px] self-start rounded-xl sm:self-auto"
|
||||
onclick={() => appController.setMotionDetectionEnabled(!$appState.motionDetection.enabled)}
|
||||
>
|
||||
{$appState.motionDetection.enabled ? 'Pause' : 'Arm'}
|
||||
@@ -197,7 +197,7 @@
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-3">
|
||||
<div class="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
||||
<div class="rounded-xl border border-white/5 bg-white/5 px-3 py-2">
|
||||
<p class="text-[10px] uppercase tracking-wider text-gray-500">Detector State</p>
|
||||
<p class="mt-1 text-sm font-medium text-gray-200">{$appState.motionDetection.state}</p>
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
import AppChrome from '$lib/sim/ui/AppChrome.svelte';
|
||||
import { appController } from '$lib/app/controller';
|
||||
import { appState } from '$lib/app/store';
|
||||
import { Alert, AlertDescription, AlertTitle } from '$lib/components/ui/alert/index.js';
|
||||
import { Badge } from '$lib/components/ui/badge/index.js';
|
||||
import { Button } from '$lib/components/ui/button/index.js';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '$lib/components/ui/card/index.js';
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '$lib/components/ui/dropdown-menu/index.js';
|
||||
import { ScrollArea } from '$lib/components/ui/scroll-area/index.js';
|
||||
|
||||
let clientVideoElement: HTMLVideoElement | null = null;
|
||||
|
||||
@@ -25,26 +31,27 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<svelte:window onclick={() => appController.closeLinkedCameraMenu()} />
|
||||
|
||||
<AppChrome pageKey="client">
|
||||
<section id="screen-home-client" class="flex flex-col gap-12 max-w-7xl mx-auto h-full">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h2 class="text-2xl font-bold text-white tracking-tight">Client Dashboard</h2>
|
||||
<div class="flex gap-3">
|
||||
<button
|
||||
<Button
|
||||
id="linkCameraBtn"
|
||||
class="btn btn-outline border-white/10 text-gray-300 hover:text-white hover:bg-white/5 rounded-xl gap-2 shadow-none"
|
||||
variant="outline"
|
||||
class="rounded-xl border-white/10 text-gray-300 shadow-none hover:bg-white/5 hover:text-white"
|
||||
onclick={() => appController.linkCamera()}
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<svg data-icon="inline-start" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
|
||||
</svg>
|
||||
Link Camera
|
||||
</button>
|
||||
<button
|
||||
</Button>
|
||||
<Button
|
||||
id="refreshClientBtn"
|
||||
class="btn btn-ghost btn-square rounded-xl bg-white/5 border border-white/5 hover:bg-white/10"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
class="rounded-xl border border-white/5 bg-white/5 hover:bg-white/10"
|
||||
aria-label="Refresh linked cameras"
|
||||
title="Refresh linked cameras"
|
||||
onclick={() => appController.refreshClientData()}
|
||||
@@ -57,128 +64,155 @@
|
||||
d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="glass-card rounded-3xl border border-white/5 p-5 shrink-0 mb-4">
|
||||
<h3 class="text-xs font-bold text-gray-400 uppercase tracking-wider mb-4">Your Cameras</h3>
|
||||
<div id="linkedCamerasList" class="flex overflow-x-auto gap-4 pb-2 snap-x">
|
||||
<Card class="glass-card mb-4 shrink-0 rounded-3xl border-white/10 bg-[#16161d]/80">
|
||||
<CardHeader>
|
||||
<CardTitle class="text-xs font-bold uppercase tracking-wider text-gray-400">Your Cameras</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{#if $appState.linkedCameras.length === 0}
|
||||
<div class="w-full text-center py-6 bg-black/20 rounded-2xl border border-dashed border-white/10">
|
||||
<p class="text-gray-500 text-sm">No cameras linked yet</p>
|
||||
</div>
|
||||
<Alert class="border-dashed border-white/10 bg-black/20 text-center">
|
||||
<AlertTitle class="justify-self-center text-sm text-gray-200">No cameras linked</AlertTitle>
|
||||
<AlertDescription class="justify-self-center text-sm text-gray-500">
|
||||
Link a camera to start viewing live feeds and recordings.
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
{:else}
|
||||
{#each $appState.linkedCameras as link (link.id)}
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="min-w-[240px] max-w-[240px] bg-gray-900/60 rounded-xl border border-white/5 overflow-hidden flex-shrink-0 cursor-pointer hover:border-blue-500/50 transition-colors text-left"
|
||||
onclick={() => appController.selectCamera(link.cameraDeviceId)}
|
||||
onkeydown={(event) => {
|
||||
if (event.key === 'Enter' || event.key === ' ') appController.selectCamera(link.cameraDeviceId);
|
||||
}}
|
||||
>
|
||||
<div class="relative overflow-hidden bg-black/40 border-b border-white/5 aspect-video">
|
||||
{#if $appState.activeCameraDeviceId === link.cameraDeviceId}
|
||||
<div class="absolute inset-0 flex flex-col items-center justify-center gap-2 text-blue-400 bg-blue-500/10">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
|
||||
</svg>
|
||||
<p class="text-[10px] font-medium uppercase tracking-wider">Viewing</p>
|
||||
<ScrollArea class="w-full whitespace-nowrap" orientation="horizontal">
|
||||
<div id="linkedCamerasList" class="flex gap-4 pb-2">
|
||||
{#each $appState.linkedCameras as link (link.id)}
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="min-w-[240px] max-w-[240px] flex-shrink-0 cursor-pointer text-left"
|
||||
onclick={(event) => {
|
||||
if ((event.target as HTMLElement).closest('[data-menu-trigger]')) return;
|
||||
appController.selectCamera(link.cameraDeviceId);
|
||||
}}
|
||||
onkeydown={(event) => {
|
||||
if (event.key === 'Enter' || event.key === ' ') appController.selectCamera(link.cameraDeviceId);
|
||||
}}
|
||||
>
|
||||
<Card
|
||||
size="sm"
|
||||
class="overflow-hidden rounded-xl border transition-colors { $appState.activeCameraDeviceId === link.cameraDeviceId ? 'border-blue-500/50 bg-blue-950/20' : 'border-white/5 bg-gray-900/60 hover:border-blue-500/30' }"
|
||||
>
|
||||
<div class="relative aspect-video overflow-hidden border-b border-white/5 bg-black/40">
|
||||
{#if $appState.activeCameraDeviceId === link.cameraDeviceId}
|
||||
<div class="absolute inset-0 flex flex-col items-center justify-center gap-2 bg-blue-500/10 text-blue-400">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
|
||||
</svg>
|
||||
<Badge variant="secondary" class="rounded-full px-2 text-[10px] uppercase tracking-wider">
|
||||
Viewing
|
||||
</Badge>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="absolute inset-0 flex flex-col items-center justify-center gap-2 text-gray-500 transition-colors hover:text-gray-300">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" />
|
||||
</svg>
|
||||
<p class="text-[10px]">{isCameraLive(link.cameraDeviceId) ? 'Live Stream Active' : 'Click to view'}</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="absolute inset-0 flex flex-col items-center justify-center gap-2 text-gray-500 hover:text-gray-300 transition-colors">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" />
|
||||
</svg>
|
||||
<p class="text-[10px]">{isCameraLive(link.cameraDeviceId) ? 'Live Stream Active' : 'Click to view'}</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="px-3 py-3">
|
||||
<div class="flex items-start justify-between gap-2">
|
||||
<div class="flex items-center gap-2 min-w-0">
|
||||
<div class="w-2 h-2 rounded-full shrink-0 {statusDotClass(link.cameraStatus)}"></div>
|
||||
<div class="min-w-0">
|
||||
<p class="text-xs font-bold text-gray-200 truncate" title={link.cameraName || link.cameraDeviceId}>
|
||||
{link.cameraName || link.cameraDeviceId}
|
||||
</p>
|
||||
<p class="text-[10px] text-gray-400 capitalize">{link.cameraStatus || 'offline'}</p>
|
||||
<CardContent class="px-3 py-3">
|
||||
<div class="flex items-start justify-between gap-2">
|
||||
<div class="min-w-0 flex-1 space-y-2">
|
||||
<p class="truncate text-xs font-bold text-gray-200" title={link.cameraName || link.cameraDeviceId}>
|
||||
{link.cameraName || link.cameraDeviceId}
|
||||
</p>
|
||||
<Badge
|
||||
variant={link.cameraStatus?.toLowerCase() === 'online' ? 'secondary' : 'outline'}
|
||||
class="gap-1.5 rounded-full px-2 capitalize"
|
||||
>
|
||||
<span class="h-2 w-2 rounded-full shrink-0 {statusDotClass(link.cameraStatus)}"></span>
|
||||
{link.cameraStatus || 'offline'}
|
||||
</Badge>
|
||||
</div>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger>
|
||||
{#snippet child({ props })}
|
||||
<Button
|
||||
data-menu-trigger
|
||||
variant="ghost"
|
||||
size="icon-xs"
|
||||
class="text-gray-400 hover:text-white"
|
||||
{...props}
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
||||
<circle cx="10" cy="4" r="1.6" />
|
||||
<circle cx="10" cy="10" r="1.6" />
|
||||
<circle cx="10" cy="16" r="1.6" />
|
||||
</svg>
|
||||
</Button>
|
||||
{/snippet}
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" class="w-28">
|
||||
<DropdownMenuItem
|
||||
onclick={(event) => {
|
||||
event.stopPropagation();
|
||||
appController.renameLinkedCamera(link.cameraDeviceId);
|
||||
}}
|
||||
>
|
||||
Rename
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
variant="destructive"
|
||||
onclick={(event) => {
|
||||
event.stopPropagation();
|
||||
appController.deleteLinkedCamera(link.id);
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</div>
|
||||
<div class="relative">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-ghost btn-xs btn-circle text-gray-400 hover:text-white"
|
||||
aria-label="Camera options"
|
||||
onclick={(event) => {
|
||||
event.stopPropagation();
|
||||
appController.toggleLinkedCameraMenu(link.id);
|
||||
}}
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
||||
<circle cx="10" cy="4" r="1.6" />
|
||||
<circle cx="10" cy="10" r="1.6" />
|
||||
<circle cx="10" cy="16" r="1.6" />
|
||||
</svg>
|
||||
</button>
|
||||
<div class="{($appState.openLinkedCameraMenuId === link.id ? '' : 'hidden ')}absolute right-0 bottom-8 z-20 w-28 overflow-hidden rounded-lg border border-white/10 bg-gray-900/95 shadow-xl backdrop-blur">
|
||||
<button
|
||||
type="button"
|
||||
class="w-full px-3 py-2 text-left text-xs text-gray-200 hover:bg-white/10"
|
||||
onclick={(event) => {
|
||||
event.stopPropagation();
|
||||
appController.renameLinkedCamera(link.cameraDeviceId);
|
||||
}}
|
||||
>
|
||||
Rename
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="w-full px-3 py-2 text-left text-xs text-red-300 hover:bg-red-500/10"
|
||||
onclick={(event) => {
|
||||
event.stopPropagation();
|
||||
appController.deleteLinkedCamera(link.id);
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/each}
|
||||
</ScrollArea>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<div class="flex flex-col xl:flex-row gap-8 flex-1 min-h-0">
|
||||
<div
|
||||
<Card
|
||||
id="clientStreamViewerWrapper"
|
||||
class="flex-1 glass-card rounded-3xl overflow-hidden border border-white/10 flex flex-col shadow-xl min-h-[400px] {$appState.activeCameraDeviceId ? '' : 'hidden'}"
|
||||
class="glass-card min-h-[400px] flex-1 overflow-hidden rounded-3xl border-white/10 bg-[#16161d]/80 shadow-xl {$appState.activeCameraDeviceId ? '' : 'hidden'}"
|
||||
>
|
||||
<div class="px-5 py-4 border-b border-white/5 bg-black/20 flex justify-between items-center">
|
||||
<div class="flex items-center gap-3">
|
||||
<span class="w-2 h-2 rounded-full bg-red-500 animate-[pulse_2s_ease-in-out_infinite] {isCameraLive($appState.activeCameraDeviceId) ? '' : 'hidden'}" id="clientLiveDot"></span>
|
||||
<h3 class="font-medium text-white tracking-wide" id="clientStreamViewerTitle">Live Feed: {activeCameraLabel()}</h3>
|
||||
</div>
|
||||
<button
|
||||
<CardHeader class="border-b border-white/5 bg-black/20 px-5 py-4">
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<div class="flex items-center gap-3">
|
||||
<span class="w-2 h-2 rounded-full bg-red-500 animate-[pulse_2s_ease-in-out_infinite] {isCameraLive($appState.activeCameraDeviceId) ? '' : 'hidden'}" id="clientLiveDot"></span>
|
||||
<CardTitle class="font-medium tracking-wide text-white" id="clientStreamViewerTitle">
|
||||
Live Feed: {activeCameraLabel()}
|
||||
</CardTitle>
|
||||
</div>
|
||||
<Button
|
||||
id="closeStreamViewerBtn"
|
||||
class="btn btn-ghost btn-sm btn-circle text-gray-400 hover:text-white"
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
class="text-gray-400 hover:text-white"
|
||||
aria-label="Close stream viewer"
|
||||
title="Close stream viewer"
|
||||
onclick={() => appController.closeStreamViewer()}
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</Button>
|
||||
</div>
|
||||
</CardHeader>
|
||||
|
||||
<div id="clientStreamContainer" class="flex-1 bg-black relative flex items-center justify-center">
|
||||
<CardContent id="clientStreamContainer" class="flex flex-1 items-center justify-center bg-black">
|
||||
<video
|
||||
id="clientStreamVideo"
|
||||
class="absolute inset-0 w-full h-full object-contain {$appState.clientStreamMode === 'video' ? '' : 'hidden'}"
|
||||
@@ -186,7 +220,10 @@
|
||||
bind:this={clientVideoElement}
|
||||
></video>
|
||||
|
||||
<div id="clientStreamPlaceholder" class="flex flex-col items-center gap-4 animate-pulse {$appState.clientStreamMode === 'none' || $appState.clientStreamMode === 'connecting' || $appState.clientStreamMode === 'unavailable' ? '' : 'hidden'}">
|
||||
<Alert
|
||||
id="clientStreamPlaceholder"
|
||||
class="flex max-w-md flex-col items-center gap-4 border-white/10 bg-black/40 text-center {$appState.clientStreamMode === 'none' || $appState.clientStreamMode === 'connecting' || $appState.clientStreamMode === 'unavailable' ? '' : 'hidden'}"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 text-gray-700" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
@@ -195,40 +232,56 @@
|
||||
d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"
|
||||
></path>
|
||||
</svg>
|
||||
<p class="text-sm font-medium text-gray-500 tracking-wide uppercase">{$appState.clientPlaceholderText}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<AlertTitle class="justify-self-center text-sm text-gray-200">Stream unavailable</AlertTitle>
|
||||
<AlertDescription class="justify-self-center text-sm font-medium uppercase tracking-wide text-gray-500">
|
||||
{$appState.clientPlaceholderText}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<div class="xl:w-96 shrink-0 flex flex-col gap-6 overflow-y-auto pr-2">
|
||||
<div class="glass-card rounded-3xl border border-white/5 p-5 flex-1">
|
||||
<h3 class="text-xs font-bold text-gray-400 uppercase tracking-wider mb-4">Recent Recordings</h3>
|
||||
<div id="recordingsList" class="space-y-3">
|
||||
<Card class="glass-card flex-1 rounded-3xl border-white/10 bg-[#16161d]/80">
|
||||
<CardHeader>
|
||||
<CardTitle class="text-xs font-bold uppercase tracking-wider text-gray-400">Recent Recordings</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ScrollArea class="max-h-[26rem] pr-3">
|
||||
<div id="recordingsList" class="space-y-3">
|
||||
{#if $appState.recordings.length === 0}
|
||||
<div class="text-center py-4 bg-gray-900/30 rounded-xl">
|
||||
<p class="text-gray-600 text-xs text-center">No recordings found</p>
|
||||
</div>
|
||||
<Alert class="border-white/10 bg-gray-900/30 text-center">
|
||||
<AlertTitle class="justify-self-center text-xs text-gray-200">No recordings found</AlertTitle>
|
||||
<AlertDescription class="justify-self-center text-xs text-gray-500">
|
||||
Captured clips will appear here when they are ready.
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
{:else}
|
||||
{#each $appState.recordings.slice(0, 5) as recording (recording.id)}
|
||||
<div class="flex items-center justify-between p-3 bg-gray-900/40 rounded-lg border border-white/5 hover:bg-gray-800 transition-colors">
|
||||
<div class="flex flex-col">
|
||||
<span class="text-xs font-medium text-gray-300">{new Date(recording.createdAt).toLocaleString()}</span>
|
||||
<span class="text-[10px] text-gray-500">
|
||||
{recording.durationSeconds != null ? `${recording.durationSeconds}s duration` : 'Duration pending'} · {recording.status ?? 'unknown'}
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
class="btn btn-xs btn-outline border-white/10 text-gray-400"
|
||||
disabled={recording.status !== 'ready'}
|
||||
onclick={() => appController.openRecording(recording.id)}
|
||||
>
|
||||
View
|
||||
</button>
|
||||
</div>
|
||||
<Card size="sm" class="border-white/5 bg-gray-900/40">
|
||||
<CardContent class="flex items-center justify-between gap-4 px-3 py-3">
|
||||
<div class="flex flex-col">
|
||||
<span class="text-xs font-medium text-gray-300">{new Date(recording.createdAt).toLocaleString()}</span>
|
||||
<span class="text-[10px] text-gray-500">
|
||||
{recording.durationSeconds != null ? `${recording.durationSeconds}s duration` : 'Duration pending'} · {recording.status ?? 'unknown'}
|
||||
</span>
|
||||
</div>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="xs"
|
||||
class="border-white/10 text-gray-400"
|
||||
disabled={recording.status !== 'ready'}
|
||||
onclick={() => appController.openRecording(recording.id)}
|
||||
>
|
||||
View
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ScrollArea>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
@import 'tailwindcss';
|
||||
@plugin "daisyui";
|
||||
|
||||
body {
|
||||
font-family: 'Inter', sans-serif;
|
||||
}
|
||||
|
||||
/* Custom Scrollbar */
|
||||
::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: rgb(0 0 0 / 20%);
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: rgb(255 255 255 / 10%);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: rgb(255 255 255 / 20%);
|
||||
}
|
||||
|
||||
.glass-panel {
|
||||
background: rgb(15 15 20 / 70%);
|
||||
backdrop-filter: blur(16px);
|
||||
border: 1px solid rgb(255 255 255 / 5%);
|
||||
}
|
||||
|
||||
.glass-card {
|
||||
background: rgb(25 25 30 / 60%);
|
||||
border: 1px solid rgb(255 255 255 / 8%);
|
||||
}
|
||||
|
||||
.btn-premium {
|
||||
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
|
||||
border: none;
|
||||
color: white;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.btn-premium:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgb(37 99 235 / 30%);
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
height: 8px;
|
||||
width: 8px;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.status-online {
|
||||
background-color: #10b981;
|
||||
box-shadow: 0 0 8px rgb(16 185 129 / 40%);
|
||||
}
|
||||
|
||||
.status-offline {
|
||||
background-color: #ef4444;
|
||||
box-shadow: 0 0 8px rgb(239 68 68 / 40%);
|
||||
}
|
||||
|
||||
@keyframes slideIn {
|
||||
from {
|
||||
transform: translateY(100%);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
to {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.toast-enter {
|
||||
animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
||||
}
|
||||
@@ -3,74 +3,90 @@
|
||||
import AppChrome from '$lib/sim/ui/AppChrome.svelte';
|
||||
import { appController } from '$lib/app/controller';
|
||||
import { appState } from '$lib/app/store';
|
||||
import { Button } from '$lib/components/ui/button/index.js';
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '$lib/components/ui/card/index.js';
|
||||
import { Input } from '$lib/components/ui/input/index.js';
|
||||
import { Label } from '$lib/components/ui/label/index.js';
|
||||
import { ToggleGroup, ToggleGroupItem } from '$lib/components/ui/toggle-group/index.js';
|
||||
</script>
|
||||
|
||||
<AppChrome pageKey="onboarding">
|
||||
<section id="screen-onboarding" class="flex flex-col items-center justify-center min-h-[70vh] max-w-lg mx-auto">
|
||||
<div class="text-center space-y-2 mb-8">
|
||||
<h2 class="text-3xl font-bold text-white tracking-tight">Configure Device</h2>
|
||||
<p class="text-sm text-gray-400">Set up this browser dashboard role</p>
|
||||
</div>
|
||||
|
||||
<div class="w-full glass-card p-6 md:p-8 rounded-3xl space-y-6 shadow-2xl">
|
||||
<div class="form-control w-full">
|
||||
<label class="label" for="deviceName"
|
||||
><span class="label-text text-xs font-semibold text-gray-400 tracking-wider">DEVICE NAME</span></label
|
||||
>
|
||||
<input
|
||||
id="deviceName"
|
||||
type="text"
|
||||
placeholder="e.g. Living Room Cam"
|
||||
class="input input-bordered h-12 rounded-xl bg-black/40 border-white/10 focus:border-blue-500"
|
||||
value={$appState.onboardingForm.name}
|
||||
oninput={(event) => appController.setOnboardingField('name', (event.currentTarget as HTMLInputElement).value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-control w-full">
|
||||
<label class="label" for="role"
|
||||
><span class="label-text text-xs font-semibold text-gray-400 tracking-wider">ROLE</span></label
|
||||
>
|
||||
<div class="grid grid-cols-2 gap-2 p-1.5 bg-black/40 rounded-xl border border-white/5">
|
||||
<button
|
||||
class="btn btn-ghost normal-case rounded-lg h-10 min-h-0 {$appState.onboardingForm.role === 'camera' ? 'bg-blue-600 text-white' : 'text-gray-400'}"
|
||||
id="btn-role-camera"
|
||||
onclick={() => appController.selectRole('camera')}
|
||||
>
|
||||
Camera
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-ghost normal-case rounded-lg h-10 min-h-0 {$appState.onboardingForm.role === 'client' ? 'bg-blue-600 text-white' : 'text-gray-400'}"
|
||||
id="btn-role-client"
|
||||
onclick={() => appController.selectRole('client')}
|
||||
>
|
||||
Client
|
||||
</button>
|
||||
<Card class="glass-card w-full rounded-3xl border-white/10 bg-[#16161d]/80 shadow-2xl">
|
||||
<CardHeader class="px-6 pt-6 text-center">
|
||||
<CardTitle class="text-3xl font-bold tracking-tight text-white">Configure Device</CardTitle>
|
||||
<CardDescription class="text-sm text-gray-400">Set up this browser dashboard role</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent class="flex flex-col gap-6 px-6">
|
||||
<div class="flex flex-col gap-2">
|
||||
<Label class="text-xs font-semibold tracking-wider text-gray-400" for="deviceName">DEVICE NAME</Label>
|
||||
<Input
|
||||
id="deviceName"
|
||||
type="text"
|
||||
placeholder="e.g. Living Room Cam"
|
||||
class="h-12 rounded-xl border-white/10 bg-black/40 text-white placeholder:text-gray-500"
|
||||
value={$appState.onboardingForm.name}
|
||||
oninput={(event) => appController.setOnboardingField('name', (event.currentTarget as HTMLInputElement).value)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-control w-full">
|
||||
<label class="label" for="pushToken"
|
||||
><span class="label-text text-xs font-semibold text-gray-400 tracking-wider">PUSH TOKEN (OPTIONAL)</span></label
|
||||
<div class="flex flex-col gap-2">
|
||||
<Label class="text-xs font-semibold tracking-wider text-gray-400" for="role">ROLE</Label>
|
||||
<ToggleGroup
|
||||
id="role"
|
||||
type="single"
|
||||
value={$appState.onboardingForm.role}
|
||||
variant="outline"
|
||||
size="lg"
|
||||
class="grid w-full grid-cols-2 gap-2 rounded-xl border border-white/5 bg-black/40 p-1.5"
|
||||
onValueChange={(value) => value && appController.selectRole(value)}
|
||||
>
|
||||
<ToggleGroupItem
|
||||
id="btn-role-camera"
|
||||
value="camera"
|
||||
class="h-10 justify-center rounded-lg border-white/0 text-sm font-medium text-gray-400 data-[state=on]:border-blue-500/30 data-[state=on]:bg-blue-600 data-[state=on]:text-white"
|
||||
>
|
||||
Camera
|
||||
</ToggleGroupItem>
|
||||
<ToggleGroupItem
|
||||
id="btn-role-client"
|
||||
value="client"
|
||||
class="h-10 justify-center rounded-lg border-white/0 text-sm font-medium text-gray-400 data-[state=on]:border-blue-500/30 data-[state=on]:bg-blue-600 data-[state=on]:text-white"
|
||||
>
|
||||
Client
|
||||
</ToggleGroupItem>
|
||||
</ToggleGroup>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-2">
|
||||
<Label class="text-xs font-semibold tracking-wider text-gray-400" for="pushToken">PUSH TOKEN (OPTIONAL)</Label>
|
||||
<Input
|
||||
id="pushToken"
|
||||
type="text"
|
||||
placeholder="simulated_token_123"
|
||||
class="h-12 rounded-xl border-white/10 bg-black/40 text-white placeholder:text-gray-500"
|
||||
value={$appState.onboardingForm.pushToken}
|
||||
oninput={(event) => appController.setOnboardingField('pushToken', (event.currentTarget as HTMLInputElement).value)}
|
||||
/>
|
||||
</div>
|
||||
</CardContent>
|
||||
<CardFooter class="flex flex-col items-stretch gap-3 border-0 bg-transparent px-6 pb-6 pt-2">
|
||||
<Button
|
||||
id="registerBtn"
|
||||
class="btn-premium h-12 w-full rounded-xl text-base text-white"
|
||||
onclick={() => appController.registerDevice()}
|
||||
>
|
||||
<input
|
||||
id="pushToken"
|
||||
type="text"
|
||||
placeholder="simulated_token_123"
|
||||
class="input input-bordered h-12 rounded-xl bg-black/40 border-white/10 focus:border-blue-500"
|
||||
value={$appState.onboardingForm.pushToken}
|
||||
oninput={(event) => appController.setOnboardingField('pushToken', (event.currentTarget as HTMLInputElement).value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="pt-6">
|
||||
<button id="registerBtn" class="btn btn-premium w-full h-12 rounded-xl text-base" onclick={() => appController.registerDevice()}>
|
||||
Complete Setup
|
||||
</button>
|
||||
<button id="loadSavedBtn" class="btn btn-ghost w-full mt-3 text-gray-500 hover:text-white hover:bg-white/5" onclick={() => appController.loadSavedDevice()}>
|
||||
</Button>
|
||||
<Button
|
||||
id="loadSavedBtn"
|
||||
variant="ghost"
|
||||
class="h-12 w-full rounded-xl text-gray-500 hover:bg-white/5 hover:text-white"
|
||||
onclick={() => appController.loadSavedDevice()}
|
||||
>
|
||||
Load previously saved device
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</Button>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</section>
|
||||
</AppChrome>
|
||||
|
||||
@@ -7,7 +7,7 @@ describe('/+page.svelte', () => {
|
||||
it('should render simulator auth heading', async () => {
|
||||
render(Page);
|
||||
|
||||
const heading = page.getByRole('heading', { name: 'SecureCam Web' });
|
||||
const heading = page.getByRole('heading', { name: 'PhoneCam Web' });
|
||||
await expect.element(heading).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
import AppChrome from '$lib/sim/ui/AppChrome.svelte';
|
||||
import { appController } from '$lib/app/controller';
|
||||
import { appState } from '$lib/app/store';
|
||||
import { Avatar, AvatarFallback } from '$lib/components/ui/avatar/index.js';
|
||||
import { Button } from '$lib/components/ui/button/index.js';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '$lib/components/ui/card/index.js';
|
||||
import { Separator } from '$lib/components/ui/separator/index.js';
|
||||
|
||||
const profileName = () => $appState.session?.user?.name || 'User';
|
||||
const profileEmail = () => $appState.session?.user?.email || 'user@example.com';
|
||||
@@ -13,23 +17,27 @@
|
||||
<section id="screen-settings" class="flex flex-col gap-6 max-w-2xl mx-auto py-8">
|
||||
<h2 class="text-2xl font-bold text-white tracking-tight px-2">Settings</h2>
|
||||
|
||||
<div class="glass-card rounded-3xl border border-white/5 p-8 flex items-center gap-6">
|
||||
<div
|
||||
class="w-20 h-20 bg-blue-600/20 text-blue-500 rounded-full flex items-center justify-center leading-none text-2xl font-bold border border-blue-500/30"
|
||||
id="profileInitials"
|
||||
>
|
||||
{profileInitial()}
|
||||
</div>
|
||||
<div>
|
||||
<h3 class="text-xl text-white font-semibold tracking-wide" id="profileName">{profileName()}</h3>
|
||||
<p class="text-gray-400 mt-1" id="profileEmail">{profileEmail()}</p>
|
||||
</div>
|
||||
</div>
|
||||
<Card class="glass-card rounded-3xl border-white/10 bg-[#16161d]/80">
|
||||
<CardContent class="flex items-center gap-6">
|
||||
<Avatar id="profileInitials" size="lg" class="size-20 bg-blue-600/20 text-2xl font-bold text-blue-500">
|
||||
<AvatarFallback>{profileInitial()}</AvatarFallback>
|
||||
</Avatar>
|
||||
<div>
|
||||
<h3 class="text-xl font-semibold tracking-wide text-white" id="profileName">{profileName()}</h3>
|
||||
<p class="mt-1 text-gray-400" id="profileEmail">{profileEmail()}</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<div class="glass-card rounded-3xl border border-white/5 overflow-hidden">
|
||||
<button
|
||||
<Card class="glass-card overflow-hidden rounded-3xl border-white/10 bg-[#16161d]/80">
|
||||
<CardHeader>
|
||||
<CardTitle class="text-sm font-semibold tracking-wide text-white">Tools</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent class="flex flex-col gap-0 p-0">
|
||||
<Button
|
||||
id="checkOpsBtn"
|
||||
class="w-full flex items-center justify-between p-5 text-left text-gray-300 hover:bg-white/5 transition-colors border-b border-white/5 group"
|
||||
variant="ghost"
|
||||
class="group h-auto w-full justify-between rounded-none px-5 py-5 text-left text-gray-300 hover:bg-white/5"
|
||||
onclick={() => appController.runDiagnostics()}
|
||||
>
|
||||
<div class="flex items-center gap-4">
|
||||
@@ -45,11 +53,12 @@
|
||||
</div>
|
||||
<span class="font-medium">Run Diagnostics</span>
|
||||
</div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<svg data-icon="inline-end" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
|
||||
</svg>
|
||||
</button>
|
||||
<button class="w-full flex items-center justify-between p-5 text-left text-gray-300 hover:bg-white/5 transition-colors group">
|
||||
</Button>
|
||||
<Separator class="bg-white/5" />
|
||||
<Button variant="ghost" class="group h-auto w-full justify-between rounded-none px-5 py-5 text-left text-gray-300 hover:bg-white/5">
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="p-2 rounded-lg bg-white/5 group-hover:bg-blue-500/20 group-hover:text-blue-400 transition-colors">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
@@ -64,18 +73,20 @@
|
||||
</div>
|
||||
<span class="font-medium">Device Information</span>
|
||||
</div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<svg data-icon="inline-end" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<button
|
||||
<Button
|
||||
id="signOutBtn"
|
||||
class="btn btn-error btn-outline w-full rounded-2xl h-14 text-base font-medium gap-3 border-red-500/50 hover:bg-red-500/10 hover:border-red-500 mt-4"
|
||||
variant="destructive"
|
||||
class="mt-4 h-14 w-full rounded-2xl border border-red-500/50 text-base font-medium hover:border-red-500 hover:bg-red-500/10"
|
||||
onclick={() => appController.signOut()}
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<svg data-icon="inline-start" xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
@@ -84,6 +95,6 @@
|
||||
/>
|
||||
</svg>
|
||||
Sign Out
|
||||
</button>
|
||||
</Button>
|
||||
</section>
|
||||
</AppChrome>
|
||||
|
||||
Reference in New Issue
Block a user