fix(home): preview reflects what's on the frame, not what's queued
CI / test (push) Has been cancelled
CI / test (push) Has been cancelled
Both the backend preview endpoint and the frontend cache-buster were preferring lockedImage over currentImage. Locking is a queued override that doesn't take effect until the device's next poll, so showing it on Home before the device has actually pulled it lied about the frame's state. Always use currentImage now. Also: add a primary "+ Add Photo" button at the top of the Library page so users can upload without bouncing back to Home; updates the empty- state copy to point at the new button. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
<template>
|
||||
<main class="library">
|
||||
<PullToRefresh :is-at-top="isAtTop" :on-refresh="refreshLibrary">
|
||||
<!-- Top action bar -->
|
||||
<div class="library__header">
|
||||
<BaseButton variant="primary" class="library__add-btn" @click="onAddPhoto">
|
||||
+ Add Photo
|
||||
</BaseButton>
|
||||
</div>
|
||||
<!-- Tabs -->
|
||||
<div class="library__tabs" role="tablist">
|
||||
<button
|
||||
@@ -26,7 +32,7 @@
|
||||
<polyline points="21,15 16,10 5,21"/>
|
||||
</svg>
|
||||
<p class="library__empty-title">No photos yet</p>
|
||||
<p class="library__empty-sub">Tap "+ Add Photo" on the home screen to get started.</p>
|
||||
<p class="library__empty-sub">Tap "+ Add Photo" above to upload your first one.</p>
|
||||
</div>
|
||||
|
||||
<div v-else class="library__grid">
|
||||
@@ -291,6 +297,23 @@ onMounted(() => {
|
||||
if (activeTab.value === 'shared') loadShared(sharedTab.value)
|
||||
})
|
||||
|
||||
// ── Add Photo ─────────────────────────────────────────────────────────────────
|
||||
|
||||
function onAddPhoto() {
|
||||
// File picker must be triggered in the user-gesture context (the click
|
||||
// handler) before navigating, otherwise browsers block it as a popup.
|
||||
const input = document.createElement('input')
|
||||
input.type = 'file'
|
||||
input.accept = 'image/jpeg,image/png,image/webp,image/gif'
|
||||
input.onchange = () => {
|
||||
const file = input.files?.[0]
|
||||
if (!file) return
|
||||
uploadStore.init(file)
|
||||
router.push('/upload')
|
||||
}
|
||||
input.click()
|
||||
}
|
||||
|
||||
// ── Pull-to-refresh ───────────────────────────────────────────────────────────
|
||||
|
||||
function isAtTop(): boolean {
|
||||
@@ -414,6 +437,14 @@ async function doDelete() {
|
||||
.library {
|
||||
padding-bottom: calc(var(--bottom-nav-height) + var(--space-4));
|
||||
|
||||
&__header {
|
||||
padding: var(--space-4) var(--space-4) var(--space-3);
|
||||
}
|
||||
|
||||
&__add-btn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&__tabs {
|
||||
display: flex;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
|
||||
Reference in New Issue
Block a user