@@ -12,6 +12,7 @@ import {
1212 ArrowRightCircleIcon ,
1313 TrashIcon ,
1414 EyeIcon ,
15+ ShareIcon ,
1516} from "@heroicons/react/24/outline" ;
1617import AuthWrapper from "./AuthWrapper" ;
1718import Header from "./Header" ;
@@ -24,6 +25,7 @@ import RenameDialog from "./RenameDialog";
2425import PreviewModal from "./PreviewModal" ;
2526import MoveDialog from "./MoveDialog" ;
2627import DeleteConfirmDialog from "./DeleteConfirmDialog" ;
28+ import ShareDialog , { AccessLevel } from "./ShareDialog" ;
2729import FileUploadHandler from "./FileUploadHandler" ;
2830import ContextMenu , { ContextMenuAction } from "./ContextMenu" ;
2931import { FileItemData } from "./FileItem" ;
@@ -94,6 +96,8 @@ export default function FileManager() {
9496 const [ showDeleteDialog , setShowDeleteDialog ] = useState ( false ) ;
9597 const [ fileToDelete , setFileToDelete ] = useState < FileItemData | null > ( null ) ;
9698 const [ isDeleting , setIsDeleting ] = useState ( false ) ;
99+ const [ showShareDialog , setShowShareDialog ] = useState ( false ) ;
100+ const [ fileToShare , setFileToShare ] = useState < FileItemData | null > ( null ) ;
97101 const [ contextMenuState , setContextMenuState ] = useState < ContextMenuState | null > ( null ) ;
98102
99103 const closeContextMenu = ( ) => setContextMenuState ( null ) ;
@@ -392,6 +396,17 @@ export default function FileManager() {
392396 }
393397 } ;
394398
399+ const handleShare = ( file : FileItemData ) => {
400+ setFileToShare ( file ) ;
401+ setShowShareDialog ( true ) ;
402+ } ;
403+
404+ const handleShareConfirm = async ( webId : string , accessLevel : AccessLevel ) => {
405+ // TODO: Implement actual sharing logic
406+ console . log ( `Sharing ${ fileToShare ?. name } with ${ webId } as ${ accessLevel } ` ) ;
407+ toast . success ( `Shared with ${ webId } as ${ accessLevel } ` ) ;
408+ } ;
409+
395410 const handleDragEnter = ( event : React . DragEvent < HTMLElement > ) => {
396411 if ( ! hasFilesInDrag ( event ) ) return ;
397412 event . preventDefault ( ) ;
@@ -633,6 +648,14 @@ export default function FileManager() {
633648 closeContextMenu ( ) ;
634649 handleCopy ( file ) ;
635650 } ,
651+ } ,
652+ {
653+ label : "Share" ,
654+ icon : ShareIcon ,
655+ onClick : ( ) => {
656+ closeContextMenu ( ) ;
657+ handleShare ( file ) ;
658+ } ,
636659 }
637660 ) ;
638661
@@ -823,6 +846,7 @@ export default function FileManager() {
823846 onFileMove = { handleMove }
824847 onFileDownload = { handleDownload }
825848 onFileDelete = { handleDelete }
849+ onFileShare = { handleShare }
826850 selectedFileIds = { selectedFileIds }
827851 onFileContextMenu = { handleFileContextMenu }
828852 />
@@ -888,6 +912,15 @@ export default function FileManager() {
888912 onConfirm = { handleDeleteConfirm }
889913 isDeleting = { isDeleting }
890914 />
915+ < ShareDialog
916+ isOpen = { showShareDialog }
917+ onClose = { ( ) => {
918+ setShowShareDialog ( false ) ;
919+ setFileToShare ( null ) ;
920+ } }
921+ file = { fileToShare }
922+ onShare = { handleShareConfirm }
923+ />
891924 { isDragActive && (
892925 < div className = "pointer-events-none fixed inset-0 z-40 flex flex-col items-center justify-center bg-purple-500/10" >
893926 < div className = "rounded-2xl border border-purple-400 bg-white/90 px-8 py-6 text-center shadow-lg" >
0 commit comments