@griddo/ax 10.3.2 → 10.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/api/files.tsx +20 -4
- package/src/api/utils.tsx +4 -2
- package/src/components/Fields/FileField/index.tsx +1 -1
- package/src/components/FileGallery/index.tsx +101 -70
- package/src/components/FileGallery/style.tsx +19 -3
- package/src/components/Icon/components/Download.js +7 -0
- package/src/components/Icon/svgs/Download.svg +3 -0
- package/src/components/SearchField/index.tsx +17 -1
- package/src/components/SearchField/style.tsx +4 -1
- package/src/components/Tag/index.tsx +12 -2
- package/src/components/Tag/style.tsx +19 -9
- package/src/containers/FileDrive/actions.tsx +26 -0
- package/src/containers/Sites/actions.tsx +26 -13
- package/src/hooks/index.tsx +2 -0
- package/src/hooks/resize.ts +57 -0
- package/src/modules/Content/PageItem/index.tsx +1 -0
- package/src/modules/Content/index.tsx +23 -6
- package/src/modules/FileDrive/BulkListHeader/TableHeader/index.tsx +3 -1
- package/src/modules/FileDrive/BulkListHeader/TableHeader/style.tsx +16 -2
- package/src/modules/FileDrive/BulkListHeader/index.tsx +9 -2
- package/src/modules/FileDrive/FileDragAndDrop/index.tsx +4 -2
- package/src/modules/FileDrive/FileFilters/SortBy/index.tsx +60 -0
- package/src/modules/FileDrive/FileFilters/SortBy/style.tsx +31 -0
- package/src/modules/FileDrive/FileFilters/Type/index.tsx +77 -0
- package/src/modules/FileDrive/FileFilters/Type/style.tsx +39 -0
- package/src/modules/FileDrive/FileFilters/Usage/index.tsx +66 -0
- package/src/modules/FileDrive/FileFilters/Usage/style.tsx +30 -0
- package/src/modules/FileDrive/FileModal/DetailPanel/index.tsx +26 -7
- package/src/modules/FileDrive/FileModal/index.tsx +81 -15
- package/src/modules/FileDrive/GridItem/index.tsx +24 -5
- package/src/modules/FileDrive/GridItem/style.tsx +9 -4
- package/src/modules/FileDrive/ListItem/index.tsx +22 -4
- package/src/modules/FileDrive/ListItem/style.tsx +7 -1
- package/src/modules/FileDrive/atoms.tsx +27 -4
- package/src/modules/FileDrive/helpers.tsx +17 -17
- package/src/modules/FileDrive/hooks.tsx +77 -0
- package/src/modules/FileDrive/index.tsx +145 -23
- package/src/modules/FileDrive/style.tsx +40 -6
- package/src/modules/FileDrive/utils.tsx +19 -0
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +1 -1
- package/src/types/index.tsx +2 -3
|
@@ -15,9 +15,10 @@ import {
|
|
|
15
15
|
Modal,
|
|
16
16
|
Tabs,
|
|
17
17
|
BackFolder,
|
|
18
|
+
SearchField,
|
|
18
19
|
} from "@ax/components";
|
|
19
20
|
import { IBulkAction, IFile, IFilesFolder, IFolder, IFolderTree, IGetFolderParams, IRootState } from "@ax/types";
|
|
20
|
-
import { useBulkSelection, useModal, usePermission, useToast } from "@ax/hooks";
|
|
21
|
+
import { useBulkSelection, useIsDirty, useModal, usePermission, useResizable, useToast } from "@ax/hooks";
|
|
21
22
|
import { fileDriveActions } from "@ax/containers/FileDrive";
|
|
22
23
|
|
|
23
24
|
import GridItem from "./GridItem";
|
|
@@ -29,7 +30,12 @@ import FolderTree from "./FolderTree";
|
|
|
29
30
|
import FileDragAndDrop from "./FileDragAndDrop";
|
|
30
31
|
import FileModal from "./FileModal";
|
|
31
32
|
import BulkGridHeader from "./BulkGridHeader";
|
|
32
|
-
import { DeleteFileModal, MoveItemModal, NewFolderModal } from "./atoms";
|
|
33
|
+
import { DeleteFileModal, MoveItemModal, NewFolderModal, NotSavedModal } from "./atoms";
|
|
34
|
+
import { useFilterQuery, useSortedListStatus } from "./hooks";
|
|
35
|
+
import { getSortedListStatus } from "./utils";
|
|
36
|
+
import Type from "./FileFilters/Type";
|
|
37
|
+
import SortBy from "./FileFilters/SortBy";
|
|
38
|
+
import Usage from "./FileFilters/Usage";
|
|
33
39
|
|
|
34
40
|
import * as S from "./style";
|
|
35
41
|
|
|
@@ -47,6 +53,7 @@ const FileDrive = (props: IProps) => {
|
|
|
47
53
|
moveFile,
|
|
48
54
|
updateDisplayMode,
|
|
49
55
|
updateTab,
|
|
56
|
+
downloadFiles,
|
|
50
57
|
breadcrumb,
|
|
51
58
|
isLoading,
|
|
52
59
|
isSaving,
|
|
@@ -71,6 +78,7 @@ const FileDrive = (props: IProps) => {
|
|
|
71
78
|
const { isOpen: isUploadOpen, toggleModal: toggleUploadModal } = useModal();
|
|
72
79
|
const { isOpen: isDeleteOpen, toggleModal: toggleDeleteModal } = useModal();
|
|
73
80
|
const { isOpen: isMoveOpen, toggleModal: toggleMoveModal } = useModal();
|
|
81
|
+
const { isOpen: isSaveOpen, toggleModal: toggleSaveModal } = useModal();
|
|
74
82
|
const { isOpen, toggleModal } = useModal();
|
|
75
83
|
const { isVisible, toggleToast, setIsVisible } = useToast();
|
|
76
84
|
const { isVisible: isNewVisible, toggleToast: toggleNewToast, setIsVisible: setIsNewVisible } = useToast();
|
|
@@ -82,8 +90,19 @@ const FileDrive = (props: IProps) => {
|
|
|
82
90
|
setIsVisible: setIsMoveFolderVisible,
|
|
83
91
|
} = useToast();
|
|
84
92
|
|
|
85
|
-
const
|
|
86
|
-
|
|
93
|
+
const [ref] = useResizable();
|
|
94
|
+
|
|
95
|
+
const initFolderState = { name: "", folderID: currentFolderID };
|
|
96
|
+
const [folderForm, setFolderForm] = useState<IFolderFormState>(initFolderState);
|
|
97
|
+
const { setFiltersSelection, setFilterQuery, filterValues } = useFilterQuery();
|
|
98
|
+
const { sortedListStatus, setSortedListStatus } = useSortedListStatus();
|
|
99
|
+
const [currentFilterQuery, setCurrentFilterQuery] = useState("");
|
|
100
|
+
const [searchQuery, setSearchQuery] = useState<string>("");
|
|
101
|
+
const isSearching = searchQuery.length > 0;
|
|
102
|
+
|
|
103
|
+
const initFileState: IFileFormState = { title: "", alt: "", tags: [] };
|
|
104
|
+
const [fileForm, setFileForm] = useState(initFileState);
|
|
105
|
+
const { isDirty, resetDirty } = useIsDirty(fileForm);
|
|
87
106
|
|
|
88
107
|
const isSiteView = !!currentSiteID;
|
|
89
108
|
const isTabGlobal = selectedTab === "global";
|
|
@@ -91,7 +110,7 @@ const FileDrive = (props: IProps) => {
|
|
|
91
110
|
const hasFolders = !!folders.length;
|
|
92
111
|
const isRoot = !breadcrumb.length;
|
|
93
112
|
const isGrid = displayMode === "grid";
|
|
94
|
-
const validFormats = ["pdf", "doc", "docx", "xls", "xlsx", "zip"];
|
|
113
|
+
const validFormats = ["pdf", "doc", "docx", "xls", "xlsx", "zip", "csv"];
|
|
95
114
|
|
|
96
115
|
const allowedToAccessGlobalFromSite = usePermission("mediaGallery.accessToGlobalFileDriveFromSite");
|
|
97
116
|
|
|
@@ -126,10 +145,12 @@ const FileDrive = (props: IProps) => {
|
|
|
126
145
|
const params = {
|
|
127
146
|
siteID,
|
|
128
147
|
folderID: currentFolderID,
|
|
148
|
+
search: searchQuery,
|
|
149
|
+
query: currentFilterQuery,
|
|
129
150
|
};
|
|
130
151
|
|
|
131
152
|
return params;
|
|
132
|
-
}, [currentFolderID, selectedTab]);
|
|
153
|
+
}, [currentFolderID, selectedTab, searchQuery, currentFilterQuery]);
|
|
133
154
|
|
|
134
155
|
useLayoutEffect(() => {
|
|
135
156
|
return () => {
|
|
@@ -171,13 +192,14 @@ const FileDrive = (props: IProps) => {
|
|
|
171
192
|
|
|
172
193
|
const handleSelectedTab = (tab: "local" | "global") => {
|
|
173
194
|
if (tab !== selectedTab) {
|
|
195
|
+
setSearchQuery("");
|
|
174
196
|
updateCurrentFolder(null);
|
|
175
197
|
updateTab(tab);
|
|
176
198
|
}
|
|
177
199
|
};
|
|
178
200
|
|
|
179
201
|
const handleNewFolder = () => {
|
|
180
|
-
setFolderForm(
|
|
202
|
+
setFolderForm(initFolderState);
|
|
181
203
|
!isNewOpen && toggleNewModal();
|
|
182
204
|
};
|
|
183
205
|
|
|
@@ -233,11 +255,20 @@ const FileDrive = (props: IProps) => {
|
|
|
233
255
|
};
|
|
234
256
|
|
|
235
257
|
const handleCloseModal = () => {
|
|
258
|
+
if(isDirty){
|
|
259
|
+
toggleSaveModal();
|
|
260
|
+
} else {
|
|
261
|
+
resetFileModal();
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
const resetFileModal = () => {
|
|
236
266
|
setFileSelected(null);
|
|
237
267
|
setGalleryItems(filesIds);
|
|
238
268
|
setGalleryDelete(true);
|
|
269
|
+
resetDirty();
|
|
239
270
|
toggleModal();
|
|
240
|
-
}
|
|
271
|
+
}
|
|
241
272
|
|
|
242
273
|
const handleDeleteFile = async (fileID: number) => {
|
|
243
274
|
const isDeleted = await deleteFile(fileID, siteID);
|
|
@@ -298,6 +329,33 @@ const FileDrive = (props: IProps) => {
|
|
|
298
329
|
}
|
|
299
330
|
};
|
|
300
331
|
|
|
332
|
+
const handleDownloadBulk = async () => {
|
|
333
|
+
await downloadFiles(selectedItems.all, true);
|
|
334
|
+
resetBulkSelection();
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
const handleUpdateCurrentFolder = (folderID: number | null) => {
|
|
338
|
+
setSearchQuery("");
|
|
339
|
+
updateCurrentFolder(folderID);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
const handleDownload = async (fileID: number, fileName: string) => await downloadFiles(fileID, false, fileName);
|
|
343
|
+
|
|
344
|
+
const sortItems = async (orderPointer: string, isAscending: boolean) => {
|
|
345
|
+
const sortedState = getSortedListStatus(orderPointer, isAscending);
|
|
346
|
+
setSortedListStatus(sortedState);
|
|
347
|
+
|
|
348
|
+
const filtersSelection = setFiltersSelection("order", orderPointer, isAscending);
|
|
349
|
+
const filterQuery = setFilterQuery(filtersSelection);
|
|
350
|
+
setCurrentFilterQuery(filterQuery);
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
const filterItems = async (filterPointer: string, filtersSelected: string) => {
|
|
354
|
+
const filtersSelection = setFiltersSelection(filterPointer, filtersSelected);
|
|
355
|
+
const filterQuery = setFilterQuery(filtersSelection);
|
|
356
|
+
setCurrentFilterQuery(filterQuery);
|
|
357
|
+
};
|
|
358
|
+
|
|
301
359
|
let bulkActions: IBulkAction[] = [];
|
|
302
360
|
|
|
303
361
|
if (allowedToEditFile) {
|
|
@@ -315,6 +373,15 @@ const FileDrive = (props: IProps) => {
|
|
|
315
373
|
];
|
|
316
374
|
}
|
|
317
375
|
|
|
376
|
+
bulkActions = [
|
|
377
|
+
...bulkActions,
|
|
378
|
+
{
|
|
379
|
+
icon: "download",
|
|
380
|
+
text: "download",
|
|
381
|
+
action: handleDownloadBulk,
|
|
382
|
+
},
|
|
383
|
+
];
|
|
384
|
+
|
|
318
385
|
if (allowedToDeleteFile) {
|
|
319
386
|
bulkActions = [
|
|
320
387
|
...bulkActions,
|
|
@@ -334,11 +401,12 @@ const FileDrive = (props: IProps) => {
|
|
|
334
401
|
totalItems={totalItems}
|
|
335
402
|
selectItems={selectItems}
|
|
336
403
|
bulkActions={bulkActions}
|
|
404
|
+
isSearching={isSearching}
|
|
337
405
|
/>
|
|
338
406
|
);
|
|
339
407
|
|
|
340
408
|
const GridList = () => (
|
|
341
|
-
<S.GridWrapper>
|
|
409
|
+
<S.GridWrapper isSearching={isSearching}>
|
|
342
410
|
{items.map((file: IFile, i: number) => {
|
|
343
411
|
const isItemSelected = isSelected(file.id);
|
|
344
412
|
return (
|
|
@@ -346,14 +414,15 @@ const FileDrive = (props: IProps) => {
|
|
|
346
414
|
file={file}
|
|
347
415
|
isSelected={isItemSelected}
|
|
348
416
|
onChange={addToBulkSelection}
|
|
349
|
-
key={file.fileName}
|
|
417
|
+
key={`${file.fileName}${file.id}`}
|
|
350
418
|
onClick={handleClick}
|
|
351
419
|
onDelete={handleDeleteFile}
|
|
352
420
|
onMove={handleMoveFile}
|
|
353
421
|
currentFolderID={currentFolderID}
|
|
354
422
|
isAllowedToDelete={allowedToDeleteFile}
|
|
355
423
|
isAllowedToEdit={allowedToEditFile}
|
|
356
|
-
isAllowedToMove={!isRoot || (isRoot && folders.length > 0)}
|
|
424
|
+
isAllowedToMove={!isRoot || (isRoot && (folders.length > 0 || isSearching))}
|
|
425
|
+
isSearching={isSearching}
|
|
357
426
|
/>
|
|
358
427
|
);
|
|
359
428
|
})}
|
|
@@ -369,14 +438,15 @@ const FileDrive = (props: IProps) => {
|
|
|
369
438
|
file={file}
|
|
370
439
|
isSelected={isItemSelected}
|
|
371
440
|
onChange={addToBulkSelection}
|
|
372
|
-
key={file.fileName}
|
|
441
|
+
key={`${file.fileName}${file.id}`}
|
|
373
442
|
onClick={handleClick}
|
|
374
443
|
onDelete={handleDeleteFile}
|
|
375
444
|
onMove={handleMoveFile}
|
|
376
445
|
currentFolderID={currentFolderID}
|
|
377
446
|
isAllowedToDelete={allowedToDeleteFile}
|
|
378
447
|
isAllowedToEdit={allowedToEditFile}
|
|
379
|
-
isAllowedToMove={!isRoot || (isRoot && folders.length > 0)}
|
|
448
|
+
isAllowedToMove={!isRoot || (isRoot && (folders.length > 0 || isSearching))}
|
|
449
|
+
isSearching={isSearching}
|
|
380
450
|
/>
|
|
381
451
|
);
|
|
382
452
|
})}
|
|
@@ -421,6 +491,12 @@ const FileDrive = (props: IProps) => {
|
|
|
421
491
|
action: () => toggleUploadModal(),
|
|
422
492
|
};
|
|
423
493
|
|
|
494
|
+
const emptySearchStateProps = {
|
|
495
|
+
icon: "search",
|
|
496
|
+
title: "Oh! No Results Found",
|
|
497
|
+
message: "We couldn’t find what you are looking for. Please, try another search.",
|
|
498
|
+
};
|
|
499
|
+
|
|
424
500
|
const mainNewModalAction = {
|
|
425
501
|
title: isSaving ? "Saving..." : "Create New Folder",
|
|
426
502
|
onClick: () => handleCreateNewFolder(),
|
|
@@ -443,6 +519,18 @@ const FileDrive = (props: IProps) => {
|
|
|
443
519
|
|
|
444
520
|
const secondaryMoveModalAction = { title: "Cancel", onClick: handleModalClose };
|
|
445
521
|
|
|
522
|
+
const handleMainAction = () => {
|
|
523
|
+
toggleSaveModal();
|
|
524
|
+
resetFileModal();
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
const mainSaveModalAction = {
|
|
528
|
+
title: "Yes, discard changes",
|
|
529
|
+
onClick: () => handleMainAction(),
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
const secondarySaveModalAction = { title: "Cancel", onClick: toggleSaveModal };
|
|
533
|
+
|
|
446
534
|
const foldersIcon = isPanelOpen ? <Icon name="closePanel" size="24" /> : <Icon name="openPanel" size="24" />;
|
|
447
535
|
|
|
448
536
|
const tabs = ["local", "global"];
|
|
@@ -458,19 +546,27 @@ const FileDrive = (props: IProps) => {
|
|
|
458
546
|
<></>
|
|
459
547
|
);
|
|
460
548
|
|
|
549
|
+
const Filters = () => (
|
|
550
|
+
<S.Filters>
|
|
551
|
+
<Type filterItems={filterItems} value={filterValues["filterType"]} />
|
|
552
|
+
<SortBy sortItems={sortItems} sortedState={sortedListStatus} />
|
|
553
|
+
<Usage filterItems={filterItems} value={filterValues["filterUsage"]} />
|
|
554
|
+
</S.Filters>
|
|
555
|
+
);
|
|
556
|
+
|
|
461
557
|
return (
|
|
462
558
|
<MainWrapper backLink={false} title="File Drive Manager" rightButton={rightButtonProps}>
|
|
463
559
|
<S.Wrapper>
|
|
464
|
-
<S.FolderPanel isOpen={isPanelOpen}>
|
|
560
|
+
<S.FolderPanel isOpen={isPanelOpen} ref={ref} style={{ width: isPanelOpen ? "240px" : "0" }}>
|
|
465
561
|
<S.FolderPanelContent>
|
|
466
562
|
<FolderTree
|
|
467
563
|
folderID={currentFolderID || 0}
|
|
468
|
-
onClick={
|
|
564
|
+
onClick={handleUpdateCurrentFolder}
|
|
469
565
|
title="Folders"
|
|
470
566
|
createAction={allowedToAddFile ? handleNewFolder : undefined}
|
|
471
|
-
trimNames={true}
|
|
472
567
|
/>
|
|
473
568
|
</S.FolderPanelContent>
|
|
569
|
+
<S.ResizeHandle className="resizer" />
|
|
474
570
|
</S.FolderPanel>
|
|
475
571
|
<S.ContentWrapper>
|
|
476
572
|
<ErrorToast />
|
|
@@ -484,6 +580,7 @@ const FileDrive = (props: IProps) => {
|
|
|
484
580
|
<Tabs tabs={tabs} active={selectedTab} setSelectedTab={handleSelectedTab} noMargins />
|
|
485
581
|
</S.TabsWrapper>
|
|
486
582
|
)}
|
|
583
|
+
{!isSiteView && <Filters />}
|
|
487
584
|
<S.DisplayModeWrapper>
|
|
488
585
|
<IconAction icon="Grid2" onClick={() => changeDisplayMode("grid")} active={displayMode === "grid"} />
|
|
489
586
|
<IconAction
|
|
@@ -493,7 +590,11 @@ const FileDrive = (props: IProps) => {
|
|
|
493
590
|
/>
|
|
494
591
|
</S.DisplayModeWrapper>
|
|
495
592
|
</S.FiltersBar>
|
|
496
|
-
|
|
593
|
+
<S.FiltersBar isSite={false}>
|
|
594
|
+
{isSiteView && <Filters />}
|
|
595
|
+
<SearchField onChange={setSearchQuery} placeholder="Search" value={searchQuery} autoFocus={false} />
|
|
596
|
+
</S.FiltersBar>
|
|
597
|
+
{!isRoot && <Breadcrumb breadcrumb={breadcrumb} onClick={handleUpdateCurrentFolder} />}
|
|
497
598
|
{(hasFolders || !isRoot) && (
|
|
498
599
|
<S.SectionWrapper>
|
|
499
600
|
<S.SectionHeader>
|
|
@@ -511,13 +612,13 @@ const FileDrive = (props: IProps) => {
|
|
|
511
612
|
{folders.map((folder: IFolder) => (
|
|
512
613
|
<FolderItem
|
|
513
614
|
folder={folder}
|
|
514
|
-
onClick={
|
|
615
|
+
onClick={handleUpdateCurrentFolder}
|
|
515
616
|
onDelete={handleDeleteFolder}
|
|
516
|
-
key={folder.folderName}
|
|
617
|
+
key={`${folder.folderName}${folder.id}`}
|
|
517
618
|
toggleToast={toggleMoveFolderToast}
|
|
518
619
|
isAllowedToDelete={allowedToDeleteFile}
|
|
519
620
|
isAllowedToEdit={allowedToEditFile}
|
|
520
|
-
isAllowedToMove={!isRoot || (isRoot && folders.length > 1)}
|
|
621
|
+
isAllowedToMove={!isRoot || (isRoot && (folders.length > 1 || isSearching))}
|
|
521
622
|
/>
|
|
522
623
|
))}
|
|
523
624
|
</S.FoldersGrid>
|
|
@@ -537,7 +638,7 @@ const FileDrive = (props: IProps) => {
|
|
|
537
638
|
bulkActions={bulkActions}
|
|
538
639
|
/>
|
|
539
640
|
)}
|
|
540
|
-
{!hasFolders && isRoot && <NewFolderButton />}
|
|
641
|
+
{!hasFolders && isRoot && !isSearching && <NewFolderButton />}
|
|
541
642
|
</S.SectionHeader>
|
|
542
643
|
<S.DocumentsWrapper>
|
|
543
644
|
{items.length > 0 ? (
|
|
@@ -548,7 +649,7 @@ const FileDrive = (props: IProps) => {
|
|
|
548
649
|
)
|
|
549
650
|
) : (
|
|
550
651
|
<S.EmptyStateWrapper data-testid="empty-state">
|
|
551
|
-
<EmptyState {...emptyProps} />
|
|
652
|
+
{isSearching ? <EmptyState {...emptySearchStateProps} /> : <EmptyState {...emptyProps} />}
|
|
552
653
|
</S.EmptyStateWrapper>
|
|
553
654
|
)}
|
|
554
655
|
</S.DocumentsWrapper>
|
|
@@ -588,6 +689,11 @@ const FileDrive = (props: IProps) => {
|
|
|
588
689
|
activeDelete={galleryDelete && allowedToDeleteFile}
|
|
589
690
|
setFileSelected={setFileSelected}
|
|
590
691
|
isAllowedToEdit={allowedToEditFile}
|
|
692
|
+
handleDownload={handleDownload}
|
|
693
|
+
form={fileForm}
|
|
694
|
+
setForm={setFileForm}
|
|
695
|
+
isDirty={isDirty}
|
|
696
|
+
resetDirty={resetDirty}
|
|
591
697
|
/>
|
|
592
698
|
)}
|
|
593
699
|
</Modal>
|
|
@@ -610,6 +716,14 @@ const FileDrive = (props: IProps) => {
|
|
|
610
716
|
setFolder={setSelectedFolder}
|
|
611
717
|
/>
|
|
612
718
|
)}
|
|
719
|
+
{isSaveOpen && (
|
|
720
|
+
<NotSavedModal
|
|
721
|
+
isOpen={isSaveOpen}
|
|
722
|
+
toggleModal={toggleSaveModal}
|
|
723
|
+
mainModalAction={mainSaveModalAction}
|
|
724
|
+
secondaryModalAction={secondarySaveModalAction}
|
|
725
|
+
/>
|
|
726
|
+
)}
|
|
613
727
|
{isVisible && <Toast {...toastDeleteFolderProps} />}
|
|
614
728
|
{isDeleteVisible && <Toast {...toastDeleteFileProps} />}
|
|
615
729
|
{isNewVisible && <Toast {...toastNewProps} />}
|
|
@@ -637,13 +751,20 @@ interface IProps {
|
|
|
637
751
|
moveFile(fileID: number | number[], folderID: number, siteID: number | "global"): Promise<boolean>;
|
|
638
752
|
updateDisplayMode(displayMode: "grid" | "list"): Promise<void>;
|
|
639
753
|
updateTab(tab: "local" | "global"): Promise<void>;
|
|
754
|
+
downloadFiles(fileID: number | number[], zip: boolean, fileName?: string): Promise<void>;
|
|
640
755
|
}
|
|
641
756
|
|
|
642
|
-
export interface
|
|
757
|
+
export interface IFolderFormState {
|
|
643
758
|
name: string;
|
|
644
759
|
folderID: number | null;
|
|
645
760
|
}
|
|
646
761
|
|
|
762
|
+
export interface IFileFormState {
|
|
763
|
+
title: string;
|
|
764
|
+
alt: string;
|
|
765
|
+
tags: string[];
|
|
766
|
+
}
|
|
767
|
+
|
|
647
768
|
const mapDispatchToProps = {
|
|
648
769
|
getFolderContent: fileDriveActions.getFolderContent,
|
|
649
770
|
getFoldersTree: fileDriveActions.getFoldersTree,
|
|
@@ -654,6 +775,7 @@ const mapDispatchToProps = {
|
|
|
654
775
|
moveFile: fileDriveActions.moveFile,
|
|
655
776
|
updateDisplayMode: fileDriveActions.updateDisplayMode,
|
|
656
777
|
updateTab: fileDriveActions.updateTab,
|
|
778
|
+
downloadFiles: fileDriveActions.downloadFiles,
|
|
657
779
|
};
|
|
658
780
|
|
|
659
781
|
const mapStateToProps = (state: IRootState) => ({
|
|
@@ -8,11 +8,13 @@ const Wrapper = styled.div`
|
|
|
8
8
|
`;
|
|
9
9
|
|
|
10
10
|
const FolderPanel = styled.div<{ isOpen: boolean }>`
|
|
11
|
+
position: relative;
|
|
11
12
|
background-color: ${(p) => p.theme.color.uiBackground02};
|
|
12
13
|
border-right: ${(p) => `1px solid ${p.theme.color.uiLine}`};
|
|
13
14
|
width: ${(p) => (p.isOpen ? "240px" : "0")};
|
|
15
|
+
min-width: ${(p) => (p.isOpen ? "240px" : "0")};
|
|
16
|
+
max-width: ${(p) => (p.isOpen ? "50%" : "0")};
|
|
14
17
|
overflow: hidden;
|
|
15
|
-
transition: width 0.8s ease-out;
|
|
16
18
|
flex-shrink: 0;
|
|
17
19
|
`;
|
|
18
20
|
|
|
@@ -64,24 +66,29 @@ const DocumentsWrapper = styled.div`
|
|
|
64
66
|
width: 100%;
|
|
65
67
|
`;
|
|
66
68
|
|
|
67
|
-
const GridWrapper = styled.div
|
|
69
|
+
const GridWrapper = styled.div<{ isSearching: boolean }>`
|
|
68
70
|
display: grid;
|
|
69
71
|
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
|
70
|
-
grid-template-rows:
|
|
72
|
+
grid-template-rows: ${(p) =>
|
|
73
|
+
p.isSearching ? "repeat(auto-fit, minmax(180px, 180px))" : "repeat(auto-fit, minmax(154px, 154px))"};
|
|
71
74
|
gap: ${(p) => p.theme.spacing.s};
|
|
72
75
|
width: 100%;
|
|
73
76
|
justify-content: start;
|
|
74
77
|
`;
|
|
75
78
|
|
|
76
|
-
const FiltersBar = styled.div<{isSite: boolean}>`
|
|
79
|
+
const FiltersBar = styled.div<{ isSite: boolean }>`
|
|
77
80
|
display: flex;
|
|
78
81
|
background-color: ${(p) => p.theme.color.uiBackground02};
|
|
79
|
-
padding: ${(p) =>
|
|
82
|
+
padding: ${(p) =>
|
|
83
|
+
p.isSite
|
|
84
|
+
? `${p.theme.spacing.s} ${p.theme.spacing.m} 0 ${p.theme.spacing.m}`
|
|
85
|
+
: `${p.theme.spacing.s} ${p.theme.spacing.m}`};
|
|
80
86
|
border-bottom: ${(p) => `1px solid ${p.theme.color.uiLine}`};
|
|
81
87
|
`;
|
|
82
88
|
|
|
83
89
|
const DisplayModeWrapper = styled.div`
|
|
84
90
|
margin-left: auto;
|
|
91
|
+
flex-shrink: 0;
|
|
85
92
|
button:last-child {
|
|
86
93
|
margin-left: ${(p) => p.theme.spacing.xxs};
|
|
87
94
|
}
|
|
@@ -120,7 +127,32 @@ const NoMarginFieldsBehavior = styled(FieldsBehavior)`
|
|
|
120
127
|
`;
|
|
121
128
|
|
|
122
129
|
const TabsWrapper = styled.div`
|
|
123
|
-
width: ${p => `calc(${p.theme.spacing.xl} * 3)`};
|
|
130
|
+
width: ${(p) => `calc(${p.theme.spacing.xl} * 3)`};
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
const Filters = styled.div`
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
width: 50%;
|
|
137
|
+
flex-shrink: 0;
|
|
138
|
+
& > * {
|
|
139
|
+
&:not(:last-child) {
|
|
140
|
+
margin-right: ${p => p.theme.spacing.m};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
`;
|
|
144
|
+
|
|
145
|
+
const ResizeHandle = styled.div`
|
|
146
|
+
position: absolute;
|
|
147
|
+
width: 2px;
|
|
148
|
+
right: 0;
|
|
149
|
+
top: 0;
|
|
150
|
+
bottom: 0;
|
|
151
|
+
cursor: col-resize;
|
|
152
|
+
|
|
153
|
+
&:hover {
|
|
154
|
+
background-color: ${(p) => p.theme.color.interactive01};
|
|
155
|
+
}
|
|
124
156
|
`;
|
|
125
157
|
|
|
126
158
|
export {
|
|
@@ -143,4 +175,6 @@ export {
|
|
|
143
175
|
ModalContent,
|
|
144
176
|
NoMarginFieldsBehavior,
|
|
145
177
|
TabsWrapper,
|
|
178
|
+
ResizeHandle,
|
|
179
|
+
Filters,
|
|
146
180
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const getSortedListStatus = (orderPointer: string, isAscending: boolean): ISortedListStatus => {
|
|
2
|
+
const sortedListStatus = {
|
|
3
|
+
isAscending,
|
|
4
|
+
sortedByName: orderPointer === "name",
|
|
5
|
+
sortedByDate: orderPointer === "date",
|
|
6
|
+
sortedBySize: orderPointer === "size",
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
return sortedListStatus;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { getSortedListStatus };
|
|
13
|
+
|
|
14
|
+
interface ISortedListStatus {
|
|
15
|
+
isAscending: boolean;
|
|
16
|
+
sortedByName: boolean;
|
|
17
|
+
sortedByDate: boolean;
|
|
18
|
+
sortedBySize: boolean;
|
|
19
|
+
}
|
|
@@ -398,7 +398,7 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
|
|
|
398
398
|
)}
|
|
399
399
|
{!isAllPages && activeColumns.includes("site") && (
|
|
400
400
|
<S.SiteCell role="cell">
|
|
401
|
-
<ElementsTooltip elements={availableSiteNames} elementsPerRow={3} />
|
|
401
|
+
<ElementsTooltip elements={availableSiteNames} elementsPerRow={3} maxChar={30} />
|
|
402
402
|
</S.SiteCell>
|
|
403
403
|
)}
|
|
404
404
|
{activeColumns.includes("live") && (
|
package/src/types/index.tsx
CHANGED
|
@@ -911,7 +911,7 @@ export interface IFile {
|
|
|
911
911
|
alt: string;
|
|
912
912
|
title: string;
|
|
913
913
|
site: number | null;
|
|
914
|
-
folder: number | null;
|
|
914
|
+
folder: { folderId: number; folderName: string } | null;
|
|
915
915
|
}
|
|
916
916
|
|
|
917
917
|
export interface IFolder {
|
|
@@ -933,8 +933,7 @@ export interface IGetFolderParams {
|
|
|
933
933
|
folderID: number | null;
|
|
934
934
|
loading?: boolean;
|
|
935
935
|
search?: string;
|
|
936
|
-
|
|
937
|
-
order?: string;
|
|
936
|
+
query?: string;
|
|
938
937
|
}
|
|
939
938
|
|
|
940
939
|
export interface IActionMenuOption {
|