🐛 Fix shared file action menu (#626)

This commit is contained in:
Montassar Ghanmy
2024-07-24 14:06:46 +01:00
committed by GitHub
parent bb07ca2a7a
commit a09bd964e1
@@ -149,14 +149,14 @@ export default memo(
if (item?.id) setUploadModalState({ open: true, parent_id: item.id }); if (item?.id) setUploadModalState({ open: true, parent_id: item.id });
}, [item?.id, setUploadModalState]); }, [item?.id, setUploadModalState]);
const documents = ( const items = item?.is_directory === false
item?.is_directory === false
? //We use this hack for public shared single file ? //We use this hack for public shared single file
item item
? [item] ? [item]
: [] : []
: children : children
).filter(i => !i.is_directory);
const documents = items.filter(i => !i.is_directory);
const selectedCount = Object.values(checked).filter(v => v).length; const selectedCount = Object.values(checked).filter(v => v).length;
@@ -307,7 +307,7 @@ export default memo(
<div <div
className={ className={
'flex flex-col grow h-full overflow-hidden ' + 'flex flex-col grow h-full overflow-hidden ' +
(loading && (!children?.length || loadingParentChange) ? 'opacity-50 ' : '') (loading && (!items?.length || loadingParentChange) ? 'opacity-50 ' : '')
} }
> >
<div className="flex flex-row shrink-0 items-center mb-4"> <div className="flex flex-row shrink-0 items-center mb-4">
@@ -423,7 +423,7 @@ export default memo(
<DndContext sensors={sensors} onDragEnd={handleDragEnd} onDragStart={handleDragStart}> <DndContext sensors={sensors} onDragEnd={handleDragEnd} onDragStart={handleDragStart}>
<div className="grow overflow-auto" ref={scrollViwer}> <div className="grow overflow-auto" ref={scrollViwer}>
{children.length === 0 && !loading && ( {items.length === 0 && !loading && (
<div className="mt-4 text-center border-2 border-dashed rounded-md p-8"> <div className="mt-4 text-center border-2 border-dashed rounded-md p-8">
<Subtitle className="block mb-2"> <Subtitle className="block mb-2">
{Languages.t('scenes.app.drive.nothing')} {Languages.t('scenes.app.drive.nothing')}
@@ -443,14 +443,14 @@ export default memo(
)} )}
</div> </div>
)} )}
{children.map((child, index) => {items.map((child, index) =>
child.is_directory ? ( child.is_directory ? (
<Droppable id={index} key={index}> <Droppable id={index} key={index}>
<FolderRow <FolderRow
key={index} key={index}
className={ className={
(index === 0 ? 'rounded-t-md ' : '') + (index === 0 ? 'rounded-t-md ' : '') +
(index === children.length - 1 ? 'rounded-b-md ' : '') (index === items.length - 1 ? 'rounded-b-md ' : '')
} }
item={child} item={child}
onClick={() => { onClick={() => {
@@ -476,7 +476,7 @@ export default memo(
<DocumentRowOverlay <DocumentRowOverlay
className={ className={
(activeIndex === 0 ? 'rounded-t-md ' : '') + (activeIndex === 0 ? 'rounded-t-md ' : '') +
(activeIndex === children.length - 1 ? 'rounded-b-md ' : '') (activeIndex === items.length - 1 ? 'rounded-b-md ' : '')
} }
item={activeChild} item={activeChild}
></DocumentRowOverlay> ></DocumentRowOverlay>