Edge-Drop is a clipboard shelf on the edge of your screen. Hover to open it. Drag files and images into any app, click to copy text and links. Free and open-source for Windows.
TypeScript clipboardclipboard-managerdesktop-appdrag-and-dropelectronopen-sourceproductivityproductivity-toolwindows
feat: persistent update check state, fast GitHub release checks, and off-screen scroll indicator badge
Deepender252a73526fda14
diff --git a/electron/main/updater.ts b/electron/main/updater.tsindex 5c56390..72c8ae3 100644--- a/electron/main/updater.ts+++ b/electron/main/updater.ts@@ -1,4 +1,4 @@-import { app } from 'electron'+import { app, net } from 'electron'import { isStoreBuild } from './ipc'import { pushState } from './state'import { getSettings } from '../store/settings'@@ -36,34 +36,124 @@ export function syncAutoUpdaterState(): void {console.log('[AutoUpdater] Synced autoDownload =', enabled)}+function semverCompare(v1: string, v2: string): number {+ const p1 = v1.replace(/^v/i, '').split('.').map((x) => parseInt(x, 10) || 0)+ const p2 = v2.replace(/^v/i, '').split('.').map((x) => parseInt(x, 10) || 0)+ for (let i = 0; i < Math.max(p1.length, p2.length); i++) {+ const n1 = p1[i] || 0+ const n2 = p2[i] || 0+ if (n1 > n2) return 1+ if (n1 < n2) return -1+ }+ return 0+}++/**+ * Fast direct check against GitHub Releases API (< 0.5s) with a 4s max timeout.+ */+function checkGitHubReleaseFast(): Promise<{ tag_name?: string } | null> {+ return new Promise((resolve) => {+ try {+ const request = net.request({+ method: 'GET',+ url: 'https://api.github.com/repos/Deepender25/Edge-Drop/releases/latest'+ })+ request.setHeader('User-Agent', 'Edge-Drop-App')+ request.setHeader('Accept', 'application/vnd.github.v3+json')++ const timer = setTimeout(() => {+ try { request.abort() } catch { /* ignore */ }+ resolve(null)+ }, 4000)++ request.on('response', (response) => {+ let body = ''+ response.on('data', (chunk) => { body += chunk })+ response.on('end', () => {+ clearTimeout(timer)+ try {+ if (response.statusCode === 200) {+ resolve(JSON.parse(body))+ } else {+ resolve(null)+ }+ } catch {+ resolve(null)+ }+ })+ })++ request.on('error', () => {+ clearTimeout(timer)+ resolve(null)+ })++ request.end()+ } catch {+ resolve(null)+ }+ })+}+/**- * Manually check for updates on user click.+ * Manually check for updates on user click with instant fast-path resolution.*/export async function checkForUpdatesManual(): Promise<{ status: string; version?: string; error?: string }> {if (isStoreBuild()) {return { status: 'up-to-date', version: app.getVersion() }}++ // Ensure autoUpdater reference is initialized for subsequent download callsif (!_autoUpdater) {try {const { autoUpdater } = require('electron-updater')_autoUpdater = autoUpdater- } catch (err: any) {- return { status: 'error', error: err?.message || 'AutoUpdater not initialized' }+ _autoUpdater.autoDownload = false+ _autoUpdater.autoInstallOnAppQuit = false+ if (!app.isPackaged) {+ _autoUpdater.forceDevUpdateConfig = true+ }+ } catch {+ /* ignore */}- }-- try {- // Strictly disable autoDownload for manual checks so it only downloads on explicit user click!+ } else {_autoUpdater.autoDownload = false_autoUpdater.autoInstallOnAppQuit = false- const result = await _autoUpdater.checkForUpdates()- if (result && result.updateInfo && result.updateInfo.version !== app.getVersion()) {- return { status: 'available', version: result.updateInfo.version }+ }++ // 1. Fast path: Direct GitHub API query (returns in ~300ms)+ const fastResult = await checkGitHubReleaseFast()+ if (fastResult && fastResult.tag_name) {+ const latestVersion = fastResult.tag_name.replace(/^v/i, '')+ const currentVersion = app.getVersion()+ if (semverCompare(latestVersion, currentVersion) > 0) {+ console.log(`[AutoUpdater] Fast check found new version: v${latestVersion} (current: v${currentVersion})`)+ pushState.updateAvailable({ version: latestVersion })+ return { status: 'available', version: latestVersion }+ } else {+ console.log(`[AutoUpdater] Fast check confirms app is up to date: v${currentVersion}`)+ return { status: 'up-to-date', version: currentVersion }}- return { status: 'up-to-date', version: app.getVersion() }- } catch (err: any) {- return { status: 'error', error: typeof err === 'string' ? err : err?.message || 'Failed to check for updates' }}++ // 2. Fallback path: electron-updater check with 5-second race timeout+ if (_autoUpdater) {+ try {+ const checkPromise = _autoUpdater.checkForUpdates()+ const timeoutPromise = new Promise<{ updateInfo?: { version: string } }>((_, reject) =>+ setTimeout(() => reject(new Error('Update check timeout')), 5000)+ )+ const result = await Promise.race([checkPromise, timeoutPromise])+ if (result && result.updateInfo && semverCompare(result.updateInfo.version, app.getVersion()) > 0) {+ return { status: 'available', version: result.updateInfo.version }+ }+ return { status: 'up-to-date', version: app.getVersion() }+ } catch (err: any) {+ return { status: 'error', error: typeof err === 'string' ? err : err?.message || 'Failed to check for updates' }+ }+ }++ return { status: 'error', error: 'Failed to check for updates' }}/**diff --git a/src/components/Header.tsx b/src/components/Header.tsxindex 86d7a83..3bacc76 100644--- a/src/components/Header.tsx+++ b/src/components/Header.tsx@@ -218,7 +218,7 @@ export function Header() {width: 8,height: 8,borderRadius: '50%',- backgroundColor: updateInfo?.downloaded ? '#4caf50' : '#f97316',+ backgroundColor: '#4caf50',border: '1.5px solid #000000',pointerEvents: 'none'}}diff --git a/src/components/Settings.tsx b/src/components/Settings.tsxindex 296c1ea..7fd1130 100644--- a/src/components/Settings.tsx+++ b/src/components/Settings.tsx@@ -72,36 +72,9 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: boolconst updateDownloaded = updateInfo?.downloaded ? { version: updateInfo.latestVersion } : nullconst autoUpdates = settings.autoUpdates ?? true- const [checkState, setCheckState] = useState<{- status: 'idle' | 'checking' | 'up-to-date' | 'available' | 'downloading' | 'error'- version?: string- error?: string- }>({ status: 'idle' })-- const handleManualCheck = async () => {- setCheckState({ status: 'checking' })- try {- const res = await window.edge.checkForUpdatesManual()- if (res.status === 'available') {- setCheckState({ status: 'available', version: res.version })- } else if (res.status === 'up-to-date') {- setCheckState({ status: 'up-to-date', version: res.version })- } else {- setCheckState({ status: 'error', error: res.error || 'Check failed' })- }- } catch (err: any) {- setCheckState({ status: 'error', error: err?.message || 'Check failed' })- }- }-- const handleStartDownload = async () => {- setCheckState({ status: 'downloading' })- try {- await window.edge.startUpdateDownload()- } catch {- setCheckState({ status: 'error', error: 'Download failed' })- }- }+ const checkState = useStore((s) => s.manualCheckState)+ const handleManualCheck = () => useStore.getState().startManualCheck()+ const handleStartDownload = () => useStore.getState().startManualDownload()// ── Tab state & Independent Scroll Memory per section ──────────────────────const [activeTab, setActiveTab] = useState<SettingsTab>('behaviour')@@ -130,6 +103,46 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool}}, [activeTab])+ // ── Off-screen Update Banner Visibility Tracking ─────────────────────────────+ const updateBannerRef = useRef<HTMLDivElement | null>(null)+ const [isUpdateBannerVisible, setIsUpdateBannerVisible] = useState(true)++ const hasUpdatePrompt = !isStoreBuild && !!(updateDownloaded || ((settings.autoUpdates ?? true) && updateInfo?.hasUpdate) || checkState.status === 'available')+ const showScrollUpdateBadge = hasUpdatePrompt && activeTab === 'behaviour' && !isUpdateBannerVisible++ useEffect(() => {+ if (isStoreBuild || activeTab !== 'behaviour' || !hasUpdatePrompt) {+ setIsUpdateBannerVisible(true)+ return+ }++ const container = scrollListRef.current+ if (!container) return++ const checkVisibility = () => {+ const el = updateBannerRef.current+ if (!el) {+ setIsUpdateBannerVisible(true)+ return+ }+ const elRect = el.getBoundingClientRect()+ const containerRect = container.getBoundingClientRect()+ // Element is visible if its top and bottom are inside container's view+ const visible = elRect.top >= containerRect.top - 10 && elRect.bottom <= containerRect.bottom + 20+ setIsUpdateBannerVisible(visible)+ }++ checkVisibility()+ // Small delay to allow DOM render on tab switch+ const timer = setTimeout(checkVisibility, 60)++ container.addEventListener('scroll', checkVisibility, { passive: true })+ return () => {+ clearTimeout(timer)+ container.removeEventListener('scroll', checkVisibility)+ }+ }, [isStoreBuild, activeTab, hasUpdatePrompt, updateDownloaded, updateInfo, checkState.status])+// ── Persistent footer shared across all tabs ───────────────────────────const PersistentFooter = (<>@@ -226,7 +239,7 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: boolanimate={{ opacity: 1, x: 0 }}exit={{ opacity: 0, x: 12 }}transition={{ type: 'spring', stiffness: 400, damping: 36, mass: 0.6 }}- style={{ width: '100%', height: '100%', display: 'flex', flexDirection: 'column', overflow: 'hidden' }}+ style={{ width: '100%', height: '100%', display: 'flex', flexDirection: 'column', overflow: 'hidden', position: 'relative' }}>{/* ── Stationary Fixed Header (Tab Selector) ────────────────── */}<div className="settings-fixed-header">@@ -386,224 +399,223 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool</div>{/* ── UPDATE CONTROL / MANUAL CHECK BANNER ── */}- {updateDownloaded ? (- <div style={{- marginTop: 12,- background: 'rgba(76, 175, 80, 0.08)',- border: '1px solid rgba(76, 175, 80, 0.3)',- borderRadius: 12,- padding: '14px 16px',- display: 'flex',- flexDirection: 'column',- gap: 10,- boxShadow: '0 4px 16px rgba(0, 0, 0, 0.2)'- }}>- <div>- <div style={{ fontSize: 13.5, fontWeight: 600, color: '#ffffff', letterSpacing: '-0.01em' }}>- Update v{updateDownloaded.version} Ready- </div>- <div style={{ fontSize: 12, color: 'rgba(255, 255, 255, 0.7)', marginTop: 3, lineHeight: 1.45 }}>- Click to restart Edge-Drop and apply the update.+ <div ref={updateBannerRef}>+ {updateDownloaded ? (+ <div style={{+ marginTop: 12,+ background: 'rgba(76, 175, 80, 0.08)',+ border: '1px solid rgba(76, 175, 80, 0.3)',+ borderRadius: 12,+ padding: '14px 16px',+ display: 'flex',+ flexDirection: 'column',+ gap: 10,+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.2)'+ }}>+ <div>+ <div style={{ fontSize: 13.5, fontWeight: 600, color: '#ffffff', letterSpacing: '-0.01em' }}>+ Update v{updateDownloaded.version} Ready+ </div>+ <div style={{ fontSize: 12, color: 'rgba(255, 255, 255, 0.7)', marginTop: 3, lineHeight: 1.45 }}>+ Click to restart Edge-Drop and apply the update.+ </div></div>- </div>- <button- onClick={() => window.edge.installUpdate()}- style={{- width: '100%',- background: '#ffffff',- color: '#000000',- border: 'none',- borderRadius: 9,- padding: '8px 16px',- fontSize: 12.5,- fontWeight: 600,- cursor: 'pointer',- textAlign: 'center',- boxShadow: '0 2px 8px rgba(255, 255, 255, 0.15)',- transition: 'opacity 0.15s ease'- }}- onMouseEnter={(e) => { e.currentTarget.style.opacity = '0.92' }}- onMouseLeave={(e) => { e.currentTarget.style.opacity = '1' }}- >- Restart to Update- </button>- </div>- ) : !autoUpdates ? (- <div style={{- marginTop: 12,- background: 'rgba(255, 255, 255, 0.035)',- border: '1px solid rgba(255, 255, 255, 0.08)',- borderRadius: 12,- padding: '14px 16px',- display: 'flex',- flexDirection: 'column',- gap: 12,- boxShadow: '0 4px 16px rgba(0, 0, 0, 0.18)'- }}>- {checkState.status === 'idle' && (<button- onClick={handleManualCheck}+ onClick={() => window.edge.installUpdate()}style={{width: '100%',- background: 'rgba(255, 255, 255, 0.07)',- color: '#ffffff',- border: '1px solid rgba(255, 255, 255, 0.14)',- borderRadius: 10,- padding: '9px 16px',+ background: '#ffffff',+ color: '#000000',+ border: 'none',+ borderRadius: 9,+ padding: '8px 16px',fontSize: 12.5,- fontWeight: 500,+ fontWeight: 600,cursor: 'pointer',textAlign: 'center',- transition: 'all 0.2s ease'- }}- onMouseEnter={(e) => {- e.currentTarget.style.background = 'rgba(255, 255, 255, 0.12)'- e.currentTarget.style.borderColor = 'rgba(255, 255, 255, 0.25)'- }}- onMouseLeave={(e) => {- e.currentTarget.style.background = 'rgba(255, 255, 255, 0.07)'- e.currentTarget.style.borderColor = 'rgba(255, 255, 255, 0.14)'+ boxShadow: '0 2px 8px rgba(255, 255, 255, 0.15)',+ transition: 'opacity 0.15s ease'}}+ onMouseEnter={(e) => { e.currentTarget.style.opacity = '0.92' }}+ onMouseLeave={(e) => { e.currentTarget.style.opacity = '1' }}>- Check for updates+ Restart to Update</button>- )}-- {checkState.status === 'checking' && (- <div style={{ fontSize: 12.5, color: 'rgba(255, 255, 255, 0.85)', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 10, padding: '6px 0' }}>- <motion.span- animate={{ rotate: 360 }}- transition={{ repeat: Infinity, duration: 0.8, ease: 'linear' }}- style={{- display: 'inline-block',- width: 13,- height: 13,- border: '2px solid rgba(255, 255, 255, 0.25)',- borderTopColor: '#ffffff',- borderRadius: '50%'- }}- />- Checking GitHub for updates...- </div>- )}-- {checkState.status === 'up-to-date' && (- <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12 }}>- <div style={{ fontSize: 12.5, color: '#4caf50', fontWeight: 500 }}>- ✓ Edge-Drop is up to date (v{currentVersion || '0.2.1'})- </div>+ </div>+ ) : !autoUpdates ? (+ <div style={{+ marginTop: 12,+ background: 'rgba(255, 255, 255, 0.035)',+ border: '1px solid rgba(255, 255, 255, 0.08)',+ borderRadius: 12,+ padding: '14px 16px',+ display: 'flex',+ flexDirection: 'column',+ gap: 12,+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.18)'+ }}>+ {checkState.status === 'idle' && (<buttononClick={handleManualCheck}style={{- background: 'transparent',- color: 'rgba(255, 255, 255, 0.65)',- border: 'none',- fontSize: 11.5,+ width: '100%',+ background: 'rgba(255, 255, 255, 0.07)',+ color: '#ffffff',+ border: '1px solid rgba(255, 255, 255, 0.14)',+ borderRadius: 10,+ padding: '9px 16px',+ fontSize: 12.5,+ fontWeight: 500,cursor: 'pointer',- textDecoration: 'underline'+ textAlign: 'center',+ transition: 'all 0.2s ease'+ }}+ onMouseEnter={(e) => {+ e.currentTarget.style.background = 'rgba(255, 255, 255, 0.12)'+ e.currentTarget.style.borderColor = 'rgba(255, 255, 255, 0.25)'+ }}+ onMouseLeave={(e) => {+ e.currentTarget.style.background = 'rgba(255, 255, 255, 0.07)'+ e.currentTarget.style.borderColor = 'rgba(255, 255, 255, 0.14)'}}>- Check again+ Check for updates</button>- </div>- )}+ )}- {checkState.status === 'available' && (- <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>- <div>- <div style={{ fontSize: 13.5, fontWeight: 600, color: '#ffffff', letterSpacing: '-0.01em' }}>- Edge-Drop v{checkState.version} is available!- </div>- <div style={{ fontSize: 12, color: 'rgba(255, 255, 255, 0.65)', marginTop: 3, lineHeight: 1.45 }}>- A newer version is ready on GitHub. Would you like to download and update now?- </div>+ {checkState.status === 'checking' && (+ <div style={{ fontSize: 12.5, color: 'rgba(255, 255, 255, 0.85)', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 10, padding: '6px 0' }}>+ <motion.span+ animate={{ rotate: 360 }}+ transition={{ repeat: Infinity, duration: 0.8, ease: 'linear' }}+ style={{+ display: 'inline-block',+ width: 13,+ height: 13,+ border: '2px solid rgba(255, 255, 255, 0.25)',+ borderTopColor: '#ffffff',+ borderRadius: '50%'+ }}+ />+ Checking GitHub for updates...</div>- <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginTop: 4 }}>+ )}++ {checkState.status === 'up-to-date' && (+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12 }}>+ <div style={{ fontSize: 12.5, color: '#4caf50', fontWeight: 500 }}>+ ✓ Edge-Drop is up to date (v{currentVersion || '0.2.1'})+ </div><button- onClick={handleStartDownload}+ onClick={handleManualCheck}style={{- background: '#ffffff',- color: '#000000',+ background: 'transparent',+ color: 'rgba(255, 255, 255, 0.65)',border: 'none',- borderRadius: 9,- padding: '7px 16px',- fontSize: 12,- fontWeight: 600,+ fontSize: 11.5,cursor: 'pointer',- boxShadow: '0 2px 8px rgba(255, 255, 255, 0.15)',- transition: 'transform 0.15s ease, opacity 0.15s ease'+ textDecoration: 'underline'}}- onMouseEnter={(e) => { e.currentTarget.style.opacity = '0.92' }}- onMouseLeave={(e) => { e.currentTarget.style.opacity = '1' }}>- Download & Update+ Check again</button>- <button- onClick={() => {- useStore.getState().dismissUpdate()- setCheckState({ status: 'idle' })+ </div>+ )}++ {checkState.status === 'available' && (+ <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>+ <div>+ <div style={{ fontSize: 13.5, fontWeight: 600, color: '#ffffff', letterSpacing: '-0.01em' }}>+ Edge-Drop v{checkState.version} is available!+ </div>+ <div style={{ fontSize: 12, color: 'rgba(255, 255, 255, 0.65)', marginTop: 3, lineHeight: 1.45 }}>+ A newer version is ready on GitHub. Would you like to download and update now?+ </div>+ </div>+ <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginTop: 4 }}>+ <button+ onClick={handleStartDownload}+ style={{+ background: '#ffffff',+ color: '#000000',+ border: 'none',+ borderRadius: 9,+ padding: '7px 16px',+ fontSize: 12,+ fontWeight: 600,+ cursor: 'pointer',+ boxShadow: '0 2px 8px rgba(255, 255, 255, 0.15)',+ transition: 'transform 0.15s ease, opacity 0.15s ease'+ }}+ onMouseEnter={(e) => { e.currentTarget.style.opacity = '0.92' }}+ onMouseLeave={(e) => { e.currentTarget.style.opacity = '1' }}+ >+ Download & Update+ </button>+ <button+ onClick={() => useStore.getState().dismissUpdate()}+ style={{+ background: 'rgba(255, 255, 255, 0.08)',+ color: 'rgba(255, 255, 255, 0.8)',+ border: '1px solid rgba(255, 255, 255, 0.14)',+ borderRadius: 9,+ padding: '7px 14px',+ fontSize: 12,+ fontWeight: 500,+ cursor: 'pointer',+ transition: 'background 0.2s ease'+ }}+ onMouseEnter={(e) => { e.currentTarget.style.background = 'rgba(255, 255, 255, 0.14)' }}+ onMouseLeave={(e) => { e.currentTarget.style.background = 'rgba(255, 255, 255, 0.08)' }}+ >+ Skip+ </button>+ </div>+ </div>+ )}++ {checkState.status === 'downloading' && (+ <div style={{ fontSize: 12.5, color: 'rgba(255, 255, 255, 0.9)', display: 'flex', alignItems: 'center', gap: 10, padding: '6px 0' }}>+ <motion.span+ animate={{ rotate: 360 }}+ transition={{ repeat: Infinity, duration: 0.8, ease: 'linear' }}+ style={{+ display: 'inline-block',+ width: 13,+ height: 13,+ border: '2px solid rgba(255, 255, 255, 0.25)',+ borderTopColor: '#ffffff',+ borderRadius: '50%'}}+ />+ Downloading update package in background...+ </div>+ )}++ {checkState.status === 'error' && (+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12 }}>+ <div style={{ fontSize: 12, color: '#f44336' }}>+ ⚠️ {checkState.error || 'Update check failed'}+ </div>+ <button+ onClick={handleManualCheck}style={{- background: 'rgba(255, 255, 255, 0.08)',- color: 'rgba(255, 255, 255, 0.8)',- border: '1px solid rgba(255, 255, 255, 0.14)',- borderRadius: 9,- padding: '7px 14px',- fontSize: 12,- fontWeight: 500,- cursor: 'pointer',- transition: 'background 0.2s ease'+ background: 'rgba(255, 255, 255, 0.12)',+ color: '#ffffff',+ border: '1px solid rgba(255, 255, 255, 0.2)',+ borderRadius: 7,+ padding: '4px 10px',+ fontSize: 11.5,+ cursor: 'pointer'}}- onMouseEnter={(e) => { e.currentTarget.style.background = 'rgba(255, 255, 255, 0.14)' }}- onMouseLeave={(e) => { e.currentTarget.style.background = 'rgba(255, 255, 255, 0.08)' }}>- Skip+ Try again</button></div>- </div>- )}-- {checkState.status === 'downloading' && (- <div style={{ fontSize: 12.5, color: 'rgba(255, 255, 255, 0.9)', display: 'flex', alignItems: 'center', gap: 10, padding: '6px 0' }}>- <motion.span- animate={{ rotate: 360 }}- transition={{ repeat: Infinity, duration: 0.8, ease: 'linear' }}- style={{- display: 'inline-block',- width: 13,- height: 13,- border: '2px solid rgba(255, 255, 255, 0.25)',- borderTopColor: '#ffffff',- borderRadius: '50%'- }}- />- Downloading update package in background...- </div>- )}-- {checkState.status === 'error' && (- <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12 }}>- <div style={{ fontSize: 12, color: '#f44336' }}>- ⚠️ {checkState.error || 'Update check failed'}- </div>- <button- onClick={handleManualCheck}- style={{- background: 'rgba(255, 255, 255, 0.12)',- color: '#ffffff',- border: '1px solid rgba(255, 255, 255, 0.2)',- borderRadius: 7,- padding: '4px 10px',- fontSize: 11.5,- cursor: 'pointer'- }}- >- Try again- </button>- </div>- )}- </div>- ) : null}+ )}+ </div>+ ) : null}+ </div></>)}@@ -1180,6 +1192,52 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool</AnimatePresence></div>++ {/* ── Floating Scroll Indicator Badge for Off-Screen Update Banner ── */}+ <AnimatePresence>+ {showScrollUpdateBadge && (+ <motion.div+ key="scroll-update-badge"+ initial={{ opacity: 0, y: 12, scale: 0.9 }}+ animate={{ opacity: 1, y: 0, scale: 1 }}+ exit={{ opacity: 0, y: 12, scale: 0.9 }}+ transition={{ type: 'spring', stiffness: 450, damping: 30 }}+ onClick={() => {+ playButtonClickSound()+ updateBannerRef.current?.scrollIntoView({ behavior: 'smooth', block: 'nearest' })+ }}+ style={{+ position: 'absolute',+ bottom: 14,+ left: 12,+ right: 12,+ margin: '0 auto',+ width: 'fit-content',+ maxWidth: 'calc(100% - 24px)',+ background: 'rgba(76, 175, 80, 0.95)',+ color: '#ffffff',+ backdropFilter: 'blur(12px)',+ border: '1px solid rgba(255, 255, 255, 0.25)',+ borderRadius: 20,+ padding: '6px 14px',+ fontSize: 11.5,+ fontWeight: 600,+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ gap: 6,+ cursor: 'pointer',+ boxShadow: '0 6px 20px rgba(0, 0, 0, 0.45)',+ zIndex: 30,+ whiteSpace: 'nowrap'+ }}+ >+ <span style={{ display: 'inline-block', width: 6, height: 6, borderRadius: '50%', background: '#ffffff' }} />+ <span>{updateDownloaded ? 'Restart to update below' : 'New update available below'}</span>+ <span style={{ fontSize: 11, marginLeft: 2 }}>↓</span>+ </motion.div>+ )}+ </AnimatePresence></motion.div>)}</AnimatePresence>diff --git a/src/store/appStore.ts b/src/store/appStore.tsindex 903bfd1..f51974a 100644--- a/src/store/appStore.ts+++ b/src/store/appStore.ts@@ -60,6 +60,14 @@ interface AppState {/* hydration + sync */hydrate: () => Promise<void>+ manualCheckState: {+ status: 'idle' | 'checking' | 'up-to-date' | 'available' | 'downloading' | 'error'+ version?: string+ error?: string+ }+ startManualCheck: () => Promise<void>+ startManualDownload: () => Promise<void>+ resetManualCheck: () => voidsetUpdateAvailable: (info: { version: string }) => voidsetUpdateDownloaded: (info: { version: string }) => voiddismissUpdate: () => void@@ -153,6 +161,44 @@ export const useStore = create<AppState>((set, get) => ({})},+ manualCheckState: { status: 'idle' },++ startManualCheck: async () => {+ set({ manualCheckState: { status: 'checking' } })+ try {+ const res = await edge.checkForUpdatesManual()+ if (res.status === 'available') {+ set({+ manualCheckState: { status: 'available', version: res.version },+ updateInfo: { hasUpdate: true, latestVersion: res.version || '', downloaded: false }+ })+ } else if (res.status === 'up-to-date') {+ set({+ manualCheckState: { status: 'up-to-date', version: res.version }+ })+ } else {+ set({+ manualCheckState: { status: 'error', error: res.error || 'Check failed' }+ })+ }+ } catch (err: any) {+ set({+ manualCheckState: { status: 'error', error: err?.message || 'Check failed' }+ })+ }+ },++ startManualDownload: async () => {+ set({ manualCheckState: { status: 'downloading' } })+ try {+ await edge.startUpdateDownload()+ } catch {+ set({ manualCheckState: { status: 'error', error: 'Download failed' } })+ }+ },++ resetManualCheck: () => set({ manualCheckState: { status: 'idle' } }),+setUpdateAvailable: (info) => {set({updateInfo: {@@ -169,11 +215,12 @@ export const useStore = create<AppState>((set, get) => ({hasUpdate: true,latestVersion: info.version,downloaded: true- }+ },+ manualCheckState: { status: 'idle' }})},- dismissUpdate: () => set({ updateInfo: null }),+ dismissUpdate: () => set({ updateInfo: null, manualCheckState: { status: 'idle' } }),async installUpdate() {await edge.installUpdate()