feat(story-2.4): home screen device list with FrameCard component
CI / test (push) Has been cancelled
CI / test (push) Has been cancelled
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -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<Device[]>([])
|
||||
const loading = ref(false)
|
||||
const error = ref<string | null>(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 }
|
||||
})
|
||||
Reference in New Issue
Block a user