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: add automatic updates toggle, manual update workflow, store build isolation, image title formatting, and smooth flyout transitions

Deepender25fffe79d7ab85
diff --git a/electron/main/ipc.ts b/electron/main/ipc.ts
index 6732a47..27d99da 100644
--- a/electron/main/ipc.ts
+++ b/electron/main/ipc.ts
@@ -20,7 +20,7 @@ import { rebuildTrayMenu } from './tray'
import { startDragOut, resolveDragData } from './drag'
import { clipboardSignature } from '../clipboard/formats'
import type { ItemData, MergeResult } from '../../shared/types'
-import { quitAndInstallUpdate } from './updater'
+import { quitAndInstallUpdate, checkForUpdatesManual, startUpdateDownload, syncAutoUpdaterState } from './updater'
/**
* Returns true if the current system clipboard content matches the given item data.
@@ -180,7 +180,8 @@ export function registerIpc(): void {
return {
items: getStore().toDto(),
settings: loadSettings(),
- version: app.getVersion()
+ version: app.getVersion(),
+ isStoreBuild: isStoreBuild()
}
})
@@ -190,6 +191,16 @@ export function registerIpc(): void {
quitAndInstallUpdate()
})
+ handle('updater:check-manual', async () => {
+ if (isStoreBuild()) return { status: 'up-to-date', version: app.getVersion() }
+ return checkForUpdatesManual()
+ })
+
+ handle('updater:start-download', async () => {
+ if (isStoreBuild()) return
+ await startUpdateDownload()
+ })
+
handle('app:quit', () => {
console.log('[IPC] app:quit requested by renderer — quitting application')
app.quit()
@@ -495,6 +506,9 @@ export function registerIpc(): void {
popUpAndRetract(1500)
}
}
+ if (patch.autoUpdates !== undefined) {
+ syncAutoUpdaterState()
+ }
pushState.settings(next)
rebuildTrayMenu()
return next
@@ -857,9 +871,13 @@ async function fetchAndCacheReleases() {
}
}
-// Background pre-fetch 3 seconds after startup so releases are cached in memory before user opens Settings
+// Background pre-fetch 3 seconds after startup ONLY if autoUpdates is enabled
setTimeout(() => {
- fetchAndCacheReleases().catch(() => {})
+ if (loadSettings().autoUpdates !== false) {
+ fetchAndCacheReleases().catch(() => {})
+ } else {
+ console.log('[IPC] Automatic updates disabled by setting; using bundled static release notes.')
+ }
}, 3000)
diff --git a/electron/main/updater.ts b/electron/main/updater.ts
index 1ad14db..5c56390 100644
--- a/electron/main/updater.ts
+++ b/electron/main/updater.ts
@@ -1,18 +1,17 @@
import { app } from 'electron'
import { isStoreBuild } from './ipc'
import { pushState } from './state'
+import { getSettings } from '../store/settings'
// Module-level reference to the single autoUpdater instance.
-// This is the ONLY instance — both the download logic and the
-// quitAndInstall trigger must use this exact reference.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let _autoUpdater: any = null
/**
* Called from ipc.ts when the renderer clicks "Restart to Update".
- * Uses the same autoUpdater instance that performed the download.
*/
export function quitAndInstallUpdate(): void {
+ if (isStoreBuild()) return
if (!_autoUpdater) {
console.error('[AutoUpdater] quitAndInstall requested but autoUpdater is not initialized.')
return
@@ -25,6 +24,60 @@ export function quitAndInstallUpdate(): void {
_autoUpdater.quitAndInstall(false, true)
}
+/**
+ * Syncs the autoDownload flag on electron-updater whenever user changes settings.
+ */
+export function syncAutoUpdaterState(): void {
+ if (isStoreBuild() || !_autoUpdater) return
+ const settings = getSettings()
+ const enabled = settings.autoUpdates !== false
+ _autoUpdater.autoDownload = enabled
+ _autoUpdater.autoInstallOnAppQuit = enabled
+ console.log('[AutoUpdater] Synced autoDownload =', enabled)
+}
+
+/**
+ * Manually check for updates on user click.
+ */
+export async function checkForUpdatesManual(): Promise<{ status: string; version?: string; error?: string }> {
+ if (isStoreBuild()) {
+ return { status: 'up-to-date', version: app.getVersion() }
+ }
+ if (!_autoUpdater) {
+ try {
+ const { autoUpdater } = require('electron-updater')
+ _autoUpdater = autoUpdater
+ } catch (err: any) {
+ return { status: 'error', error: err?.message || 'AutoUpdater not initialized' }
+ }
+ }
+
+ try {
+ // Strictly disable autoDownload for manual checks so it only downloads on explicit user click!
+ _autoUpdater.autoDownload = false
+ _autoUpdater.autoInstallOnAppQuit = false
+ const result = await _autoUpdater.checkForUpdates()
+ if (result && result.updateInfo && result.updateInfo.version !== app.getVersion()) {
+ return { status: 'available', version: result.updateInfo.version }
+ }
+ return { status: 'up-to-date', version: app.getVersion() }
+ } catch (err: any) {
+ return { status: 'error', error: typeof err === 'string' ? err : err?.message || 'Failed to check for updates' }
+ }
+}
+
+/**
+ * Trigger download of the update when user clicks "Download & Update" in manual mode.
+ */
+export async function startUpdateDownload(): Promise<void> {
+ if (isStoreBuild() || !_autoUpdater) return
+ try {
+ await _autoUpdater.downloadUpdate()
+ } catch (err) {
+ console.error('[AutoUpdater] downloadUpdate failed:', err)
+ }
+}
+
/**
* Initializes electron-updater for GitHub release auto-updates.
* Completely disabled on Microsoft Store (MSIX) builds to comply with Store policies.
@@ -37,16 +90,15 @@ export function initAutoUpdater(): void {
try {
const { autoUpdater } = require('electron-updater')
-
- // Store the module-level reference so quitAndInstallUpdate() can use it
_autoUpdater = autoUpdater
- // Verbose console logging for diagnostics
+ const settings = getSettings()
+ const autoUpdatesEnabled = settings.autoUpdates !== false
+
autoUpdater.logger = console
- autoUpdater.autoDownload = true
- autoUpdater.autoInstallOnAppQuit = true
+ autoUpdater.autoDownload = autoUpdatesEnabled
+ autoUpdater.autoInstallOnAppQuit = autoUpdatesEnabled
- // Enable dev-mode testing if unpackaged
if (!app.isPackaged) {
console.log('[AutoUpdater] Unpackaged dev build detected — enabling forceDevUpdateConfig')
autoUpdater.forceDevUpdateConfig = true
@@ -75,13 +127,17 @@ export function initAutoUpdater(): void {
console.warn('[AutoUpdater] Update check error:', msg)
})
- // Initiate background update check 3 seconds after startup
- setTimeout(() => {
- autoUpdater.checkForUpdates().catch((err: Error | string) => {
- const msg = typeof err === 'string' ? err : err?.message
- console.warn('[AutoUpdater] checkForUpdates failed:', msg)
- })
- }, 3000)
+ // Initiate background update check ONLY if autoUpdates is enabled!
+ if (autoUpdatesEnabled) {
+ setTimeout(() => {
+ autoUpdater.checkForUpdates().catch((err: Error | string) => {
+ const msg = typeof err === 'string' ? err : err?.message
+ console.warn('[AutoUpdater] checkForUpdates failed:', msg)
+ })
+ }, 3000)
+ } else {
+ console.log('[AutoUpdater] Automatic updates disabled by user setting. Staying network-silent on startup.')
+ }
} catch (err) {
console.error('[AutoUpdater] Initialization failed:', err)
}
diff --git a/electron/preload/index.ts b/electron/preload/index.ts
index c85817e..7a8ba2c 100644
--- a/electron/preload/index.ts
+++ b/electron/preload/index.ts
@@ -100,6 +100,8 @@ const api = {
pasteItem: (id: string) => invoke('item:paste', id),
pasteSubitem: (req: import('../../shared/types').DragRequest) => invoke('item:paste-subitem', req),
installUpdate: () => invoke('app:install-update'),
+ checkForUpdatesManual: () => invoke('updater:check-manual'),
+ startUpdateDownload: () => invoke('updater:start-download'),
quitApp: () => invoke('app:quit'),
startDrag: (req: DragRequest) => send('item:start-drag', req),
addFiles: (paths: string[]) => invoke('item:add-files', paths),
diff --git a/electron/store/ItemStore.ts b/electron/store/ItemStore.ts
index f62e86d..a7f1096 100644
--- a/electron/store/ItemStore.ts
+++ b/electron/store/ItemStore.ts
@@ -233,28 +233,52 @@ export class ItemStore {
const tgt = this.items[tgtIdx]
// Determine how to merge based on kinds
- // 1. Files + Files -> Files (any non-image files stack together)
- // 2. Image(s) + Image(s) -> Image Collection
- // 3. Cross image <-> files -> reject (keeps image previews intact)
+ // 1. Image(s) + Image(s) -> Image Collection / Image File Stack (any screenshot or image file)
+ // 2. Files + Files -> Files (any non-image files stack together)
let newData: ItemData | null = null
- const srcIsImage = src.data.kind === 'image' || src.data.kind === 'image-collection'
- const tgtIsImage = tgt.data.kind === 'image' || tgt.data.kind === 'image-collection'
+ const isImageItem = (item: ClipboardItem): boolean => {
+ if (item.data.kind === 'image' || item.data.kind === 'image-collection') return true
+ if (item.data.kind === 'files' && item.data.paths.length > 0) {
+ return item.data.paths.every((p) => isImageExt(p))
+ }
+ return false
+ }
+
+ const getImagePaths = (item: ClipboardItem): string[] => {
+ if (item.data.kind === 'files') return item.data.paths
+ if (item.data.kind === 'image') return [this.imagePath(item.data.imageId, item.data.ext)]
+ if (item.data.kind === 'image-collection') return item.data.images.map((img) => this.imagePath(img.imageId, img.ext))
+ return []
+ }
+
+ const srcIsImage = isImageItem(src)
+ const tgtIsImage = isImageItem(tgt)
if (srcIsImage && tgtIsImage) {
- const srcImages = src.data.kind === 'image-collection' ? src.data.images : src.data.kind === 'image' ? [{ imageId: src.data.imageId, width: src.data.width, height: src.data.height, bytes: src.data.bytes }] : []
- const tgtImages = tgt.data.kind === 'image-collection' ? tgt.data.images : tgt.data.kind === 'image' ? [{ imageId: tgt.data.imageId, width: tgt.data.width, height: tgt.data.height, bytes: tgt.data.bytes }] : []
- // Filter out exact duplicate imageIds just in case
- const seen = new Set(tgtImages.map((i: { imageId: string }) => i.imageId))
- const combined = [...tgtImages, ...srcImages.filter((i: { imageId: string }) => !seen.has(i.imageId))]
-
- // Enforce the per-stack cap BEFORE mutating anything.
- if (combined.length > MAX_STACK) return { ok: false, reason: 'full', message: 'An image collection can hold a maximum of 10 items' }
- newData = { kind: 'image-collection', images: combined }
+ if (src.data.kind !== 'files' && tgt.data.kind !== 'files') {
+ const srcData = src.data
+ const tgtData = tgt.data
+ const srcImages = srcData.kind === 'image-collection' ? srcData.images : srcData.kind === 'image' ? [{ imageId: srcData.imageId, width: srcData.width, height: srcData.height, bytes: srcData.bytes, ext: srcData.ext }] : []
+ const tgtImages = tgtData.kind === 'image-collection' ? tgtData.images : tgtData.kind === 'image' ? [{ imageId: tgtData.imageId, width: tgtData.width, height: tgtData.height, bytes: tgtData.bytes, ext: tgtData.ext }] : []
+ const seen = new Set(tgtImages.map((i) => i.imageId))
+ const combined = [...tgtImages, ...srcImages.filter((i) => !seen.has(i.imageId))]
+
+ if (combined.length > MAX_STACK) return { ok: false, reason: 'full', message: 'An image collection can hold a maximum of 10 items' }
+ newData = { kind: 'image-collection', images: combined }
+ } else {
+ const srcPaths = getImagePaths(src)
+ const tgtPaths = getImagePaths(tgt)
+ const seen = new Set(tgtPaths)
+ const combined = [...tgtPaths, ...srcPaths.filter((p) => !seen.has(p))]
+
+ if (combined.length > MAX_STACK) return { ok: false, reason: 'full', message: 'An image collection can hold a maximum of 10 items' }
+ newData = { kind: 'files', paths: combined }
+ }
} else if (src.data.kind === 'files' && tgt.data.kind === 'files') {
const seen = new Set(tgt.data.paths)
- const combined = [...tgt.data.paths, ...src.data.paths.filter(p => !seen.has(p))]
+ const combined = [...tgt.data.paths, ...src.data.paths.filter((p) => !seen.has(p))]
if (combined.length > MAX_STACK) return { ok: false, reason: 'full', message: 'A folder bundle can hold a maximum of 10 files' }
newData = { kind: 'files', paths: combined }
@@ -365,12 +389,25 @@ export class ItemStore {
this.items.splice(sourceIndex, 1)
}
+ let newData: ItemData = { kind: 'files', paths: targetPaths }
+ if (targetPaths.length === 1) {
+ const p = targetPaths[0]
+ const imgName = pathBasename(p)
+ if (/^[a-z0-9]{6,12}-[a-z0-9]{6,12}\.[a-z0-9]+$/i.test(imgName) || p.includes('edge-drop/images') || p.includes('edge-drop\\images') || p.includes('edge-drop/temp') || p.includes('edge-drop\\temp')) {
+ const imageId = imgName.split('.')[0]
+ const ext = extname(p).slice(1) || 'png'
+ let bytes = 0
+ try { bytes = statSync(p).size } catch {}
+ newData = { kind: 'image', imageId, width: 0, height: 0, bytes, ext }
+ }
+ }
+
const newItem: ClipboardItem = {
id: createId(),
capturedAt: Date.now(),
hitCount: 1,
pinned: false,
- data: { kind: 'files', paths: targetPaths }
+ data: newData
}
this.items.splice(req.splitPlacement === 'after' ? sourceIndex + 1 : sourceIndex, 0, newItem)
this.rebuildIndex()
diff --git a/electron/store/settings.ts b/electron/store/settings.ts
index 009be34..eb072bd 100644
--- a/electron/store/settings.ts
+++ b/electron/store/settings.ts
@@ -27,6 +27,10 @@ function merge(base: Settings, patch: Partial<Settings>): Settings {
return out
}
+export function getSettings(): Settings {
+ return loadSettings()
+}
+
export function loadSettings(): Settings {
if (cache) return cache
let file: Partial<Settings> = {}
diff --git a/package.json b/package.json
index 737e72e..4c9f789 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "edge-drop",
- "version": "0.2.2",
+ "version": "0.2.1",
"description": "Edge-Drop — a clipboard manager that lives on the left edge of your screen and expands on hover.",
"author": "Edge-Drop",
"license": "Apache-2.0",
diff --git a/shared/bridge.ts b/shared/bridge.ts
index af1a1ad..316c1c0 100644
--- a/shared/bridge.ts
+++ b/shared/bridge.ts
@@ -10,7 +10,7 @@ import type { DragRequest } from './types'
export interface EdgeApi {
/* Renderer -> Main */
- loadState: () => Promise<{ items: import('./types').ClipboardItemDto[]; settings: Settings; version: string }>
+ loadState: () => Promise<{ items: import('./types').ClipboardItemDto[]; settings: Settings; version: string; isStoreBuild?: boolean }>
setPinned: (id: string, pinned: boolean) => Promise<import('./types').ClipboardItemDto[]>
deleteItem: (id: string) => Promise<import('./types').ClipboardItemDto[]>
clearItems: () => Promise<import('./types').ClipboardItemDto[]>
@@ -20,6 +20,8 @@ export interface EdgeApi {
pasteItem: (id: string) => Promise<boolean>
pasteSubitem: (req: DragRequest) => Promise<boolean>
installUpdate: () => Promise<void>
+ checkForUpdatesManual: () => Promise<{ status: string; version?: string; error?: string }>
+ startUpdateDownload: () => Promise<void>
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 809eb23..00d0c38 100644
--- a/shared/ipc.ts
+++ b/shared/ipc.ts
@@ -17,7 +17,7 @@ import type { ClipboardItemDto, DragRequest, MergeResult, Settings } from './typ
export interface InvokeMap {
/** Returns the full current item list + settings on startup. */
- 'state:load': { args: []; result: { items: ClipboardItemDto[]; settings: Settings; version: string } }
+ 'state:load': { args: []; result: { items: ClipboardItemDto[]; settings: Settings; version: string; isStoreBuild?: boolean } }
/** Set an item's pinned state. */
'item:set-pinned': { args: [id: string, pinned: boolean]; result: ClipboardItemDto[] }
@@ -68,6 +68,12 @@ export interface InvokeMap {
/** Trigger a download of the already-available update and quit-and-install. */
'app:install-update': { args: []; result: void }
+ /** Manually check for updates on user click. */
+ 'updater:check-manual': { args: []; result: { status: string; version?: string; error?: string } }
+
+ /** Start background download of an update in manual mode. */
+ 'updater:start-download': { args: []; result: void }
+
/** Quit the application process. */
'app:quit': { args: []; result: void }
diff --git a/shared/types.ts b/shared/types.ts
index 53e414f..cf1dc82 100644
--- a/shared/types.ts
+++ b/shared/types.ts
@@ -162,8 +162,10 @@ export interface Settings {
lastSeenChangelogVersion?: string
/** When true, hovering cursor near edge activates the panel. When false, panel opens exclusively via Alt + C. Default: true. */
hoverActivation?: boolean
- /** Font size scale multiplier (0.85 = Small, 1.00 = Normal, 1.15 = Large, 1.30 = XL). Default: 1.0. */
+ /** Font size scale multiplier (0.85 = Small, 1.00 = Normal, 1.15 = Large). Default: 1.0. */
fontSizeScale?: number
+ /** When true, automatically checks for and downloads app updates in background. Default: true. */
+ autoUpdates?: boolean
}
export const DEFAULT_SETTINGS: Settings = {
@@ -192,7 +194,8 @@ export const DEFAULT_SETTINGS: Settings = {
soundEffects: true,
lastSeenChangelogVersion: undefined,
hoverActivation: true,
- fontSizeScale: 1.0
+ fontSizeScale: 1.0,
+ autoUpdates: true
}
diff --git a/src/components/ChangelogView.tsx b/src/components/ChangelogView.tsx
index 5a7d77d..5547b93 100644
--- a/src/components/ChangelogView.tsx
+++ b/src/components/ChangelogView.tsx
@@ -234,8 +234,8 @@ export function ChangelogView() {
gap: '12px',
maxWidth: '100%',
overflowX: 'hidden',
- paddingBottom: index < CHANGELOG_DATA.length - 1 ? '24px' : '0',
- borderBottom: index < CHANGELOG_DATA.length - 1 ? '1px solid rgba(255, 255, 255, 0.08)' : 'none'
+ paddingBottom: index < releases.length - 1 ? '24px' : '0',
+ borderBottom: index < releases.length - 1 ? '1px solid rgba(255, 255, 255, 0.08)' : 'none'
}}
>
{/* Version Header */}
@@ -259,68 +259,57 @@ export function ChangelogView() {
border: '1px solid rgba(255, 255, 255, 0.15)',
padding: '2px 6px',
borderRadius: '4px',
- letterSpacing: '0.04em',
textTransform: 'uppercase',
- flexShrink: 0
+ letterSpacing: '0.04em'
}}>
- LATEST
+ Current
</span>
)}
</div>
- <span style={{ fontSize: '12px', color: 'rgba(255, 255, 255, 0.45)', fontWeight: 400, flexShrink: 0 }}>
- {rel.date}
- </span>
+ {rel.date && (
+ <span style={{ fontSize: '11px', color: 'rgba(255, 255, 255, 0.45)', whiteSpace: 'nowrap' }}>
+ {rel.date}
+ </span>
+ )}
</div>
{/* Summary */}
<p style={{
- fontSize: '13px',
- lineHeight: '1.6',
- color: 'rgba(255, 255, 255, 0.75)',
margin: 0,
- fontWeight: 400,
- overflowWrap: 'break-word',
- wordBreak: 'break-word'
+ fontSize: '12.5px',
+ lineHeight: '1.5',
+ color: 'rgba(255, 255, 255, 0.8)',
+ fontWeight: 400
}}>
{rel.summary}
</p>
- {/* Highlights Bullet List */}
- <div style={{ display: 'flex', flexDirection: 'column', gap: '8px', marginTop: '4px' }}>
- {rel.highlights.map((item, idx) => (
- <div
- key={idx}
- style={{
- display: 'flex',
- alignItems: 'flex-start',
- gap: '10px',
- fontSize: '13px',
- lineHeight: '1.55',
- minWidth: 0
- }}
- >
- <span style={{
- color: 'rgba(255, 255, 255, 0.35)',
- fontSize: '14px',
- lineHeight: '1.5',
- userSelect: 'none',
- flexShrink: 0
- }}>
- •
- </span>
- <div style={{ display: 'flex', flexDirection: 'column', gap: '2px', flex: 1, minWidth: 0 }}>
- <span style={{ fontWeight: 600, color: 'rgba(255, 255, 255, 0.95)', overflowWrap: 'break-word', wordBreak: 'break-word' }}>
- {item.title}
- </span>
- {item.description && (
- <span style={{ color: 'rgba(255, 255, 255, 0.6)', fontSize: '12.5px', lineHeight: '1.5', overflowWrap: 'break-word', wordBreak: 'break-word' }}>
- {item.description}
- </span>
- )}
+ {/* Highlights List */}
+ {rel.highlights && rel.highlights.length > 0 && (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '8px', marginTop: '4px' }}>
+ {rel.highlights.map((h, hIdx) => (
+ <div
+ key={hIdx}
+ style={{
+ background: 'rgba(255, 255, 255, 0.03)',
+ border: '1px solid rgba(255, 255, 255, 0.06)',
+ borderRadius: '8px',
+ padding: '10px 12px',
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '4px'
+ }}
+ >
+ <div style={{ fontSize: '12px', fontWeight: 600, color: '#ffffff' }}>
+ {h.title}
+ </div>
+ <div style={{ fontSize: '11.5px', lineHeight: '1.4', color: 'rgba(255, 255, 255, 0.6)' }}>
+ {h.description}
+ </div>
</div>
- </div>
- ))}
- </div>
+ ))}
+ </div>
+ )}
</div>
)
})}
diff --git a/src/components/ClipboardItem.tsx b/src/components/ClipboardItem.tsx
index ae4ae60..820981e 100644
--- a/src/components/ClipboardItem.tsx
+++ b/src/components/ClipboardItem.tsx
@@ -21,9 +21,9 @@ import { MAX_STACK } from '../../shared/types'
import type { DragRequest } from '../../shared/types'
import { useStore } from '../store/appStore'
import { useDragOut } from '../hooks/useDragOut'
-import { basename, formatBytes, previewText, relativeTime } from '../lib/format'
+import { basename, formatBytes, previewText, relativeTime, formatImageDisplayName } from '../lib/format'
import { getFileKind } from '../lib/fileType'
-import { playButtonClickSound, playToggleSound, playDeleteSound } from '../lib/soundEffects'
+import { playButtonClickSound, playToggleSound, playDeleteSound, playCardExpandSound } from '../lib/soundEffects'
import { CopyIcon, FileKindIcon, ImageIcon, LinkIcon, PinIcon, PinFillIcon, TrashIcon, MinusIcon, ChevronUpIcon, ExpandIcon, ContractIcon, ExternalLinkIcon } from './icons'
import '../styles/item.css'
@@ -76,6 +76,7 @@ function ClipboardItemBase({ item }: Props) {
const onExpand = useCallback((e?: React.MouseEvent) => {
e?.stopPropagation()
if (isBundle) {
+ playCardExpandSound(true)
setExpanded(true)
if (useStore.getState().tutorialStep === 4 && item.id === 'onboarding-files') {
useStore.getState().setTutorialStep(5)
@@ -85,6 +86,7 @@ function ClipboardItemBase({ item }: Props) {
const onCollapse = useCallback((e?: React.MouseEvent) => {
e?.stopPropagation()
+ playCardExpandSound(false)
setExpanded(false)
}, [])
@@ -222,7 +224,7 @@ function ClipboardItemBase({ item }: Props) {
onClick={(e) => {
e.stopPropagation()
e.currentTarget.blur()
- playButtonClickSound()
+ playCardExpandSound(!isPreviewing)
const rect = e.currentTarget.closest('.item-main')?.getBoundingClientRect()
const rectData = rect ? { y: rect.y, height: rect.height } : undefined
useStore.getState().setPreviewItemId(isPreviewing ? null : item.id, rectData)
@@ -502,7 +504,7 @@ function BundleFluidPreview({
</div>
{paths.map((filePath, idx) => {
const entry = entries?.[idx]
- const name = entry?.name ?? basename(filePath)
+ const name = formatImageDisplayName(entry?.name ?? filePath, item.capturedAt)
const size = entry?.size ?? 0
return (
<motion.div
@@ -642,27 +644,33 @@ function Preview({ item }: { item: ClipboardItemDto }) {
case 'files': {
const first = item.data.paths[0]
const entry = item.data.entries?.[0]
- const name = entry?.name ?? basename(first)
+ const rawName = entry?.name ?? basename(first)
+ const displayName = formatImageDisplayName(first, item.capturedAt)
+ const isInternalHash = /^[a-z0-9]{6,12}-[a-z0-9]{6,12}\.[a-z0-9]+$/i.test(rawName) || first.includes('edge-drop/images') || first.includes('edge-drop\\images') || first.includes('edge-drop/temp') || first.includes('edge-drop\\temp')
const isImage = entry?.isImage || getFileKind(first).kind === 'image'
// Single image file — show its thumbnail.
if (item.data.paths.length === 1 && isImage) {
return (
- <div className="thumb-wrap">
- {entry?.preview ? (
- <img
- className="thumb"
- src={entry.preview}
- alt=""
- draggable={false}
- />
- ) : (
- <div className="preview">[image: {name}]</div>
- )}
- <div className="preview single">
- {name}
+ <>
+ <div className="thumb-wrap">
+ {entry?.preview ? (
+ <img
+ className="thumb"
+ src={entry.preview}
+ alt=""
+ draggable={false}
+ />
+ ) : (
+ <div className="preview">[image: {displayName}]</div>
+ )}
</div>
- </div>
+ {!isInternalHash && (
+ <div className="preview single" style={{ marginTop: 4 }}>
+ {displayName}
+ </div>
+ )}
+ </>
)
}
// Non-image single file — show a tinted type icon alongside its name.
@@ -674,7 +682,7 @@ function Preview({ item }: { item: ClipboardItemDto }) {
</div>
<div className="single-file-meta">
<div className="preview single">
- {name}
+ {displayName}
</div>
<div className="single-file-sub">
{info.label}{entry && entry.size > 0 ? ` · ${formatBytes(entry.size)}` : ''}
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index 1baf480..86d7a83 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -177,9 +177,21 @@ export function Header() {
title={settingsOpen ? 'Close Settings' : 'Settings'}
onClick={() => {
playButtonClickSound()
- setSettingsOpen(!settingsOpen)
if (settingsOpen) {
+ setSettingsOpen(false)
setSettingsSubView('main')
+ return
+ }
+ const state = useStore.getState()
+ const hasActiveFlyout = !!(state.previewItemId || state.styleFlyoutOpen)
+ if (hasActiveFlyout) {
+ state.setPreviewItemId(null)
+ state.setStyleFlyoutOpen(false)
+ setTimeout(() => {
+ useStore.getState().setSettingsOpen(true)
+ }, 220)
+ } else {
+ setSettingsOpen(true)
}
}}
style={{
@@ -197,7 +209,7 @@ export function Header() {
}}
>
{settingsOpen ? <CloseIcon /> : <GearIcon />}
- {!settingsOpen && updateInfo?.hasUpdate && (
+ {!settingsOpen && (updateInfo?.downloaded || ((settings.autoUpdates ?? true) && updateInfo?.hasUpdate)) && (
<span
style={{
position: 'absolute',
@@ -206,7 +218,7 @@ export function Header() {
width: 8,
height: 8,
borderRadius: '50%',
- backgroundColor: '#f97316',
+ backgroundColor: updateInfo?.downloaded ? '#4caf50' : '#f97316',
border: '1.5px solid #000000',
pointerEvents: 'none'
}}
diff --git a/src/components/ItemList.tsx b/src/components/ItemList.tsx
index 0a2e7be..19d2f9c 100644
--- a/src/components/ItemList.tsx
+++ b/src/components/ItemList.tsx
@@ -15,6 +15,7 @@ import { useFilteredItems } from '../hooks/useFilteredItems'
import { ClipboardItemCard } from './ClipboardItem'
import { EmptyState } from './EmptyState'
import { ChevronDownIcon, PinFillIcon } from './icons'
+import { playExpandSound } from '../lib/soundEffects'
export function ItemList() {
const { pinned, recent } = useFilteredItems()
@@ -200,7 +201,11 @@ export function ItemList() {
<section className="pinned-section">
<div
className={`section-label pinned-header-interactive ${pinnedCollapsed ? 'is-collapsed' : ''}`}
- onClick={() => setPinnedCollapsed(!pinnedCollapsed)}
+ onClick={() => {
+ const next = !pinnedCollapsed
+ playExpandSound(!next)
+ setPinnedCollapsed(next)
+ }}
title={pinnedCollapsed ? "Click to expand pinned items" : "Click to collapse pinned items"}
>
<div className="pinned-header-left">
diff --git a/src/components/PreviewFlyout.tsx b/src/components/PreviewFlyout.tsx
index 7af5cfb..966381e 100644
--- a/src/components/PreviewFlyout.tsx
+++ b/src/components/PreviewFlyout.tsx
@@ -1,7 +1,7 @@
import { useState, useRef, useEffect } from 'react'
import { motion, AnimatePresence } from 'framer-motion'
import { useStore } from '../store/appStore'
-import { formatBytes } from '../lib/format'
+import { formatBytes, formatImageDisplayName } from '../lib/format'
import { getFileKind } from '../lib/fileType'
import { FileKindIcon, FolderOpenIcon, CopyIcon, CheckIcon, ExternalLinkIcon, CloseIcon } from './icons'
import { createPortal } from 'react-dom'
@@ -717,7 +717,7 @@ function PreviewContent({
if (isSingleImage) {
const p = item.data.paths[0]
const entry = item.data.entries?.[0]
- const fileName = entry?.name || p.split(/[\\\/]/).pop() || p
+ const fileName = formatImageDisplayName(entry?.name || p, item.capturedAt)
const fullResUrl = `edgelocal://file/${encodeURIComponent(p.replace(/\\/g, '/'))}`
return (
<div
@@ -797,7 +797,7 @@ function PreviewContent({
{item.data.paths.map((p: string, i: number) => {
const entry = item.data.entries?.[i]
const info = getFileKind(p)
- const fileName = entry?.name || p.split(/[\\\/]/).pop() || p
+ const fileName = formatImageDisplayName(entry?.name || p, item.capturedAt)
const isSelected = selectedKeys?.has(p) ?? false
const isImg = entry?.isImage || info.kind === 'image'
diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx
index 4ad73d5..296c1ea 100644
--- a/src/components/Settings.tsx
+++ b/src/components/Settings.tsx
@@ -21,7 +21,7 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool
const settings = useStore((s) => s.settings)
const patch = useStore((s) => s.patchSettings)
const updateInfo = useStore((s) => s.updateInfo)
- const installUpdate = useStore((s) => s.installUpdate)
+ const isStoreBuild = useStore((s) => s.isStoreBuild)
const currentVersion = useStore((s) => s.currentVersion)
const styleFlyoutOpen = useStore((s) => s.styleFlyoutOpen)
const setStyleFlyoutOpen = useStore((s) => s.setStyleFlyoutOpen)
@@ -69,6 +69,40 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool
window.edge.getDisplays().then(setDisplays).catch(() => {})
}, [])
+ const updateDownloaded = updateInfo?.downloaded ? { version: updateInfo.latestVersion } : null
+ const autoUpdates = settings.autoUpdates ?? true
+
+ const [checkState, setCheckState] = useState<{
+ status: 'idle' | 'checking' | 'up-to-date' | 'available' | 'downloading' | 'error'
+ version?: string
+ error?: string
+ }>({ status: 'idle' })
+
+ const handleManualCheck = async () => {
+ setCheckState({ status: 'checking' })
+ try {
+ const res = await window.edge.checkForUpdatesManual()
+ if (res.status === 'available') {
+ setCheckState({ status: 'available', version: res.version })
+ } else if (res.status === 'up-to-date') {
+ setCheckState({ status: 'up-to-date', version: res.version })
+ } else {
+ setCheckState({ status: 'error', error: res.error || 'Check failed' })
+ }
+ } catch (err: any) {
+ setCheckState({ status: 'error', error: err?.message || 'Check failed' })
+ }
+ }
+
+ const handleStartDownload = async () => {
+ setCheckState({ status: 'downloading' })
+ try {
+ await window.edge.startUpdateDownload()
+ } catch {
+ setCheckState({ status: 'error', error: 'Download failed' })
+ }
+ }
+
// ── Tab state & Independent Scroll Memory per section ──────────────────────
const [activeTab, setActiveTab] = useState<SettingsTab>('behaviour')
const scrollListRef = useRef<HTMLDivElement>(null)
@@ -216,27 +250,6 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool
{/* ── Scrollable Content Area (Independent per section) ───────── */}
<div className="settings-scroll-list" ref={scrollListRef}>
- {/* ── Update Banner (Prominently displayed at top of all sections) ── */}
- {updateInfo?.hasUpdate && (
- <div style={{ marginBottom: 12 }}>
- <div className="update-prompt">
- <div className="update-text">
- {updateInfo.downloaded
- ? `Update ${updateInfo.latestVersion} is ready to install.`
- : `Downloading update ${updateInfo.latestVersion} in the background...`}
- </div>
- <button
- className="update-btn"
- disabled={!updateInfo.downloaded}
- onClick={() => void installUpdate()}
- >
- {updateInfo.downloaded ? `Restart to Update` : `Downloading...`}
- </button>
- </div>
- <div className="setting-divider" />
- </div>
- )}
-
{/* ── Tab 1: Behaviour (First) ──────────────────────────────── */}
<AnimatePresence mode="wait">
{activeTab === 'behaviour' && (
@@ -353,6 +366,247 @@ export function Settings({ inlineIndicatorStyle }: { inlineIndicatorStyle?: bool
/>
</div>
+ {!isStoreBuild && (
+ <>
+ <div className="setting-divider" />
+
+ <div className="setting-row">
+ <div className="setting-info">
+ <div className="setting-title">Automatic updates</div>
+ <div className="setting-desc">
+ {(settings.autoUpdates ?? true)
+ ? 'Check for and download app updates automatically in background'
+ : 'Background update checks paused. Check for updates manually below'}
+ </div>
+ </div>
+ <Toggle
+ checked={settings.autoUpdates ?? true}
+ onChange={(v) => patch({ autoUpdates: v })}
+ />
+ </div>
+
+ {/* ── UPDATE CONTROL / MANUAL CHECK BANNER ── */}
+ {updateDownloaded ? (
+ <div style={{
+ marginTop: 12,
+ background: 'rgba(76, 175, 80, 0.08)',
+ border: '1px solid rgba(76, 175, 80, 0.3)',
+ borderRadius: 12,
+ padding: '14px 16px',
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 10,
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.2)'
+ }}>
+ <div>
+ <div style={{ fontSize: 13.5, fontWeight: 600, color: '#ffffff', letterSpacing: '-0.01em' }}>
+ Update v{updateDownloaded.version} Ready
+ </div>
+ <div style={{ fontSize: 12, color: 'rgba(255, 255, 255, 0.7)', marginTop: 3, lineHeight: 1.45 }}>
+ Click to restart Edge-Drop and apply the update.
+ </div>
+ </div>
+ <button
+ onClick={() => window.edge.installUpdate()}
+ style={{
+ width: '100%',
+ background: '#ffffff',
+ color: '#000000',
+ border: 'none',
+ borderRadius: 9,
+ padding: '8px 16px',
+ fontSize: 12.5,
+ fontWeight: 600,
+ cursor: 'pointer',
+ textAlign: 'center',
+ boxShadow: '0 2px 8px rgba(255, 255, 255, 0.15)',
+ transition: 'opacity 0.15s ease'
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.opacity = '0.92' }}
+ onMouseLeave={(e) => { e.currentTarget.style.opacity = '1' }}
+ >
+ Restart to Update
+ </button>
+ </div>
+ ) : !autoUpdates ? (
+ <div style={{
+ marginTop: 12,
+ background: 'rgba(255, 255, 255, 0.035)',
+ border: '1px solid rgba(255, 255, 255, 0.08)',
+ borderRadius: 12,
+ padding: '14px 16px',
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 12,
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.18)'
+ }}>
+ {checkState.status === 'idle' && (
+ <button
+ onClick={handleManualCheck}
+ style={{
+ width: '100%',
+ background: 'rgba(255, 255, 255, 0.07)',
+ color: '#ffffff',
+ border: '1px solid rgba(255, 255, 255, 0.14)',
+ borderRadius: 10,
+ padding: '9px 16px',
+ fontSize: 12.5,
+ fontWeight: 500,
+ cursor: 'pointer',
+ textAlign: 'center',
+ transition: 'all 0.2s ease'
+ }}
+ onMouseEnter={(e) => {
+ e.currentTarget.style.background = 'rgba(255, 255, 255, 0.12)'
+ e.currentTarget.style.borderColor = 'rgba(255, 255, 255, 0.25)'
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.background = 'rgba(255, 255, 255, 0.07)'
+ e.currentTarget.style.borderColor = 'rgba(255, 255, 255, 0.14)'
+ }}
+ >
+ Check for updates
+ </button>
+ )}
+
+ {checkState.status === 'checking' && (
+ <div style={{ fontSize: 12.5, color: 'rgba(255, 255, 255, 0.85)', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 10, padding: '6px 0' }}>
+ <motion.span
+ animate={{ rotate: 360 }}
+ transition={{ repeat: Infinity, duration: 0.8, ease: 'linear' }}
+ style={{
+ display: 'inline-block',
+ width: 13,
+ height: 13,
+ border: '2px solid rgba(255, 255, 255, 0.25)',
+ borderTopColor: '#ffffff',
+ borderRadius: '50%'
+ }}
+ />
+ Checking GitHub for updates...
+ </div>
+ )}
+
+ {checkState.status === 'up-to-date' && (
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12 }}>
+ <div style={{ fontSize: 12.5, color: '#4caf50', fontWeight: 500 }}>
+ ✓ Edge-Drop is up to date (v{currentVersion || '0.2.1'})
+ </div>
+ <button
+ onClick={handleManualCheck}
+ style={{
+ background: 'transparent',
+ color: 'rgba(255, 255, 255, 0.65)',
+ border: 'none',
+ fontSize: 11.5,
+ cursor: 'pointer',
+ textDecoration: 'underline'
+ }}
+ >
+ Check again
+ </button>
+ </div>
+ )}
+
+ {checkState.status === 'available' && (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
+ <div>
+ <div style={{ fontSize: 13.5, fontWeight: 600, color: '#ffffff', letterSpacing: '-0.01em' }}>
+ Edge-Drop v{checkState.version} is available!
+ </div>
+ <div style={{ fontSize: 12, color: 'rgba(255, 255, 255, 0.65)', marginTop: 3, lineHeight: 1.45 }}>
+ A newer version is ready on GitHub. Would you like to download and update now?
+ </div>
+ </div>
+ <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginTop: 4 }}>
+ <button
+ onClick={handleStartDownload}
+ style={{
+ background: '#ffffff',
+ color: '#000000',
+ border: 'none',
+ borderRadius: 9,
+ padding: '7px 16px',
+ fontSize: 12,
+ fontWeight: 600,
+ cursor: 'pointer',
+ boxShadow: '0 2px 8px rgba(255, 255, 255, 0.15)',
+ transition: 'transform 0.15s ease, opacity 0.15s ease'
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.opacity = '0.92' }}
+ onMouseLeave={(e) => { e.currentTarget.style.opacity = '1' }}
+ >
+ Download & Update
+ </button>
+ <button
+ onClick={() => {
+ useStore.getState().dismissUpdate()
+ setCheckState({ status: 'idle' })
+ }}
+ style={{
+ background: 'rgba(255, 255, 255, 0.08)',
+ color: 'rgba(255, 255, 255, 0.8)',
+ border: '1px solid rgba(255, 255, 255, 0.14)',
+ borderRadius: 9,
+ padding: '7px 14px',
+ fontSize: 12,
+ fontWeight: 500,
+ cursor: 'pointer',
+ transition: 'background 0.2s ease'
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.background = 'rgba(255, 255, 255, 0.14)' }}
+ onMouseLeave={(e) => { e.currentTarget.style.background = 'rgba(255, 255, 255, 0.08)' }}
+ >
+ Skip
+ </button>
+ </div>
+ </div>
+ )}
+
+ {checkState.status === 'downloading' && (
+ <div style={{ fontSize: 12.5, color: 'rgba(255, 255, 255, 0.9)', display: 'flex', alignItems: 'center', gap: 10, padding: '6px 0' }}>
+ <motion.span
+ animate={{ rotate: 360 }}
+ transition={{ repeat: Infinity, duration: 0.8, ease: 'linear' }}
+ style={{
+ display: 'inline-block',
+ width: 13,
+ height: 13,
+ border: '2px solid rgba(255, 255, 255, 0.25)',
+ borderTopColor: '#ffffff',
+ borderRadius: '50%'
+ }}
+ />
+ Downloading update package in background...
+ </div>
+ )}
+
+ {checkState.status === 'error' && (
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12 }}>
+ <div style={{ fontSize: 12, color: '#f44336' }}>
+ ⚠️ {checkState.error || 'Update check failed'}
+ </div>
+ <button
+ onClick={handleManualCheck}
+ style={{
+ background: 'rgba(255, 255, 255, 0.12)',
+ color: '#ffffff',
+ border: '1px solid rgba(255, 255, 255, 0.2)',
+ borderRadius: 7,
+ padding: '4px 10px',
+ fontSize: 11.5,
+ cursor: 'pointer'
+ }}
+ >
+ Try again
+ </button>
+ </div>
+ )}
+ </div>
+ ) : null}
+ </>
+ )}
+
<div className="setting-divider" />
<div className="setting-row vertical">
diff --git a/src/lib/format.ts b/src/lib/format.ts
index 691d426..fa4d298 100644
--- a/src/lib/format.ts
+++ b/src/lib/format.ts
@@ -38,6 +38,23 @@ export function basename(p: string): string {
return parts[parts.length - 1] ?? p
}
+/** Formats a path into a clean display title (converts internal hash IDs to human screenshot titles). */
+export function formatImageDisplayName(path: string, capturedAt?: number): string {
+ const name = basename(path)
+ const isInternalHash = /^[a-z0-9]{6,12}-[a-z0-9]{6,12}\.[a-z0-9]+$/i.test(name) || path.includes('edge-drop/images') || path.includes('edge-drop\\images') || path.includes('edge-drop/temp') || path.includes('edge-drop\\temp')
+
+ if (isInternalHash) {
+ if (capturedAt) {
+ const d = new Date(capturedAt)
+ const dateStr = d.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })
+ const timeStr = d.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' })
+ return `Screenshot ${dateStr}, ${timeStr}`
+ }
+ return 'Screenshot'
+ }
+ return name
+}
+
/** Is this a path to an image (by extension)? */
const IMG_EXT = /\.(png|jpe?g|gif|webp|bmp|svg|avif|ico|tiff?|jfif|pjpeg|pjp)$/i
export function isImagePath(p: string): boolean {
diff --git a/src/lib/soundEffects.ts b/src/lib/soundEffects.ts
index bf72c99..a76f898 100644
--- a/src/lib/soundEffects.ts
+++ b/src/lib/soundEffects.ts
@@ -263,3 +263,121 @@ export function playDeleteSound(): void {
/* ignore Web Audio API restrictions */
}
}
+
+/**
+ * Plays a warm mechanical expansion/contraction sound for collapsible sections (e.g. Pinned section).
+ */
+export function playExpandSound(expanding: boolean): void {
+ try {
+ const ctx = getAudioContext()
+ if (!ctx) return
+
+ const play = () => {
+ const now = ctx.currentTime
+
+ const startFreq = expanding ? 450 : 1100
+ const endFreq = expanding ? 1250 : 380
+ const dur = expanding ? 0.022 : 0.018
+
+ const osc = ctx.createOscillator()
+ const gain = ctx.createGain()
+
+ osc.type = 'sine'
+ osc.frequency.setValueAtTime(startFreq, now)
+ osc.frequency.exponentialRampToValueAtTime(endFreq, now + dur)
+
+ gain.gain.setValueAtTime(0.12, now)
+ gain.gain.exponentialRampToValueAtTime(0.001, now + dur)
+
+ osc.connect(gain)
+ gain.connect(ctx.destination)
+
+ osc.start(now)
+ osc.stop(now + dur)
+
+ const bodyOsc = ctx.createOscillator()
+ const bodyGain = ctx.createGain()
+
+ bodyOsc.type = 'triangle'
+ bodyOsc.frequency.setValueAtTime(expanding ? 90 : 140, now)
+ bodyOsc.frequency.exponentialRampToValueAtTime(expanding ? 180 : 60, now + dur + 0.004)
+
+ bodyGain.gain.setValueAtTime(0.09, now)
+ bodyGain.gain.exponentialRampToValueAtTime(0.001, now + dur + 0.004)
+
+ bodyOsc.connect(bodyGain)
+ bodyGain.connect(ctx.destination)
+
+ bodyOsc.start(now)
+ bodyOsc.stop(now + dur + 0.004)
+ }
+
+ if (ctx.state === 'suspended') {
+ ctx.resume().then(() => play()).catch(() => {})
+ } else {
+ play()
+ }
+ } catch {
+ /* ignore */
+ }
+}
+
+/**
+ * Plays a rich 3D glassmorphic pop sound when cards expand, file bundles open/close, or preview flyout toggles.
+ */
+export function playCardExpandSound(expanding: boolean): void {
+ try {
+ const ctx = getAudioContext()
+ if (!ctx) return
+
+ const play = () => {
+ const now = ctx.currentTime
+
+ const startFreq = expanding ? 650 : 1500
+ const endFreq = expanding ? 1650 : 480
+ const dur = expanding ? 0.028 : 0.022
+
+ // Primary tone
+ const osc = ctx.createOscillator()
+ const gain = ctx.createGain()
+
+ osc.type = 'sine'
+ osc.frequency.setValueAtTime(startFreq, now)
+ osc.frequency.exponentialRampToValueAtTime(endFreq, now + dur)
+
+ gain.gain.setValueAtTime(0.15, now)
+ gain.gain.exponentialRampToValueAtTime(0.001, now + dur)
+
+ osc.connect(gain)
+ gain.connect(ctx.destination)
+
+ osc.start(now)
+ osc.stop(now + dur)
+
+ // Harmonics for rich glassmorphic texture
+ const harmonicOsc = ctx.createOscillator()
+ const harmonicGain = ctx.createGain()
+
+ harmonicOsc.type = 'triangle'
+ harmonicOsc.frequency.setValueAtTime(startFreq * 1.5, now)
+ harmonicOsc.frequency.exponentialRampToValueAtTime(endFreq * 1.5, now + dur * 0.8)
+
+ harmonicGain.gain.setValueAtTime(0.06, now)
+ harmonicGain.gain.exponentialRampToValueAtTime(0.001, now + dur * 0.8)
+
+ harmonicOsc.connect(harmonicGain)
+ harmonicGain.connect(ctx.destination)
+
+ harmonicOsc.start(now)
+ harmonicOsc.stop(now + dur * 0.8)
+ }
+
+ if (ctx.state === 'suspended') {
+ ctx.resume().then(() => play()).catch(() => {})
+ } else {
+ play()
+ }
+ } catch {
+ /* ignore */
+ }
+}
diff --git a/src/store/appStore.ts b/src/store/appStore.ts
index 12b63f4..903bfd1 100644
--- a/src/store/appStore.ts
+++ b/src/store/appStore.ts
@@ -44,6 +44,7 @@ interface AppState {
toasts: ToastMsg[]
tutorialStep: number
currentVersion: string
+ isStoreBuild: boolean
updateInfo: { hasUpdate: boolean; latestVersion: string; downloaded: boolean } | null
/** Item ID currently being previewed in the flyout. */
previewItemId: string | null
@@ -61,6 +62,7 @@ interface AppState {
hydrate: () => Promise<void>
setUpdateAvailable: (info: { version: string }) => void
setUpdateDownloaded: (info: { version: string }) => void
+ dismissUpdate: () => void
installUpdate: () => Promise<void>
setItems: (items: ClipboardItemDto[]) => void
setSettings: (next: Settings) => void
@@ -111,6 +113,7 @@ export const useStore = create<AppState>((set, get) => ({
toasts: [],
tutorialStep: 0,
currentVersion: '',
+ isStoreBuild: false,
updateInfo: null,
previewItemId: null,
previewItemRect: null,
@@ -140,11 +143,12 @@ export const useStore = create<AppState>((set, get) => ({
flareKey: 0,
async hydrate() {
- const { items, settings, version } = await edge.loadState()
+ const { items, settings, version, isStoreBuild } = await edge.loadState()
set({
items,
settings,
currentVersion: version,
+ isStoreBuild: isStoreBuild ?? false,
hydrated: true
})
},
@@ -169,6 +173,8 @@ export const useStore = create<AppState>((set, get) => ({
})
},
+ dismissUpdate: () => set({ updateInfo: null }),
+
async installUpdate() {
await edge.installUpdate()
},
@@ -203,7 +209,20 @@ export const useStore = create<AppState>((set, get) => ({
edge.setPreviewMode(false)
}
},
- setSettingsOpen: (settingsOpen) => set({ settingsOpen, settingsSubView: 'main' }),
+ setSettingsOpen: (settingsOpen) => {
+ set({
+ settingsOpen,
+ settingsSubView: 'main',
+ ...(settingsOpen
+ ? {
+ previewItemId: null,
+ previewItemRect: null,
+ previewFlyoutRect: null,
+ styleFlyoutOpen: false
+ }
+ : {})
+ })
+ },
setDragActive: (dragActive) => set({ dragActive }),
setInternalDragReq: (internalDragReq) => {
if (internalDragReq === null) {