🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots 📖
TypeScript browser-extensionchrome-extensiondocumentationfirefox-extensionguide-generatorlocal-firstmanifest-v3privacy-firstproductivityreactscreenshotstep-by-step-guidetutorialtypescriptworkflowwxt
feat(editor): add inline zoom and pan controls to screenshots
Luis Ortizcbca0cf99315
diff --git a/src/locales/en.yml b/src/locales/en.ymlindex fc1fa67..1fa20e7 100644--- a/src/locales/en.yml+++ b/src/locales/en.yml@@ -161,6 +161,11 @@ blurPanel:doneResume: "Done \xB7 Resume Recording"resetAll: Reset All+screenshotView:+ zoomIn: Zoom in+ zoomOut: Zoom out+ saved: Saved+exportMenu:html: HTMLmarkdown: Markdowndiff --git a/src/locales/es.yml b/src/locales/es.ymlindex 46fa5ca..a99a6ae 100644--- a/src/locales/es.yml+++ b/src/locales/es.yml@@ -161,6 +161,11 @@ blurPanel:doneResume: "Listo \xB7 Continuar grabación"resetAll: Restablecer todo+screenshotView:+ zoomIn: Acercar+ zoomOut: Alejar+ saved: Guardado+exportMenu:html: HTMLmarkdown: Markdowndiff --git a/src/locales/fr.yml b/src/locales/fr.ymlindex c3cf21e..82e1f8b 100644--- a/src/locales/fr.yml+++ b/src/locales/fr.yml@@ -161,6 +161,11 @@ blurPanel:doneResume: "Terminé \xB7 Reprendre l'enregistrement"resetAll: Tout réinitialiser+screenshotView:+ zoomIn: "Zoom avant"+ zoomOut: "Zoom arrière"+ saved: "Enregistré"+exportMenu:html: HTMLmarkdown: Markdowndiff --git a/src/locales/pt-BR.yml b/src/locales/pt-BR.ymlindex a3c5a8f..f3eca6e 100644--- a/src/locales/pt-BR.yml+++ b/src/locales/pt-BR.yml@@ -161,6 +161,11 @@ blurPanel:doneResume: "Pronto \xB7 Continuar gravação"resetAll: Limpar tudo+screenshotView:+ zoomIn: Aumentar zoom+ zoomOut: Diminuir zoom+ saved: Salvo+exportMenu:html: HTMLmarkdown: Markdowndiff --git a/src/ui/fullview/components/GuideGridView.tsx b/src/ui/fullview/components/GuideGridView.tsxindex 8e84ca4..25a584c 100644--- a/src/ui/fullview/components/GuideGridView.tsx+++ b/src/ui/fullview/components/GuideGridView.tsx@@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from 'react';import { i18n } from '#imports';import { formatDate } from '@/lib/utils';import { useFullview } from '@/stores/fullview';-import ZoomScreenshot from '@/ui/sidepanel/ZoomScreenshot';+import ScreenshotView from '@/ui/shared/ScreenshotView';import { navigate } from '../router';interface GuideGridViewProps {@@ -152,7 +152,7 @@ export default function GuideGridView({ category, onStar, onTrash, onRestore, on><div className="h-36 overflow-hidden rounded-t-xl">{thumb ? (- <ZoomScreenshot screenshot={thumb} alt={guide.title} className="!rounded-none !border-0" />+ <ScreenshotView screenshot={thumb} alt={guide.title} className="!rounded-none !border-0" readOnly />) : (<MimikEyes />)}diff --git a/src/ui/shared/ScreenshotView.tsx b/src/ui/shared/ScreenshotView.tsxnew file mode 100644index 0000000..9a0188e--- /dev/null+++ b/src/ui/shared/ScreenshotView.tsx@@ -0,0 +1,293 @@+import { ZoomIn, ZoomOut } from 'lucide-react';+import { useEffect, useRef, useState } from 'react';+import { i18n } from '#imports';+import { updateScreenshotEdits } from '@/core/guides/service';+import type { Screenshot, ScreenshotBounds } from '@/core/guides/types';+import { panBy, resolveViewport, zoomBy } from '@/core/screenshot/geometry';+import { renderScreenshot } from '@/core/screenshot/render';+import type { ScreenshotEdits } from '@/core/screenshot/types';++interface ScreenshotViewProps {+ screenshot: Screenshot;+ className?: string;+ alt?: string;+ animate?: boolean;+ crop?: boolean;+ readOnly?: boolean;+}++interface DragState {+ pointerId: number;+ startX: number;+ startY: number;+ startViewport: ScreenshotBounds;+ moved: boolean;+}++const SAVE_DEBOUNCE_MS = 400;+const SAVED_MESSAGE_MS = 1500;+const ZOOM_IN_FACTOR = 1.25;+const ZOOM_OUT_FACTOR = 0.8;+const VIEWPORT_EPSILON = 0.5;++function isFullFrame(viewport: ScreenshotBounds, screenshot: Screenshot): boolean {+ return (+ viewport.x === 0 && viewport.y === 0 && viewport.width === screenshot.width && viewport.height === screenshot.height+ );+}++function withFullViewport(screenshot: Screenshot): Screenshot {+ return {+ ...screenshot,+ edits: { ...screenshot.edits, viewport: { x: 0, y: 0, width: screenshot.width, height: screenshot.height } },+ };+}++export default function ScreenshotView({+ screenshot,+ className = '',+ alt = '',+ animate = false,+ crop = false,+ readOnly = false,+}: ScreenshotViewProps) {+ const [fullUrl, setFullUrl] = useState<string | null>(null);+ const [croppedUrl, setCroppedUrl] = useState<string | null>(null);+ const [showCropped, setShowCropped] = useState(false);+ const [editsOverride, setEditsOverride] = useState<ScreenshotEdits | undefined>(undefined);+ const [saved, setSaved] = useState(false);+ const processedKeyRef = useRef<string | null>(null);+ const urlsRef = useRef<string[]>([]);+ const imgRef = useRef<HTMLImageElement>(null);+ const idRef = useRef(screenshot.id);+ const saveTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ const savedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ const dragRef = useRef<DragState | null>(null);++ const effectiveEdits = editsOverride ?? screenshot.edits;++ useEffect(() => {+ if (idRef.current !== screenshot.id) {+ idRef.current = screenshot.id;+ setEditsOverride(undefined);+ }+ }, [screenshot.id]);++ useEffect(() => {+ if (!screenshot.blob) return;+ const cacheKey = `${screenshot.id}:${screenshot.blob.size}:${JSON.stringify(effectiveEdits)}`;+ if (processedKeyRef.current === cacheKey) return;++ let cancelled = false;+ const current: Screenshot = { ...screenshot, edits: effectiveEdits };++ (async () => {+ const viewport = resolveViewport(current);+ const needsCrop = crop && !isFullFrame(viewport, current);++ const [fullBlob, viewportBlob] = await Promise.all([+ renderScreenshot(withFullViewport(current)),+ needsCrop ? renderScreenshot(current) : Promise.resolve(null),+ ]);++ const newFullUrl = URL.createObjectURL(fullBlob);+ const newCroppedUrl = viewportBlob ? URL.createObjectURL(viewportBlob) : null;++ if (cancelled) {+ URL.revokeObjectURL(newFullUrl);+ if (newCroppedUrl) URL.revokeObjectURL(newCroppedUrl);+ return;+ }++ processedKeyRef.current = cacheKey;+ for (const u of urlsRef.current) URL.revokeObjectURL(u);++ if (newCroppedUrl) {+ urlsRef.current = [newFullUrl, newCroppedUrl];+ setShowCropped(false);+ setFullUrl(newFullUrl);+ setCroppedUrl(newCroppedUrl);+ } else {+ urlsRef.current = [newFullUrl];+ setShowCropped(true);+ setFullUrl(newFullUrl);+ setCroppedUrl(null);+ }+ })();++ return () => {+ cancelled = true;+ };+ }, [screenshot, crop, effectiveEdits]);++ useEffect(() => {+ if (!croppedUrl || showCropped) return;+ if (!animate) {+ setShowCropped(true);+ return;+ }+ let id = requestAnimationFrame(() => {+ id = requestAnimationFrame(() => {+ setShowCropped(true);+ });+ });+ return () => cancelAnimationFrame(id);+ }, [croppedUrl, showCropped, animate]);++ useEffect(() => {+ return () => {+ for (const u of urlsRef.current) URL.revokeObjectURL(u);+ };+ }, []);++ useEffect(() => {+ return () => {+ if (saveTimerRef.current) clearTimeout(saveTimerRef.current);+ if (savedTimerRef.current) clearTimeout(savedTimerRef.current);+ };+ }, []);++ const scheduleSave = (edits: ScreenshotEdits) => {+ if (saveTimerRef.current) clearTimeout(saveTimerRef.current);+ saveTimerRef.current = setTimeout(() => {+ updateScreenshotEdits(screenshot.id, edits).then(() => {+ setSaved(true);+ if (savedTimerRef.current) clearTimeout(savedTimerRef.current);+ savedTimerRef.current = setTimeout(() => setSaved(false), SAVED_MESSAGE_MS);+ });+ }, SAVE_DEBOUNCE_MS);+ };++ const handleZoom = (factor: number) => {+ const current: Screenshot = { ...screenshot, edits: effectiveEdits };+ const viewport = resolveViewport(current);+ const nextViewport = zoomBy(viewport, factor, screenshot);+ const nextEdits: ScreenshotEdits = { ...effectiveEdits, viewport: nextViewport };+ setEditsOverride(nextEdits);+ scheduleSave(nextEdits);+ };++ const handlePointerDown = (e: React.PointerEvent<HTMLImageElement>) => {+ if (readOnly || !crop) return;+ const viewport = resolveViewport({ ...screenshot, edits: effectiveEdits });+ const zoomed =+ viewport.width < screenshot.width - VIEWPORT_EPSILON || viewport.height < screenshot.height - VIEWPORT_EPSILON;+ if (!zoomed) return;+ e.currentTarget.setPointerCapture(e.pointerId);+ dragRef.current = {+ pointerId: e.pointerId,+ startX: e.clientX,+ startY: e.clientY,+ startViewport: viewport,+ moved: false,+ };+ };++ const handlePointerMove = (e: React.PointerEvent<HTMLImageElement>) => {+ const drag = dragRef.current;+ if (!drag || drag.pointerId !== e.pointerId) return;+ const el = imgRef.current;+ if (!el || el.clientWidth === 0) return;+ drag.moved = true;+ const scale = drag.startViewport.width / el.clientWidth;+ const dx = (e.clientX - drag.startX) * scale;+ const dy = (e.clientY - drag.startY) * scale;+ const nextViewport = panBy(drag.startViewport, -dx, -dy, screenshot);+ setEditsOverride({ ...effectiveEdits, viewport: nextViewport });+ };++ const handlePointerEnd = (e: React.PointerEvent<HTMLImageElement>) => {+ const drag = dragRef.current;+ if (!drag || drag.pointerId !== e.pointerId) return;+ dragRef.current = null;+ if (drag.moved) scheduleSave(effectiveEdits ?? {});+ };++ const ratio = screenshot.width && screenshot.height ? screenshot.width / screenshot.height : 16 / 9;++ if (!fullUrl) {+ return (+ <div className={`rounded-lg bg-secondary p-4 flex flex-col gap-2.5 ${className}`} style={{ aspectRatio: ratio }}>+ <div className="h-7 rounded-md bg-border/60 animate-pulse" />+ <div className="flex-1 flex gap-3">+ <div className="w-[30%] flex flex-col gap-2">+ <div className="h-5 rounded bg-border/50 animate-pulse [animation-delay:100ms]" />+ <div className="h-4 rounded bg-border/40 animate-pulse [animation-delay:200ms]" />+ <div className="h-4 rounded bg-border/40 animate-pulse [animation-delay:300ms]" />+ <div className="h-4 rounded bg-border/40 animate-pulse [animation-delay:400ms]" />+ </div>+ <div className="flex-1 flex flex-col gap-2">+ <div className="h-6 w-3/5 rounded bg-border/40 animate-pulse [animation-delay:150ms]" />+ <div className="h-3 w-4/5 rounded bg-border/30 animate-pulse [animation-delay:250ms]" />+ <div className="h-3 w-[70%] rounded bg-border/30 animate-pulse [animation-delay:350ms]" />+ <div className="h-3 w-3/4 rounded bg-border/30 animate-pulse [animation-delay:450ms]" />+ </div>+ </div>+ </div>+ );+ }++ const currentViewport = resolveViewport({ ...screenshot, edits: effectiveEdits });+ const isZoomed =+ currentViewport.width < screenshot.width - VIEWPORT_EPSILON ||+ currentViewport.height < screenshot.height - VIEWPORT_EPSILON;+ const showControls = !readOnly && crop;++ return (+ <div className={`relative overflow-hidden rounded-lg border border-border ${className}`}>+ <img+ ref={imgRef}+ src={croppedUrl || fullUrl}+ alt={alt}+ draggable={false}+ className={`w-full block ${showControls && isZoomed ? 'cursor-grab active:cursor-grabbing' : ''}`}+ onPointerDown={handlePointerDown}+ onPointerMove={handlePointerMove}+ onPointerUp={handlePointerEnd}+ onPointerCancel={handlePointerEnd}+ />+ {croppedUrl && (+ <img+ src={fullUrl}+ alt=""+ className="absolute inset-0 w-full h-full block pointer-events-none"+ style={{+ opacity: showCropped ? 0 : 1,+ transition: 'opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1)',+ }}+ />+ )}+ {showControls && (+ <div className="absolute bottom-2 right-2 z-10 flex items-center gap-1">+ {saved && (+ <span className="flex items-center px-2 h-7 rounded-md text-[10px] font-semibold bg-primary text-primary-foreground shadow-sm">+ {i18n.t('screenshotView.saved')}+ </span>+ )}+ <button+ type="button"+ onClick={(e) => {+ e.stopPropagation();+ handleZoom(ZOOM_IN_FACTOR);+ }}+ className="flex items-center justify-center w-7 h-7 rounded-md border border-border bg-card/90 text-foreground backdrop-blur-sm transition-colors hover:bg-secondary hover:text-accent"+ title={i18n.t('screenshotView.zoomIn')}+ >+ <ZoomIn size={14} />+ </button>+ <button+ type="button"+ onClick={(e) => {+ e.stopPropagation();+ handleZoom(ZOOM_OUT_FACTOR);+ }}+ className="flex items-center justify-center w-7 h-7 rounded-md border border-border bg-card/90 text-foreground backdrop-blur-sm transition-colors hover:bg-secondary hover:text-accent"+ title={i18n.t('screenshotView.zoomOut')}+ >+ <ZoomOut size={14} />+ </button>+ </div>+ )}+ </div>+ );+}diff --git a/src/ui/sidepanel/RecordingView.tsx b/src/ui/sidepanel/RecordingView.tsxindex 1e118c1..c1b0116 100644--- a/src/ui/sidepanel/RecordingView.tsx+++ b/src/ui/sidepanel/RecordingView.tsx@@ -7,7 +7,7 @@ import { getActiveTab } from '@/lib/browser-api';import { sendMessage } from '@/lib/messaging';import { extractDomain } from '@/lib/utils';import { Button } from '@/ui/components/ui/button';-import ZoomScreenshot from './ZoomScreenshot';+import ScreenshotView from '@/ui/shared/ScreenshotView';interface RecordingViewProps {guideId: string;@@ -146,12 +146,13 @@ export default function RecordingView({ guideId, onStop }: RecordingViewProps) {<div className="px-4 pb-4 group">{liveStep.screenshot && (<div className="mb-2">- <ZoomScreenshot+ <ScreenshotViewscreenshot={liveStep.screenshot}alt={liveStep.step.description}className="shadow-sm"cropanimate+ readOnly/></div>)}diff --git a/src/ui/sidepanel/StepCard.tsx b/src/ui/sidepanel/StepCard.tsxindex d418043..a343fac 100644--- a/src/ui/sidepanel/StepCard.tsx+++ b/src/ui/sidepanel/StepCard.tsx@@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';import { i18n } from '#imports';import type { Screenshot, Step } from '@/core/guides/types';import { logger } from '@/lib/logger';-import ZoomScreenshot from './ZoomScreenshot';+import ScreenshotView from '@/ui/shared/ScreenshotView';interface DragHandleProps {onDragStart: (e: React.DragEvent) => void;@@ -76,10 +76,11 @@ export default function StepCard({className={`rounded-xl mb-3 overflow-hidden transition-shadow border border-border bg-card ${dragOver ? 'ring-2 ring-accent' : ''}`}>{screenshot ? (- <ZoomScreenshot+ <ScreenshotViewscreenshot={screenshot}alt={`Step ${step.index + 1} screenshot`}className="!rounded-none !border-0"+ crop/>) : (<div className="w-full h-32 flex items-center justify-center text-sm bg-secondary text-purple">diff --git a/src/ui/sidepanel/ZoomScreenshot.tsx b/src/ui/sidepanel/ZoomScreenshot.tsxdeleted file mode 100644index 8db31ab..0000000--- a/src/ui/sidepanel/ZoomScreenshot.tsx+++ /dev/null@@ -1,227 +0,0 @@-import { useEffect, useRef, useState } from 'react';-import type { Screenshot } from '@/core/guides/types';--interface ZoomScreenshotProps {- screenshot: Screenshot;- className?: string;- alt?: string;- animate?: boolean;- crop?: boolean;-}--function clamp(val: number, min: number, max: number): number {- return Math.max(min, Math.min(max, val));-}--function drawRoundedRect(- ctx: OffscreenCanvasRenderingContext2D,- x: number,- y: number,- w: number,- h: number,- r: number,-) {- ctx.beginPath();- ctx.moveTo(x + r, y);- ctx.lineTo(x + w - r, y);- ctx.quadraticCurveTo(x + w, y, x + w, y + r);- ctx.lineTo(x + w, y + h - r);- ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);- ctx.lineTo(x + r, y + h);- ctx.quadraticCurveTo(x, y + h, x, y + h - r);- ctx.lineTo(x, y + r);- ctx.quadraticCurveTo(x, y, x + r, y);- ctx.closePath();- ctx.stroke();-}--async function renderScreenshot(- screenshot: Screenshot,-): Promise<{ fullUrl: string; croppedUrl: string } | { fullUrl: string; croppedUrl: null }> {- const img = await createImageBitmap(screenshot.blob);- const imgW = img.width;- const imgH = img.height;- const bounds = screenshot.bounds;- const dpr = screenshot.pixelRatio || 1;-- const fullCanvas = new OffscreenCanvas(imgW, imgH);- const fullCtx = fullCanvas.getContext('2d')!;- fullCtx.drawImage(img, 0, 0, imgW, imgH);-- if (!bounds) {- img.close();- const fullBlob = await fullCanvas.convertToBlob({ type: 'image/webp', quality: 0.8 });- return { fullUrl: URL.createObjectURL(fullBlob), croppedUrl: null };- }-- const bx = bounds.x * dpr;- const by = bounds.y * dpr;- const bw = bounds.width * dpr;- const bh = bounds.height * dpr;-- fullCtx.strokeStyle = '#4F46E5';- fullCtx.lineWidth = 3.5;- fullCtx.setLineDash([8, 5]);- drawRoundedRect(fullCtx, bx, by, bw, bh, 12);- fullCtx.setLineDash([]);-- const fullBlob = await fullCanvas.convertToBlob({ type: 'image/webp', quality: 0.8 });- const fullUrl = URL.createObjectURL(fullBlob);-- const PAD_RATIO = 0.3;- const padH = PAD_RATIO * imgW;- const padV = PAD_RATIO * imgH;- const imgAspect = imgW / imgH;- const elAspect = bw / bh;-- const cx = bx + bw / 2;- const cy = by + bh / 2;-- let visW = bw + padH;- let visH = bh + padV;-- if (elAspect > 1) {- visW = bw + padH;- visH = visW / imgAspect;- } else if (elAspect < 1) {- visH = bh + padV;- visW = visH * imgAspect;- }-- visW = Math.min(visW, imgW);- visH = Math.min(visH, imgH);-- const cropX = clamp(cx - visW / 2, 0, imgW - visW);- const cropY = clamp(cy - visH / 2, 0, imgH - visH);-- const cropCanvas = new OffscreenCanvas(imgW, imgH);- const cropCtx = cropCanvas.getContext('2d')!;- cropCtx.drawImage(img, cropX, cropY, visW, visH, 0, 0, imgW, imgH);-- const scaleX = imgW / visW;- const scaleY = imgH / visH;- cropCtx.strokeStyle = '#4F46E5';- cropCtx.lineWidth = 3.5;- cropCtx.setLineDash([8, 5]);- drawRoundedRect(cropCtx, (bx - cropX) * scaleX, (by - cropY) * scaleY, bw * scaleX, bh * scaleY, 12);- cropCtx.setLineDash([]);-- img.close();- const croppedBlob = await cropCanvas.convertToBlob({ type: 'image/webp', quality: 0.8 });- const croppedUrl = URL.createObjectURL(croppedBlob);-- return { fullUrl, croppedUrl };-}--export default function ZoomScreenshot({- screenshot,- className = '',- alt = '',- animate = false,- crop = false,-}: ZoomScreenshotProps) {- const [fullUrl, setFullUrl] = useState<string | null>(null);- const [croppedUrl, setCroppedUrl] = useState<string | null>(null);- const [showCropped, setShowCropped] = useState(false);- const processedKeyRef = useRef<string | null>(null);- const urlsRef = useRef<string[]>([]);-- useEffect(() => {- if (!screenshot.blob) return;- const cacheKey = `${screenshot.id}:${screenshot.blob.size}`;- if (processedKeyRef.current === cacheKey) return;-- let cancelled = false;-- (async () => {- const result = await renderScreenshot(screenshot);- if (cancelled) {- URL.revokeObjectURL(result.fullUrl);- if (result.croppedUrl) URL.revokeObjectURL(result.croppedUrl);- return;- }-- processedKeyRef.current = cacheKey;-- for (const u of urlsRef.current) URL.revokeObjectURL(u);-- if (crop && result.croppedUrl) {- urlsRef.current = [result.fullUrl, result.croppedUrl];- setShowCropped(false);- setFullUrl(result.fullUrl);- setCroppedUrl(result.croppedUrl);- } else {- if (result.croppedUrl) URL.revokeObjectURL(result.croppedUrl);- urlsRef.current = [result.fullUrl];- setShowCropped(true);- setFullUrl(result.fullUrl);- setCroppedUrl(null);- }- })();-- return () => {- cancelled = true;- };- }, [screenshot, crop]);-- useEffect(() => {- if (!croppedUrl || showCropped) return;- if (!animate) {- setShowCropped(true);- return;- }- let id = requestAnimationFrame(() => {- id = requestAnimationFrame(() => {- setShowCropped(true);- });- });- return () => cancelAnimationFrame(id);- }, [croppedUrl, showCropped, animate]);-- useEffect(() => {- return () => {- for (const u of urlsRef.current) URL.revokeObjectURL(u);- };- }, []);-- const ratio = screenshot.width && screenshot.height ? screenshot.width / screenshot.height : 16 / 9;-- if (!fullUrl) {- return (- <div className={`rounded-lg bg-secondary p-4 flex flex-col gap-2.5 ${className}`} style={{ aspectRatio: ratio }}>- <div className="h-7 rounded-md bg-border/60 animate-pulse" />- <div className="flex-1 flex gap-3">- <div className="w-[30%] flex flex-col gap-2">- <div className="h-5 rounded bg-border/50 animate-pulse [animation-delay:100ms]" />- <div className="h-4 rounded bg-border/40 animate-pulse [animation-delay:200ms]" />- <div className="h-4 rounded bg-border/40 animate-pulse [animation-delay:300ms]" />- <div className="h-4 rounded bg-border/40 animate-pulse [animation-delay:400ms]" />- </div>- <div className="flex-1 flex flex-col gap-2">- <div className="h-6 w-3/5 rounded bg-border/40 animate-pulse [animation-delay:150ms]" />- <div className="h-3 w-4/5 rounded bg-border/30 animate-pulse [animation-delay:250ms]" />- <div className="h-3 w-[70%] rounded bg-border/30 animate-pulse [animation-delay:350ms]" />- <div className="h-3 w-3/4 rounded bg-border/30 animate-pulse [animation-delay:450ms]" />- </div>- </div>- </div>- );- }-- return (- <div className={`relative overflow-hidden rounded-lg border border-border ${className}`}>- <img src={croppedUrl || fullUrl} alt={alt} className="w-full block" />- {croppedUrl && (- <img- src={fullUrl}- alt=""- className="absolute inset-0 w-full h-full block"- style={{- opacity: showCropped ? 0 : 1,- transition: 'opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1)',- }}- />- )}- </div>- );-}