mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: show loading spinner instead of error for HEIC preview, default fullscreen details to visible
Replace static "Preview not available" and "Cannot preview this image format" messages with a loading spinner in ImageViewer and SplitCanvas, since HEIC files get server-side conversion and the preview appears after a few seconds. Also default showDetails to true on /fullscreen.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Maximize, Minimize2, ZoomIn, ZoomOut } from "lucide-react";
|
||||
import { Loader2, Maximize, Minimize2, ZoomIn, ZoomOut } from "lucide-react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { formatFileSize } from "@/lib/download";
|
||||
|
||||
@@ -182,11 +182,10 @@ export function ImageViewer({
|
||||
}}
|
||||
>
|
||||
{loadError ? (
|
||||
<div className="flex flex-col items-center gap-2 text-center">
|
||||
<p className="text-sm text-muted-foreground">Preview not available</p>
|
||||
<p className="text-xs text-muted-foreground/60">
|
||||
This format cannot be displayed in the browser
|
||||
</p>
|
||||
<div className="flex flex-col items-center justify-center gap-3 text-center">
|
||||
<Loader2 className="h-8 w-8 text-muted-foreground animate-spin" />
|
||||
<p className="text-sm text-muted-foreground">Loading preview...</p>
|
||||
<p className="text-xs text-muted-foreground/60">{filename}</p>
|
||||
</div>
|
||||
) : bgPreview?.backgroundSrc || bgPreview?.containerBackground ? (
|
||||
/* Layered bg-removal preview: background layer + subject layer */
|
||||
|
||||
@@ -88,9 +88,10 @@ export function SplitCanvas() {
|
||||
|
||||
if (loadError) {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center h-full gap-2 text-center p-4">
|
||||
<p className="text-sm text-muted-foreground">Cannot preview this image format</p>
|
||||
<p className="text-xs text-muted-foreground">{filename}</p>
|
||||
<div className="flex flex-col items-center justify-center h-full gap-3 text-center p-4">
|
||||
<Loader2 className="h-8 w-8 text-muted-foreground animate-spin" />
|
||||
<p className="text-sm text-muted-foreground">Loading preview...</p>
|
||||
<p className="text-xs text-muted-foreground/60">{filename}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useFeaturesStore } from "@/stores/features-store";
|
||||
|
||||
export function FullscreenGridPage() {
|
||||
const [search, setSearch] = useState("");
|
||||
const [showDetails, setShowDetails] = useState(false);
|
||||
const [showDetails, setShowDetails] = useState(true);
|
||||
const navigate = useNavigate();
|
||||
const [disabledTools, setDisabledTools] = useState<string[]>([]);
|
||||
const [experimentalEnabled, setExperimentalEnabled] = useState(false);
|
||||
|
||||
Reference in New Issue
Block a user