From 6c7c7a1a6f141e03444d4945a26753bd20b62894 Mon Sep 17 00:00:00 2001 From: Matt Edholm Date: Tue, 28 Apr 2026 00:50:46 -0400 Subject: [PATCH] feat(story-2.4): home screen device list with FrameCard component MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - FrameCard: large (single device, 5:3 preview + Add Photo CTA) and compact (52px thumb + name + count + icon pill) variants; WCAG- compliant offline/sync-fail status (color + text, never color alone) - devices Pinia store: fetchDevices() → GET /api/devices - HomeView: 0 devices → dashed empty-state card; 1 device → large FrameCard; 2+ → compact stack; add-photo wired (Epic 3 stub) - Fix Device type: rotationInterval → rotationIntervalHours to match API Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/components/FrameCard.vue | 184 ++++++++++++++++++++++++++ frontend/src/stores/devices.ts | 25 ++++ frontend/src/types/index.ts | 2 +- frontend/src/views/HomeView.vue | 123 ++++++++++++++++- 4 files changed, 330 insertions(+), 4 deletions(-) create mode 100644 frontend/src/components/FrameCard.vue create mode 100644 frontend/src/stores/devices.ts diff --git a/frontend/src/components/FrameCard.vue b/frontend/src/components/FrameCard.vue new file mode 100644 index 0000000..5fd08a7 --- /dev/null +++ b/frontend/src/components/FrameCard.vue @@ -0,0 +1,184 @@ + + + + + diff --git a/frontend/src/stores/devices.ts b/frontend/src/stores/devices.ts new file mode 100644 index 0000000..796515f --- /dev/null +++ b/frontend/src/stores/devices.ts @@ -0,0 +1,25 @@ +import { defineStore } from 'pinia' +import { ref } from 'vue' +import type { Device } from '@/types' + +export const useDevicesStore = defineStore('devices', () => { + const devices = ref([]) + const loading = ref(false) + const error = ref(null) + + async function fetchDevices() { + loading.value = true + error.value = null + try { + const res = await fetch('/api/devices') + if (!res.ok) throw new Error('Failed to load devices') + devices.value = await res.json() + } catch (e) { + error.value = e instanceof Error ? e.message : 'Unknown error' + } finally { + loading.value = false + } + } + + return { devices, loading, error, fetchDevices } +}) diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index dfe81d0..b0497ed 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -10,7 +10,7 @@ export interface Device { mac: string name: string orientation: 'landscape' | 'portrait' - rotationInterval: number + rotationIntervalHours: number uniquenessWindow: number linkedAt: string } diff --git a/frontend/src/views/HomeView.vue b/frontend/src/views/HomeView.vue index 25c830f..069ede4 100644 --- a/frontend/src/views/HomeView.vue +++ b/frontend/src/views/HomeView.vue @@ -1,9 +1,126 @@ + +