Skip to content

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.

feat(settings): redesign update flow, add changelog info action, and polish settings UX

Deepender25d76a612b19ca
diff --git a/electron/main/ipc.ts b/electron/main/ipc.ts
index 1c9197c..ac76409 100644
--- a/electron/main/ipc.ts
+++ b/electron/main/ipc.ts
@@ -19,7 +19,7 @@ import { rebuildTrayMenu } from './tray'
import { startDragOut, resolveDragData, prestageDrag, stageDragFile } from './drag'
import { clipboardSignature, formatTabularDataForClipboard, signatureMatchesItem } from '../clipboard/formats'
import type { ClipboardItem, ItemData, MergeResult } from '../../shared/types'
-import { quitAndInstallUpdate, checkForUpdatesManual, startUpdateDownload, syncAutoUpdaterState } from './updater'
+import { quitAndInstallUpdate, checkForUpdatesManual, startUpdateDownload, syncAutoUpdaterState, getCachedUpdateState, triggerBackgroundCheck } from './updater'
import { createId } from '../store/ids'
import { isStoreBuild } from './config'
import { applyLaunchAtLogin, refreshLaunchAtLoginFromOs } from './loginItems'
@@ -193,7 +193,8 @@ export function registerIpc(): void {
items: getStore().toDto(),
settings: loadSettings(),
version: app.getVersion(),
- isStoreBuild: isStoreBuild()
+ isStoreBuild: isStoreBuild(),
+ updateInfo: getCachedUpdateState()
}
})
@@ -213,6 +214,11 @@ export function registerIpc(): void {
await startUpdateDownload()
})
+ handle('updater:get-state', async () => {
+ if (isStoreBuild()) return null
+ return getCachedUpdateState()
+ })
+
handle('app:quit', () => {
console.log('[IPC] app:quit requested by renderer — quitting application')
app.quit()
@@ -699,6 +705,13 @@ export function registerIpc(): void {
if (patch.autoUpdates !== undefined || patch.updateMode !== undefined) {
syncAutoUpdaterState()
}
+ // Switching into a checking mode checks now — previously nothing happened
+ // until the next restart. Switching to 'off' cancels any pending check.
+ if (patch.updateMode !== undefined) {
+ try {
+ triggerBackgroundCheck()
+ } catch { /* ignore */ }
+ }
if (patch.toggleHotkey !== undefined) {
registerGlobalHotkey(patch.toggleHotkey)
}
diff --git a/electron/main/updater.ts b/electron/main/updater.ts
index 5b480b3..d7bb57c 100644
--- a/electron/main/updater.ts
+++ b/electron/main/updater.ts
@@ -4,9 +4,25 @@ import { pushState } from './state'
import { getSettings } from '../store/settings'
import { resolveUpdateMode } from '../../shared/types'
-// Module-level reference to the single autoUpdater instance.
+export interface CachedUpdateInfo {
+ hasUpdate: boolean
+ latestVersion: string
+ downloaded: boolean
+ downloadProgress?: { percent: number; bytesPerSecond?: number; transferred?: number; total?: number }
+}
+
+// Module-level reference to the single autoUpdater instance and cached update state.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let _autoUpdater: any = null
+let _cachedUpdateInfo: CachedUpdateInfo | null = null
+
+export function getCachedUpdateState(): CachedUpdateInfo | null {
+ return _cachedUpdateInfo
+}
+
+export function clearCachedUpdateState(): void {
+ _cachedUpdateInfo = null
+}
/**
* Called from ipc.ts when the renderer clicks "Restart to Update".
@@ -38,6 +54,46 @@ export function syncAutoUpdaterState(): void {
console.log('[AutoUpdater] Synced mode =', mode, 'autoDownload =', autoDownload)
}
+let bgCheckTimer: ReturnType<typeof setTimeout> | null = null
+
+/**
+ * Run a background check outside startup — e.g. right after the user switches
+ * into 'auto' or 'notify' mode. Previously switching modes only flipped flags
+ * and nothing happened until the next restart, which read as "notify never
+ * shows anything". Debounced; switching to 'off' cancels a pending check so
+ * off stays fully network-silent.
+ */
+export function triggerBackgroundCheck(delayMs = 3000): void {
+ if (isStoreBuild()) return
+ if (bgCheckTimer !== null) {
+ clearTimeout(bgCheckTimer)
+ bgCheckTimer = null
+ }
+ let mode: ReturnType<typeof resolveUpdateMode>
+ try {
+ mode = resolveUpdateMode(getSettings())
+ } catch {
+ return
+ }
+ if (mode === 'off' || !_autoUpdater) return
+ console.log('[AutoUpdater] Background check scheduled (mode switch).')
+ bgCheckTimer = setTimeout(() => {
+ bgCheckTimer = null
+ try {
+ const r = _autoUpdater.checkForUpdates() as unknown
+ const p = r as Promise<unknown> | undefined
+ if (p && typeof p.catch === 'function') {
+ p.catch((err: unknown) => {
+ const msg = typeof err === 'string' ? err : (err as { message?: string })?.message
+ console.warn('[AutoUpdater] triggered check failed:', msg)
+ })
+ }
+ } catch (err) {
+ console.warn('[AutoUpdater] triggered check threw:', err)
+ }
+ }, Math.max(0, delayMs))
+}
+
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)
@@ -130,6 +186,7 @@ export async function checkForUpdatesManual(): Promise<{ status: string; version
const currentVersion = app.getVersion()
if (semverCompare(latestVersion, currentVersion) > 0) {
console.log(`[AutoUpdater] Fast check found new version: v${latestVersion} (current: v${currentVersion})`)
+ _cachedUpdateInfo = { hasUpdate: true, latestVersion, downloaded: false }
pushState.updateAvailable({ version: latestVersion })
return { status: 'available', version: latestVersion }
} else {
@@ -147,6 +204,7 @@ export async function checkForUpdatesManual(): Promise<{ status: string; version
)
const result = await Promise.race([checkPromise, timeoutPromise])
if (result && result.updateInfo && semverCompare(result.updateInfo.version, app.getVersion()) > 0) {
+ _cachedUpdateInfo = { hasUpdate: true, latestVersion: result.updateInfo.version, downloaded: false }
return { status: 'available', version: result.updateInfo.version }
}
return { status: 'up-to-date', version: app.getVersion() }
@@ -162,11 +220,32 @@ export async function checkForUpdatesManual(): Promise<{ status: string; version
* Trigger download of the update when user clicks "Download & Update" in manual mode.
*/
export async function startUpdateDownload(): Promise<void> {
- if (isStoreBuild() || !_autoUpdater) return
+ if (isStoreBuild()) return
+ if (!_autoUpdater) {
+ try {
+ const { autoUpdater } = require('electron-updater')
+ _autoUpdater = autoUpdater
+ // Match manual-check semantics: never auto-download as a side effect.
+ // An explicit downloadUpdate() call below is unaffected by these flags.
+ _autoUpdater.autoDownload = false
+ _autoUpdater.autoInstallOnAppQuit = false
+ if (!app.isPackaged) {
+ _autoUpdater.forceDevUpdateConfig = true
+ }
+ } catch {
+ return
+ }
+ }
try {
await _autoUpdater.downloadUpdate()
} catch (err) {
- console.error('[AutoUpdater] downloadUpdate failed:', err)
+ console.warn('[AutoUpdater] downloadUpdate failed, retrying with checkForUpdates first:', err)
+ try {
+ await _autoUpdater.checkForUpdates()
+ await _autoUpdater.downloadUpdate()
+ } catch (retryErr) {
+ console.error('[AutoUpdater] downloadUpdate retry failed:', retryErr)
+ }
}
}
@@ -206,6 +285,7 @@ export function initAutoUpdater(): void {
autoUpdater.on('update-available', (info: { version: string }) => {
console.log('[AutoUpdater] New update available on GitHub:', info.version)
+ _cachedUpdateInfo = { hasUpdate: true, latestVersion: info.version, downloaded: false }
pushState.updateAvailable({ version: info.version })
})
@@ -216,6 +296,14 @@ export function initAutoUpdater(): void {
autoUpdater.on('download-progress', (progressObj: { percent: number; bytesPerSecond?: number; transferred?: number; total?: number }) => {
const percent = Math.min(100, Math.max(0, Math.round(progressObj.percent || 0)))
console.log(`[AutoUpdater] Download progress: ${percent}%`)
+ if (_cachedUpdateInfo) {
+ _cachedUpdateInfo.downloadProgress = {
+ percent,
+ bytesPerSecond: progressObj.bytesPerSecond,
+ transferred: progressObj.transferred,
+ total: progressObj.total
+ }
+ }
pushState.updateProgress({
percent,
bytesPerSecond: progressObj.bytesPerSecond,
@@ -226,6 +314,7 @@ export function initAutoUpdater(): void {
autoUpdater.on('update-downloaded', (info: { version: string }) => {
console.log('[AutoUpdater] Update downloaded and ready to install:', info.version)
+ _cachedUpdateInfo = { hasUpdate: true, latestVersion: info.version, downloaded: true }
pushState.updateDownloaded({ version: info.version })
})
diff --git a/electron/preload/index.ts b/electron/preload/index.ts
index f5f5eb0..3d987b6 100644
--- a/electron/preload/index.ts
+++ b/electron/preload/index.ts
@@ -191,6 +191,7 @@ const api = {
installUpdate: () => invoke('app:install-update'),
checkForUpdatesManual: () => invoke('updater:check-manual'),
startUpdateDownload: () => invoke('updater:start-download'),
+ getUpdateState: () => invoke('updater:get-state'),
quitApp: () => invoke('app:quit'),
startDrag: (req: DragRequest) => {
setInternalDragState(true)
diff --git a/electron/store/settings.ts b/electron/store/settings.ts
index 53b949b..d72db4a 100644
--- a/electron/store/settings.ts
+++ b/electron/store/settings.ts
@@ -38,9 +38,10 @@ function merge(base: Settings, patch: Partial<Settings>): Settings {
out.updateMode = out.autoUpdates === false ? 'off' : 'auto'
}
out.autoUpdates = out.updateMode === 'auto'
- if (typeof out.skippedUpdateVersion !== 'string' || !out.skippedUpdateVersion.trim()) {
- out.skippedUpdateVersion = undefined
- }
+ // Skip is session-only by contract ("remind me next restart"), so a
+ // persisted skip from older builds is self-healed away on load. This also
+ // un-sticks anyone whose prompt went permanently silent.
+ out.skippedUpdateVersion = undefined
return out
}
diff --git a/shared/bridge.ts b/shared/bridge.ts
index 7edb358..8ad5a4e 100644
--- a/shared/bridge.ts
+++ b/shared/bridge.ts
@@ -10,7 +10,18 @@ import type { DragRequest } from './types'
export interface EdgeApi {
/* Renderer -> Main */
- loadState: () => Promise<{ items: import('./types').ClipboardItemDto[]; settings: Settings; version: string; isStoreBuild?: boolean }>
+ loadState: () => Promise<{
+ items: import('./types').ClipboardItemDto[]
+ settings: Settings
+ version: string
+ isStoreBuild?: boolean
+ updateInfo?: {
+ hasUpdate: boolean
+ latestVersion: string
+ downloaded: boolean
+ downloadProgress?: { percent: number; bytesPerSecond?: number; transferred?: number; total?: number }
+ } | null
+ }>
setPinned: (id: string, pinned: boolean) => Promise<import('./types').ClipboardItemDto[]>
deleteItem: (id: string) => Promise<import('./types').ClipboardItemDto[]>
deleteBatchItems: (ids: string[]) => Promise<import('./types').ClipboardItemDto[]>
@@ -25,6 +36,12 @@ export interface EdgeApi {
installUpdate: () => Promise<void>
checkForUpdatesManual: () => Promise<{ status: string; version?: string; error?: string }>
startUpdateDownload: () => Promise<void>
+ getUpdateState: () => Promise<{
+ hasUpdate: boolean
+ latestVersion: string
+ downloaded: boolean
+ downloadProgress?: { percent: number; bytesPerSecond?: number; transferred?: number; total?: number }
+ } | null>
quitApp: () => Promise<void>
/**
* Begin a native OS drag-out. Fire-and-forget: must be called synchronously
diff --git a/shared/ipc.ts b/shared/ipc.ts
index bb2f893..77ec572 100644
--- a/shared/ipc.ts
+++ b/shared/ipc.ts
@@ -95,6 +95,13 @@ export interface InvokeMap {
/** Start background download of an update in manual mode. */
'updater:start-download': { args: []; result: void }
+ /**
+ * Current update state snapshot (background findings so far). Lets a
+ * freshly subscribed renderer recover pushes it missed (slow load after
+ * the startup check already fired). Null when nothing is known.
+ */
+ 'updater:get-state': { args: []; result: { hasUpdate: boolean; latestVersion: string; downloaded: boolean; downloadProgress?: { percent: number; bytesPerSecond?: number; transferred?: number; total?: number } } | null }
+
/** Quit the application process. */
'app:quit': { args: []; result: void }
diff --git a/src/App.tsx b/src/App.tsx
index e0ee4a4..470c086 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -239,6 +239,19 @@ export default function App() {
if (useStore.getState().isInternalCopying) return
useStore.getState().triggerCopyFlare()
})
+ // Recover any update findings that landed before we subscribed (slow
+ // first load can miss the startup check's fire-and-forget push).
+ // Skip-filtering applies automatically inside setUpdateAvailable.
+ void edge.getUpdateState().then((s) => {
+ if (!s) return
+ const st = useStore.getState()
+ if (s.downloaded) {
+ st.setUpdateDownloaded({ version: s.latestVersion })
+ } else if (s.hasUpdate) {
+ st.setUpdateAvailable({ version: s.latestVersion })
+ if (s.downloadProgress) st.setUpdateProgress(s.downloadProgress)
+ }
+ }).catch(() => {})
return () => {
offItems()
offSettings()
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index 737646e..8b97ef1 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -23,6 +23,7 @@ export interface HeaderProps {
}
export function Header({ isHorizontal = false, itemCount, clearProps }: HeaderProps = {}) {
+ const isStoreBuild = useStore((s) => s.isStoreBuild)
const { t } = useTranslation()
const setSettingsOpen = useStore((s) => s.setSettingsOpen)
const settingsOpen = useStore((s) => s.settingsOpen)
@@ -381,17 +382,18 @@ export function Header({ isHorizontal = false, itemCount, clearProps }: HeaderPr
>
<CloseIcon />
</span>
- {!settingsOpen && (updateInfo?.downloaded || updateInfo?.hasUpdate) && (
+ {!settingsOpen && !isStoreBuild && (updateInfo?.downloaded || updateInfo?.hasUpdate) && (
<span
style={{
position: 'absolute',
- top: 5,
- right: 5,
- width: 8,
- height: 8,
+ top: 6,
+ right: 6,
+ width: 6,
+ height: 6,
borderRadius: '50%',
- backgroundColor: '#4caf50',
+ backgroundColor: '#30d158',
border: '1.5px solid #000000',
+ boxShadow: '0 0 8px rgba(48, 209, 88, 0.7)',
pointerEvents: 'none'
}}
/>
diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx
index a579766..e6bad9f 100644
--- a/src/components/Settings.tsx
+++ b/src/components/Settings.tsx
@@ -9,8 +9,10 @@ import {
CopyIndicatorIcon,
SparkleIndicatorIcon
} from './CopyIndicatorCurve'
-import { ChevronRightIcon, CloseIcon, LogOutIcon, StarIcon, GithubOctocatLogo, MicrosoftStoreLogo } from './icons'
+import { ChevronRightIcon, CloseIcon, LogOutIcon, StarIcon, InfoIcon, GithubOctocatLogo, MicrosoftStoreLogo } from './icons'
import { HotkeyRecorder } from './HotkeyRecorder'
+import { SlideCommit } from './SlideCommit'
+import { WakeSlider } from './WakeSlider'
import { playDialTickSound, playToggleSound, playButtonClickSound } from '../lib/soundEffects'
import { useTranslation } from '../i18n'
import '../styles/settings.css'
@@ -175,12 +177,10 @@ export function Settings({
const handleManualCheck = () => useStore.getState().startManualCheck()
const handleStartDownload = () => useStore.getState().startManualDownload()
- // Downloading while a real download runs (manual or auto). In 'auto' mode a
- // just-found update starts downloading immediately, so cover that gap too;
- // in 'notify' mode a found update waits for the user's Download click.
- const isDownloading = checkState.status === 'downloading' || (!updateDownloaded && !!updateInfo?.hasUpdate && (updateMode === 'auto' || !!updateInfo?.downloadProgress))
- // Background-found update waiting for a decision (notify mode prompt).
- const hasBackgroundUpdate = !updateDownloaded && !isDownloading && !!updateInfo?.hasUpdate
+ const isManualDownloading = checkState.status === 'downloading'
+ const isDownloading = isManualDownloading || (!updateDownloaded && !!updateInfo?.hasUpdate && (updateMode === 'auto' || !!updateInfo?.downloadProgress))
+ // Update waiting for a user decision (Notify mode prompt or available check).
+ const hasBackgroundUpdate = !updateDownloaded && !isDownloading && (!!updateInfo?.hasUpdate || checkState.status === 'available')
const downloadPercent = updateInfo?.downloadProgress?.percent ?? 0
// ── Tab state & Independent Scroll Memory per section ──────────────────────
@@ -223,77 +223,35 @@ export function Settings({
}
}, [activeTab])
- // ── Update banner ref & status tracking ────────────────────────────────────
- const updateBannerRef = useRef<HTMLDivElement | null>(null)
- // Active update states, mode-independent: banners and prompts show whenever
- // an update is known (auto download, notify prompt, or manual result).
- const hasUpdatePrompt = !isStoreBuild && !!(updateDownloaded || isDownloading || checkState.status === 'available' || hasBackgroundUpdate)
-
- // ── Floating Scroll Indicator Badge for Off-Screen Update Banner ────────────
- const [isUpdateCardVisible, setIsUpdateCardVisible] = useState(false)
- const hasActiveUpdate = !isStoreBuild && !!(updateDownloaded || isDownloading || checkState.status === 'available' || hasBackgroundUpdate)
- const showScrollUpdateBadge = hasActiveUpdate && !isUpdateCardVisible
-
+ // When update check finds a new update, smoothly scroll to top/front to highlight the update card
useEffect(() => {
- if (!hasActiveUpdate) {
- setIsUpdateCardVisible(false)
- return
- }
-
- if (activeTab !== 'behaviour') {
- setIsUpdateCardVisible(false)
- return
- }
-
- const scrollEl = scrollListRef.current
- const bannerEl = updateBannerRef.current
- if (!scrollEl || !bannerEl) {
- setIsUpdateCardVisible(false)
- return
- }
-
- const checkVisibility = () => {
- const scrollRect = scrollEl.getBoundingClientRect()
- const bannerRect = bannerEl.getBoundingClientRect()
- const isVisible = bannerRect.top < scrollRect.bottom && bannerRect.bottom > scrollRect.top
- setIsUpdateCardVisible(isVisible)
- }
-
- checkVisibility()
-
- const observer = new IntersectionObserver(
- (entries) => {
- const [entry] = entries
- setIsUpdateCardVisible(entry?.isIntersecting ?? false)
- },
- {
- root: scrollEl,
- threshold: 0.05
+ if (checkState.status === 'available') {
+ const behavior = settings.reduceMotion ? 'auto' : 'smooth'
+ if (isHorizontal) {
+ if (shelfTrackRef.current) {
+ shelfTrackRef.current.scrollTo({ left: 0, behavior })
+ }
+ horizontalTabScrollPositions.current.behaviour = 0
+ } else {
+ if (scrollListRef.current) {
+ scrollListRef.current.scrollTo({ top: 0, behavior })
+ }
+ tabScrollPositions.current.behaviour = 0
}
- )
-
- observer.observe(bannerEl)
- scrollEl.addEventListener('scroll', checkVisibility, { passive: true })
-
- return () => {
- observer.disconnect()
- scrollEl.removeEventListener('scroll', checkVisibility)
}
- }, [activeTab, hasActiveUpdate, hasUpdatePrompt, isDownloading, updateDownloaded, checkState.status])
-
- const scrollToUpdateCard = () => {
- playButtonClickSound()
- if (activeTab !== 'behaviour') {
- handleTabSwitch('behaviour')
- requestAnimationFrame(() => {
- setTimeout(() => {
- updateBannerRef.current?.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
- }, 60)
- })
- } else {
- updateBannerRef.current?.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
- }
- }
+ }, [checkState.status, isHorizontal, settings.reduceMotion])
+
+ // ── Promoted Active Update State ───────────────────────────────────────────
+ // The top card shows all active update lifecycle stages:
+ // 1) Downloaded update -> 'Restart to Update'
+ // 2) Downloading in progress -> Live progress bar
+ // 3) Update found & available -> 'Download & Update' / 'Skip'
+ const hasPromotedTopUpdate = !isStoreBuild && (
+ !!updateDownloaded ||
+ isDownloading ||
+ hasBackgroundUpdate
+ )
+ const updateBannerRef = useRef<HTMLDivElement | null>(null)
// ── Persistent footer shared across all tabs ───────────────────────────
const PersistentFooter = (
@@ -409,97 +367,316 @@ export function Settings({
</>
)
- // ── Manual update card renderer shared between vertical and horizontal views ──
- const renderManualUpdateCard = (withRef = false) => {
- // Callers gate visibility; the idle branch below IS the Check button, so
- // the card renders in every state on GitHub builds. Store builds never
- // call this (whole update section is hidden there).
+ const handleOpenChangelog = () => {
+ playButtonClickSound()
+ const targetVersion = checkState.version || updateInfo?.latestVersion || currentVersion
+ if (targetVersion) {
+ patch({ lastSeenChangelogVersion: targetVersion })
+ }
+ window.open('https://www.edgedrop.app/changelog', '_blank')
+ }
+
+ // ── Promoted Top Update Card Renderer (Vertical Layout) ────────────────────
+ const renderPromotedTopUpdateCard = () => {
if (isStoreBuild) return null
- return (
- <div className="manual-update-section" ref={withRef ? updateBannerRef : undefined} style={{ width: '100%' }}>
- <div className="manual-update-card">
- {updateDownloaded ? (
- <>
- <div className="manual-update-info">
- <div className="manual-update-title">
- <span className="manual-update-dot ready" />
- <span>{t('behaviour.updateReadyTitle', { version: updateDownloaded.version })}</span>
- </div>
- <div className="manual-update-desc">
- {t('behaviour.updateReadyDesc')}
- </div>
+ if (!hasPromotedTopUpdate) return null
+
+ if (updateDownloaded) {
+ return (
+ <div className="setting-card update-promoted-card">
+ <div className="shelf-card-top">
+ <div className="update-header-row">
+ <div className="update-group-label">
+ <span className="update-dot" />
+ <span>{t('behaviour.updateLabelReady') || 'UPDATE READY'}</span>
+ </div>
+ <button
+ type="button"
+ className="update-info-btn"
+ title={t('header.whatsNew') || "What's New"}
+ aria-label={t('header.whatsNew') || "What's New"}
+ onClick={handleOpenChangelog}
+ >
+ <InfoIcon width={13} height={13} />
+ </button>
+ </div>
+ <div className="setting-title">
+ {t('behaviour.updateReadyTitle', { version: updateDownloaded.version })}
+ </div>
+ <div className="setting-desc">
+ {t('behaviour.updateReadyDesc')}
+ </div>
+ </div>
+ <div className="shelf-card-bottom">
+ <SlideCommit
+ label={t('behaviour.restart') || 'Restart'}
+ doneLabel={t('behaviour.restarting') || 'Restarting...'}
+ height={32}
+ radius={10}
+ onConfirm={() => {
+ playButtonClickSound()
+ void window.edge.installUpdate()
+ }}
+ />
+ </div>
+ </div>
+ )
+ }
+
+ if (isDownloading) {
+ return (
+ <div className="setting-card update-promoted-card">
+ <div className="shelf-card-top">
+ <div className="update-header-row">
+ <div className="update-group-label">
+ <span className="update-dot checking" />
+ <span>{t('behaviour.updateLabelDownloading') || 'DOWNLOADING UPDATE'}</span>
+ </div>
+ <button
+ type="button"
+ className="update-info-btn"
+ title={t('header.whatsNew') || "What's New"}
+ aria-label={t('header.whatsNew') || "What's New"}
+ onClick={handleOpenChangelog}
+ >
+ <InfoIcon width={13} height={13} />
+ </button>
+ </div>
+ <div className="setting-title">
+ {updateInfo?.latestVersion
+ ? t('behaviour.updateAvailableTitle', { version: updateInfo.latestVersion })
+ : t('behaviour.downloadingUpdate')}
+ </div>
+ <div className="setting-desc">
+ {downloadPercent > 0 ? t('behaviour.downloadingWithPercent', { percent: downloadPercent }) : t('behaviour.downloadingUpdate')}
+ </div>
+ </div>
+ <div className="shelf-card-bottom">
+ <div className="shelf-update-progress-wrap">
+ <div className="shelf-progress-bar" style={{ width: `${downloadPercent}%` }} />
+ <span className="shelf-progress-text">{downloadPercent > 0 ? `${downloadPercent}%` : 'Connecting...'}</span>
+ </div>
+ </div>
+ </div>
+ )
+ }
+
+ if (checkState.status === 'available' || hasBackgroundUpdate) {
+ const versionStr = checkState.version || updateInfo?.latestVersion || ''
+ return (
+ <div className="setting-card update-promoted-card">
+ <div className="shelf-card-top">
+ <div className="update-header-row">
+ <div className="update-group-label">
+ <span className="update-dot" />
+ <span>{t('behaviour.updateLabelAvailable') || 'NEW UPDATE AVAILABLE'}</span>
</div>
<button
type="button"
- className="manual-update-pill primary"
+ className="update-info-btn"
+ title={t('header.whatsNew') || "What's New"}
+ aria-label={t('header.whatsNew') || "What's New"}
+ onClick={handleOpenChangelog}
+ >
+ <InfoIcon width={13} height={13} />
+ </button>
+ </div>
+ <div className="setting-title">
+ {t('behaviour.updateAvailableTitle', { version: versionStr })}
+ </div>
+ <div className="setting-desc">
+ {t('behaviour.updateAvailableDesc')}
+ </div>
+ </div>
+ <div className="shelf-card-bottom">
+ <div className="update-action-row">
+ <button
+ type="button"
+ className="update-action-btn primary"
+ style={{ flex: 1 }}
onClick={() => {
playButtonClickSound()
- void window.edge.installUpdate()
+ handleStartDownload()
}}
>
- {t('behaviour.restartToUpdate')}
+ {t('behaviour.update') || 'Update'}
</button>
- </>
- ) : isDownloading ? (
- <>
- <div className="manual-update-info">
- <div className="manual-update-title">
- <span className="manual-update-dot ready" />
- <span>
- {updateInfo?.latestVersion
- ? `Update v${updateInfo.latestVersion} Available`
- : t('behaviour.updateAvailableTitle', { version: '' })}
- </span>
- </div>
- <div className="manual-update-desc">
- {t('behaviour.downloadingUpdate')}
- </div>
+ <button
+ type="button"
+ className="update-action-btn secondary"
+ style={{ flex: '0 0 68px' }}
+ onClick={() => {
+ playButtonClickSound()
+ useStore.getState().dismissUpdate()
+ }}
+ >
+ {t('behaviour.skip')}
+ </button>
+ </div>
+ </div>
+ </div>
+ )
+ }
+
+ return null
+ }
+
+ // ── Promoted Front Update Card Renderer (Horizontal Shelf Layout) ──────────
+ const renderPromotedHorizontalUpdateCard = () => {
+ if (isStoreBuild) return null
+ if (!hasPromotedTopUpdate) return null
+
+ if (updateDownloaded) {
+ return (
+ <div className="settings-shelf-card update-promoted-card behaviour-col">
+ <div className="shelf-card-top">
+ <div className="update-header-row">
+ <div className="update-group-label">
+ <span className="update-dot" />
+ <span>{t('behaviour.updateLabelReady') || 'UPDATE READY'}</span>
</div>
<button
type="button"
- className="manual-update-pill primary"
- disabled
+ className="update-info-btn"
+ title={t('header.whatsNew') || "What's New"}
+ aria-label={t('header.whatsNew') || "What's New"}
+ onClick={handleOpenChangelog}
>
- {downloadPercent > 0
- ? `Downloading... (${downloadPercent}%)`
- : 'Downloading update...'}
+ <InfoIcon width={13} height={13} />
</button>
- </>
- ) : (checkState.status === 'available' || hasBackgroundUpdate) ? (
- <>
- <div className="manual-update-info">
- <div className="manual-update-title">
- <span className="manual-update-dot ready" />
- <span>{t('behaviour.updateAvailableTitle', { version: checkState.version || updateInfo?.latestVersion || '' })}</span>
- </div>
- <div className="manual-update-desc">
- {t('behaviour.updateAvailableDesc')}
- </div>
+ </div>
+ <div className="setting-title">
+ {t('behaviour.updateReadyTitle', { version: updateDownloaded.version })}
+ </div>
+ <div className="setting-desc">
+ {t('behaviour.updateReadyDesc')}
+ </div>
+ </div>
+ <div className="shelf-card-bottom">
+ <SlideCommit
+ label={t('behaviour.restart') || 'Restart'}
+ doneLabel={t('behaviour.restarting') || 'Restarting...'}
+ height={32}
+ radius={10}
+ onConfirm={() => {
+ playButtonClickSound()
+ void window.edge.installUpdate()
+ }}
+ />
+ </div>
+ </div>
+ )
+ }
+
+ if (isDownloading) {
+ return (
+ <div className="settings-shelf-card update-promoted-card behaviour-col">
+ <div className="shelf-card-top">
+ <div className="update-header-row">
+ <div className="update-group-label">
+ <span className="update-dot checking" />
+ <span>{t('behaviour.updateLabelDownloading') || 'DOWNLOADING UPDATE'}</span>
</div>
- <div className="manual-update-actions">
- <button
- type="button"
- className="manual-update-pill primary"
- onClick={() => {
- playButtonClickSound()
- handleStartDownload()
- }}
- >
- {t('behaviour.downloadAndUpdate')}
- </button>
- <button
- type="button"
- className="manual-update-pill outline"
- onClick={() => {
- playButtonClickSound()
- useStore.getState().dismissUpdate()
- }}
- >
- {t('behaviour.skip')}
- </button>
+ <button
+ type="button"
+ className="update-info-btn"
+ title={t('header.whatsNew') || "What's New"}
+ aria-label={t('header.whatsNew') || "What's New"}
+ onClick={handleOpenChangelog}
+ >
+ <InfoIcon width={13} height={13} />
+ </button>
+ </div>
+ <div className="setting-title">
+ {updateInfo?.latestVersion
+ ? t('behaviour.updateAvailableTitle', { version: updateInfo.latestVersion })
+ : t('behaviour.downloadingUpdate')}
+ </div>
+ <div className="setting-desc">
+ {downloadPercent > 0 ? t('behaviour.downloadingWithPercent', { percent: downloadPercent }) : t('behaviour.downloadingUpdate')}
+ </div>
+ </div>
+ <div className="shelf-card-bottom">
+ <div className="shelf-update-progress-wrap">
+ <div className="shelf-progress-bar" style={{ width: `${downloadPercent}%` }} />
+ <span className="shelf-progress-text">{downloadPercent > 0 ? `${downloadPercent}%` : 'Connecting...'}</span>
+ </div>
+ </div>
+ </div>
+ )
+ }
+
+ if (checkState.status === 'available' || hasBackgroundUpdate) {
+ const versionStr = checkState.version || updateInfo?.latestVersion || ''
+ return (
+ <div className="settings-shelf-card update-promoted-card behaviour-col">
+ <div className="shelf-card-top">
+ <div className="update-header-row">
+ <div className="update-group-label">
+ <span className="update-dot" />
+ <span>{t('behaviour.updateLabelAvailable') || 'NEW UPDATE AVAILABLE'}</span>
</div>
- </>
- ) : checkState.status === 'checking' ? (
+ <button
+ type="button"
+ className="update-info-btn"
+ title={t('header.whatsNew') || "What's New"}
+ aria-label={t('header.whatsNew') || "What's New"}
+ onClick={handleOpenChangelog}
+ >
+ <InfoIcon width={13} height={13} />
+ </button>
+ </div>
+ <div className="setting-title">
+ {t('behaviour.updateAvailableTitle', { version: versionStr })}
+ </div>
+ <div className="setting-desc">
+ {t('behaviour.updateAvailableDesc')}
+ </div>
+ </div>
+ <div className="shelf-card-bottom">
+ <div className="update-action-row">
+ <button
+ type="button"
+ className="update-action-btn primary"
+ style={{ flex: 1 }}
+ onClick={() => {
+ playButtonClickSound()
+ handleStartDownload()
+ }}
+ >
+ {t('behaviour.update') || 'Update'}
+ </button>
+ <button
+ type="button"
+ className="update-action-btn secondary"
+ style={{ flex: '0 0 68px' }}
+ onClick={() => {
+ playButtonClickSound()
+ useStore.getState().dismissUpdate()
+ }}
+ >
+ {t('behaviour.skip')}
+ </button>
+ </div>
+ </div>
+ </div>
+ )
+ }
+
+ return null
+ }
+
+ // ── Manual update card renderer (idle/check states at the bottom) ──
+ const renderManualUpdateCard = (withRef = false) => {
+ // Hidden while the promoted top card shows an actionable state — the
+ // top card already carries Download/Skip/Restart/progress, so rendering
+ // both would duplicate the prompt. The idle branch below IS the Check
+ // button, which is exactly what belongs at the bottom.
+ if (isStoreBuild || hasPromotedTopUpdate) return null
+ return (
+ <div className="manual-update-section" ref={withRef ? updateBannerRef : undefined} style={{ width: '100%' }}>
+ <div className="manual-update-card">
+ {checkState.status === 'checking' ? (
<>
<div className="manual-update-info">
<div className="manual-update-title">{t('behaviour.checkForUpdates')}</div>
@@ -510,7 +687,7 @@ export function Settings({
className="manual-update-pill outline"
disabled
>
- <span className="manual-update-dot checking" />
+ <span className="update-dot checking" />
<span>{t('behaviour.checkingForUpdates')}</span>
</button>
</>
@@ -518,7 +695,7 @@ export function Settings({
<>
<div className="manual-update-info">
<div className="manual-update-title">
- <span className="manual-update-dot ready" />
+ <span className="update-dot available" />
<span>{t('behaviour.isUpToDate')}</span>
</div>
<div className="manual-update-desc">
@@ -713,6 +890,8 @@ export function Settings({
{/* ── TAB 1: BEHAVIOUR ── */}
{horizontalTab === 'behaviour' && (
<>
+ {renderPromotedHorizontalUpdateCard()}
+
{/* ── SUB-GROUP 1 DIVIDER: General & Startup ── */}
<div className="shelf-section-divider">
<span className="shelf-section-divider-text">{t('tabs.generalStartup') || 'GENERAL & STARTUP'}</span>
@@ -1005,7 +1184,7 @@ export function Settings({
? (updateMode === 'auto'
? t('behaviour.autoUpdatesDescOn')
: updateMode === 'notify'
- ? (t('behaviour.updateModeNotifyDesc') || 'Check at launch and notify — never downloads automatically')
+ ? (t('behaviour.updateModeNotifyDesc') || 'Notify when updates are available without downloading')
: t('behaviour.autoUpdatesDescOff'))
: 'Managed by Microsoft Store'}
</div>
@@ -1033,92 +1212,53 @@ export function Settings({
)}
</div>
- {/* Card 12: Update Status & Actions */}
- {!isStoreBuild && (
+ {/* Card 12: Update Status & Actions (idle/check states; hidden
+ while the promoted front card shows an actionable state) */}
+ {!isStoreBuild && !hasPromotedTopUpdate && (
<div className="settings-shelf-card check-updates-card behaviour-col" ref={updateBannerRef}>
<div className="shelf-card-top">
- <div className="setting-group-label" style={hasUpdatePrompt ? { color: '#ffd60a' } : undefined}>
- {hasUpdatePrompt ? 'UPDATE' : 'UPDATE STATUS'}
+ <div className="setting-group-label">
+ UPDATE STATUS
</div>
<div className="setting-title" style={{ lineHeight: 1.3 }}>
- {updateDownloaded
- ? t('behaviour.updateReadyTitle', { version: updateDownloaded.version })
- : isDownloading
- ? 'Downloading Update...'
- : (checkState.status === 'available' || hasBackgroundUpdate)
- ? t('behaviour.updateAvailableTitle', { version: checkState.version || updateInfo?.latestVersion || '' })
+ {checkState.status === 'checking'
+ ? t('behaviour.checkingForUpdates')
+ : checkState.status === 'up-to-date'
+ ? t('behaviour.isUpToDate')
+ : checkState.status === 'error'
+ ? t('behaviour.updateCheckFailed')
: t('behaviour.checkForUpdates')}
</div>
<div className="setting-desc">
- {updateDownloaded
- ? t('behaviour.updateReadyDesc')
- : isDownloading
- ? t('behaviour.downloadingUpdate')
- : (checkState.status === 'available' || hasBackgroundUpdate)
- ? `Edge-Drop v${checkState.version || updateInfo?.latestVersion || ''}`
+ {checkState.status === 'error'
+ ? (checkState.error || t('behaviour.updateCheckFailed'))
: `Edge-Drop v${currentVersion || '0.3.1'}`}
</div>
</div>
<div className="shelf-card-bottom">
- {updateDownloaded ? (
- <button
- type="button"
- className="pill primary-pill"
- style={{ width: '100%', justifyContent: 'center', background: '#ffd60a', color: '#000000', fontWeight: 600, height: 32, fontSize: 11.5 }}
- onClick={() => {
- playButtonClickSound()
- void window.edge.installUpdate()
- }}
- >
- {t('behaviour.restartToUpdate')}
- </button>
- ) : isDownloading ? (
- <div className="shelf-update-progress-wrap" style={{ width: '100%' }}>
- <div className="shelf-progress-bar" style={{ width: `${downloadPercent}%` }} />
- <span className="shelf-progress-text">{downloadPercent > 0 ? `${downloadPercent}%` : 'Connecting...'}</span>
- </div>
- ) : (checkState.status === 'available' || hasBackgroundUpdate) ? (
- <div style={{ display: 'flex', flexDirection: 'column', gap: 6, width: '100%' }}>
- <button
- type="button"
- className="pill primary-pill"
- style={{ width: '100%', justifyContent: 'center', height: 30, fontSize: 11.5 }}
- onClick={() => {
- playButtonClickSound()
- handleStartDownload()
- }}
- >
- {t('behaviour.downloadAndUpdate')}
- </button>
- <button
- type="button"
- className="pill display-pill"
- style={{ width: '100%', justifyContent: 'center', height: 28, fontSize: 11 }}
- onClick={() => {
- playButtonClickSound()
- useStore.getState().dismissUpdate()
- }}
- >
- {t('behaviour.skip')}
- </button>
- </div>
- ) : (
- <button
- type="button"
- className="pill display-pill"
- style={{ width: '100%', justifyContent: 'center', padding: '6px 12px', fontSize: 11.5, height: 32 }}
- onClick={() => {
- playButtonClickSound()
- handleManualCheck()
- }}
- >
- {checkState.status === 'checking'
- ? t('behaviour.checkingForUpdates')
- : checkState.status === 'up-to-date'
- ? `${t('behaviour.isUpToDate')}`
- : t('behaviour.checkForUpdates')}
- </button>
- )}
+ <button
+ type="button"
+ className="pill display-pill"
+ style={{ width: '100%', justifyContent: 'center', fontSize: 11.5, height: 32 }}
+ disabled={checkState.status === 'checking'}
+ onClick={() => {
+ playButtonClickSound()
+ handleManualCheck()
+ }}
+ >
+ {checkState.status === 'checking' ? (
+ <>
+ <span className="update-dot checking" style={{ marginRight: 6 }} />
+ <span>{t('behaviour.checkingForUpdates')}</span>
+ </>
+ ) : checkState.status === 'up-to-date' ? (
+ t('behaviour.checkAgain')
+ ) : checkState.status === 'error' ? (
+ t('behaviour.tryAgain')
+ ) : (
+ t('behaviour.checkForUpdates')
+ )}
+ </button>
</div>
</div>
)}
@@ -1296,51 +1436,27 @@ export function Settings({
</div>
</div>
<div className="shelf-card-bottom">
- <div className="setting-slider-wrap" style={{ gap: 2, padding: '2px 0' }}>
- <input
- type="range"
- min="1"
- max="7"
- step="1"
- className="setting-range-input"
+ <div className="setting-slider-wrap" style={{ gap: 4, padding: '2px 0' }}>
+ <WakeSlider
+ min={1}
+ max={7}
+ step={1}
+ bars={14}
+ height={26}
+ restHeight={7}
+ gap={3}
value={settings.hotZoneWidth ?? 3}
- style={{
- width: '100%',
- margin: '1px 0',
- touchAction: 'none',
- background: `linear-gradient(to right, #ffffff 0%, #ffffff ${(((settings.hotZoneWidth ?? 3) - 1) / 6) * 100}%, rgba(255, 255, 255, 0.12) ${(((settings.hotZoneWidth ?? 3) - 1) / 6) * 100}%, rgba(255, 255, 255, 0.12) 100%)`
- }}
- onPointerDown={() => {
+ onStart={() => {
void window.edge.setInteractive(true)
setSliderActive(true)
}}
- onPointerUp={(e) => {
- handleThicknessRelease(parseInt((e.target as HTMLInputElement).value, 10))
- }}
- onPointerCancel={(e) => {
- handleThicknessRelease(parseInt((e.target as HTMLInputElement).value, 10))
+ onRelease={(val) => {
+ handleThicknessRelease(val)
}}
- onLostPointerCapture={(e) => {
- handleThicknessRelease(parseInt((e.target as HTMLInputElement).value, 10))
- }}
- onChange={(e) => {
- handleThicknessInput(parseInt(e.target.value, 10))
+ onChange={(val) => {
+ handleThicknessInput(val)
}}
/>
- <div className="setting-slider-ticks">
- {Array.from({ length: 7 }, (_, i) => {
- const tickPx = i + 1
- const currentPx = settings.hotZoneWidth ?? 3
- const isMajor = tickPx === 1 || tickPx === 4 || tickPx === 7
- const isActive = currentPx === tickPx
- return (
- <span
- key={tickPx}
- className={`slider-tick${isMajor ? ' major' : ''}${isActive ? ' active' : ''}`}
- />
- )
- })}
- </div>
<div className="setting-slider-labels" style={{ marginTop: 2 }}>
{[
{ label: 'Min', val: 1 },
@@ -1528,6 +1644,8 @@ export function Settings({
exit={{ opacity: 0, scale: 0.98, y: -4 }}
transition={{ duration: 0.2, ease: [0.16, 1, 0.3, 1] }}
>
+ {renderPromotedTopUpdateCard()}
+
{/* ── SUB-GROUP 1: General & Startup ───────────────── */}
<div className="setting-section-divider">
<span className="setting-section-divider-text">{t('tabs.generalStartup') || 'GENERAL & STARTUP'}</span>
@@ -1787,7 +1905,7 @@ export function Settings({
{updateMode === 'auto'
? t('behaviour.autoUpdatesDescOn')
: updateMode === 'notify'
- ? (t('behaviour.updateModeNotifyDesc') || 'Check at launch and notify — never downloads automatically')
+ ? (t('behaviour.updateModeNotifyDesc') || 'Notify when updates are available without downloading')
: t('behaviour.autoUpdatesDescOff')}
</div>
</div>
@@ -1899,49 +2017,28 @@ export function Settings({
<div className="shelf-card-bottom">
<div className="setting-slider-wrap">
- <input
- type="range"
- min="0"
- max="1"
- step="0.002"
- className="setting-range-input"
+ <WakeSlider
+ min={0}
+ max={1}
+ step={0.002}
+ bars={28}
+ height={28}
+ restHeight={8}
+ gap={3}
value={offsetVal}
- style={{
- background: `linear-gradient(to right, #ffffff 0%, #ffffff ${offsetVal * 100}%, rgba(255, 255, 255, 0.12) ${offsetVal * 100}%, rgba(255, 255, 255, 0.12) 100%)`
- }}
- onPointerDown={() => {
+ onStart={() => {
void window.edge.setInteractive(true)
setSliderActive(true)
}}
- onPointerUp={(e) => {
+ onRelease={(val) => {
setSliderActive(false)
- const val = parseFloat((e.target as HTMLInputElement).value)
if (isHorizontal) {
patch({ horizontalOffset: val })
} else {
handleSliderRelease(val)
}
}}
- onPointerCancel={(e) => {
- setSliderActive(false)
- const val = parseFloat((e.target as HTMLInputElement).value)
- if (isHorizontal) {
- patch({ horizontalOffset: val })
- } else {
- handleSliderRelease(val)
- }
- }}
- onLostPointerCapture={(e) => {
- setSliderActive(false)
- const val = parseFloat((e.target as HTMLInputElement).value)
- if (isHorizontal) {
- patch({ horizontalOffset: val })
- } else {
- handleSliderRelease(val)
- }
- }}
- onChange={(e) => {
- const raw = parseFloat(e.target.value)
+ onChange={(raw) => {
if (isHorizontal) {
patch({ horizontalOffset: raw })
} else {
@@ -1950,20 +2047,6 @@ export function Settings({
}}
/>
- <div className="setting-slider-ticks">
- {Array.from({ length: 21 }, (_, i) => {
- const tickVal = i / 20
- const isMajor = i % 5 === 0
- const isActive = tickVal <= offsetVal
- return (
- <span
- key={i}
- className={`slider-tick${isMajor ? ' major' : ''}${isActive ? ' active' : ''}`}
- />
- )
- })}
- </div>
-
<div className="setting-slider-labels">
{[
{ label: isHorizontal ? 'Left' : '0%', val: 0 },
@@ -2131,55 +2214,26 @@ export function Settings({
<div className="shelf-card-bottom">
<div className="setting-slider-wrap">
- {(() => {
- const currentPx = settings.hotZoneWidth ?? 3
- const pct = Math.max(0, Math.min(100, ((currentPx - 1) / (7 - 1)) * 100))
- return (
- <input
- type="range"
- min="1"
- max="7"
- step="1"
- className="setting-range-input"
- value={currentPx}
- style={{
- touchAction: 'none',
- background: `linear-gradient(to right, #ffffff 0%, #ffffff ${pct}%, rgba(255, 255, 255, 0.12) ${pct}%, rgba(255, 255, 255, 0.12) 100%)`
- }}
- onPointerDown={() => {
- void window.edge.setInteractive(true)
- setSliderActive(true)
- }}
- onPointerUp={(e) => {
- handleThicknessRelease(parseInt((e.target as HTMLInputElement).value, 10))
- }}
- onPointerCancel={(e) => {
- handleThicknessRelease(parseInt((e.target as HTMLInputElement).value, 10))
- }}
- onLostPointerCapture={(e) => {
- handleThicknessRelease(parseInt((e.target as HTMLInputElement).value, 10))
- }}
- onChange={(e) => {
- handleThicknessInput(parseInt(e.target.value, 10))
- }}
- />
- )
- })()}
-
- <div className="setting-slider-ticks">
- {Array.from({ length: 7 }, (_, i) => {
- const tickPx = i + 1
- const currentPx = settings.hotZoneWidth ?? 3
- const isMajor = tickPx === 1 || tickPx === 4 || tickPx === 7
- const isActive = currentPx === tickPx
- return (
- <span
- key={tickPx}
- className={`slider-tick${isMajor ? ' major' : ''}${isActive ? ' active' : ''}`}
- />
- )
- })}
- </div>
+ <WakeSlider
+ min={1}
+ max={7}
+ step={1}
+ bars={14}
+ height={28}
+ restHeight={7}
+ gap={3}
+ value={settings.hotZoneWidth ?? 3}
+ onStart={() => {
+ void window.edge.setInteractive(true)
+ setSliderActive(true)
+ }}
+ onRelease={(val) => {
+ handleThicknessRelease(val)
+ }}
+ onChange={(val) => {
+ handleThicknessInput(val)
+ }}
+ />
<div className="setting-slider-labels">
{[
@@ -2496,31 +2550,6 @@ export function Settings({
</AnimatePresence>
</div>
-
- {/* ── Floating Scroll Indicator Badge for Off-Screen Update Banner ── */}
- <AnimatePresence>
- {showScrollUpdateBadge && (
- <motion.div
- key="scroll-update-badge"
- initial={{ opacity: 0, y: 14, scale: 0.92 }}
- animate={{ opacity: 1, y: 0, scale: 1 }}
- exit={{ opacity: 0, y: 14, scale: 0.92 }}
- transition={{ type: 'spring', stiffness: 450, damping: 32 }}
- onClick={scrollToUpdateCard}
- className="floating-update-pill"
- >
- <span className="floating-update-dot" />
- <span className="floating-update-text">
- {updateDownloaded
- ? t('behaviour.restartToUpdateBelow')
- : isDownloading
- ? (downloadPercent > 0 ? t('behaviour.downloadingWithPercent', { percent: downloadPercent }) : t('behaviour.downloadingUpdate'))
- : t('behaviour.newUpdateAvailableBelow')}
- </span>
- <span className="floating-update-arrow">↓</span>
- </motion.div>
- )}
- </AnimatePresence>
</div>
)
}
diff --git a/src/components/SlideCommit.tsx b/src/components/SlideCommit.tsx
new file mode 100644
index 0000000..e0799f5
--- /dev/null
+++ b/src/components/SlideCommit.tsx
@@ -0,0 +1,436 @@
+import React, { useEffect, useRef, useState } from 'react'
+import {
+ animate,
+ motion,
+ useMotionValue,
+ useMotionValueEvent,
+ useReducedMotion,
+ useTransform
+} from 'framer-motion'
+
+const PAD = 3
+const SQUASH_MAX = 0.08
+const SQUASH_DIV = 110
+const SWELL = 1.03
+const MIN_PENDING = 300
+const EASE_OUT = [0.23, 1, 0.32, 1]
+const SHAKE = [0, -5, 5, -3, 3, -1, 0]
+
+const clamp = (value: number, min: number, max: number) => Math.min(max, Math.max(min, value))
+
+const onColor = (hex: string) => {
+ const raw = hex.replace('#', '')
+ const full = raw.length === 3 ? [...raw].map((ch) => ch + ch).join('') : raw.slice(0, 6)
+ const n = parseInt(full, 16)
+ if (Number.isNaN(n)) return '#ffffff'
+ const yiq = (((n >> 16) & 255) * 299 + ((n >> 8) & 255) * 587 + (n & 255) * 114) / 1000
+ return yiq >= 128 ? '#000000' : '#ffffff'
+}
+
+const velocityOf = (hist: [number, number][]) => {
+ if (hist.length < 2) return 0
+ const [t0, x0] = hist[0]
+ const [t1, x1] = hist[hist.length - 1]
+ return ((x1 - x0) / Math.max(1, t1 - t0)) * 1000
+}
+
+const finePointer = () =>
+ typeof window !== 'undefined' && !!window.matchMedia?.('(hover: hover) and (pointer: fine)').matches
+
+const Spinner = ({ size = 14 }: { size?: number }) => (
+ <svg className="slide-commit__spinner" width={size} height={size} viewBox="0 0 24 24" aria-hidden="true">
+ <circle cx="12" cy="12" r="9" fill="none" stroke="currentColor" strokeWidth="2.4" strokeOpacity="0.25" />
+ <path d="M12 3a9 9 0 0 1 9 9" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" />
+ </svg>
+)
+
+export interface SlideCommitProps {
+ label?: string
+ doneLabel?: string
+ errorLabel?: string
+ onConfirm?: () => Promise<void> | void
+ onDone?: () => void
+ onError?: (err?: unknown) => void
+ trackColor?: string
+ handleColor?: string
+ successColor?: string
+ dangerColor?: string
+ width?: number | string
+ height?: number
+ radius?: number
+ speed?: number
+ returnBounce?: number
+ landingDip?: number
+ holdMs?: number
+ disabled?: boolean
+ icon?: React.ReactNode
+ className?: string
+}
+
+export function SlideCommit({
+ label = 'Slide to restart',
+ doneLabel = 'Restarting...',
+ errorLabel = 'Failed',
+ onConfirm,
+ onDone,
+ onError,
+ trackColor = 'rgba(255, 255, 255, 0.08)',
+ handleColor = '#ffffff',
+ successColor = '#ffffff',
+ dangerColor = '#ff453a',
+ width = '100%',
+ height = 32,
+ radius = 10,
+ speed = 50,
+ returnBounce = 0.38,
+ landingDip = 0.026,
+ holdMs = 1500,
+ disabled = false,
+ icon,
+ className = ''
+}: SlideCommitProps) {
+ const reduce = useReducedMotion()
+ const [phase, setPhase] = useState<'idle' | 'pending' | 'done' | 'error'>('idle')
+ const [held, setHeld] = useState(false)
+ const [hot, setHot] = useState(false)
+
+ const trackRef = useRef<HTMLDivElement>(null)
+ const capsuleRef = useRef<HTMLDivElement>(null)
+ const grip = useRef<{ id: number; grab: number | null; moved: boolean; hist: [number, number][] } | null>(null)
+ const timer = useRef<ReturnType<typeof setTimeout> | number>(0)
+ const homeTimer = useRef<ReturnType<typeof setTimeout> | number>(0)
+ const run = useRef(0)
+ const unwatch = useRef<(() => void) | null>(null)
+ const live = useRef({ move: (_e: PointerEvent) => {}, up: (_e: PointerEvent) => {} })
+ const lastPercent = useRef(0)
+
+ const [measuredWidth, setMeasuredWidth] = useState<number>(typeof width === 'number' ? width : 230)
+
+ useEffect(() => {
+ if (!trackRef.current) return
+ const el = trackRef.current
+ const update = () => {
+ const rect = el.getBoundingClientRect()
+ if (rect.width > 0) {
+ setMeasuredWidth(rect.width)
+ }
+ }
+ update()
+ const ro = new ResizeObserver(update)
+ ro.observe(el)
+ return () => ro.disconnect()
+ }, [])
+
+ const effectiveWidth = typeof width === 'number' ? width : measuredWidth
+ const GRIP = height - PAD * 2
+ const INNER = Math.max(GRIP + 1, effectiveWidth - PAD * 2)
+ const TRAVEL = Math.max(1, INNER - GRIP)
+ const r = clamp(radius, 0, height / 2)
+ const gripR = Math.max(0, r - PAD)
+ const k = 260 + (clamp(speed, 0, 100) / 100) * 640
+ const mass = 0.9
+ const critical = 2 * Math.sqrt(k * mass)
+ const commitSpring = { type: 'spring' as const, stiffness: k, damping: critical, mass }
+ const homeSpring = { ...commitSpring, damping: critical * (1 - clamp(returnBounce, 0, 0.5)) }
+
+ const x = useMotionValue(0)
+ const anchor = useMotionValue(0)
+ const shown = useMotionValue(1)
+ const spin = useMotionValue(0)
+ const pulse = useMotionValue(1)
+ const shake = useMotionValue(0)
+ const seen = useTransform(x, (v) => clamp(v, 0, TRAVEL))
+ const edge = useTransform([seen, anchor], ([v, a]) => v + GRIP + clamp(a - v, 0, TRAVEL))
+ const clip = useTransform(edge, (R) => `inset(0 ${Math.max(0, INNER - R)}px 0 0 round ${gripR}px)`)
+ const content = useTransform([seen, edge], ([v, R]) => `translateX(${(v + R) / 2 - INNER / 2}px)`)
+ const swell = hot && !held && phase === 'idle' && !reduce ? SWELL : 1
+ const shape = useTransform(x, (v) => {
+ const q = 1 - Math.min(SQUASH_MAX, Math.max(0, -v) / SQUASH_DIV)
+ return `scale(${q * swell}, ${swell / q})`
+ })
+ const origin = useTransform(seen, (v) => `${v}px 50%`)
+ const say = useTransform(seen, [0, TRAVEL * 0.55], [1, 0])
+ const arrow = useTransform([seen, shown], ([v, on]) => on * clamp(1 - (v - TRAVEL * 0.55) / (TRAVEL * 0.4), 0, 1))
+ const trackTransform = useTransform([shake, pulse], ([s, p]) => `translateX(${s}px) scale(${p})`)
+
+ const labelText = typeof label === 'string' ? label : 'Slide to confirm'
+ useMotionValueEvent(seen, 'change', (v) => {
+ const percent = Math.round((v / TRAVEL) * 100)
+ if (percent === lastPercent.current || !capsuleRef.current) return
+ lastPercent.current = percent
+ capsuleRef.current.setAttribute('aria-valuenow', String(percent))
+ capsuleRef.current.setAttribute('aria-valuetext', `${labelText}, ${percent}%`)
+ })
+
+ useEffect(
+ () => () => {
+ clearTimeout(timer.current as number)
+ clearTimeout(homeTimer.current as number)
+ unwatch.current?.()
+ run.current += 1
+ },
+ []
+ )
+
+ const local = (clientX: number) => {
+ const rect = trackRef.current?.getBoundingClientRect()
+ if (!rect) return 0
+ return (clientX - rect.left) / (rect.width / effectiveWidth || 1)
+ }
+
+ const goHome = (velocity: number) => {
+ if (reduce) animate(x, 0, { duration: 0.2, ease: EASE_OUT })
+ else animate(x, 0, { ...homeSpring, velocity: Math.min(0, velocity) })
+ }
+
+ const settle = () => {
+ setPhase('idle')
+ animate(shown, 1, { duration: 0.2, delay: 0.12 })
+ if (reduce) anchor.set(0)
+ else animate(anchor, 0, { type: 'spring', duration: 0.3, bounce: 0 })
+ }
+
+ const resolve = (viaKey: boolean) => {
+ setPhase('done')
+ anchor.set(x.get())
+ animate(spin, 0, { duration: 0.12 })
+ if (reduce) x.set(0)
+ else {
+ animate(x, 0, commitSpring)
+ if (!viaKey && landingDip > 0) {
+ animate(pulse, [1, 1 - landingDip, 1], { duration: 0.46, times: [0, 0.62, 1], ease: EASE_OUT, delay: 0.1 })
+ }
+ }
+ onDone?.()
+ if (holdMs > 0) timer.current = setTimeout(settle, holdMs)
+ }
+
+ const reject = (reason?: unknown) => {
+ setPhase('error')
+ onError?.(reason)
+ animate(spin, 0, { duration: 0.12 })
+ animate(shown, 1, { duration: 0.2, delay: 0.12 })
+ if (reduce) goHome(0)
+ else {
+ animate(shake, SHAKE, { duration: 0.45, ease: EASE_OUT })
+ homeTimer.current = setTimeout(() => {
+ if (!grip.current) goHome(0)
+ }, 300)
+ }
+ timer.current = setTimeout(() => setPhase('idle'), Math.max(holdMs, 1500))
+ }
+
+ const commit = (viaKey: boolean) => {
+ clearTimeout(timer.current as number)
+ const id = ++run.current
+ x.set(TRAVEL)
+ let out: any
+ try {
+ out = onConfirm?.()
+ } catch (reason) {
+ reject(reason)
+ return
+ }
+ const pending = out && typeof out.then === 'function' ? out : null
+ if (!pending) {
+ animate(shown, 0, { duration: 0.12 })
+ resolve(viaKey)
+ return
+ }
+ setPhase('pending')
+ animate(shown, 0, { duration: 0.2 })
+ animate(spin, 1, { duration: 0.2 })
+ const t0 = performance.now()
+ const later = (fn: () => void) => {
+ setTimeout(
+ () => {
+ if (id === run.current) fn()
+ },
+ Math.max(0, MIN_PENDING - (performance.now() - t0))
+ )
+ }
+ pending.then(
+ () => later(() => resolve(viaKey)),
+ (reason: unknown) => later(() => reject(reason))
+ )
+ }
+
+ const down = (e: React.PointerEvent<HTMLDivElement>) => {
+ if (disabled || grip.current || phase === 'pending' || phase === 'done' || e.button !== 0) return
+ x.stop()
+ grip.current = { id: e.pointerId, grab: null, moved: false, hist: [] }
+ setHeld(true)
+ try {
+ trackRef.current?.setPointerCapture(e.pointerId)
+ } catch {}
+ unwatch.current?.()
+ const onMove = (ev: PointerEvent) => ev.isTrusted && live.current.move(ev)
+ const onUp = (ev: PointerEvent) => ev.isTrusted && live.current.up(ev)
+ window.addEventListener('pointermove', onMove)
+ window.addEventListener('pointerup', onUp)
+ window.addEventListener('pointercancel', onUp)
+ unwatch.current = () => {
+ window.removeEventListener('pointermove', onMove)
+ window.removeEventListener('pointerup', onUp)
+ window.removeEventListener('pointercancel', onUp)
+ unwatch.current = null
+ }
+ }
+
+ const move = (e: PointerEvent) => {
+ const g = grip.current
+ if (!g || g.id !== e.pointerId) return
+ const at = local(e.clientX)
+ if (g.grab === null) {
+ g.grab = at - x.get()
+ return
+ }
+ const next = clamp(at - g.grab, 0, TRAVEL)
+ if (Math.abs(next - x.get()) > 0.5) g.moved = true
+ g.hist.push([e.timeStamp, next])
+ if (g.hist.length > 4) g.hist.shift()
+ x.set(next)
+ }
+
+ const up = (e: PointerEvent | { pointerId: number }) => {
+ const g = grip.current
+ if (!g || g.id !== e.pointerId) return
+ grip.current = null
+ unwatch.current?.()
+ try {
+ trackRef.current?.releasePointerCapture(e.pointerId)
+ } catch {}
+ setHeld(false)
+ if (x.get() >= TRAVEL) commit(false)
+ else if (g.moved) goHome(velocityOf(g.hist))
+ }
+ live.current = { move, up: up as any }
+
+ const onKeyDown = (e: React.KeyboardEvent) => {
+ if (disabled || phase === 'pending' || phase === 'done') return
+ const step = TRAVEL / 10
+ if (e.key === 'End' || e.key === 'Enter' || e.key === ' ') {
+ e.preventDefault()
+ commit(true)
+ } else if (e.key === 'ArrowRight' || e.key === 'ArrowUp') {
+ e.preventDefault()
+ const next = Math.min(TRAVEL, x.get() + step)
+ x.set(next)
+ if (next >= TRAVEL) commit(true)
+ } else if (e.key === 'ArrowLeft' || e.key === 'ArrowDown') {
+ e.preventDefault()
+ x.set(Math.max(0, x.get() - step))
+ } else if (e.key === 'Home' || e.key === 'Escape') {
+ e.preventDefault()
+ if (grip.current) up({ pointerId: grip.current.id })
+ else x.set(0)
+ }
+ }
+
+ const fontSize = clamp(Math.round(height * 0.36), 11, 13)
+ const iconSize = Math.round(GRIP * 0.44)
+ const done = phase === 'done'
+
+ return (
+ <div
+ className={`slide-commit${className ? ` ${className}` : ''}`}
+ data-phase={phase}
+ data-held={held ? '' : undefined}
+ data-disabled={disabled ? '' : undefined}
+ style={
+ {
+ width,
+ height,
+ '--sc-track': trackColor,
+ '--sc-ink': handleColor,
+ '--sc-ok': successColor,
+ '--sc-no': dangerColor,
+ '--sc-on-ink': onColor(handleColor),
+ '--sc-on-ok': onColor(successColor),
+ '--sc-on-no': onColor(dangerColor),
+ '--sc-radius': `${r}px`,
+ '--sc-grip-r': `${gripR}px`,
+ '--sc-pad': `${PAD}px`,
+ '--sc-font': `${fontSize}px`
+ } as React.CSSProperties
+ }
+ >
+ <motion.div
+ ref={trackRef}
+ className="slide-commit__track"
+ style={{ transform: trackTransform }}
+ onPointerDown={down}
+ >
+ <motion.span className="slide-commit__label" style={{ opacity: say }} aria-hidden="true">
+ <span className="slide-commit__text slide-commit__text--plain">{label}</span>
+ <span className="slide-commit__text slide-commit__text--error">{errorLabel}</span>
+ </motion.span>
+ <motion.div
+ ref={capsuleRef}
+ role="slider"
+ tabIndex={disabled ? -1 : 0}
+ aria-label={labelText}
+ aria-valuemin={0}
+ aria-valuemax={100}
+ aria-valuenow={0}
+ aria-busy={phase === 'pending' || undefined}
+ aria-disabled={disabled || undefined}
+ className="slide-commit__capsule"
+ style={{ clipPath: clip, transform: shape, transformOrigin: origin }}
+ onPointerEnter={(e) => {
+ if (e.pointerType === 'mouse' && finePointer()) setHot(true)
+ }}
+ onPointerLeave={() => setHot(false)}
+ onKeyDown={onKeyDown}
+ >
+ <motion.div className="slide-commit__content" style={{ transform: content }}>
+ <motion.span className="slide-commit__arrow" style={{ opacity: arrow }} aria-hidden="true">
+ {icon ?? (
+ <svg
+ width={iconSize}
+ height={iconSize}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth={2.4}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ >
+ <line x1="5" y1="12" x2="19" y2="12" />
+ <polyline points="12 5 19 12 12 19" />
+ </svg>
+ )}
+ </motion.span>
+ <motion.span className="slide-commit__spin" style={{ opacity: spin }} aria-hidden="true">
+ <Spinner size={iconSize} />
+ </motion.span>
+ <motion.span
+ className="slide-commit__done"
+ aria-hidden="true"
+ initial={false}
+ animate={{ opacity: done ? 1 : 0, scale: done || reduce ? 1 : 0.95 }}
+ transition={{ duration: 0.2, ease: EASE_OUT }}
+ >
+ <svg
+ width={Math.round(GRIP * 0.44)}
+ height={Math.round(GRIP * 0.44)}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth={2.6}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ >
+ <polyline points="20 6 9 17 4 12" />
+ </svg>
+ <span>{doneLabel}</span>
+ </motion.span>
+ </motion.div>
+ </motion.div>
+ <span className="slide-commit__sr" aria-live="polite">
+ {phase === 'pending' ? 'Working' : phase === 'done' ? doneLabel : phase === 'error' ? errorLabel : ''}
+ </span>
+ </motion.div>
+ </div>
+ )
+}
diff --git a/src/components/WakeSlider.tsx b/src/components/WakeSlider.tsx
new file mode 100644
index 0000000..b616ab6
--- /dev/null
+++ b/src/components/WakeSlider.tsx
@@ -0,0 +1,297 @@
+import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
+import { useMotionValue, useMotionValueEvent, useReducedMotion, useSpring, useVelocity } from 'framer-motion'
+import { playDialTickSound } from '../lib/soundEffects'
+
+const SETTLE = 9.23
+const FULL_SPEED = 320
+const MIN_REACH = 1.5
+const FLAT = 0.002
+
+const clamp = (v: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, v))
+const smoothstep = (s: number) => s * s * (3 - 2 * s)
+const toPct = (v: number, min: number, max: number) => (max > min ? ((v - min) / (max - min)) * 100 : 0)
+const snap = (v: number, min: number, max: number, step: number) => {
+ if (!(max > min)) return min
+ if (!(step > 0)) return clamp(v, min, max)
+ const lastWhole = min + Math.floor(+((max - min) / step).toFixed(6)) * step
+ const grid = clamp(Math.round((v - min) / step) * step + min, min, lastWhole)
+ return +(lastWhole < max && Math.abs(v - max) <= Math.abs(v - grid) ? max : grid).toFixed(6)
+}
+
+export interface WakeSliderProps {
+ value?: number
+ defaultValue?: number
+ onChange?: (val: number) => void
+ onRelease?: (val: number) => void
+ onStart?: () => void
+ min?: number
+ max?: number
+ step?: number
+ bars?: number
+ height?: number
+ restHeight?: number
+ gap?: number
+ fillColor?: string
+ trackColor?: string
+ crestColor?: string
+ sensitivity?: number
+ reach?: number
+ skew?: number
+ glide?: number
+ smoothing?: number
+ showValue?: boolean
+ formatValue?: (val: number) => string
+ disabled?: boolean
+ ariaLabel?: string
+ className?: string
+}
+
+export function WakeSlider({
+ value: valueProp,
+ defaultValue = 50,
+ onChange,
+ onRelease,
+ onStart,
+ min = 0,
+ max = 100,
+ step = 1,
+ bars = 28,
+ height = 28,
+ restHeight = 8,
+ gap = 3,
+ fillColor = '#ffffff',
+ trackColor = 'rgba(255, 255, 255, 0.12)',
+ crestColor = '#ffffff',
+ sensitivity = 1,
+ reach = 6,
+ skew = 0.6,
+ glide = 0.3,
+ smoothing = 100,
+ showValue = false,
+ formatValue,
+ disabled = false,
+ ariaLabel = 'Value',
+ className = ''
+}: WakeSliderProps) {
+ const [inner, setInner] = useState(defaultValue)
+ const value = clamp(valueProp ?? inner, min, max)
+ const pct = toPct(value, min, max)
+ const reduce = useReducedMotion()
+ const format = formatValue ?? String
+ const rest = Math.min(restHeight, height - 1) / height
+
+ const rootRef = useRef<HTMLDivElement>(null)
+ const trackRef = useRef<HTMLDivElement>(null)
+ const handleRef = useRef<HTMLButtonElement>(null)
+ const barEls = useRef<(HTMLSpanElement | null)[]>([])
+ const crestEls = useRef<(HTMLSpanElement | null)[]>([])
+ const pointerId = useRef<number | null>(null)
+ const lastAmp = useRef(0)
+ const latest = useRef(value)
+ latest.current = value
+
+ const target = useMotionValue(pct)
+ const w0 = SETTLE / glide
+ const head = useSpring(target, { stiffness: w0 * w0, damping: 2 * w0, mass: 1 })
+ const rawSpeed = useVelocity(head)
+ const wv = 2000 / smoothing
+ const speed = useSpring(rawSpeed, { stiffness: wv * wv, damping: 2.5 * wv, mass: 1 })
+
+ useEffect(() => {
+ target.set(pct)
+ }, [pct, target])
+
+ const paint = (force = false) => {
+ const h = ((reduce ? target.get() : head.get()) / 100) * (bars - 1)
+ const v = reduce ? 0 : speed.get()
+ const amp = smoothstep(clamp((Math.abs(v) * sensitivity) / FULL_SPEED, 0, 1))
+ const dir = Math.sign(v) || 1
+ const r = MIN_REACH + (reach - MIN_REACH) * amp
+ const behind = r * (1 + skew)
+ const ahead = r * (1 - 0.5 * skew)
+ const lit = Math.round(h)
+ const flat = !force && amp < FLAT && lastAmp.current < FLAT
+ for (let i = 0; i < bars; i++) {
+ const el = barEls.current[i]
+ if (!el) continue
+ const on = i <= lit ? 'true' : 'false'
+ if (el.dataset.on !== on) el.dataset.on = on
+ if (flat) continue
+ const d = i - h
+ const R = d * dir < 0 ? behind : ahead
+ const lift = Math.abs(d) < R ? amp * Math.cos((Math.PI * d) / (2 * R)) ** 2 : 0
+ el.style.transform = `scaleY(${rest + lift * (1 - rest)})`
+ const crest = crestEls.current[i]
+ if (crest) crest.style.opacity = String(lift)
+ }
+ lastAmp.current = amp
+ }
+
+ const paintRef = useRef(paint)
+ paintRef.current = paint
+
+ const rafId = useRef<number | null>(null)
+ const schedule = useCallback(() => {
+ if (rafId.current !== null) return
+ rafId.current = requestAnimationFrame(() => {
+ rafId.current = null
+ paintRef.current()
+ })
+ }, [])
+
+ useEffect(() => {
+ return () => {
+ if (rafId.current !== null) {
+ cancelAnimationFrame(rafId.current)
+ rafId.current = null
+ }
+ }
+ }, [])
+
+ useMotionValueEvent(head, 'change', schedule)
+ useMotionValueEvent(speed, 'change', schedule)
+
+ useLayoutEffect(() => {
+ paintRef.current(true)
+ })
+
+ const commit = (next: number) => {
+ const clean = snap(next, min, max, step)
+ if (clean === latest.current) return
+ latest.current = clean
+ if (valueProp === undefined) setInner(clean)
+ playDialTickSound()
+ onChange?.(clean)
+ }
+
+ const commitFromX = (x: number) => {
+ const track = trackRef.current
+ if (!track) return
+ const rect = track.getBoundingClientRect()
+ if (!rect.width) return
+ let ratio = clamp((x - rect.left) / rect.width, 0, 1)
+ if (getComputedStyle(track).direction === 'rtl') ratio = 1 - ratio
+ commit(min + ratio * (max - min))
+ }
+
+ const onPointerDown = (e: React.PointerEvent<HTMLDivElement>) => {
+ if (disabled || pointerId.current !== null) return
+ pointerId.current = e.pointerId
+ try {
+ e.currentTarget.setPointerCapture(e.pointerId)
+ } catch {}
+ rootRef.current?.removeAttribute('data-instant')
+ handleRef.current?.focus({ preventScroll: true })
+ onStart?.()
+ commitFromX(e.clientX)
+ }
+
+ const onPointerMove = (e: React.PointerEvent<HTMLDivElement>) => {
+ if (e.pointerId === pointerId.current) commitFromX(e.clientX)
+ }
+
+ const endDrag = (e: React.PointerEvent<HTMLDivElement>) => {
+ if (e.pointerId !== pointerId.current) return
+ try {
+ e.currentTarget.releasePointerCapture(e.pointerId)
+ } catch {}
+ pointerId.current = null
+ onRelease?.(latest.current)
+ }
+
+ const onKeyDown = (e: React.KeyboardEvent<HTMLButtonElement>) => {
+ if (disabled) return
+ const jumps: Record<string, number> = {
+ ArrowRight: value + step,
+ ArrowUp: value + step,
+ ArrowLeft: value - step,
+ ArrowDown: value - step,
+ PageUp: value + step * 10,
+ PageDown: value - step * 10,
+ Home: min,
+ End: max
+ }
+ if (!(e.key in jumps)) return
+ e.preventDefault()
+ const clean = snap(jumps[e.key], min, max, step)
+ const p = toPct(clean, min, max)
+ rootRef.current?.setAttribute('data-instant', 'true')
+ head.jump(p)
+ speed.jump(0)
+ target.jump(p)
+ commit(clean)
+ onRelease?.(clean)
+ }
+
+ const barNodes = useMemo(() => {
+ barEls.current.length = bars
+ crestEls.current.length = bars
+ return Array.from({ length: bars }, (_, i) => (
+ <span
+ key={i}
+ ref={(el) => {
+ barEls.current[i] = el
+ }}
+ className="wake-slider__bar"
+ >
+ {crestColor ? (
+ <span
+ ref={(el) => {
+ crestEls.current[i] = el
+ }}
+ className="wake-slider__crest"
+ />
+ ) : null}
+ </span>
+ ))
+ }, [bars, crestColor])
+
+ return (
+ <div
+ ref={rootRef}
+ className={`wake-slider${className ? ` ${className}` : ''}`}
+ aria-disabled={disabled || undefined}
+ style={
+ {
+ '--ws-fill': fillColor,
+ '--ws-track': trackColor,
+ '--ws-crest': crestColor || fillColor,
+ '--ws-height': `${height}px`,
+ '--ws-gap': `${gap}px`,
+ '--ws-rest': rest
+ } as React.CSSProperties
+ }
+ >
+ <div
+ ref={trackRef}
+ className="wake-slider__track"
+ onPointerDown={onPointerDown}
+ onPointerMove={onPointerMove}
+ onPointerUp={endDrag}
+ onPointerCancel={endDrag}
+ onLostPointerCapture={endDrag}
+ >
+ {barNodes}
+ <button
+ ref={handleRef}
+ type="button"
+ role="slider"
+ className="wake-slider__handle"
+ tabIndex={disabled ? -1 : 0}
+ aria-label={ariaLabel}
+ aria-valuemin={min}
+ aria-valuemax={max}
+ aria-valuenow={value}
+ aria-valuetext={format(value)}
+ aria-disabled={disabled || undefined}
+ onKeyDown={onKeyDown}
+ />
+ </div>
+ {showValue ? (
+ <span className="wake-slider__value" aria-hidden="true">
+ {format(value)}
+ </span>
+ ) : null}
+ </div>
+ )
+}
diff --git a/src/i18n/translations.ts b/src/i18n/translations.ts
index 7c61bfa..8c14aa3 100644
--- a/src/i18n/translations.ts
+++ b/src/i18n/translations.ts
@@ -56,6 +56,9 @@ export interface TranslationKeys {
updateModeNotify?: string
updateModeOff?: string
updateModeNotifyDesc?: string
+ updateLabelReady?: string
+ updateLabelDownloading?: string
+ updateLabelAvailable?: string
checkForUpdates: string
checkingForUpdates: string
isUpToDate: string
@@ -65,6 +68,9 @@ export interface TranslationKeys {
updateAvailableTitle: string
updateAvailableDesc: string
downloadAndUpdate: string
+ update?: string
+ restart?: string
+ restarting?: string
skip: string
downloadingUpdate: string
downloadingWithPercent?: string
@@ -532,12 +538,15 @@ export const en: TranslationKeys = {
"soundEffectsTitle": "Sound Effects",
"soundEffectsDesc": "Play tactile audio feedback for toggles, sliders, and button clicks",
"autoUpdatesTitle": "Automatic updates",
- "autoUpdatesDescOn": "Check for and download app updates automatically in background",
- "autoUpdatesDescOff": "Fully silent. The app never checks for updates on its own",
+ "autoUpdatesDescOn": "Automatically download updates in the background",
+ "autoUpdatesDescOff": "Never check automatically. Check manually below",
"updateModeAuto": "Automatic",
"updateModeNotify": "Notify me",
"updateModeOff": "Off",
- "updateModeNotifyDesc": "Check at launch and notify — never downloads automatically",
+ "updateModeNotifyDesc": "Notify when updates are available without downloading",
+ "updateLabelReady": "UPDATE READY TO INSTALL",
+ "updateLabelDownloading": "DOWNLOADING UPDATE",
+ "updateLabelAvailable": "NEW UPDATE AVAILABLE",
"checkForUpdates": "Check for updates",
"checkingForUpdates": "Checking GitHub for updates...",
"isUpToDate": "✓ Edge-Drop is up to date",
@@ -545,8 +554,11 @@ export const en: TranslationKeys = {
"tryAgain": "Try again",
"updateCheckFailed": "Update check failed",
"updateAvailableTitle": "Edge-Drop v{version} is available!",
- "updateAvailableDesc": "A newer version is ready on GitHub. Would you like to download and update now?",
+ "updateAvailableDesc": "A newer version is ready to download.",
"downloadAndUpdate": "Download & Update",
+ "update": "Update",
+ "restart": "Restart",
+ "restarting": "Restarting...",
"skip": "Skip",
"downloadingUpdate": "Downloading in background...",
"downloadingWithPercent": "Downloading update... ({percent}%)",
diff --git a/src/store/appStore.ts b/src/store/appStore.ts
index 6e90de4..36719e9 100644
--- a/src/store/appStore.ts
+++ b/src/store/appStore.ts
@@ -15,6 +15,13 @@ import { playEdgeRetractSound, playEdgeBeaconAppearSound, playEdgeExpandSound, p
let flareTimer: ReturnType<typeof setTimeout> | null = null
+/**
+ * Version dismissed this run. Session-only (never persisted): quitting and
+ * relaunching clears it, so a skipped update prompts again next launch —
+ * the "remind me next restart" contract. Manual checks bypass it entirely.
+ */
+let sessionSkippedVersion: string | null = null
+
export type EdgeTransitionStage =
| 'retracting'
| 'bar_fade_out'
@@ -104,6 +111,12 @@ interface AppState {
startManualCheck: () => Promise<void>
startManualDownload: () => Promise<void>
resetManualCheck: () => void
+ /**
+ * True while the user is driving an update flow by hand (check/download in
+ * progress or a manual result on screen). Decides placement: manual flows
+ * render in place where clicked; background finds promote to the top.
+ */
+ manualUpdateActive: boolean
setUpdateAvailable: (info: { version: string }) => void
setUpdateProgress: (progress: UpdateProgress) => void
setUpdateDownloaded: (info: { version: string }) => void
@@ -259,45 +272,53 @@ export const useStore = create<AppState>((set, get) => ({
flareKey: 0,
async hydrate() {
- const { items, settings, version, isStoreBuild } = await edge.loadState()
+ const { items, settings, version, isStoreBuild, updateInfo } = await edge.loadState()
+ const skipped = settings?.skippedUpdateVersion
+ const validUpdateInfo = (updateInfo && (!skipped || updateInfo.latestVersion !== skipped)) ? updateInfo : null
set({
items,
settings,
currentVersion: version,
isStoreBuild: isStoreBuild ?? false,
+ updateInfo: validUpdateInfo ?? get().updateInfo,
hydrated: true
})
},
manualCheckState: { status: 'idle' },
+ manualUpdateActive: false,
startManualCheck: async () => {
- set({ manualCheckState: { status: 'checking' } })
+ set({ manualCheckState: { status: 'checking' }, manualUpdateActive: true })
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 }
+ updateInfo: { hasUpdate: true, latestVersion: res.version || '', downloaded: false },
+ manualUpdateActive: true
})
} else if (res.status === 'up-to-date') {
set({
- manualCheckState: { status: 'up-to-date', version: res.version }
+ manualCheckState: { status: 'up-to-date', version: res.version },
+ manualUpdateActive: false
})
} else {
set({
- manualCheckState: { status: 'error', error: res.error || 'Check failed' }
+ manualCheckState: { status: 'error', error: res.error || 'Check failed' },
+ manualUpdateActive: false
})
}
} catch (err: any) {
set({
- manualCheckState: { status: 'error', error: err?.message || 'Check failed' }
+ manualCheckState: { status: 'error', error: err?.message || 'Check failed' },
+ manualUpdateActive: false
})
}
},
startManualDownload: async () => {
- set({ manualCheckState: { status: 'downloading' } })
+ set({ manualCheckState: { status: 'downloading' }, manualUpdateActive: true })
try {
await edge.startUpdateDownload()
} catch {
@@ -308,13 +329,28 @@ export const useStore = create<AppState>((set, get) => ({
resetManualCheck: () => set({ manualCheckState: { status: 'idle' } }),
setUpdateAvailable: (info) => {
- // Skip memory: a version the user explicitly skipped is not re-prompted
- // by background checks. A different (newer) version clears the stale skip
- // and surfaces normally. Manual checks bypass this (their own state).
- const skipped = get().settings.skippedUpdateVersion
- if (skipped && info.version === skipped) return
- if (skipped && info.version !== skipped) {
- void get().patchSettings({ skippedUpdateVersion: undefined }).catch(() => {})
+ // Session skip: a version dismissed this run is not re-prompted by
+ // background pushes, but WILL prompt again after the next launch (the
+ // "remind me next restart" contract). A different version clears the
+ // session skip and surfaces normally. Manual checks bypass this.
+ if (sessionSkippedVersion && info.version === sessionSkippedVersion) {
+ console.log(`[Updater] Suppressing prompt for session-skipped v${info.version}`)
+ return
+ }
+ if (sessionSkippedVersion && info.version !== sessionSkippedVersion) {
+ sessionSkippedVersion = null
+ }
+ // A background find arriving while no manual flow owns the UI resets the
+ // manual marker, so placement below keys off fresh truth, not stale flags.
+ if (get().manualCheckState.status === 'idle') {
+ set({ manualUpdateActive: false })
+ }
+ // A background find for a DIFFERENT version than a settled manual result
+ // retires the stale manual result — the top card then shows the newer
+ // version instead of two disagreeing prompts.
+ const mc = get().manualCheckState
+ if ((mc.status === 'available' || mc.status === 'up-to-date' || mc.status === 'error') && mc.version && mc.version !== info.version) {
+ set({ manualCheckState: { status: 'idle' }, manualUpdateActive: false })
}
set({
updateInfo: {
@@ -359,13 +395,11 @@ export const useStore = create<AppState>((set, get) => ({
},
dismissUpdate: () => {
- // Skip = "remind me next launch": persist the skipped version so this
- // exact version is not re-prompted, while a newer one still surfaces.
+ // Skip = "not now": remember for this session only. The next launch
+ // re-prompts (nothing persisted), a newer version always surfaces.
const skipped = get().updateInfo?.latestVersion || get().manualCheckState.version
- if (skipped) {
- void get().patchSettings({ skippedUpdateVersion: skipped }).catch(() => {})
- }
- set({ updateInfo: null, manualCheckState: { status: 'idle' } })
+ sessionSkippedVersion = skipped || null
+ set({ updateInfo: null, manualCheckState: { status: 'idle' }, manualUpdateActive: false })
},
async installUpdate() {
diff --git a/src/styles/settings.css b/src/styles/settings.css
index 1dd4bf3..61071e1 100644
--- a/src/styles/settings.css
+++ b/src/styles/settings.css
@@ -1299,7 +1299,7 @@
display: flex;
flex-direction: column;
gap: 10px;
- margin-top: 14px;
+ margin-top: 8px;
}
.manual-update-card {
@@ -1307,26 +1307,33 @@
flex-direction: column;
gap: 8px;
padding: 12px 14px;
- background: #141414;
- border-radius: 12px;
+ background: var(--bg-card, #141414);
+ border-radius: var(--radius-card, 16px);
+ border: 1px solid rgba(255, 255, 255, 0.08);
box-sizing: border-box;
animation: updateCardFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
+ transition: background 0.14s ease, border-color 0.14s ease;
+}
+
+.manual-update-card:hover {
+ background: var(--bg-card-hover, #1c1c1c);
+ border-color: rgba(255, 255, 255, 0.14);
}
.manual-update-info {
display: flex;
flex-direction: column;
- gap: 3px;
+ gap: 2px;
}
.manual-update-title {
display: inline-flex;
align-items: center;
- gap: 8px;
- font-size: 12px;
- font-weight: 550;
+ gap: 6px;
+ font-size: calc(13px * var(--font-scale, 1));
+ font-weight: 600;
color: #ffffff;
- letter-spacing: -0.01em;
+ line-height: 1.3;
}
.manual-update-title.error {
@@ -1334,8 +1341,8 @@
}
.manual-update-desc {
- font-size: 11px;
- color: rgba(255, 255, 255, 0.65);
+ font-size: calc(11.5px * var(--font-scale, 1));
+ color: rgba(255, 255, 255, 0.62);
line-height: 1.35;
}
@@ -1343,63 +1350,28 @@
color: rgba(248, 113, 113, 0.75);
}
-.manual-update-dot {
- width: 6px;
- height: 6px;
- border-radius: 50%;
- flex-shrink: 0;
- background: #ffffff;
-}
-
-.manual-update-dot.ready {
- background: #ffffff;
-}
-
-.manual-update-dot.checking {
- animation: dotPulse 1.2s ease-in-out infinite;
-}
-
-@keyframes dotPulse {
- 0%, 100% {
- opacity: 0.3;
- transform: scale(0.85);
- }
- 50% {
- opacity: 1;
- transform: scale(1.15);
- }
-}
-
-.manual-update-actions {
- display: flex;
- align-items: center;
- gap: 8px;
- width: 100%;
- margin-top: 2px;
-}
-
.manual-update-pill {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
width: 100%;
- height: 28px;
- min-height: 28px;
- max-height: 28px;
+ height: 32px;
+ min-height: 32px;
+ max-height: 32px;
padding: 0 14px;
- border-radius: 999px;
+ border-radius: 10px;
font-size: 11.5px;
font-weight: 600;
box-sizing: border-box;
cursor: pointer;
border: none;
- transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
+ transition: all 0.15s ease;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
- font-variant-numeric: tabular-nums;
- margin-top: 2px;
+ outline: none;
+ user-select: none;
}
.manual-update-pill.primary {
@@ -1408,7 +1380,7 @@
}
.manual-update-pill.primary:hover:not(:disabled) {
- background: rgba(255, 255, 255, 0.92);
+ background: rgba(255, 255, 255, 0.9);
transform: translateY(-1px);
}
@@ -1422,15 +1394,16 @@
}
.manual-update-pill.outline {
- background: #1f1f1f;
- color: #ffffff;
+ background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.08);
- font-weight: 550;
+ color: rgba(255, 255, 255, 0.85);
+ font-weight: 500;
}
.manual-update-pill.outline:hover:not(:disabled) {
- background: #282828;
+ background: rgba(255, 255, 255, 0.09);
border-color: rgba(255, 255, 255, 0.16);
+ color: #ffffff;
transform: translateY(-1px);
}
@@ -1440,85 +1413,180 @@
.manual-update-pill.outline:disabled {
cursor: default;
- opacity: 0.8;
+ opacity: 0.6;
}
-.manual-update-actions .manual-update-pill {
- margin-top: 0;
+/* ── Unified Update Indicator Dots ── */
+.update-dot {
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+ flex-shrink: 0;
+ display: inline-block;
+ background: #30d158;
+ box-shadow: 0 0 8px rgba(48, 209, 88, 0.6);
}
-.manual-update-actions .manual-update-pill.primary {
- flex: 1;
+.update-dot.checking {
+ animation: dotPulse 1.2s ease-in-out infinite;
}
-.manual-update-actions .manual-update-pill.outline {
- width: auto;
- padding: 0 16px;
+@keyframes dotPulse {
+ 0%, 100% {
+ opacity: 1;
+ transform: scale(1);
+ box-shadow: 0 0 8px rgba(48, 209, 88, 0.6);
+ }
+ 50% {
+ opacity: 0.4;
+ transform: scale(0.85);
+ box-shadow: 0 0 2px rgba(48, 209, 88, 0.2);
+ }
}
-/* ── Floating Scroll Indicator Badge for Off-Screen Update Banner ── */
-.floating-update-pill {
- position: absolute;
- bottom: 14px;
- left: 0;
- right: 0;
- margin: 0 auto;
- width: fit-content;
- max-width: calc(100% - 32px);
- height: 30px;
- padding: 0 14px;
+/* ── Unified Group Labels & Header for Update Cards ── */
+.update-header-row {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ width: 100%;
+ margin-bottom: 3px;
+}
+
+.update-group-label {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ font-size: 9.5px;
+ font-weight: 700;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: rgba(255, 255, 255, 0.45);
+ margin: 0;
+ user-select: none;
+}
+
+.update-info-btn {
display: inline-flex;
align-items: center;
justify-content: center;
+ width: 20px;
+ height: 20px;
+ margin: -2px -2px 0 0;
+ padding: 0;
+ border: none;
+ border-radius: 6px;
+ background: transparent;
+ color: rgba(255, 255, 255, 0.45);
+ cursor: pointer;
+ outline: none;
+ transition: color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
+ flex-shrink: 0;
+}
+
+.update-info-btn:hover {
+ color: #ffffff;
+ background: rgba(255, 255, 255, 0.08);
+ transform: scale(1.08);
+}
+
+.update-info-btn:active {
+ transform: scale(0.95);
+}
+
+/* ── Unified Action Row and Buttons ── */
+.update-action-row {
+ display: flex;
+ align-items: center;
gap: 8px;
- background: #121212;
- border: 1px solid rgba(255, 255, 255, 0.16);
- border-radius: 999px;
+ width: 100%;
+}
+
+.update-action-btn {
+ height: 32px;
+ min-height: 32px;
+ max-height: 32px;
+ padding: 0 12px;
+ border-radius: 10px;
font-size: 11.5px;
font-weight: 600;
- color: #ffffff;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ box-sizing: border-box;
cursor: pointer;
- box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
- z-index: 40;
+ border: none;
+ transition: all 0.15s ease;
white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ outline: none;
user-select: none;
- font-variant-numeric: tabular-nums;
- transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
-.floating-update-pill:hover {
- background: #242424;
- border-color: rgba(255, 255, 255, 0.28);
- transform: translateY(-2px);
+.update-action-btn:active:not(:disabled) {
+ transform: scale(0.98);
}
-.floating-update-pill:active {
- transform: scale(0.97);
+.update-action-btn.full-width {
+ width: 100%;
}
-.floating-update-dot {
- width: 6px;
- height: 6px;
- border-radius: 50%;
- flex-shrink: 0;
+.update-action-btn.primary {
background: #ffffff;
- animation: dotPulse 1.2s ease-in-out infinite;
+ color: #000000;
+ box-shadow: 0 0 14px rgba(255, 255, 255, 0.16), 0 2px 8px rgba(0, 0, 0, 0.35);
+ animation: updateBtnGlow 3s ease-in-out infinite;
}
-.floating-update-text {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
+.update-action-btn.primary:hover:not(:disabled) {
+ background: #ffffff;
+ box-shadow: 0 0 22px rgba(255, 255, 255, 0.35), 0 4px 12px rgba(0, 0, 0, 0.45);
+ transform: translateY(-1px);
}
-.floating-update-arrow {
- font-size: 11px;
- opacity: 0.85;
- transition: transform 0.15s ease;
+@keyframes updateBtnGlow {
+ 0%, 100% {
+ box-shadow: 0 0 12px rgba(255, 255, 255, 0.12), 0 2px 6px rgba(0, 0, 0, 0.35);
+ }
+ 50% {
+ box-shadow: 0 0 20px rgba(255, 255, 255, 0.28), 0 2px 8px rgba(0, 0, 0, 0.4);
+ }
+}
+
+.update-action-btn.secondary {
+ background: rgba(255, 255, 255, 0.06);
+ border: 1px solid rgba(255, 255, 255, 0.12);
+ color: rgba(255, 255, 255, 0.85);
+ font-weight: 500;
}
-.floating-update-pill:hover .floating-update-arrow {
- transform: translateY(1px);
+.update-action-btn.secondary:hover:not(:disabled) {
+ background: rgba(255, 255, 255, 0.11);
+ border-color: rgba(255, 255, 255, 0.22);
+ color: #ffffff;
+ transform: translateY(-1px);
+}
+
+.update-action-btn.secondary:disabled {
+ opacity: 0.6;
+ cursor: default;
+}
+
+/* ── Promoted Active Update Card at Top/Front (Border-free) ── */
+.update-promoted-card {
+ background: var(--bg-card, #141414) !important;
+ border: none !important;
+ box-shadow: none !important;
+ transition: background 0.14s ease;
+}
+
+.update-promoted-card:hover {
+ background: var(--bg-card-hover, #1c1c1c) !important;
+}
+
+.settings-shelf-card.update-promoted-card {
+ width: 250px;
}
/* ==========================================================================
@@ -1961,9 +2029,7 @@
}
.settings-shelf-card.update-card {
- width: 290px;
- background: linear-gradient(180deg, rgba(255, 214, 10, 0.08) 0%, #141414 100%);
- box-shadow: 0 4px 20px rgba(255, 214, 10, 0.08);
+ width: 250px;
}
/* Card Header */
@@ -2139,17 +2205,19 @@
transform: scale(0.98);
}
-/* Update Progress inside Shelf */
+/* Update Progress inside Shelf / Vertical Settings */
.shelf-update-progress-wrap {
width: 100%;
- height: 24px;
- background: rgba(255, 255, 255, 0.06);
- border-radius: 6px;
+ height: 32px;
+ background: rgba(255, 255, 255, 0.05);
+ border: 1px solid rgba(255, 255, 255, 0.10);
+ border-radius: 10px;
position: relative;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
+ box-sizing: border-box;
}
.shelf-progress-bar {
@@ -2157,14 +2225,334 @@
left: 0;
top: 0;
bottom: 0;
- background: rgba(255, 214, 10, 0.4);
+ background: rgba(255, 255, 255, 0.18);
transition: width 0.2s ease;
}
.shelf-progress-text {
position: relative;
z-index: 1;
- font-size: 11px;
+ font-size: 11.5px;
font-weight: 600;
color: #ffffff;
+ letter-spacing: 0.01em;
+}
+
+/* ── SlideCommit Swipe-to-Confirm Capsule ── */
+.slide-commit {
+ --sc-track: rgba(255, 255, 255, 0.08);
+ --sc-ink: #ffffff;
+ --sc-ok: #ffffff;
+ --sc-no: #ff453a;
+ --sc-on-ink: #000000;
+ --sc-on-ok: #000000;
+ --sc-on-no: #ffffff;
+ --sc-radius: 10px;
+ --sc-grip-r: 7px;
+ --sc-pad: 3px;
+ --sc-font: 11.5px;
+
+ position: relative;
+ display: block;
+ width: 100%;
+ box-sizing: border-box;
+ vertical-align: middle;
+ font-family: inherit;
+}
+
+.slide-commit[data-disabled] {
+ opacity: 0.55;
+ pointer-events: none;
+}
+
+.slide-commit__track {
+ position: relative;
+ width: 100%;
+ height: 100%;
+ border-radius: var(--sc-radius);
+ background: var(--sc-track);
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ box-sizing: border-box;
+ cursor: grab;
+ touch-action: none;
+ user-select: none;
+ -webkit-user-select: none;
+ -webkit-touch-callout: none;
+ -webkit-tap-highlight-color: transparent;
+ overflow: hidden;
+ box-shadow: 0 0 10px rgba(255, 255, 255, 0.06);
+ transition: border-color 0.2s ease, box-shadow 0.2s ease;
+}
+
+.slide-commit:hover .slide-commit__track {
+ border-color: rgba(255, 255, 255, 0.16);
+ box-shadow: 0 0 16px rgba(255, 255, 255, 0.12);
+}
+
+.slide-commit[data-held] .slide-commit__track {
+ cursor: grabbing;
+}
+
+.slide-commit[data-phase='pending'] .slide-commit__track,
+.slide-commit[data-phase='done'] .slide-commit__track {
+ cursor: default;
+}
+
+.slide-commit__label {
+ position: absolute;
+ inset: 0;
+ display: grid;
+ place-items: center;
+ pointer-events: none;
+ font-size: var(--sc-font);
+ font-weight: 550;
+ line-height: 1;
+ letter-spacing: 0.01em;
+ white-space: nowrap;
}
+
+.slide-commit__text {
+ grid-area: 1 / 1;
+ color: rgba(255, 255, 255, 0.65);
+ transition:
+ opacity 200ms ease,
+ filter 200ms ease;
+}
+
+.slide-commit__text--error {
+ color: var(--sc-no);
+ opacity: 0;
+ filter: blur(2px);
+}
+
+.slide-commit[data-phase='error'] .slide-commit__text--plain {
+ opacity: 0;
+ filter: blur(2px);
+}
+
+.slide-commit[data-phase='error'] .slide-commit__text--error {
+ opacity: 1;
+ filter: none;
+}
+
+.slide-commit__capsule {
+ position: absolute;
+ top: var(--sc-pad);
+ left: var(--sc-pad);
+ width: calc(100% - var(--sc-pad) * 2);
+ height: calc(100% - var(--sc-pad) * 2);
+ background: var(--sc-ink);
+ color: var(--sc-on-ink);
+ outline: none;
+ transition:
+ background-color 200ms ease,
+ color 200ms ease;
+ box-shadow: 0 0 12px rgba(255, 255, 255, 0.24), 0 1px 4px rgba(0, 0, 0, 0.3);
+}
+
+.slide-commit[data-phase='done'] .slide-commit__capsule {
+ background: var(--sc-ok);
+ color: var(--sc-on-ok);
+}
+
+.slide-commit[data-phase='error'] .slide-commit__capsule {
+ background: var(--sc-no);
+ color: var(--sc-on-no);
+}
+
+.slide-commit__capsule:focus-visible {
+ box-shadow: inset 0 0 0 2px var(--sc-track);
+}
+
+.slide-commit__content {
+ position: absolute;
+ inset: 0;
+}
+
+.slide-commit__arrow,
+.slide-commit__spin,
+.slide-commit__done {
+ position: absolute;
+ inset: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 6px;
+ pointer-events: none;
+ font-size: var(--sc-font);
+ font-weight: 600;
+ line-height: 1;
+ letter-spacing: -0.006em;
+ white-space: nowrap;
+}
+
+.slide-commit__arrow svg,
+.slide-commit__done svg,
+.slide-commit__spinner {
+ display: block;
+}
+
+.slide-commit__arrow,
+.slide-commit__spin {
+ transition: filter 200ms ease;
+}
+
+.slide-commit[data-phase='pending'] .slide-commit__arrow {
+ filter: blur(2px);
+}
+
+.slide-commit:not([data-phase='pending']) .slide-commit__spin {
+ filter: blur(2px);
+}
+
+.slide-commit__spinner {
+ animation: slide-commit-spin 1s linear infinite;
+ animation-play-state: paused;
+}
+
+.slide-commit[data-phase='pending'] .slide-commit__spinner {
+ animation-play-state: running;
+}
+
+@keyframes slide-commit-spin {
+ to {
+ transform: rotate(360deg);
+ }
+}
+
+.slide-commit__sr {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ margin: -1px;
+ padding: 0;
+ border: 0;
+ overflow: hidden;
+ clip: rect(0 0 0 0);
+ white-space: nowrap;
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .slide-commit__spinner {
+ animation: slide-commit-breathe 1.4s ease-in-out infinite;
+ animation-play-state: paused;
+ }
+
+ .slide-commit[data-phase='pending'] .slide-commit__spinner {
+ animation-play-state: running;
+ }
+
+ @keyframes slide-commit-breathe {
+ 0%,
+ 100% {
+ opacity: 1;
+ }
+
+ 50% {
+ opacity: 0.4;
+ }
+ }
+}
+
+/* ── WakeSlider Segmented Wave Slider ── */
+.wake-slider {
+ --ws-fill: #ffffff;
+ --ws-track: rgba(255, 255, 255, 0.12);
+ --ws-crest: #ffffff;
+ --ws-height: 28px;
+ --ws-gap: 3px;
+ --ws-rest: 0.28;
+
+ display: inline-flex;
+ align-items: center;
+ gap: 10px;
+ width: 100%;
+ color: inherit;
+ box-sizing: border-box;
+}
+
+.wake-slider[aria-disabled='true'] {
+ opacity: 0.5;
+ pointer-events: none;
+}
+
+.wake-slider__track {
+ position: relative;
+ display: flex;
+ flex: 1 1 auto;
+ align-items: center;
+ gap: var(--ws-gap);
+ height: var(--ws-height);
+ min-height: 26px;
+ touch-action: none;
+ user-select: none;
+ -webkit-user-select: none;
+ -webkit-touch-callout: none;
+ -webkit-tap-highlight-color: transparent;
+ cursor: grab;
+}
+
+.wake-slider__track:active {
+ cursor: grabbing;
+}
+
+.wake-slider__bar {
+ position: relative;
+ flex: 1 1 0;
+ min-width: 0;
+ height: var(--ws-height);
+ border-radius: 9999px;
+ background: var(--ws-track);
+ transform: scaleY(var(--ws-rest));
+ transform-origin: 50% 50%;
+ transition: background-color 100ms ease;
+ will-change: transform;
+}
+
+.wake-slider__bar[data-on='true'] {
+ background: var(--ws-fill);
+}
+
+.wake-slider[data-instant='true'] .wake-slider__bar {
+ transition-duration: 0ms;
+}
+
+.wake-slider__crest {
+ position: absolute;
+ inset: 0;
+ border-radius: inherit;
+ background: var(--ws-crest);
+ opacity: 0;
+ pointer-events: none;
+}
+
+.wake-slider__handle {
+ position: absolute;
+ inset: 0;
+ margin: 0;
+ padding: 0;
+ border: 0;
+ border-radius: 8px;
+ background: transparent;
+ outline: none;
+ cursor: inherit;
+ touch-action: none;
+ -webkit-tap-highlight-color: transparent;
+}
+
+.wake-slider__value {
+ min-width: 3ch;
+ font-size: 11.5px;
+ font-weight: 600;
+ font-variant-numeric: tabular-nums;
+ text-align: right;
+ color: rgba(255, 255, 255, 0.85);
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .wake-slider__bar {
+ transform: scaleY(var(--ws-rest)) !important;
+ }
+}
+
+
diff --git a/tests/storePackaging.test.ts b/tests/storePackaging.test.ts
index 31079f0..efc022f 100644
--- a/tests/storePackaging.test.ts
+++ b/tests/storePackaging.test.ts
@@ -185,7 +185,8 @@ describe('GitHub vs Store packaging contracts (on-disk, not assumed)', () => {
const src = read('src/components/Settings.tsx')
expect(src).toContain('{!isStoreBuild && (')
expect(src).toContain('behaviour.autoUpdatesTitle')
- expect(src).toContain('hasUpdatePrompt = !isStoreBuild &&')
+ expect(src).toContain('hasPromotedTopUpdate = !isStoreBuild &&')
+ expect(src).toContain('if (isStoreBuild) return null')
})
it('Settings renders Store review button on Store builds and GitHub star on GitHub builds', () => {
diff --git a/tests/updatePlacement.test.ts b/tests/updatePlacement.test.ts
new file mode 100644
index 0000000..4cd8202
--- /dev/null
+++ b/tests/updatePlacement.test.ts
@@ -0,0 +1,33 @@
+import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { join } from 'node:path'
+
+const root = join(__dirname, '..')
+
+function read(rel: string): string {
+ return readFileSync(join(root, rel), 'utf8')
+}
+
+describe('update prompt placement contracts (promoted lifecycle, bottom hides while active)', () => {
+ it('promoted gate includes downloading and downloaded states seamlessly', () => {
+ const src = read('src/components/Settings.tsx')
+ // Top card shows all active update lifecycle stages.
+ expect(src).toContain('hasPromotedTopUpdate = !isStoreBuild && (')
+ // Bottom manual card and horizontal status card hide while promoted.
+ expect(src).toContain('if (isStoreBuild || hasPromotedTopUpdate) return null')
+ expect(src).toContain('{!isStoreBuild && !hasPromotedTopUpdate && (')
+ })
+
+ it('store tracks manual-flow ownership across check, download, and dismiss', () => {
+ const src = read('src/store/appStore.ts')
+ expect(src).toContain('manualUpdateActive: boolean')
+ expect(src).toContain('manualUpdateActive: true')
+ // Dismiss and stale-result paths release ownership.
+ expect(src).toContain('manualUpdateActive: false')
+ })
+
+ it('a background find for a newer version retires stale manual results', () => {
+ const src = read('src/store/appStore.ts')
+ expect(src).toContain("mc.version !== info.version")
+ })
+})