+ className={`group relative bg-white dark:bg-slate-800 rounded-xl shadow-sm hover:shadow-lg transition-all duration-300 hover:-translate-y-1 overflow-hidden ${(item.type === 'video' || item.type === 'photo') ? 'cursor-pointer' : ''}`}>
{
if (item.type === 'video' && item.id) {
e.preventDefault();
handleVideoClick(item);
+ } else if (item.type === 'photo' && item.id) {
+ e.preventDefault();
+ const photoIndex = items.filter(i => i.type === 'photo' && i.id).findIndex(i => i.id === item.id);
+ handlePhotoClick(item, photoIndex);
}
}}>
@@ -156,7 +201,7 @@ const FolderViewerPage = () => {
) : isMediaFile(item) ? (

@@ -227,6 +272,70 @@ const FolderViewerPage = () => {
)}
+ {/* Photo Viewer Modal */}
+ {selectedPhoto && isPhotoViewerOpen && typeof window !== 'undefined' && createPortal(
+
+
e.stopPropagation()}>
+
+
+
+
+ {/* Navigation Arrows */}
+ {items.filter(item => item.type === 'photo' && item.id).length > 1 && (
+ <>
+
+
+ >
+ )}
+
+ {isPhotoLoading && (
+
+ )}
+

setIsPhotoLoading(false)}
+ onError={() => setIsPhotoLoading(false)}
+ />
+
+ {/* Photo Info Bar */}
+
+
+
+
{selectedPhoto.name}
+
{formatFileSize(selectedPhoto.size)}
+
+
+
+
+
,
+ document.body
+ )}
+
{/* Inline Video Player - Rendered as Portal */}
{selectedVideo && isPlayerOpen && typeof window !== 'undefined' && createPortal(
(null);
const [currentPhotoIndex, setCurrentPhotoIndex] = useState(0);
const [isViewerOpen, setIsViewerOpen] = useState(false);
+ const [isPhotoLoading, setIsPhotoLoading] = useState(false);
useEffect(() => {
fetchPhotos();
@@ -61,11 +62,13 @@ export default function PhotosPage() {
setSelectedPhoto(photo);
setCurrentPhotoIndex(index);
setIsViewerOpen(true);
+ setIsPhotoLoading(true);
};
const handleCloseViewer = () => {
setIsViewerOpen(false);
setSelectedPhoto(null);
+ setIsPhotoLoading(false);
};
const handleNextPhoto = () => {
@@ -73,6 +76,7 @@ export default function PhotosPage() {
const nextIndex = (currentPhotoIndex + 1) % filteredPhotos.length;
setCurrentPhotoIndex(nextIndex);
setSelectedPhoto(filteredPhotos[nextIndex]);
+ setIsPhotoLoading(true);
}
};
@@ -81,6 +85,7 @@ export default function PhotosPage() {
const prevIndex = (currentPhotoIndex - 1 + filteredPhotos.length) % filteredPhotos.length;
setCurrentPhotoIndex(prevIndex);
setSelectedPhoto(filteredPhotos[prevIndex]);
+ setIsPhotoLoading(true);
}
};
@@ -181,11 +186,11 @@ export default function PhotosPage() {
>

{
- (e.target as HTMLImageElement).src = '/placeholder.svg';
+ (e.target as HTMLImageElement).src = '/placeholder-photo.svg';
}}
/>
@@ -276,7 +281,7 @@ export default function PhotosPage() {
{/* Photo Viewer Modal */}
{selectedPhoto && isViewerOpen && typeof window !== 'undefined' && createPortal(
-
e.stopPropagation()}>
+
e.stopPropagation()}>
)}
+ {isPhotoLoading && (
+
+ )}

setIsPhotoLoading(false)}
+ onError={() => setIsPhotoLoading(false)}
/>
{/* Photo Info Bar */}
diff --git a/src/app/videos/page.tsx b/src/app/videos/page.tsx
index bef4c65..5b9935b 100644
--- a/src/app/videos/page.tsx
+++ b/src/app/videos/page.tsx
@@ -130,11 +130,11 @@ const VideosPage = () => {
>

{
- (e.target as HTMLImageElement).src = '/placeholder.svg';
+ (e.target as HTMLImageElement).src = '/placeholder-video.svg';
}}
/>