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(stacks): larger fan tiles (+20%) and animated GIF tiles via thumbnail fallback

Deepender25e14bf7b94cec
diff --git a/src/components/ClipboardItem.tsx b/src/components/ClipboardItem.tsx
index affcad3..ba7876d 100644
--- a/src/components/ClipboardItem.tsx
+++ b/src/components/ClipboardItem.tsx
@@ -37,6 +37,16 @@ interface Props {
item: ClipboardItemDto
}
+/**
+ * Full-resolution streaming URL for a local file. Used as the load-failure
+ * fallback for bounded thumbnails: Electron's nativeImage decodes only
+ * PNG/JPEG, so formats like GIF answer 415 from edgelocal://thumb and the
+ * tile swaps to this URL — Chromium then renders (and animates) natively.
+ */
+export function fileStreamUrl(filePath: string): string {
+ return `edgelocal://file/${encodeURIComponent(filePath.replace(/\\/g, '/'))}`
+}
+
/* ------------------------------------------------------------------ */
/* Main item card */
/* ------------------------------------------------------------------ */
@@ -536,7 +546,7 @@ function BundleFluidPreview({
animate={stackMotion}
style={{ zIndex: 10 - realIndex }}
>
- <FileStackPhoto src={img.preview} width={112} height={112} />
+ <FileStackPhoto src={img.preview} width={154} height={154} />
</motion.div>
)
})}
@@ -624,6 +634,8 @@ function BundleFluidPreview({
// Single unified tile path: photos wear the folder-silhouette
// mask (FileStackPhoto), everything else wears its category's
// pastel SVG icon — identical geometry for every stack size.
+ // GIF thumbs 415 in the bounded endpoint, so tiles fall back to
+ // streaming the original file (animated) on load failure.
return (
<motion.div
key={`${item.id}-${pathIndex}`}
@@ -632,9 +644,14 @@ function BundleFluidPreview({
style={{ zIndex: 10 - realIndex }}
>
{isImg ? (
- <FileStackPhoto src={entry.preview!} width={112} height={112} />
+ <FileStackPhoto
+ src={entry.preview!}
+ width={154}
+ height={154}
+ fallbackSrc={fileStreamUrl(filePath)}
+ />
) : (
- <FileKindIcon path={filePath} width={112} height={112} isDirectory={entry?.isDirectory} />
+ <FileKindIcon path={filePath} width={154} height={154} isDirectory={entry?.isDirectory} />
)}
</motion.div>
)
@@ -673,7 +690,7 @@ function BundleFluidPreview({
>
<div className="fluid-row-icon">
{entry?.isImage && entry.preview ? (
- <FileStackPhoto src={entry.preview} width={48} height={48} />
+ <FileStackPhoto src={entry.preview} width={48} height={48} fallbackSrc={fileStreamUrl(filePath)} />
) : (
<FileKindIcon path={filePath} width={48} height={48} isDirectory={entry?.isDirectory} />
)}
diff --git a/src/components/CustomFileIcon.tsx b/src/components/CustomFileIcon.tsx
index 3824934..9439c72 100644
--- a/src/components/CustomFileIcon.tsx
+++ b/src/components/CustomFileIcon.tsx
@@ -1,4 +1,4 @@
-import { useId, type SVGProps, type JSX } from 'react'
+import { useId, useEffect, useState, type SVGProps, type JSX } from 'react'
import { getFileKind, getFileKindByExt, extOf, type FileKind } from '../lib/fileType'
export interface CustomFileIconProps extends SVGProps<SVGSVGElement> {
@@ -585,19 +585,35 @@ export function FileStackPhoto({
src,
width = 112,
height,
+ fallbackSrc,
}: {
src: string
width?: number | string
height?: number | string
+ /**
+ * Streamed full-res substitute used when the bounded thumbnail cannot be
+ * produced. Electron's nativeImage decodes only PNG/JPEG — formats like
+ * GIF make the thumb endpoint answer 415, and without this fallback the
+ * masked tile renders as an empty broken image (animated GIFs lose their
+ * stack tile). Swapping to edgelocal://file/ lets Chromium play them.
+ */
+ fallbackSrc?: string
}) {
const resolvedHeight = height ?? width
+ // One-shot swap on load failure; keyed back to src whenever a different
+ // image reuses this element.
+ const [activeSrc, setActiveSrc] = useState(src)
+ useEffect(() => { setActiveSrc(src) }, [src])
return (
<img
- src={src}
+ src={activeSrc}
alt=""
draggable={false}
width={typeof width === 'number' ? width : undefined}
height={typeof resolvedHeight === 'number' ? resolvedHeight : undefined}
+ onError={() => {
+ if (fallbackSrc && activeSrc !== fallbackSrc) setActiveSrc(fallbackSrc)
+ }}
style={{
width,
height: resolvedHeight,
diff --git a/src/styles/item.css b/src/styles/item.css
index c547066..d4ba242 100644
--- a/src/styles/item.css
+++ b/src/styles/item.css
@@ -183,10 +183,13 @@
position: absolute;
top: 50%;
left: 50%;
- margin-top: -50px;
- margin-left: -50px;
- width: 100px;
- height: 100px;
+ /* Wrapper is the centering pivot only; the masked tiles render slightly
+ larger than it (154px inside a 140px box) so the fan keeps breathing
+ room inside the fixed 124px stack area without growing the card. */
+ margin-top: -70px;
+ margin-left: -70px;
+ width: 140px;
+ height: 140px;
display: flex;
align-items: center;
justify-content: center;