From ad14f97d90623dcd481f73edd425da9b861e581e Mon Sep 17 00:00:00 2001 From: KodekaTeam Date: Sun, 21 Jun 2026 11:46:49 +0700 Subject: [PATCH] Compact container file manager breadcrumb and actions --- .../modals/ContainerFileManagerModal.tsx | 240 ++++++++++++++---- 1 file changed, 187 insertions(+), 53 deletions(-) diff --git a/src/app/containers/components/modals/ContainerFileManagerModal.tsx b/src/app/containers/components/modals/ContainerFileManagerModal.tsx index 2f809cc..9f35ebf 100644 --- a/src/app/containers/components/modals/ContainerFileManagerModal.tsx +++ b/src/app/containers/components/modals/ContainerFileManagerModal.tsx @@ -5,6 +5,7 @@ import Image from "next/image"; import { useCallback, useEffect, useRef, useState } from "react"; import { ArrowUp, + ChevronDown, ChevronRight, Download, FilePlus2, @@ -74,6 +75,7 @@ export default function ContainerFileManagerModal({ const [saving, setSaving] = useState(false); const [uploading, setUploading] = useState(false); const [busyPath, setBusyPath] = useState(null); + const [newMenuOpen, setNewMenuOpen] = useState(false); const [createMode, setCreateMode] = useState<"file" | "folder" | null>(null); const [createName, setCreateName] = useState(""); const [renamePath, setRenamePath] = useState(null); @@ -404,6 +406,7 @@ export default function ContainerFileManagerModal({ }; const handleUploadRequest = () => { + setNewMenuOpen(false); fileInputRef.current?.click(); }; @@ -442,6 +445,31 @@ export default function ContainerFileManagerModal({ : null; const pathSegments = currentPath.split("/").filter(Boolean); + const breadcrumbItems = + pathSegments.length > 5 + ? [ + ...pathSegments.slice(0, 2).map((segment, index) => ({ + segment, + index, + type: "segment" as const, + })), + { + segment: "...", + index: -1, + type: "ellipsis" as const, + title: pathSegments.slice(2, -2).join("/"), + }, + ...pathSegments.slice(-2).map((segment, offset) => ({ + segment, + index: pathSegments.length - 2 + offset, + type: "segment" as const, + })), + ] + : pathSegments.map((segment, index) => ({ + segment, + index, + type: "segment" as const, + })); return (
@@ -589,30 +617,55 @@ export default function ContainerFileManagerModal({ > / - {pathSegments.map((segment, index) => { - const targetPath = `/${pathSegments.slice(0, index + 1).join("/")}`; + {breadcrumbItems.map((item) => { return (
- + {item.type === "ellipsis" ? ( + + {item.segment} + + ) : ( + + )}
); })} @@ -620,45 +673,126 @@ export default function ContainerFileManagerModal({
- - - + + {newMenuOpen ? ( +
+ + + +
+ ) : null} +