refactor: enhance FindInput and AssetGrid components for better media handling

- Updated FindInput to accept value and onChange props for improved state management.
- Modified AssetGrid to support video assets by integrating Video plugin in Lightbox and adding isVideo property to asset objects.
- Enhanced LazyGridImage to display video duration and a play icon for video assets.
- Introduced humanizeDuration helper function to format video duration for better user experience.
- Updated search API to include download URL for video assets, ensuring consistent asset handling.
This commit is contained in:
Varun Raj committed 2025-04-27 13:56:35 +05:30
1 parent a583c8250c
commit 094a2a6e57
7 files changed
+91 -15

No files matched your search

+3 -1
View File
@@ -6,6 +6,7 @@ import Lightbox from 'yet-another-react-lightbox';
import { Gallery } from "react-grid-gallery";
import LazyGridImage from "../ui/lazy-grid-image";
import Download from "yet-another-react-lightbox/plugins/download";
import Video from "yet-another-react-lightbox/plugins/video";
interface AssetGridProps {
@@ -86,6 +87,7 @@ export default function AssetGrid({ assets, isInternal = true, selectable = fals
height: p.exifImageHeight / 10 as number,
orientation: 1,
isSelected: selectedIds.includes(p.id),
isVideo: p.type === "VIDEO",
}));
}, [assets, selectedIds]);
@@ -106,7 +108,7 @@ export default function AssetGrid({ assets, isInternal = true, selectable = fals
<div>
<Lightbox
slides={slides}
plugins={[Download]}
plugins={[Download, Video]}
open={index >= 0}
index={index}
close={() => setIndex(-1)}