From f76169ada15cff51dbf9ce3af148a78c46ed36c6 Mon Sep 17 00:00:00 2001 From: Simon Orzel Date: Wed, 16 Jul 2025 00:48:00 +0200 Subject: feat: refactors media drag overlay and media tab --- apps/web/src/components/ui/drag-overlay.tsx | 78 ++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 6 deletions(-) (limited to 'apps/web/src/components/ui/drag-overlay.tsx') diff --git a/apps/web/src/components/ui/drag-overlay.tsx b/apps/web/src/components/ui/drag-overlay.tsx index ba6fe08f..eb190e89 100644 --- a/apps/web/src/components/ui/drag-overlay.tsx +++ b/apps/web/src/components/ui/drag-overlay.tsx @@ -1,25 +1,91 @@ -import { Upload } from "lucide-react"; +import { Upload, Plus, Image } from "lucide-react"; +import { Button } from "@/components/ui/button"; interface DragOverlayProps { isVisible: boolean; title?: string; description?: string; + isProcessing?: boolean; + progress?: number; + onClick?: () => void; + isEmptyState?: boolean; } export function DragOverlay({ isVisible, title = "Drop files here", description = "Images, videos, and audio files", + isProcessing = false, + progress = 0, + onClick, + isEmptyState = false, }: DragOverlayProps) { if (!isVisible) return null; + const handleClick = (e: React.MouseEvent) => { + if (isProcessing || !onClick) return; + e.preventDefault(); + e.stopPropagation(); + onClick(); + }; + return ( -
-
- -

{title}

-

{description}

+
+
+ {isProcessing ? ( + + ) : isEmptyState ? ( + + ) : ( + + )} +
+ +
+

+ {isProcessing ? "Processing files..." : title} +

+

+ {isProcessing + ? `Processing your files (${progress}%)` + : description + } +

+ + {!isProcessing && ( +
+ +

+ {isEmptyState + ? "Supports images, videos, and audio files" + : "Or drop your files here" + } +

+
+ )} + + {isProcessing && ( +
+
+
+
+
+ )}
); } -- cgit v1.3.1 From a7e23ec714faabbeaa3b6a673e7e2d86825944bd Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Wed, 16 Jul 2025 12:22:09 +0200 Subject: media drag overlay cleanup --- .../components/editor/media-panel/drag-overlay.tsx | 57 ++++++++++++++ .../components/editor/media-panel/views/media.tsx | 20 +---- apps/web/src/components/ui/drag-overlay.tsx | 91 ---------------------- 3 files changed, 60 insertions(+), 108 deletions(-) create mode 100644 apps/web/src/components/editor/media-panel/drag-overlay.tsx delete mode 100644 apps/web/src/components/ui/drag-overlay.tsx (limited to 'apps/web/src/components/ui/drag-overlay.tsx') diff --git a/apps/web/src/components/editor/media-panel/drag-overlay.tsx b/apps/web/src/components/editor/media-panel/drag-overlay.tsx new file mode 100644 index 00000000..3f3820db --- /dev/null +++ b/apps/web/src/components/editor/media-panel/drag-overlay.tsx @@ -0,0 +1,57 @@ +import { Upload, Plus, Image } from "lucide-react"; +import { Button } from "@/components/ui/button"; + +interface MediaDragOverlayProps { + isVisible: boolean; + isProcessing?: boolean; + progress?: number; + onClick?: () => void; + isEmptyState?: boolean; +} + +export function MediaDragOverlay({ + isVisible, + isProcessing = false, + progress = 0, + onClick, + isEmptyState = false, +}: MediaDragOverlayProps) { + if (!isVisible) return null; + + const handleClick = (e: React.MouseEvent) => { + if (isProcessing || !onClick) return; + e.preventDefault(); + e.stopPropagation(); + onClick(); + }; + + return ( +
+
+ +
+ +
+

+ {isProcessing + ? `Processing your files (${progress}%)` + : "Drag and drop videos, photos, and audio files here"} +

+
+ + {isProcessing && ( +
+
+
+
+
+ )} +
+ ); +} diff --git a/apps/web/src/components/editor/media-panel/views/media.tsx b/apps/web/src/components/editor/media-panel/views/media.tsx index e532e540..631fe39a 100644 --- a/apps/web/src/components/editor/media-panel/views/media.tsx +++ b/apps/web/src/components/editor/media-panel/views/media.tsx @@ -7,7 +7,7 @@ import { Image, Loader2, Music, Plus, Video } from "lucide-react"; import { useEffect, useRef, useState } from "react"; import { toast } from "sonner"; import { Button } from "@/components/ui/button"; -import { DragOverlay } from "@/components/ui/drag-overlay"; +import { MediaDragOverlay } from "@/components/editor/media-panel/drag-overlay"; import { ContextMenu, ContextMenuContent, @@ -242,23 +242,9 @@ export function MediaView() {
- {(isDragOver || filteredMediaItems.length === 0) ? ( - void; - isEmptyState?: boolean; -} - -export function DragOverlay({ - isVisible, - title = "Drop files here", - description = "Images, videos, and audio files", - isProcessing = false, - progress = 0, - onClick, - isEmptyState = false, -}: DragOverlayProps) { - if (!isVisible) return null; - - const handleClick = (e: React.MouseEvent) => { - if (isProcessing || !onClick) return; - e.preventDefault(); - e.stopPropagation(); - onClick(); - }; - - return ( -
-
- {isProcessing ? ( - - ) : isEmptyState ? ( - - ) : ( - - )} -
- -
-

- {isProcessing ? "Processing files..." : title} -

-

- {isProcessing - ? `Processing your files (${progress}%)` - : description - } -

-
- - {!isProcessing && ( -
- -

- {isEmptyState - ? "Supports images, videos, and audio files" - : "Or drop your files here" - } -

-
- )} - - {isProcessing && ( -
-
-
-
-
- )} -
- ); -} -- cgit v1.3.1