CLN - remove local camera capture state

This commit is contained in:
Leon.Schmidt
2026-08-06 16:58:07 +02:00
parent 7f63e99482
commit e5c50ac0e2
+14 -16
View File
@@ -3,32 +3,38 @@ import { defineStore } from 'pinia'
import { usePhoneStore } from '@/stores/phone'
export type PhonePhoto = {
attachmentId: string
capturedAt: number
gradient: string
id: string
titleKey: string
url?: string
}
const samplePhotos: PhonePhoto[] = [
{
attachmentId: 'sunset-drive',
capturedAt: Date.now() - 86_400_000,
gradient: 'linear-gradient(145deg, #ff9a62, #5f2c82 58%, #141e30)',
id: 'sunset-drive',
titleKey: 'Apps.photos.samples.sunset',
},
{
attachmentId: 'ocean-air',
capturedAt: Date.now() - 172_800_000,
gradient: 'linear-gradient(160deg, #67d5b5, #26648e 55%, #0b132b)',
id: 'ocean-air',
titleKey: 'Apps.photos.samples.ocean',
},
{
attachmentId: 'city-lights',
capturedAt: Date.now() - 259_200_000,
gradient: 'linear-gradient(135deg, #fbc2eb, #a6c1ee 48%, #302b63)',
id: 'city-lights',
titleKey: 'Apps.photos.samples.city',
},
{
attachmentId: 'desert-road',
capturedAt: Date.now() - 345_600_000,
gradient: 'linear-gradient(150deg, #f6d365, #fda085 45%, #512b58)',
id: 'desert-road',
@@ -48,21 +54,6 @@ export const useMediaStore = defineStore('media', {
photos: (state): PhonePhoto[] => [...state.captures, ...samplePhotos],
},
actions: {
capture(): void {
const gradients = [
'linear-gradient(145deg, #ff6b6b, #845ec2 52%, #0f2027)',
'linear-gradient(150deg, #00c9a7, #4d8076 46%, #1f3a5f)',
'linear-gradient(135deg, #ffc75f, #f96d80 48%, #4b4453)',
]
const captureNumber = this.captures.length
this.captures.unshift({
capturedAt: Date.now(),
gradient: gradients[captureNumber % gradients.length],
id: `capture-${Date.now()}`,
titleKey: 'Apps.photos.samples.capture',
})
this.persist()
},
claimApp(id: string): void {
if (!this.claimedApps.includes(id)) {
this.claimedApps.push(id)
@@ -74,7 +65,14 @@ export const useMediaStore = defineStore('media', {
captures: PhonePhoto[]
claimedApps: string[]
}> | null
this.captures = Array.isArray(data?.captures) ? data.captures : []
this.captures = Array.isArray(data?.captures)
? data.captures.filter(
(photo) =>
typeof photo.id === 'string' &&
typeof photo.url === 'string' &&
photo.url.startsWith('https://'),
)
: []
this.claimedApps = Array.isArray(data?.claimedApps)
? data.claimedApps.filter((id): id is string => typeof id === 'string')
: []