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.

fix(ui): fold stacks open, show mixed photos as file icons, full-size flyout images

Deepender258cbd7838b019
diff --git a/src/components/ClipboardItem.tsx b/src/components/ClipboardItem.tsx
index 5dd89fd..28280bd 100644
--- a/src/components/ClipboardItem.tsx
+++ b/src/components/ClipboardItem.tsx
@@ -14,8 +14,8 @@
* clamped preview; file items list names or bundle badge. Motion is handled by
* the parent list (layout/AnimatePresence), so this component stays presentational.
*/
-import { memo, useState, useCallback, useEffect, forwardRef } from 'react'
-import { motion, AnimatePresence } from 'framer-motion'
+import { memo, useState, useCallback, useEffect, forwardRef, type ReactNode } from 'react'
+import { motion } from 'framer-motion'
import type { ClipboardItemDto } from '../../shared/types'
import { MAX_STACK } from '../../shared/types'
import type { DragRequest } from '../../shared/types'
@@ -24,7 +24,7 @@ import { useDragOut } from '../hooks/useDragOut'
import { basename, formatBytes, previewText, relativeTime, formatImageDisplayName } from '../lib/format'
import { getFileKind } from '../lib/fileType'
import { playButtonClickSound, playToggleSound, playDeleteSound, playCardExpandSound } from '../lib/soundEffects'
-import { CopyIcon, FileKindIcon, GlobeIcon, PinIcon, PinFillIcon, TrashIcon, MinusIcon, ChevronUpIcon, ExpandIcon, ContractIcon, ExternalLinkIcon } from './icons'
+import { CopyIcon, FileKindIcon, FileStackPhoto, GlobeIcon, PinIcon, PinFillIcon, TrashIcon, MinusIcon, ChevronUpIcon, ExpandIcon, ContractIcon, ExternalLinkIcon } from './icons'
import { parseUrlPreview } from '../lib/urlPreview'
import '../styles/item.css'
@@ -50,7 +50,6 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
const [copied, setCopied] = useState(false)
const [expanded, setExpanded] = useState(false)
-
const open = useStore((s) => s.open)
const [, setTimeTick] = useState(0)
@@ -66,6 +65,10 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
const isPreviewing = useStore((s) => s.previewItemId) === item.id
const isBundle = (item.data.kind === 'files' && item.data.paths.length > 1) || item.data.kind === 'image-collection'
+ useEffect(() => {
+ if (!isBundle) setExpanded(false)
+ }, [isBundle])
+
const onCopy = useCallback((e: React.MouseEvent) => {
e.stopPropagation()
playButtonClickSound()
@@ -288,70 +291,151 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
)
})
-// Bundle expand/collapse — all blur removed; opacity+y+scale composite trivially.
-const containerVariants = {
- hidden: { opacity: 0 },
- visible: {
+const expandEase = [0.16, 1, 0.3, 1] as const
+const collapseEase = [0.4, 0, 0.2, 1] as const
+
+const stackSlotVariants = {
+ open: {
opacity: 1,
- transition: {
- opacity: { duration: 0.18, ease: 'easeOut' },
- staggerChildren: 0.04,
- delayChildren: 0.01
- }
+ y: 0,
+ scale: 1,
+ transition: { duration: 0.28, ease: expandEase }
},
- exit: {
+ closed: {
opacity: 0,
- transition: {
- opacity: { duration: 0.12, ease: 'easeIn' },
- staggerChildren: 0.025,
- staggerDirection: -1
- }
+ y: -10,
+ scale: 0.92,
+ transition: { duration: 0.18, ease: collapseEase }
}
-};
+}
-const rowVariants = {
- hidden: { opacity: 0, y: 8, scale: 0.98 },
- visible: {
+const listSlotVariants = {
+ open: {
opacity: 1,
y: 0,
- scale: 1,
transition: {
- y: { type: 'spring', stiffness: 500, damping: 38, mass: 0.6, restDelta: 0.001 },
- scale: { type: 'spring', stiffness: 500, damping: 38, mass: 0.6, restDelta: 0.001 },
- opacity: { duration: 0.16, ease: 'easeOut' }
+ duration: 0.24,
+ ease: expandEase,
+ staggerChildren: 0.032,
+ delayChildren: 0.05
}
},
- exit: {
+ closed: {
opacity: 0,
- y: -6,
- scale: 0.97,
- transition: {
- y: { duration: 0.1, ease: 'easeIn' },
- scale: { duration: 0.1, ease: 'easeIn' },
- opacity: { duration: 0.1, ease: 'easeIn' }
- }
+ y: 8,
+ transition: { duration: 0.15, ease: collapseEase }
}
-};
+}
-const stackVariants = {
- hidden: { opacity: 0, scale: 0.96 },
- visible: {
+const rowVariants = {
+ open: {
opacity: 1,
- scale: 1,
- transition: {
- scale: { type: 'spring', stiffness: 480, damping: 38, mass: 0.6, restDelta: 0.001 },
- opacity: { duration: 0.18, ease: 'easeOut' }
- }
+ y: 0,
+ transition: { duration: 0.22, ease: expandEase }
},
- exit: {
+ closed: {
opacity: 0,
- scale: 0.96,
- transition: {
- scale: { duration: 0.12, ease: 'easeIn' },
- opacity: { duration: 0.12, ease: 'easeIn' }
- }
+ y: 8,
+ transition: { duration: 0.12, ease: collapseEase }
}
-};
+}
+
+function BundleExpandShell({
+ expanded,
+ stack,
+ list
+}: {
+ expanded: boolean
+ stack: ReactNode
+ list: ReactNode
+}) {
+ return (
+ <div className={`fluid-bundle${expanded ? ' is-expanded' : ''}`}>
+ <div className="bundle-slot bundle-slot-stack" aria-hidden={expanded}>
+ <motion.div
+ className="bundle-slot-inner"
+ initial={false}
+ animate={expanded ? 'closed' : 'open'}
+ variants={stackSlotVariants}
+ style={{ originY: 0.5 }}
+ >
+ {stack}
+ </motion.div>
+ </div>
+ <div className="bundle-slot bundle-slot-list" aria-hidden={!expanded}>
+ <motion.div
+ className="bundle-slot-inner fluid-list"
+ initial={false}
+ animate={expanded ? 'open' : 'closed'}
+ variants={listSlotVariants}
+ >
+ {list}
+ </motion.div>
+ </div>
+ </div>
+ )
+}
+
+function BundleToolbar({
+ count,
+ showCapacity,
+ showPin,
+ pinned,
+ onCollapse,
+ onCopy,
+ onRemove,
+ onTogglePin
+}: {
+ count?: number
+ showCapacity?: boolean
+ showPin?: boolean
+ pinned?: boolean
+ onCollapse: (e?: React.MouseEvent) => void
+ onCopy: (e: React.MouseEvent) => void
+ onRemove: () => void
+ onTogglePin?: () => void
+}) {
+ return (
+ <div className="bundle-actions">
+ <button
+ type="button"
+ className="bundle-collapse-hit"
+ title={t('item.collapsePinned')}
+ onClick={(e) => {
+ e.stopPropagation()
+ onCollapse(e)
+ }}
+ >
+ <ChevronUpIcon />
+ </button>
+ {showCapacity && count != null && (
+ <div className="bundle-capacity">
+ {count} / {MAX_STACK}
+ </div>
+ )}
+ <div className="actions-pill">
+ {showPin && onTogglePin && (
+ <button
+ className={`act${pinned ? ' active' : ''}`}
+ title={pinned ? t('item.unpin') : t('item.pin')}
+ onClick={(e) => {
+ e.stopPropagation()
+ onTogglePin()
+ }}
+ >
+ {pinned ? <PinFillIcon /> : <PinIcon />}
+ </button>
+ )}
+ <button className="act" title={t('item.copy')} onClick={(e) => { e.stopPropagation(); onCopy(e) }}>
+ <CopyIcon />
+ </button>
+ <button className="act danger" title={t('item.delete')} onClick={(e) => { e.stopPropagation(); onRemove() }}>
+ <TrashIcon />
+ </button>
+ </div>
+ </div>
+ )
+}
function BundleFluidPreview({
item,
@@ -368,273 +452,227 @@ function BundleFluidPreview({
onRemove: () => void
onCollapse: (e?: React.MouseEvent) => void
}) {
-
-
+ const mixedStack = item.data.kind === 'files' && (() => {
+ const entries = item.data.entries
+ const paths = item.data.paths
+ let hasImage = false
+ let hasNonImage = false
+ for (let i = 0; i < paths.length; i++) {
+ const e = entries?.[i]
+ if (e?.isImage && e.preview) hasImage = true
+ else hasNonImage = true
+ }
+ return hasImage && hasNonImage
+ })()
if (item.data.kind === 'image-collection') {
const more = item.data.images.length - 1
return (
- <div className="fluid-bundle">
- <AnimatePresence initial={false} mode="wait">
- {expanded ? (
- <motion.div
- key="expanded"
- className="fluid-list"
- variants={containerVariants}
- initial="hidden"
- animate="visible"
- exit="exit"
- >
- <div className="bundle-actions">
- <div
- className="bundle-collapse-zone"
- title={t('item.collapsePinned')}
- onClick={(e) => { e.stopPropagation(); onCollapse(e); }}
- >
- <button className="act bundle-collapse-btn">
- <ChevronUpIcon />
- </button>
- </div>
- <div className="actions-pill">
- <button
- className={`act${item.pinned ? ' active' : ''}`}
- title={item.pinned ? t('item.unpin') : t('item.pin')}
- onClick={(e) => { e.stopPropagation(); useStore.getState().togglePin(item.id, !item.pinned); }}
- >
- {item.pinned ? <PinFillIcon /> : <PinIcon />}
- </button>
- <button className="act" title={t('item.copy')} onClick={(e) => { e.stopPropagation(); onCopy(e); }}>
- <CopyIcon />
- </button>
- <button className="act danger" title={t('item.delete')} onClick={(e) => { e.stopPropagation(); onRemove(); }}>
- <TrashIcon />
- </button>
- </div>
- </div>
- {item.data.images.map((img) => (
- <motion.div
- key={img.imageId}
- className="fluid-list-row"
- variants={rowVariants}
- draggable
- onDragStartCapture={(e: any) => { e.stopPropagation(); onDragStart(e, { id: item.id, imageId: img.imageId }) }}
- onClick={(e) => { e.stopPropagation(); tryPaste(() => window.edge.pasteSubitem({ id: item.id, imageId: img.imageId })) }}
- >
+ <BundleExpandShell
+ expanded={expanded}
+ stack={
+ <>
+ <div className="bundle-stack-large">
+ {item.data.images.slice(0, 4).reverse().map((img, idx, arr) => {
+ const realIndex = arr.length - 1 - idx
+ return (
<motion.img
+ key={img.imageId}
src={img.preview}
loading="lazy"
decoding="async"
- style={{ width: 50, height: 50, objectFit: 'cover', borderRadius: 4, background: 'rgba(0,0,0,0.5)' }}
+ className="bundle-stack-card"
+ animate={{
+ x: realIndex * 20 - 20,
+ y: realIndex * 6,
+ rotate: realIndex * 6 - 6,
+ scale: 1 - realIndex * 0.05
+ }}
+ style={{ zIndex: 10 - realIndex }}
draggable={false}
+ initial={{ borderRadius: 8 }}
/>
- <div style={{ display: 'flex', flexDirection: 'column', gap: 4, flex: 1, minWidth: 0 }}>
- <span style={{ fontSize: 13, color: 'rgba(255,255,255,0.9)' }}>
- {t('item.imageItem')} • {img.width} × {img.height}
- </span>
- <span style={{ fontSize: 11, color: 'rgba(255,255,255,0.5)' }}>
- {formatBytes(img.bytes)}
- </span>
- </div>
+ )
+ })}
+ </div>
+ {more > 0 && <div className="bundle-more-label">{t('item.moreImages', { count: more })}</div>}
+ </>
+ }
+ list={
+ <>
+ <BundleToolbar
+ showPin
+ pinned={item.pinned}
+ onCollapse={onCollapse}
+ onCopy={onCopy}
+ onRemove={onRemove}
+ onTogglePin={() => useStore.getState().togglePin(item.id, !item.pinned)}
+ />
+ {item.data.images.map((img) => (
+ <motion.div
+ key={img.imageId}
+ className="fluid-card-row"
+ variants={rowVariants}
+ draggable
+ onDragStartCapture={(e: any) => { e.stopPropagation(); onDragStart(e, { id: item.id, imageId: img.imageId }) }}
+ onClick={(e) => { e.stopPropagation(); tryPaste(() => window.edge.pasteSubitem({ id: item.id, imageId: img.imageId })) }}
+ >
+ <div className="fluid-row-icon">
+ <img
+ src={img.preview}
+ alt=""
+ loading="lazy"
+ decoding="async"
+ draggable={false}
+ className="fluid-row-img"
+ />
+ </div>
+ <div className="fluid-row-content">
+ <div className="fluid-row-name">{t('item.imageItem')} · {img.width} × {img.height}</div>
+ <div className="fluid-row-sub">{formatBytes(img.bytes)}</div>
+ </div>
+ <div className="fluid-row-actions">
<button
className="act subitem-delete-btn"
title={t('item.ungroup')}
onClick={(e) => { e.stopPropagation(); window.edge.splitItem({ id: item.id, imageId: img.imageId, splitPlacement: 'after' }); }}
- style={{ width: 24, height: 24 }}
>
<MinusIcon width={12} height={12} />
</button>
- </motion.div>
- ))}
- </motion.div>
- ) : (
- <motion.div
- key="collapsed"
- style={{ width: '100%' }}
- variants={stackVariants}
- initial="hidden"
- animate="visible"
- exit="exit"
- >
- <div className="bundle-stack-large">
- {item.data.images.slice(0, 4).reverse().map((img, idx, arr) => {
- const realIndex = arr.length - 1 - idx
+ </div>
+ </motion.div>
+ ))}
+ </>
+ }
+ />
+ )
+ }
+
+ if (item.data.kind === 'files') {
+ const entries = item.data.entries
+ const paths = item.data.paths
+ const count = paths.length
+ return (
+ <BundleExpandShell
+ expanded={expanded}
+ stack={
+ <>
+ <div className="bundle-stack-large">
+ {paths.slice(0, 4).map((filePath, i) => ({ filePath, pathIndex: i })).reverse().map(({ filePath, pathIndex }, idx, arr) => {
+ const realIndex = arr.length - 1 - idx
+ const entry = entries?.[pathIndex]
+ const isImg = !!(entry?.isImage && entry.preview)
+ const largePhoto = isImg && !mixedStack
+ const spread = arr.length > 1 ? 22 : 0
+ const rotSpread = arr.length > 1 ? 9 : 0
+ const centerOffset = ((arr.length - 1) * spread) / 2
+ const centerRot = ((arr.length - 1) * rotSpread) / 2
+ const stackMotion = {
+ x: realIndex * spread - centerOffset,
+ y: realIndex * 5,
+ rotate: realIndex * rotSpread - centerRot,
+ scale: 1 - realIndex * 0.05
+ }
+
+ if (largePhoto) {
return (
<motion.img
- key={img.imageId}
- src={img.preview}
+ key={`${item.id}-${pathIndex}`}
+ src={entry.preview}
+ alt=""
loading="lazy"
decoding="async"
+ draggable={false}
className="bundle-stack-card"
- animate={{
- x: realIndex * 20 - 20,
- y: realIndex * 6,
- rotate: realIndex * 6 - 6,
- scale: 1 - realIndex * 0.05
- }}
+ animate={stackMotion}
style={{ zIndex: 10 - realIndex }}
- draggable={false}
initial={{ borderRadius: 8 }}
/>
)
- })}
- </div>
- {more > 0 && <div className="bundle-more-label">{t('item.moreImages', { count: more })}</div>}
- </motion.div>
- )}
- </AnimatePresence>
- </div>
- )
- }
+ }
- if (item.data.kind === 'files') {
- const entries = item.data.entries
- const paths = item.data.paths
- const count = paths.length
- return (
- <div className="fluid-bundle">
- <AnimatePresence initial={false} mode="wait">
- {expanded ? (
- <motion.div
- key="expanded"
- className="fluid-list"
- variants={containerVariants}
- initial="hidden"
- animate="visible"
- exit="exit"
- >
- <div className="bundle-actions">
- <div
- className="bundle-collapse-zone"
- title={t('item.collapsePinned')}
- onClick={(e) => { e.stopPropagation(); onCollapse(e); }}
- >
- <button className="act bundle-collapse-btn">
- <ChevronUpIcon />
- </button>
- </div>
- <div className="bundle-capacity">
- {count} / {MAX_STACK}
- </div>
- <div className="actions-pill">
- <button className="act" title={t('item.copy')} onClick={(e) => { e.stopPropagation(); onCopy(e); }}>
- <CopyIcon />
- </button>
- <button className="act danger" title={t('item.delete')} onClick={(e) => { e.stopPropagation(); onRemove(); }}>
- <TrashIcon />
- </button>
- </div>
- </div>
- {paths.map((filePath, index) => {
- const entry = entries?.[index]
- const name = formatImageDisplayName(entry?.name ?? filePath, item.capturedAt)
- const size = entry?.size ?? 0
return (
<motion.div
- key={`${item.id}-${filePath}-${index}`}
- className="fluid-card-row"
- layout
- draggable
- onMouseEnter={() => window.edge.prestageDrag({ id: item.id, paths: [filePath] })}
- onPointerDown={() => window.edge.prestageDrag({ id: item.id, paths: [filePath] })}
- onDragStartCapture={(e: any) => { e.stopPropagation(); onDragStart(e, { id: item.id, paths: [filePath] }) }}
- onClick={(e) => { e.stopPropagation(); tryPaste(() => window.edge.pasteSubitem({ id: item.id, paths: [filePath] })) }}
+ key={`${item.id}-${pathIndex}`}
+ className="bundle-stack-icon-item"
+ animate={stackMotion}
+ style={{ zIndex: 10 - realIndex }}
>
- <div className="fluid-row-icon">
- {entry?.isImage && entry.preview ? (
- <img
- src={entry.preview}
- alt=""
- loading="lazy"
- decoding="async"
- draggable={false}
- className="fluid-row-img"
- />
- ) : (
- <FileKindIcon path={filePath} width={48} height={48} isDirectory={entry?.isDirectory} />
- )}
- </div>
- <div className="fluid-row-content">
- <div className="fluid-row-name" title={name}>{name}</div>
- <div className="fluid-row-sub">
- {size > 0 ? formatBytes(size) : getFileKind(filePath, entry?.isDirectory).label}
- </div>
- </div>
- <div className="fluid-row-actions">
- <button
- className="act subitem-copy-btn"
- title={t('item.copyFilePath')}
- onClick={(e) => { e.stopPropagation(); window.edge.copySubitem({ id: item.id, paths: [filePath] }); }}
- >
- <CopyIcon width={12} height={12} />
- </button>
- <button
- className="act subitem-delete-btn"
- title={t('item.ungroup')}
- onClick={(e) => { e.stopPropagation(); window.edge.splitItem({ id: item.id, paths: [filePath], splitPlacement: 'after' }); }}
- >
- <MinusIcon width={12} height={12} />
- </button>
- </div>
+ {isImg ? (
+ <FileStackPhoto src={entry.preview!} width={112} height={112} />
+ ) : (
+ <FileKindIcon path={filePath} width={112} height={112} isDirectory={entry?.isDirectory} />
+ )}
</motion.div>
)
})}
- </motion.div>
- ) : (
- <motion.div
- key="collapsed"
- style={{ width: '100%' }}
- variants={stackVariants}
- initial="hidden"
- animate="visible"
- exit="exit"
- >
- <div className="bundle-stack-large">
- {paths.slice(0, 4).map((filePath, i) => ({ filePath, pathIndex: i })).reverse().map(({ filePath, pathIndex }, idx, arr) => {
- const realIndex = arr.length - 1 - idx
- const entry = entries?.[pathIndex]
- const isImg = entry?.isImage && !!entry.preview
- const spread = arr.length > 1 ? 22 : 0
- const rotSpread = arr.length > 1 ? 9 : 0
- const centerOffset = ((arr.length - 1) * spread) / 2
- const centerRot = ((arr.length - 1) * rotSpread) / 2
-
- return (
- <motion.div
- key={`${item.id}-${pathIndex}`}
- className={isImg ? "bundle-stack-card" : "bundle-stack-icon-item"}
- animate={{
- x: realIndex * spread - centerOffset,
- y: realIndex * 5,
- rotate: realIndex * rotSpread - centerRot,
- scale: 1 - realIndex * 0.05
- }}
- style={{ zIndex: 10 - realIndex }}
+ </div>
+ {count > 1 ? (
+ <div className="bundle-more-label">{t('item.moreFiles', { count: count - 1 })}</div>
+ ) : (
+ <div className="bundle-more-label">{t('item.singleFile')}</div>
+ )}
+ </>
+ }
+ list={
+ <>
+ <BundleToolbar
+ count={count}
+ showCapacity
+ onCollapse={onCollapse}
+ onCopy={onCopy}
+ onRemove={onRemove}
+ />
+ {paths.map((filePath, index) => {
+ const entry = entries?.[index]
+ const name = formatImageDisplayName(entry?.name ?? filePath, item.capturedAt)
+ const size = entry?.size ?? 0
+ return (
+ <motion.div
+ key={`${item.id}-${filePath}-${index}`}
+ className="fluid-card-row"
+ variants={rowVariants}
+ draggable
+ onMouseEnter={() => window.edge.prestageDrag({ id: item.id, paths: [filePath] })}
+ onPointerDown={() => window.edge.prestageDrag({ id: item.id, paths: [filePath] })}
+ onDragStartCapture={(e: any) => { e.stopPropagation(); onDragStart(e, { id: item.id, paths: [filePath] }) }}
+ onClick={(e) => { e.stopPropagation(); tryPaste(() => window.edge.pasteSubitem({ id: item.id, paths: [filePath] })) }}
+ >
+ <div className="fluid-row-icon">
+ {entry?.isImage && entry.preview ? (
+ <FileStackPhoto src={entry.preview} width={48} height={48} />
+ ) : (
+ <FileKindIcon path={filePath} width={48} height={48} isDirectory={entry?.isDirectory} />
+ )}
+ </div>
+ <div className="fluid-row-content">
+ <div className="fluid-row-name" title={name}>{name}</div>
+ <div className="fluid-row-sub">
+ {size > 0 ? formatBytes(size) : getFileKind(filePath, entry?.isDirectory).label}
+ </div>
+ </div>
+ <div className="fluid-row-actions">
+ <button
+ className="act subitem-copy-btn"
+ title={t('item.copyFilePath')}
+ onClick={(e) => { e.stopPropagation(); window.edge.copySubitem({ id: item.id, paths: [filePath] }); }}
>
- {isImg ? (
- <img
- src={entry.preview}
- alt=""
- loading="lazy"
- decoding="async"
- draggable={false}
- style={{ width: '100%', height: '100%', objectFit: 'cover', borderRadius: 8 }}
- />
- ) : (
- <FileKindIcon path={filePath} width={112} height={112} isDirectory={entry?.isDirectory} />
- )}
- </motion.div>
- )
- })}
- </div>
- {count > 1 ? (
- <div className="bundle-more-label">{t('item.moreFiles', { count: count - 1 })}</div>
- ) : (
- <div className="bundle-more-label">{t('item.singleFile')}</div>
- )}
- </motion.div>
- )}
- </AnimatePresence>
- </div>
+ <CopyIcon width={12} height={12} />
+ </button>
+ <button
+ className="act subitem-delete-btn"
+ title={t('item.ungroup')}
+ onClick={(e) => { e.stopPropagation(); window.edge.splitItem({ id: item.id, paths: [filePath], splitPlacement: 'after' }); }}
+ >
+ <MinusIcon width={12} height={12} />
+ </button>
+ </div>
+ </motion.div>
+ )
+ })}
+ </>
+ }
+ />
)
}
return null
diff --git a/src/components/CustomFileIcon.tsx b/src/components/CustomFileIcon.tsx
index 9e5457e..3824934 100644
--- a/src/components/CustomFileIcon.tsx
+++ b/src/components/CustomFileIcon.tsx
@@ -572,3 +572,47 @@ export function CustomFileIcon({
</svg>
)
}
+
+/** Same 512 viewBox and body silhouette as FileKindIcon. */
+const FILE_ICON_BODY =
+ 'M 56 378 L 56 128 C 56 112 68 100 84 100 L 162 100 C 178 100 190 108 200 120 C 208 130 218 136 232 136 L 428 136 C 444 136 456 148 456 164 L 456 378 C 456 396 442 410 424 410 L 88 410 C 70 410 56 396 56 378 Z'
+
+const FILE_ICON_MASK = `url("data:image/svg+xml,${encodeURIComponent(
+ `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="white" d="${FILE_ICON_BODY}"/></svg>`
+)}")`
+
+export function FileStackPhoto({
+ src,
+ width = 112,
+ height,
+}: {
+ src: string
+ width?: number | string
+ height?: number | string
+}) {
+ const resolvedHeight = height ?? width
+ return (
+ <img
+ src={src}
+ alt=""
+ draggable={false}
+ width={typeof width === 'number' ? width : undefined}
+ height={typeof resolvedHeight === 'number' ? resolvedHeight : undefined}
+ style={{
+ width,
+ height: resolvedHeight,
+ objectFit: 'cover',
+ flexShrink: 0,
+ display: 'block',
+ WebkitMaskImage: FILE_ICON_MASK,
+ maskImage: FILE_ICON_MASK,
+ WebkitMaskSize: '100% 100%',
+ maskSize: '100% 100%',
+ WebkitMaskRepeat: 'no-repeat',
+ maskRepeat: 'no-repeat',
+ WebkitMaskPosition: 'center',
+ maskPosition: 'center'
+ }}
+ />
+ )
+}
diff --git a/src/components/PreviewFlyout.tsx b/src/components/PreviewFlyout.tsx
index dd0121a..2666cd0 100644
--- a/src/components/PreviewFlyout.tsx
+++ b/src/components/PreviewFlyout.tsx
@@ -883,7 +883,7 @@ function PreviewContent({
solidDark={true}
/>
</div>
- <img src={`edgelocal://${img.imageId}`} alt="" style={{ width: '100%', borderRadius: 8 }} draggable={false} />
+ <img src={`edgelocal://${img.imageId}`} alt="" style={{ width: '100%', maxHeight: '65vh', objectFit: 'contain', borderRadius: 8 }} draggable={false} />
<div style={{ fontSize: 11, color: 'rgba(255,255,255,0.35)', textAlign: 'center', fontFamily: SYS_FONT, letterSpacing: '0.02em' }}>
{idx + 1} / {item.data.images.length} · {img.width} × {img.height} · {formatBytes(img.bytes)}
</div>
@@ -1077,12 +1077,12 @@ function PreviewContent({
title={t('flyout.clickToPasteDrag')}
style={{
display: 'flex',
- alignItems: 'center',
- gap: 12,
- padding: '8px 10px',
- background: isSelected ? 'rgba(255, 255, 255, 0.12)' : 'rgba(255, 255, 255, 0.035)',
+ flexDirection: 'column',
+ gap: 8,
+ padding: 4,
+ background: isSelected ? 'rgba(255, 255, 255, 0.08)' : 'transparent',
borderRadius: 10,
- border: isSelected ? '1px solid rgba(255, 255, 255, 0.3)' : '1px solid rgba(255, 255, 255, 0.06)',
+ border: isSelected ? '2px solid #ffffff' : '2px solid transparent',
cursor: 'grab',
position: 'relative',
minWidth: 0,
@@ -1090,94 +1090,43 @@ function PreviewContent({
boxSizing: 'border-box'
}}
>
- {/* Multi-Select Checkbox */}
{onToggleSelectKey && (
- <div
- onClick={(e) => {
- e.stopPropagation()
- onToggleSelectKey(p, e)
- }}
- style={{
- width: 18,
- height: 18,
- borderRadius: 4,
- border: isSelected ? '1.5px solid #fff' : '1.5px solid rgba(255, 255, 255, 0.3)',
- background: isSelected ? '#fff' : 'transparent',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- cursor: 'pointer',
- flexShrink: 0
- }}
- >
- {isSelected && (
- <CheckIcon width={12} height={12} style={{ color: '#000', strokeWidth: 3 }} />
- )}
+ <div style={{ position: 'absolute', top: 12, left: 12, zIndex: 3 }}>
+ <SelectionBadge
+ isSelected={isSelected}
+ onToggle={(e) => onToggleSelectKey(p, e)}
+ />
</div>
)}
- {/* Left Thumbnail (small image card) */}
- <div style={{
- width: 52,
- height: 52,
- borderRadius: 6,
- overflow: 'hidden',
- background: 'rgba(0, 0, 0, 0.4)',
- flexShrink: 0,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- border: '1px solid rgba(255, 255, 255, 0.08)'
- }}>
- <img
- src={fullResUrl}
- alt=""
- loading="lazy"
- decoding="async"
- draggable={false}
- style={{ width: '100%', height: '100%', objectFit: 'cover' }}
- />
- </div>
-
- {/* File Name & Metadata */}
- <div style={{ display: 'flex', flexDirection: 'column', gap: 2, minWidth: 0, flex: 1, wordBreak: 'break-word', overflowWrap: 'anywhere' }}>
- <span
- title={fileName}
- style={{
- fontSize: 13,
- fontWeight: 500,
- color: '#ffffff',
- wordBreak: 'break-word',
- overflowWrap: 'anywhere',
- lineHeight: 1.35,
- fontFamily: SYS_FONT,
- display: '-webkit-box',
- WebkitLineClamp: 2,
- WebkitBoxOrient: 'vertical',
- overflow: 'hidden'
- }}
- >
- {fileName}
- </span>
- <span style={{ fontSize: 11, color: 'rgba(255, 255, 255, 0.45)', fontFamily: SYS_FONT }}>
- {entry?.size ? `${formatBytes(entry.size)} · ` : ''}{info.label}
- </span>
- </div>
-
- {/* Actions */}
- <div style={{ display: 'flex', gap: 4, flexShrink: 0 }}>
+ <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 6, position: 'absolute', top: 12, right: 12, zIndex: 2 }}>
<QuickActionButton
title={t('flyout.copyFile')}
icon={CopyIcon}
onClick={() => window.edge.copySubitem({ id: item.id, paths: [p] })}
- size={24}
+ solidDark={true}
/>
<ExplorerButton
path={p}
title={t('flyout.openInExplorer')}
- size={24}
+ solidDark={true}
/>
</div>
+
+ <img
+ src={fullResUrl}
+ onError={(e) => {
+ if (entry?.preview) e.currentTarget.src = entry.preview
+ }}
+ alt={fileName}
+ loading="lazy"
+ decoding="async"
+ draggable={false}
+ style={{ width: '100%', maxHeight: '65vh', objectFit: 'contain', borderRadius: 8 }}
+ />
+ <div style={{ fontSize: 11, color: 'rgba(255,255,255,0.35)', textAlign: 'center', fontFamily: SYS_FONT, letterSpacing: '0.02em' }}>
+ {fileName}{entry?.size ? ` · ${formatBytes(entry.size)}` : ''}
+ </div>
</div>
)
}
diff --git a/src/components/icons.tsx b/src/components/icons.tsx
index d59a5bd..78a9527 100644
--- a/src/components/icons.tsx
+++ b/src/components/icons.tsx
@@ -85,8 +85,8 @@ export const ExpandIcon = (p: P) => <Maximize2 size={p.width ?? 16} {...(p as an
export const ContractIcon = (p: P) => <Minimize2 size={p.width ?? 16} {...(p as any)} />
export const FolderOpenIcon = (p: P) => <FolderOpen size={p.width ?? 16} {...(p as any)} />
export const CheckIcon = (p: P) => <Check size={p.width ?? 16} {...(p as any)} />
-import { CustomFileIcon } from './CustomFileIcon'
-export { CustomFileIcon, CustomFileIcon as FileKindIcon }
+import { CustomFileIcon, FileStackPhoto } from './CustomFileIcon'
+export { CustomFileIcon, CustomFileIcon as FileKindIcon, FileStackPhoto }
export const FileIcon = (p: P) => <CustomFileIcon width={p.width ?? 16} height={p.height ?? 16} {...(p as any)} />
export const FileIconGlyph = FileIcon
diff --git a/src/styles/item.css b/src/styles/item.css
index 57e83a3..986f418 100644
--- a/src/styles/item.css
+++ b/src/styles/item.css
@@ -469,6 +469,30 @@
position: relative;
}
+.bundle-slot {
+ display: grid;
+ transition: grid-template-rows 0.3s cubic-bezier(0.16, 1, 0.3, 1);
+}
+.bundle-slot-inner {
+ min-height: 0;
+ overflow: hidden;
+}
+.bundle-slot-stack {
+ grid-template-rows: 1fr;
+}
+.bundle-slot-list {
+ grid-template-rows: 0fr;
+ pointer-events: none;
+}
+.fluid-bundle.is-expanded .bundle-slot-stack {
+ grid-template-rows: 0fr;
+ pointer-events: none;
+}
+.fluid-bundle.is-expanded .bundle-slot-list {
+ grid-template-rows: 1fr;
+ pointer-events: auto;
+}
+
.fluid-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
@@ -517,7 +541,6 @@
.fluid-card-row:hover {
background: rgba(255, 255, 255, 0.06);
border-color: rgba(255, 255, 255, 0.12);
- transform: translateY(-1px);
}
.fluid-card-row:active {
@@ -681,41 +704,34 @@
/* Bundle actions (Copy all / Delete) placed at the top when expanded */
.bundle-actions {
- grid-column: 1 / -1;
display: flex;
align-items: center;
- justify-content: flex-end;
gap: 6px;
- padding: 6px 0 10px;
+ padding: 2px 0 10px;
width: 100%;
- border-bottom: 1px solid rgba(255, 255, 255, 0.04);
- margin-bottom: 4px;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.06);
+ margin-bottom: 6px;
}
-/* The invisible buffer area covering the left side to collapse the bundle */
-.bundle-collapse-zone {
+.bundle-collapse-hit {
display: flex;
align-items: center;
- flex: 1; /* stretches to push actions-pill to the right */
- height: 100%;
- padding-left: 8px;
+ justify-content: center;
+ width: 32px;
+ height: 32px;
+ margin-right: auto;
+ border-radius: 8px;
+ color: rgba(255, 255, 255, 0.75);
+ background: rgba(255, 255, 255, 0.06);
+ border: 1px solid rgba(255, 255, 255, 0.08);
cursor: pointer;
- align-self: stretch; /* fill the vertical space of the actions bar */
+ flex-shrink: 0;
+ transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
-
-/* Hovering anywhere in the buffer area highlights the button */
-.bundle-collapse-zone:hover .bundle-collapse-btn {
- background: rgba(255, 255, 255, 0.15);
+.bundle-collapse-hit:hover {
+ background: rgba(255, 255, 255, 0.14);
color: #fff;
-}
-
-/* Larger hit area for the collapse (chevron) button */
-.bundle-collapse-btn {
- width: 36px !important;
- height: 36px !important;
- border-radius: 8px !important;
- color: rgba(255, 255, 255, 0.75) !important;
- pointer-events: none; /* Let the zone handle the click */
+ border-color: rgba(255, 255, 255, 0.2);
}
.bundle-actions-label {