diff --git a/src/app/folder-viewer/page.tsx b/src/app/folder-viewer/page.tsx index 1767e6e..072caf9 100644 --- a/src/app/folder-viewer/page.tsx +++ b/src/app/folder-viewer/page.tsx @@ -107,13 +107,23 @@ const FolderViewerPage = () => { const directory = path.substring(0, lastSeparatorIndex); const filename = path.substring(lastSeparatorIndex + 1); - // If directory is short enough, show it all - if (directory.length <= 80) { - return `${directory}/${filename}`; + // If the full path is short enough, show it all + if (path.length <= 80) { + return path; } - // Truncate directory with ellipsis in the middle - const maxDirLength = 75; + // If directory is short enough, show directory + truncated filename + if (directory.length <= 50) { + const maxFilenameLength = 80 - directory.length - 1; // -1 for "/" + if (filename.length <= maxFilenameLength) { + return `${directory}/${filename}`; + } else { + return `${directory}/${filename.substring(0, maxFilenameLength - 3)}...`; + } + } + + // For longer paths, show more of the directory structure + const maxDirLength = 45; const startLength = Math.floor(maxDirLength / 2); const endLength = maxDirLength - startLength - 3; // -3 for "..." @@ -121,7 +131,13 @@ const FolderViewerPage = () => { ? `${directory.substring(0, startLength)}...${directory.substring(directory.length - endLength)}` : directory; - return `${truncatedDir}/${filename}`; + // Add filename if there's space + const remainingSpace = 80 - truncatedDir.length - 1; // -1 for "/" + if (remainingSpace > 3) { + return `${truncatedDir}/${filename.length > remainingSpace ? filename.substring(0, remainingSpace - 3) + '...' : filename}`; + } + + return `${truncatedDir}/...`; }; const formatTitle = (title: string) => { @@ -386,9 +402,9 @@ const FolderViewerPage = () => { {!error && Array.isArray(items) && items.map((item) => (
+ 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 min-h-[240px] ${(item.type === 'video' || item.type === 'photo') ? 'cursor-pointer' : ''}`}> { if (item.type === 'video' && item.id) { e.preventDefault(); @@ -399,7 +415,7 @@ const FolderViewerPage = () => { handlePhotoClick(item, photoIndex); } }}> -
+
{item.isDirectory ? (
{
) : isMediaFile(item) ? ( -
+
{item.name} {
)}
-
-

{formatTitle(item.name)}

+
+

{formatTitle(item.name)}

-
+
{formatFileSize(item.size)} {isMediaFile(item) && (item.avg_rating || 0) > 0 && (
- +

diff --git a/src/components/virtualized-media-grid.tsx b/src/components/virtualized-media-grid.tsx index 91b887a..32228a5 100644 --- a/src/components/virtualized-media-grid.tsx +++ b/src/components/virtualized-media-grid.tsx @@ -80,11 +80,11 @@ export default function VirtualizedMediaGrid({ const directory = path.substring(0, lastSeparatorIndex); const filename = path.substring(lastSeparatorIndex + 1); - if (directory.length <= 30) { + if (directory.length <= 40) { return `${directory}/${filename}`; } - const maxDirLength = 25; + const maxDirLength = 35; const startLength = Math.floor(maxDirLength / 2); const endLength = maxDirLength - startLength - 3; @@ -231,13 +231,13 @@ export default function VirtualizedMediaGrid({

- -

+ +

{item.title || item.path.split('/').pop()}

{(item.avg_rating > 0 || item.star_count > 0) && ( -
+