diff --git a/web/src/components/card/ExportCard.tsx b/web/src/components/card/ExportCard.tsx index 021524532..a7f5e7657 100644 --- a/web/src/components/card/ExportCard.tsx +++ b/web/src/components/card/ExportCard.tsx @@ -1,9 +1,8 @@ import ActivityIndicator from "../indicators/activity-indicator"; -import { LuTrash } from "react-icons/lu"; import { Button } from "../ui/button"; import { useCallback, useState } from "react"; -import { isDesktop, isMobile } from "react-device-detect"; -import { FaDownload, FaPlay, FaShareAlt } from "react-icons/fa"; +import { isMobile } from "react-device-detect"; +import { FiMoreVertical } from "react-icons/fi"; import { Skeleton } from "../ui/skeleton"; import { Dialog, @@ -15,15 +14,19 @@ import { import { Input } from "../ui/input"; import useKeyboardListener from "@/hooks/use-keyboard-listener"; import { DeleteClipType, Export } from "@/types/export"; -import { MdEditSquare } from "react-icons/md"; import { baseUrl } from "@/api/baseUrl"; import { cn } from "@/lib/utils"; import { shareOrCopy } from "@/utils/browserUtil"; import { useTranslation } from "react-i18next"; import { ImageShadowOverlay } from "../overlay/ImageShadowOverlay"; import BlurredIconButton from "../button/BlurredIconButton"; -import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip"; import { useIsAdmin } from "@/hooks/use-is-admin"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "../ui/dropdown-menu"; type ExportProps = { className: string; @@ -42,7 +45,6 @@ export default function ExportCard({ }: ExportProps) { const { t } = useTranslation(["views/exports"]); const isAdmin = useIsAdmin(); - const [hovered, setHovered] = useState(false); const [loading, setLoading] = useState( exportedRecording.thumb_path.length > 0, ); @@ -136,12 +138,14 @@ export default function ExportCard({
setHovered(true) : undefined} - onMouseLeave={isDesktop ? () => setHovered(false) : undefined} - onClick={isDesktop ? undefined : () => setHovered(!hovered)} + onClick={() => { + if (!exportedRecording.in_progress) { + onSelect(exportedRecording); + } + }} > {exportedRecording.in_progress ? ( @@ -158,95 +162,76 @@ export default function ExportCard({ )} )} - {hovered && ( - <> -
-
-
- {!exportedRecording.in_progress && ( - - - - shareOrCopy( - `${baseUrl}export?id=${exportedRecording.id}`, - exportedRecording.name.replaceAll("_", " "), - ) - } - > - - - - {t("tooltip.shareExport")} - - )} - {!exportedRecording.in_progress && ( + {!exportedRecording.in_progress && ( +
+ + + e.stopPropagation()} + > + + + + + { + e.stopPropagation(); + shareOrCopy( + `${baseUrl}export?id=${exportedRecording.id}`, + exportedRecording.name.replaceAll("_", " "), + ); + }} + > + {t("tooltip.shareExport")} + + e.stopPropagation()} > - - - - - - - - {t("tooltip.downloadVideo")} - - + {t("tooltip.downloadVideo")} - )} - {isAdmin && !exportedRecording.in_progress && ( - - - - setEditName({ - original: exportedRecording.name, - update: undefined, - }) - } - > - - - - {t("tooltip.editName")} - + + {isAdmin && ( + { + e.stopPropagation(); + setEditName({ + original: exportedRecording.name, + update: undefined, + }); + }} + > + {t("tooltip.editName")} + )} {isAdmin && ( - - - - onDelete({ - file: exportedRecording.id, - exportName: exportedRecording.name, - }) - } - > - - - - {t("tooltip.deleteExport")} - + { + e.stopPropagation(); + onDelete({ + file: exportedRecording.id, + exportName: exportedRecording.name, + }); + }} + > + {t("tooltip.deleteExport")} + )} -
-
- - {!exportedRecording.in_progress && ( - - )} - + + +
)} {loading && (