feat(ui): migrate routes and app shell to controller-driven state
This commit is contained in:
@@ -1,8 +1,50 @@
|
||||
<script lang="ts">
|
||||
import ActivityScreen from '$lib/sim/screens/ActivityScreen.svelte';
|
||||
// @ts-nocheck
|
||||
import AppChrome from '$lib/sim/ui/AppChrome.svelte';
|
||||
import { appController } from '$lib/app/controller';
|
||||
import { appState } from '$lib/app/store';
|
||||
</script>
|
||||
|
||||
<AppChrome pageKey="activity">
|
||||
<ActivityScreen />
|
||||
<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
|
||||
id="clearActivityBtn"
|
||||
class="btn btn-ghost text-gray-400 hover:bg-white/5 hover:text-white rounded-xl border border-transparent"
|
||||
onclick={() => appController.clearNotifications()}
|
||||
>
|
||||
Clear Read
|
||||
</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">
|
||||
{#if $appState.motionNotifications.length === 0}
|
||||
<div class="text-center py-16 opacity-50">
|
||||
<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"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
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>
|
||||
{: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'}"
|
||||
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>
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</AppChrome>
|
||||
|
||||
Reference in New Issue
Block a user