@widgetic/file-browser 0.5.17
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/README.md +131 -0
- package/dist/components/FolderTree.svelte +143 -0
- package/dist/components/FolderTree.svelte.d.ts +32 -0
- package/dist/components/core/FileBrowser.css +79 -0
- package/dist/components/core/FileBrowser.svelte +3989 -0
- package/dist/components/core/FileBrowser.svelte.d.ts +55 -0
- package/dist/components/core/FileUploader.svelte +1152 -0
- package/dist/components/core/FileUploader.svelte.d.ts +43 -0
- package/dist/components/core/Header.svelte +143 -0
- package/dist/components/core/Header.svelte.d.ts +36 -0
- package/dist/components/core/RecentFiles.svelte +753 -0
- package/dist/components/core/RecentFiles.svelte.d.ts +37 -0
- package/dist/components/core/UploadStatus.svelte +133 -0
- package/dist/components/core/UploadStatus.svelte.d.ts +28 -0
- package/dist/components/core/UploadStatusList.svelte +138 -0
- package/dist/components/core/UploadStatusList.svelte.d.ts +33 -0
- package/dist/components/core/index.d.ts +4 -0
- package/dist/components/core/index.js +4 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +8 -0
- package/dist/components/items/FileItem.svelte +684 -0
- package/dist/components/items/FileItem.svelte.d.ts +34 -0
- package/dist/components/items/FolderItem.svelte +77 -0
- package/dist/components/items/FolderItem.svelte.d.ts +27 -0
- package/dist/components/items/index.d.ts +2 -0
- package/dist/components/items/index.js +2 -0
- package/dist/components/modals/MoveDialog.svelte +539 -0
- package/dist/components/modals/MoveDialog.svelte.d.ts +32 -0
- package/dist/components/modals/NewFolderButton.svelte +25 -0
- package/dist/components/modals/NewFolderButton.svelte.d.ts +20 -0
- package/dist/components/modals/README.md +99 -0
- package/dist/components/modals/SearchModal.svelte +500 -0
- package/dist/components/modals/SearchModal.svelte.d.ts +28 -0
- package/dist/components/modals/SelectedFilesModal.svelte +291 -0
- package/dist/components/modals/SelectedFilesModal.svelte.d.ts +32 -0
- package/dist/components/modals/index.d.ts +6 -0
- package/dist/components/modals/index.js +9 -0
- package/dist/components/previews/AudioPlayer.svelte +117 -0
- package/dist/components/previews/AudioPlayer.svelte.d.ts +22 -0
- package/dist/components/previews/ErrorPreview.svelte +12 -0
- package/dist/components/previews/ErrorPreview.svelte.d.ts +20 -0
- package/dist/components/previews/FilePreview.svelte +475 -0
- package/dist/components/previews/FilePreview.svelte.d.ts +31 -0
- package/dist/components/previews/FontPreview.svelte +82 -0
- package/dist/components/previews/FontPreview.svelte.d.ts +22 -0
- package/dist/components/previews/ImagePreview.svelte +551 -0
- package/dist/components/previews/ImagePreview.svelte.d.ts +27 -0
- package/dist/components/previews/TextPreview.svelte +92 -0
- package/dist/components/previews/TextPreview.svelte.d.ts +20 -0
- package/dist/components/previews/VideoPlayer.svelte +268 -0
- package/dist/components/previews/VideoPlayer.svelte.d.ts +22 -0
- package/dist/components/previews/WaveformVisualizer.svelte +240 -0
- package/dist/components/previews/WaveformVisualizer.svelte.d.ts +20 -0
- package/dist/components/previews/index.d.ts +8 -0
- package/dist/components/previews/index.js +8 -0
- package/dist/components/ui/ControlToolbar.svelte +342 -0
- package/dist/components/ui/ControlToolbar.svelte.d.ts +36 -0
- package/dist/components/ui/DragSelect.svelte +815 -0
- package/dist/components/ui/DragSelect.svelte.d.ts +31 -0
- package/dist/components/ui/DropdownMenu.svelte +83 -0
- package/dist/components/ui/DropdownMenu.svelte.d.ts +25 -0
- package/dist/components/ui/FileIcon.svelte +65 -0
- package/dist/components/ui/FileIcon.svelte.d.ts +25 -0
- package/dist/components/ui/FileMetadata.svelte +26 -0
- package/dist/components/ui/FileMetadata.svelte.d.ts +21 -0
- package/dist/components/ui/LoadingSkeleton.svelte +26 -0
- package/dist/components/ui/LoadingSkeleton.svelte.d.ts +22 -0
- package/dist/components/ui/SearchResults.svelte +37 -0
- package/dist/components/ui/SearchResults.svelte.d.ts +21 -0
- package/dist/components/ui/VirtualList.svelte +106 -0
- package/dist/components/ui/VirtualList.svelte.d.ts +45 -0
- package/dist/components/ui/index.d.ts +8 -0
- package/dist/components/ui/index.js +8 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.js +14 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +11 -0
- package/dist/static/favicon.png +0 -0
- package/dist/static/files/audio/audio-file.mp3 +0 -0
- package/dist/static/files/document/-missing-file.txt +1 -0
- package/dist/static/files/document/HeliosDesign Website Project Brief Sample.pdf +0 -0
- package/dist/static/files/document/RFP-NEC_Website-Development_2021-August.pdf +0 -0
- package/dist/static/files/document/The World Before Calculus.pdf +0 -0
- package/dist/static/files/document/specs.txt +15 -0
- package/dist/static/files/font/CooperHewitt/CooperHewitt-Bold.otf +0 -0
- package/dist/static/files/font/CooperHewitt/CooperHewitt-BoldItalic.otf +0 -0
- package/dist/static/files/font/CooperHewitt/CooperHewitt-Book.otf +0 -0
- package/dist/static/files/font/CooperHewitt/CooperHewitt-BookItalic.otf +0 -0
- package/dist/static/files/font/CooperHewitt/CooperHewitt-Heavy.otf +0 -0
- package/dist/static/files/font/CooperHewitt/CooperHewitt-HeavyItalic.otf +0 -0
- package/dist/static/files/font/CooperHewitt/CooperHewitt-Light.otf +0 -0
- package/dist/static/files/font/CooperHewitt/CooperHewitt-LightItalic.otf +0 -0
- package/dist/static/files/font/CooperHewitt/CooperHewitt-Medium.otf +0 -0
- package/dist/static/files/font/CooperHewitt/CooperHewitt-MediumItalic.otf +0 -0
- package/dist/static/files/font/CooperHewitt/CooperHewitt-Semibold.otf +0 -0
- package/dist/static/files/font/CooperHewitt/CooperHewitt-SemiboldItalic.otf +0 -0
- package/dist/static/files/font/CooperHewitt/CooperHewitt-Thin.otf +0 -0
- package/dist/static/files/font/CooperHewitt/CooperHewitt-ThinItalic.otf +0 -0
- package/dist/static/files/font/Kimpo/Kimpo-Bold.otf +0 -0
- package/dist/static/files/font/Kimpo/Kimpo-Regular.otf +0 -0
- package/dist/static/files/image/image 1.jpg +0 -0
- package/dist/static/files/image/image 10.jpg +0 -0
- package/dist/static/files/image/image 11.jpg +0 -0
- package/dist/static/files/image/image 12.jpg +0 -0
- package/dist/static/files/image/image 13.jpg +0 -0
- package/dist/static/files/image/image 14.jpg +0 -0
- package/dist/static/files/image/image 15.jpg +0 -0
- package/dist/static/files/image/image 16.jpg +0 -0
- package/dist/static/files/image/image 17.jpg +0 -0
- package/dist/static/files/image/image 18.jpg +0 -0
- package/dist/static/files/image/image 19.jpg +0 -0
- package/dist/static/files/image/image 2.jpg +0 -0
- package/dist/static/files/image/image 20.jpg +0 -0
- package/dist/static/files/image/image 21.jpg +0 -0
- package/dist/static/files/image/image 22.jpg +0 -0
- package/dist/static/files/image/image 23.jpg +0 -0
- package/dist/static/files/image/image 24.jpg +0 -0
- package/dist/static/files/image/image 25.jpg +0 -0
- package/dist/static/files/image/image 26.jpg +0 -0
- package/dist/static/files/image/image 27.jpg +0 -0
- package/dist/static/files/image/image 28.jpg +0 -0
- package/dist/static/files/image/image 29.jpg +0 -0
- package/dist/static/files/image/image 3.jpg +0 -0
- package/dist/static/files/image/image 30.jpg +0 -0
- package/dist/static/files/image/image 31.jpg +0 -0
- package/dist/static/files/image/image 32.jpg +0 -0
- package/dist/static/files/image/image 33.jpg +0 -0
- package/dist/static/files/image/image 34.jpg +0 -0
- package/dist/static/files/image/image 35.jpg +0 -0
- package/dist/static/files/image/image 36.jpg +0 -0
- package/dist/static/files/image/image 37.jpg +0 -0
- package/dist/static/files/image/image 38.jpg +0 -0
- package/dist/static/files/image/image 39.jpg +0 -0
- package/dist/static/files/image/image 4.jpg +0 -0
- package/dist/static/files/image/image 40.jpg +0 -0
- package/dist/static/files/image/image 41.jpg +0 -0
- package/dist/static/files/image/image 42.jpg +0 -0
- package/dist/static/files/image/image 43.jpg +0 -0
- package/dist/static/files/image/image 44.jpg +0 -0
- package/dist/static/files/image/image 45.jpg +0 -0
- package/dist/static/files/image/image 46.jpg +0 -0
- package/dist/static/files/image/image 47.jpg +0 -0
- package/dist/static/files/image/image 48.jpg +0 -0
- package/dist/static/files/image/image 49.jpg +0 -0
- package/dist/static/files/image/image 5.jpg +0 -0
- package/dist/static/files/image/image 50.jpg +0 -0
- package/dist/static/files/image/image 51.jpg +0 -0
- package/dist/static/files/image/image 52.jpg +0 -0
- package/dist/static/files/image/image 53.jpg +0 -0
- package/dist/static/files/image/image 54.jpg +0 -0
- package/dist/static/files/image/image 55.jpg +0 -0
- package/dist/static/files/image/image 56.jpg +0 -0
- package/dist/static/files/image/image 57.jpg +0 -0
- package/dist/static/files/image/image 58.jpg +0 -0
- package/dist/static/files/image/image 59.jpg +0 -0
- package/dist/static/files/image/image 6.jpg +0 -0
- package/dist/static/files/image/image 60.jpg +0 -0
- package/dist/static/files/image/image 61.jpg +0 -0
- package/dist/static/files/image/image 62.jpg +0 -0
- package/dist/static/files/image/image 63.jpg +0 -0
- package/dist/static/files/image/image 64.jpg +0 -0
- package/dist/static/files/image/image 65.jpg +0 -0
- package/dist/static/files/image/image 66.jpg +0 -0
- package/dist/static/files/image/image 67.jpg +0 -0
- package/dist/static/files/image/image 68.jpg +0 -0
- package/dist/static/files/image/image 7.jpg +0 -0
- package/dist/static/files/image/image 8.jpg +0 -0
- package/dist/static/files/image/image 9.jpg +0 -0
- package/dist/static/files/svg/astronaut.svg +30 -0
- package/dist/static/files/svg/cook.svg +30 -0
- package/dist/static/files/svg/dj.svg +28 -0
- package/dist/static/files/svg/doctor.svg +29 -0
- package/dist/static/files/svg/farmer.svg +43 -0
- package/dist/static/files/svg/fire fighter.svg +40 -0
- package/dist/static/files/svg/plumber.svg +32 -0
- package/dist/static/files/svg/santa.svg +34 -0
- package/dist/static/files/svg/scientist.svg +31 -0
- package/dist/static/files/svg/student.svg +32 -0
- package/dist/static/files/thumbnail/image 1.jpg +0 -0
- package/dist/static/files/thumbnail/image 10.jpg +0 -0
- package/dist/static/files/thumbnail/image 11.jpg +0 -0
- package/dist/static/files/thumbnail/image 12.jpg +0 -0
- package/dist/static/files/thumbnail/image 13.jpg +0 -0
- package/dist/static/files/thumbnail/image 14.jpg +0 -0
- package/dist/static/files/thumbnail/image 15.jpg +0 -0
- package/dist/static/files/thumbnail/image 16.jpg +0 -0
- package/dist/static/files/thumbnail/image 17.jpg +0 -0
- package/dist/static/files/thumbnail/image 18.jpg +0 -0
- package/dist/static/files/thumbnail/image 19.jpg +0 -0
- package/dist/static/files/thumbnail/image 2.jpg +0 -0
- package/dist/static/files/thumbnail/image 20.jpg +0 -0
- package/dist/static/files/thumbnail/image 21.jpg +0 -0
- package/dist/static/files/thumbnail/image 22.jpg +0 -0
- package/dist/static/files/thumbnail/image 23.jpg +0 -0
- package/dist/static/files/thumbnail/image 24.jpg +0 -0
- package/dist/static/files/thumbnail/image 25.jpg +0 -0
- package/dist/static/files/thumbnail/image 26.jpg +0 -0
- package/dist/static/files/thumbnail/image 27.jpg +0 -0
- package/dist/static/files/thumbnail/image 28.jpg +0 -0
- package/dist/static/files/thumbnail/image 29.jpg +0 -0
- package/dist/static/files/thumbnail/image 3.jpg +0 -0
- package/dist/static/files/thumbnail/image 30.jpg +0 -0
- package/dist/static/files/thumbnail/image 31.jpg +0 -0
- package/dist/static/files/thumbnail/image 32.jpg +0 -0
- package/dist/static/files/thumbnail/image 33.jpg +0 -0
- package/dist/static/files/thumbnail/image 34.jpg +0 -0
- package/dist/static/files/thumbnail/image 35.jpg +0 -0
- package/dist/static/files/thumbnail/image 36.jpg +0 -0
- package/dist/static/files/thumbnail/image 37.jpg +0 -0
- package/dist/static/files/thumbnail/image 38.jpg +0 -0
- package/dist/static/files/thumbnail/image 39.jpg +0 -0
- package/dist/static/files/thumbnail/image 4.jpg +0 -0
- package/dist/static/files/thumbnail/image 40.jpg +0 -0
- package/dist/static/files/thumbnail/image 41.jpg +0 -0
- package/dist/static/files/thumbnail/image 42.jpg +0 -0
- package/dist/static/files/thumbnail/image 43.jpg +0 -0
- package/dist/static/files/thumbnail/image 44.jpg +0 -0
- package/dist/static/files/thumbnail/image 45.jpg +0 -0
- package/dist/static/files/thumbnail/image 46.jpg +0 -0
- package/dist/static/files/thumbnail/image 47.jpg +0 -0
- package/dist/static/files/thumbnail/image 48.jpg +0 -0
- package/dist/static/files/thumbnail/image 49.jpg +0 -0
- package/dist/static/files/thumbnail/image 5.jpg +0 -0
- package/dist/static/files/thumbnail/image 50.jpg +0 -0
- package/dist/static/files/thumbnail/image 51.jpg +0 -0
- package/dist/static/files/thumbnail/image 52.jpg +0 -0
- package/dist/static/files/thumbnail/image 53.jpg +0 -0
- package/dist/static/files/thumbnail/image 54.jpg +0 -0
- package/dist/static/files/thumbnail/image 55.jpg +0 -0
- package/dist/static/files/thumbnail/image 56.jpg +0 -0
- package/dist/static/files/thumbnail/image 57.jpg +0 -0
- package/dist/static/files/thumbnail/image 58.jpg +0 -0
- package/dist/static/files/thumbnail/image 59.jpg +0 -0
- package/dist/static/files/thumbnail/image 6.jpg +0 -0
- package/dist/static/files/thumbnail/image 60.jpg +0 -0
- package/dist/static/files/thumbnail/image 61.jpg +0 -0
- package/dist/static/files/thumbnail/image 62.jpg +0 -0
- package/dist/static/files/thumbnail/image 63.jpg +0 -0
- package/dist/static/files/thumbnail/image 64.jpg +0 -0
- package/dist/static/files/thumbnail/image 65.jpg +0 -0
- package/dist/static/files/thumbnail/image 66.jpg +0 -0
- package/dist/static/files/thumbnail/image 67.jpg +0 -0
- package/dist/static/files/thumbnail/image 68.jpg +0 -0
- package/dist/static/files/thumbnail/image 7.jpg +0 -0
- package/dist/static/files/thumbnail/image 8.jpg +0 -0
- package/dist/static/files/thumbnail/image 9.jpg +0 -0
- package/dist/static/files/video/video-file.mp4 +0 -0
- package/dist/static/files/video/video-file.png +0 -0
- package/dist/static/icons/audio.svg +7 -0
- package/dist/static/icons/check.svg +3 -0
- package/dist/static/icons/checked.svg +4 -0
- package/dist/static/icons/close.svg +11 -0
- package/dist/static/icons/document.svg +11 -0
- package/dist/static/icons/dots.svg +1 -0
- package/dist/static/icons/download.svg +1 -0
- package/dist/static/icons/empty-folder.svg +24 -0
- package/dist/static/icons/error.svg +5 -0
- package/dist/static/icons/file-upload.svg +1 -0
- package/dist/static/icons/folder-plus.svg +1 -0
- package/dist/static/icons/folder.svg +28 -0
- package/dist/static/icons/jump-to-folder.svg +1 -0
- package/dist/static/icons/move.svg +1 -0
- package/dist/static/icons/new-folder.svg +5 -0
- package/dist/static/icons/pdf.svg +6 -0
- package/dist/static/icons/player-pause.svg +1 -0
- package/dist/static/icons/player-play.svg +3 -0
- package/dist/static/icons/plus.svg +1 -0
- package/dist/static/icons/rename.svg +1 -0
- package/dist/static/icons/search.svg +1 -0
- package/dist/static/icons/trash.svg +1 -0
- package/dist/static/icons/unorganized-folder.svg +60 -0
- package/dist/stores/dragStore.d.ts +2 -0
- package/dist/stores/dragStore.js +2 -0
- package/dist/stores/fileStore.d.ts +36 -0
- package/dist/stores/fileStore.js +166 -0
- package/dist/stores/folderCountStore.d.ts +5 -0
- package/dist/stores/folderCountStore.js +49 -0
- package/dist/stores/index.d.ts +7 -0
- package/dist/stores/index.js +8 -0
- package/dist/stores/missingFilesStore.d.ts +3 -0
- package/dist/stores/missingFilesStore.js +14 -0
- package/dist/stores/navigationStore.d.ts +36 -0
- package/dist/stores/navigationStore.js +615 -0
- package/dist/stores/persistentSelectStore.d.ts +17 -0
- package/dist/stores/persistentSelectStore.js +170 -0
- package/dist/stores/searchStore.d.ts +1 -0
- package/dist/stores/searchStore.js +2 -0
- package/dist/stores/uploadApiStore.d.ts +13 -0
- package/dist/stores/uploadApiStore.js +36 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/pdf.d.ts +3 -0
- package/dist/types.d.ts +23 -0
- package/dist/types.js +1 -0
- package/dist/utils/apiConfig.d.ts +9 -0
- package/dist/utils/apiConfig.js +19 -0
- package/dist/utils/dateUtils.d.ts +2 -0
- package/dist/utils/dateUtils.js +38 -0
- package/dist/utils/fileOperations.d.ts +36 -0
- package/dist/utils/fileOperations.js +573 -0
- package/dist/utils/fileTypes.d.ts +17 -0
- package/dist/utils/fileTypes.js +110 -0
- package/dist/utils/fileUtils.d.ts +15 -0
- package/dist/utils/fileUtils.js +112 -0
- package/dist/utils/folderUtils.d.ts +4 -0
- package/dist/utils/folderUtils.js +26 -0
- package/dist/utils/imageTransform.d.ts +22 -0
- package/dist/utils/imageTransform.js +60 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/resolveFileUrl.d.ts +6 -0
- package/dist/utils/resolveFileUrl.js +21 -0
- package/dist/utils/userUploadsStorage.d.ts +27 -0
- package/dist/utils/userUploadsStorage.js +168 -0
- package/dist/utils/widgeticTusUpload.d.ts +18 -0
- package/dist/utils/widgeticTusUpload.js +131 -0
- package/dist/utils/widgeticUpload.d.ts +29 -0
- package/dist/utils/widgeticUpload.js +105 -0
- package/package.json +156 -0
|
@@ -0,0 +1,3989 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// console.timeEnd('FileBrowser module initialization');
|
|
3
|
+
// console.time('FileBrowser component initialization');
|
|
4
|
+
// console.log('Starting imports...');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* FileBrowser Component
|
|
8
|
+
* Main interface for browsing and managing files/folders in a grid layout.
|
|
9
|
+
* Handles file operations, navigation, sorting, filtering, and modal interactions.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// SVELTE IMPORTS
|
|
13
|
+
import { createEventDispatcher, onMount, onDestroy } from 'svelte';
|
|
14
|
+
const dispatch = createEventDispatcher();
|
|
15
|
+
|
|
16
|
+
// CSS IMPORTS
|
|
17
|
+
// Local CSS imports
|
|
18
|
+
import './FileBrowser.css';
|
|
19
|
+
|
|
20
|
+
// Design System Style import
|
|
21
|
+
import '@widgetic/design-system/styles';
|
|
22
|
+
|
|
23
|
+
// Design system components
|
|
24
|
+
import { Button, DebugGrid, WScrollArea, EmptyState, ActionModal, SearchInput } from '@widgetic/design-system/components';
|
|
25
|
+
import {IconSearch, IconAdjustmentsHorizontal, IconCheck } from '@widgetic/design-system/icons';
|
|
26
|
+
|
|
27
|
+
// LOCAL COMPONENT IMPORTS
|
|
28
|
+
import { NewFolderButton } from '../modals';
|
|
29
|
+
import { RecentFiles, Header, FileUploader } from './';
|
|
30
|
+
import { FilePreview } from '../previews';
|
|
31
|
+
import { SelectedFilesModal, SearchModal, RenameDialog, MoveDialog } from '../modals';
|
|
32
|
+
import { NewItemDialog } from '@widgetic/design-system/components';
|
|
33
|
+
import { FileItem, FolderItem } from '../items';
|
|
34
|
+
import { VirtualList, LoadingSkeleton, DragSelect, ControlToolbar } from '../ui';
|
|
35
|
+
|
|
36
|
+
// TYPE IMPORTS
|
|
37
|
+
import type { FileSystemItem, FolderItemWithCount } from '../../types';
|
|
38
|
+
|
|
39
|
+
// Define interface for navigate event detail
|
|
40
|
+
interface NavigateEventDetail {
|
|
41
|
+
targetFolderId: string | string[];
|
|
42
|
+
movedItems?: Array<{ id: string; [key: string]: any }>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// UTILS IMPORTS
|
|
46
|
+
import { getFileType, getFileIcon } from '../../utils/fileUtils';
|
|
47
|
+
import { getFolderIcon } from '../../utils/folderUtils';
|
|
48
|
+
import { type FileFilterType, FILTER_OPTIONS, getAllowedFileTypes, FILE_TYPES, formatFileTypesForDisplay } from '../../utils/fileTypes';
|
|
49
|
+
import { getPathNamesFromIds, deleteItem, renameItem, moveItem } from '../../utils/fileOperations';
|
|
50
|
+
import { getFileBrowserUploadConfig, setFileBrowserUploadConfig } from '../../stores/uploadApiStore';
|
|
51
|
+
import {
|
|
52
|
+
loadUserUploads,
|
|
53
|
+
saveUserUpload,
|
|
54
|
+
saveLibraryTreeChildren,
|
|
55
|
+
createUserUploadsFileSystemRoot,
|
|
56
|
+
} from '../../utils/userUploadsStorage';
|
|
57
|
+
import { fetchUserUploadsFromApi } from '../../utils/widgeticUpload';
|
|
58
|
+
import { get } from 'svelte/store';
|
|
59
|
+
import { resolveFileItemUrl } from '../../utils/resolveFileUrl';
|
|
60
|
+
import { dev } from '$app/environment';
|
|
61
|
+
// import { showToast } from '../../utils/toastUtils';
|
|
62
|
+
import { showToast } from '@widgetic/design-system/components';
|
|
63
|
+
|
|
64
|
+
// Constants for localStorage keys
|
|
65
|
+
const FILTER_STORAGE_KEY = (id: string) => `file-browser-filter-${id}`;
|
|
66
|
+
//
|
|
67
|
+
// STORE IMPORTS
|
|
68
|
+
import {
|
|
69
|
+
fileStore,
|
|
70
|
+
currentFolder,
|
|
71
|
+
sortCriteria,
|
|
72
|
+
sortDirection,
|
|
73
|
+
sortedFiles,
|
|
74
|
+
selectedFiles
|
|
75
|
+
} from '../../stores/fileStore';
|
|
76
|
+
//
|
|
77
|
+
import { isDraggingFiles } from '../../stores/dragStore';
|
|
78
|
+
import { folderCounts, updateFolderCounts } from '../../stores/folderCountStore';
|
|
79
|
+
import {
|
|
80
|
+
getNavigationStore,
|
|
81
|
+
createCurrentPathStore,
|
|
82
|
+
createCanGoBackStore,
|
|
83
|
+
createCanGoForwardStore,
|
|
84
|
+
getStorageKey,
|
|
85
|
+
getStoredState
|
|
86
|
+
} from '../../stores/navigationStore';
|
|
87
|
+
//
|
|
88
|
+
import { persistentSelectStore, validSelections } from '../../stores/persistentSelectStore';
|
|
89
|
+
import { isModalOpen, modalState } from '@widgetic/design-system/components/modals/modalStore';
|
|
90
|
+
|
|
91
|
+
// logs flags
|
|
92
|
+
let showLogs = false;
|
|
93
|
+
let showRecentFilesLogs = false;
|
|
94
|
+
let showFiltersLogs = false;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* COMPONENT PROPS
|
|
98
|
+
*/
|
|
99
|
+
// data props
|
|
100
|
+
export let data: any = null;
|
|
101
|
+
// reactive statement to initialize the component if data is passed
|
|
102
|
+
$: if(data) {
|
|
103
|
+
// if(showLogs) console.log('FileBrowser: data reactive statement:', data);
|
|
104
|
+
init();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// class and style props
|
|
108
|
+
let className = '';
|
|
109
|
+
export { className as class };
|
|
110
|
+
export let style: string = '';
|
|
111
|
+
// content settings
|
|
112
|
+
export let basePath: string = '/files/'; // Base path for file URLs
|
|
113
|
+
export const api: any = null; // API config with endpoints (external reference only)
|
|
114
|
+
export let restrictUpload = false; // Toggle upload type restrictions
|
|
115
|
+
// header settings
|
|
116
|
+
export let headerEl: any = null;
|
|
117
|
+
// filter and sort settings
|
|
118
|
+
export let showFilters = true; // Toggle filter dropdown visibility
|
|
119
|
+
export let showSorting = true; // Toggle sort dropdown visibility
|
|
120
|
+
export let initialFilter: FileFilterType = 'all';
|
|
121
|
+
export let initialSortCriteria: 'name' | 'date' | 'size' = 'name'; // Default to date
|
|
122
|
+
// navigation settings
|
|
123
|
+
export let instanceId: string = 'default'; // Unique identifier for this file browser instance
|
|
124
|
+
export let persistHistory = true; // Whether to persist navigation history in localStorage
|
|
125
|
+
export let showBreadcrumbs = true; // Whether to show breadcrumbs
|
|
126
|
+
// selection settings
|
|
127
|
+
export let allowSelecting = true; // Toggle file selection functionality by default
|
|
128
|
+
export let maxSelections: number | null = null; // null = unlimited; 1 = single-file picker
|
|
129
|
+
/** When set (single-file picker), disables confirm until user picks a different file. */
|
|
130
|
+
export let activeFileId: string | null = null;
|
|
131
|
+
export let showAddToEditor = false; // Toggle visibility of "Add to Editor" functionality
|
|
132
|
+
export let addToEditorLabel = 'Add to Editor';
|
|
133
|
+
/** When false, skips bundled demo tree (use with Widgetic upload config). */
|
|
134
|
+
export let useDemoContent = true;
|
|
135
|
+
/**
|
|
136
|
+
* Opt-in Dexie L1 (`@widgetic/cache-layer`). Default false.
|
|
137
|
+
* Site `/files` passes true. When true and upload config has a token, scopes cache to that user.
|
|
138
|
+
* When false, never calls setCacheOwner (host site authStore may already own the cache).
|
|
139
|
+
*/
|
|
140
|
+
export let enableLocalCache = false;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* LOCAL API METHODS
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
import { ENDPOINTS, logApiRequest } from '../../utils/apiConfig';
|
|
147
|
+
|
|
148
|
+
// LOCAL API fetch files data method
|
|
149
|
+
export async function fetchFilesData() {
|
|
150
|
+
try {
|
|
151
|
+
logApiRequest(ENDPOINTS.FILES);
|
|
152
|
+
const response = await fetch(ENDPOINTS.FILES);
|
|
153
|
+
if(showLogs) console.log('FileBrowser: FetchFilesData: response received:', response);
|
|
154
|
+
|
|
155
|
+
if (!response.ok) {
|
|
156
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// parse the response
|
|
160
|
+
const data = await response.json();
|
|
161
|
+
|
|
162
|
+
// Transform all URLs in the data to absolute URLs
|
|
163
|
+
// const transformedData = transformFileUrls(data, baseUrl);
|
|
164
|
+
// console.log('FileBrowser: Transformed data with absolute URLs');
|
|
165
|
+
|
|
166
|
+
return data;
|
|
167
|
+
} catch (error) {
|
|
168
|
+
if(showLogs) console.log("FileBrowser: FetchFilesData: Failed to fetch files:", error);
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* LOCAL STATE VARS
|
|
175
|
+
*/
|
|
176
|
+
// Helper function to check if code is running in browser environment
|
|
177
|
+
const isBrowser = typeof window !== 'undefined' && typeof localStorage !== 'undefined';
|
|
178
|
+
|
|
179
|
+
// Safe localStorage wrapper functions
|
|
180
|
+
function getFromStorage(key: string, defaultValue: any) {
|
|
181
|
+
try {
|
|
182
|
+
if (!isBrowser) return defaultValue;
|
|
183
|
+
const storedValue = localStorage.getItem(key);
|
|
184
|
+
return storedValue !== null ? JSON.parse(storedValue) : defaultValue;
|
|
185
|
+
} catch (error) {
|
|
186
|
+
if(showLogs) console.log(`Error retrieving ${key} from localStorage:`, error);
|
|
187
|
+
return defaultValue;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function saveToStorage(key: string, value: any) {
|
|
192
|
+
try {
|
|
193
|
+
if (!isBrowser) return;
|
|
194
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
195
|
+
} catch (error) {
|
|
196
|
+
if(showLogs) console.log(`Error saving ${key} to localStorage:`, error);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function removeFromStorage(instanceId: string) {
|
|
201
|
+
const key = getStorageKey(instanceId);
|
|
202
|
+
|
|
203
|
+
try {
|
|
204
|
+
if (!isBrowser) return;
|
|
205
|
+
localStorage.removeItem(key);
|
|
206
|
+
} catch (error) {
|
|
207
|
+
if(showLogs) console.log(`Error removing ${key} from localStorage:`, error);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Root container class
|
|
212
|
+
let rootContainerClass = 'file-browser-module';
|
|
213
|
+
// demo content settings
|
|
214
|
+
let demoContentKey = 'file-browser-demo-data';
|
|
215
|
+
const GRID_ITEM_HEIGHT = 96;
|
|
216
|
+
let demoContent = {
|
|
217
|
+
"basePath": "/files/",
|
|
218
|
+
"root": {
|
|
219
|
+
"id": "root_xyz789",
|
|
220
|
+
"name": "Root",
|
|
221
|
+
"type": "folder",
|
|
222
|
+
"children": [
|
|
223
|
+
{
|
|
224
|
+
"id": "folder_abc123",
|
|
225
|
+
"name": "Docs",
|
|
226
|
+
"type": "folder",
|
|
227
|
+
"children": []
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"id": "folder_pqr678x",
|
|
231
|
+
"name": "Design Process",
|
|
232
|
+
"type": "folder",
|
|
233
|
+
"children": [
|
|
234
|
+
{
|
|
235
|
+
"id": "file_mno8d25",
|
|
236
|
+
"name": "image 40.jpg",
|
|
237
|
+
"type": "file",
|
|
238
|
+
"size": 2800000,
|
|
239
|
+
"width": 1024,
|
|
240
|
+
"height": 904,
|
|
241
|
+
"modified": "2023-09-22T11:00:00Z",
|
|
242
|
+
"url": "image/image 40.jpg",
|
|
243
|
+
"thumbnail": "thumbnail/image 40.jpg",
|
|
244
|
+
"hash": "A1 08 12 16 82 40 57 88 7C 77 87 78 78 78 87 87 78 87 08 81 87 00 98"
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"id": "folder_abs123x",
|
|
250
|
+
"name": "Research",
|
|
251
|
+
"type": "folder",
|
|
252
|
+
"children": [
|
|
253
|
+
{
|
|
254
|
+
"id": "file_mno345x",
|
|
255
|
+
"name": "astronaut.svg",
|
|
256
|
+
"type": "file",
|
|
257
|
+
"size": 1500000,
|
|
258
|
+
"modified": "2024-09-28T11:00:00Z",
|
|
259
|
+
"url": "svg/astronaut.svg",
|
|
260
|
+
"thumbnail": "svg/astronaut.svg"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"id": "file_pqr678y",
|
|
264
|
+
"name": "cook.svg",
|
|
265
|
+
"type": "file",
|
|
266
|
+
"size": 1500000,
|
|
267
|
+
"modified": "2024-03-27T10:01:00Z",
|
|
268
|
+
"url": "svg/cook.svg",
|
|
269
|
+
"thumbnail": "svg/cook.svg"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"id": "file_stud964",
|
|
273
|
+
"name": "image 28.jpg",
|
|
274
|
+
"type": "file",
|
|
275
|
+
"size": 3150000,
|
|
276
|
+
"width": 1024,
|
|
277
|
+
"height": 683,
|
|
278
|
+
"modified": "2024-09-27T11:45:00Z",
|
|
279
|
+
"url": "image/image 28.jpg",
|
|
280
|
+
"thumbnail": "thumbnail/image 28.jpg",
|
|
281
|
+
"hash": "55 38 06 15 86 72 96 58 9F 56 A5 49 B7 C6 46 94 FA 9B BC AF C9"
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"id": "file_def456",
|
|
287
|
+
"name": "Recipe.mp3",
|
|
288
|
+
"type": "file",
|
|
289
|
+
"size": 5000000,
|
|
290
|
+
"modified": "2024-09-28T10:00:00Z",
|
|
291
|
+
"url": "audio/audio-file.mp3"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"id": "file_ghi789",
|
|
295
|
+
"name": "Doc.txt",
|
|
296
|
+
"type": "file",
|
|
297
|
+
"size": 5000000,
|
|
298
|
+
"modified": "2024-09-28T09:00:00Z",
|
|
299
|
+
"url": "document/specs.txt"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"id": "file_pdf_world_before_calculus",
|
|
303
|
+
"name": "The World Before Calculus.pdf",
|
|
304
|
+
"type": "file",
|
|
305
|
+
"size": 5000000,
|
|
306
|
+
"modified": "2025-02-21T09:00:00Z",
|
|
307
|
+
"url": "document/The World Before Calculus.pdf"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"id": "file_pdf_rfp_nec_website_development",
|
|
311
|
+
"name": "RFP-NEC_Website-Development_2021-August.pdf",
|
|
312
|
+
"type": "file",
|
|
313
|
+
"size": 5000000,
|
|
314
|
+
"modified": "2025-03-21T09:00:00Z",
|
|
315
|
+
"url": "document/RFP-NEC_Website-Development_2021-August.pdf"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"id": "file_pdf_helios_design_website_project_brief",
|
|
319
|
+
"name": "HeliosDesign Website Project Brief Sample.pdf",
|
|
320
|
+
"type": "file",
|
|
321
|
+
"size": 5000000,
|
|
322
|
+
"modified": "2025-03-21T09:00:00Z",
|
|
323
|
+
"url": "document/HeliosDesign Website Project Brief Sample.pdf"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"id": "file_pqr8544",
|
|
327
|
+
"name": "celebration.mp4",
|
|
328
|
+
"type": "file",
|
|
329
|
+
"size": 150000000,
|
|
330
|
+
"modified": "2024-09-28T08:00:00Z",
|
|
331
|
+
"url": "video/video-file.mp4",
|
|
332
|
+
"thumbnail": "video/video-file.png",
|
|
333
|
+
"hash": "AE F7 09 06 80 A6 F9 6B 8B 88 76 AE 77 72 76 98 76 99 AE 8D D0 A9 08"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"id": "folder_jkl012",
|
|
337
|
+
"name": "Onboarding Content",
|
|
338
|
+
"type": "folder",
|
|
339
|
+
"children": [
|
|
340
|
+
{
|
|
341
|
+
"id": "file_mno345",
|
|
342
|
+
"name": "astronaut.svg",
|
|
343
|
+
"type": "file",
|
|
344
|
+
"size": 1500000,
|
|
345
|
+
"modified": "2024-03-27T10:00:00Z",
|
|
346
|
+
"url": "svg/astronaut.svg",
|
|
347
|
+
"thumbnail": "svg/astronaut.svg"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"id": "file_pqr678",
|
|
351
|
+
"name": "cook.svg",
|
|
352
|
+
"type": "file",
|
|
353
|
+
"size": 1500000,
|
|
354
|
+
"modified": "2024-03-27T10:01:00Z",
|
|
355
|
+
"url": "svg/cook.svg",
|
|
356
|
+
"thumbnail": "svg/cook.svg"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"id": "file_stu910",
|
|
360
|
+
"name": "dj.svg",
|
|
361
|
+
"type": "file",
|
|
362
|
+
"size": 1500000,
|
|
363
|
+
"modified": "2024-03-27T10:02:00Z",
|
|
364
|
+
"url": "svg/dj.svg",
|
|
365
|
+
"thumbnail": "svg/dj.svg"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"id": "file_uvw123",
|
|
369
|
+
"name": "doctor.svg",
|
|
370
|
+
"type": "file",
|
|
371
|
+
"size": 1500000,
|
|
372
|
+
"modified": "2024-03-27T10:03:00Z",
|
|
373
|
+
"url": "svg/doctor.svg",
|
|
374
|
+
"thumbnail": "svg/doctor.svg"
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"id": "file_xyz456",
|
|
378
|
+
"name": "farmer.svg",
|
|
379
|
+
"type": "file",
|
|
380
|
+
"size": 1500000,
|
|
381
|
+
"modified": "2024-03-27T10:04:00Z",
|
|
382
|
+
"url": "svg/farmer.svg",
|
|
383
|
+
"thumbnail": "svg/farmer.svg"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"id": "file_abc789",
|
|
387
|
+
"name": "fire fighter.svg",
|
|
388
|
+
"type": "file",
|
|
389
|
+
"size": 1500000,
|
|
390
|
+
"modified": "2024-03-27T10:05:00Z",
|
|
391
|
+
"url": "svg/fire fighter.svg",
|
|
392
|
+
"thumbnail": "svg/fire fighter.svg"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"id": "file_def123",
|
|
396
|
+
"name": "plumber.svg",
|
|
397
|
+
"type": "file",
|
|
398
|
+
"size": 1500000,
|
|
399
|
+
"modified": "2024-03-27T10:06:00Z",
|
|
400
|
+
"url": "svg/plumber.svg",
|
|
401
|
+
"thumbnail": "svg/plumber.svg"
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"id": "file_ghi456",
|
|
405
|
+
"name": "santa.svg",
|
|
406
|
+
"type": "file",
|
|
407
|
+
"size": 1500000,
|
|
408
|
+
"modified": "2024-03-27T10:07:00Z",
|
|
409
|
+
"url": "svg/santa.svg",
|
|
410
|
+
"thumbnail": "svg/santa.svg"
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"id": "file_ghid789",
|
|
414
|
+
"name": "scientist.svg",
|
|
415
|
+
"type": "file",
|
|
416
|
+
"size": 1500000,
|
|
417
|
+
"modified": "2024-03-27T10:08:00Z",
|
|
418
|
+
"url": "svg/scientist.svg",
|
|
419
|
+
"thumbnail": "svg/scientist.svg"
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"id": "file_jkl123",
|
|
423
|
+
"name": "student.svg",
|
|
424
|
+
"type": "file",
|
|
425
|
+
"size": 1500000,
|
|
426
|
+
"modified": "2024-03-27T10:09:00Z",
|
|
427
|
+
"url": "svg/student.svg",
|
|
428
|
+
"thumbnail": "svg/student.svg"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"id": "file_jkl823",
|
|
432
|
+
"name": "image 39.jpg",
|
|
433
|
+
"type": "file",
|
|
434
|
+
"size": 2500000,
|
|
435
|
+
"width": 1024,
|
|
436
|
+
"height": 1536,
|
|
437
|
+
"modified": "2023-09-20T14:30:00Z",
|
|
438
|
+
"url": "image/image 39.jpg",
|
|
439
|
+
"thumbnail": "thumbnail/image 39.jpg",
|
|
440
|
+
"hash": "6C 08 0A 15 02 96 97 72 77 F8 65 67 87 96 B7 97 79 7A 90 B7 07"
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"id": "file_jkl824",
|
|
444
|
+
"name": "image 38.jpg",
|
|
445
|
+
"type": "file",
|
|
446
|
+
"size": 3000000,
|
|
447
|
+
"width": 1024,
|
|
448
|
+
"height": 1536,
|
|
449
|
+
"modified": "2023-09-21T09:15:00Z",
|
|
450
|
+
"url": "image/image 38.jpg",
|
|
451
|
+
"thumbnail": "thumbnail/image 38.jpg",
|
|
452
|
+
"hash": "A9 18 0A 15 02 07 66 AB 97 67 88 88 77 76 7A A7 9F 5A F5 9A 76"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"id": "folder_mno345",
|
|
456
|
+
"name": "Assets",
|
|
457
|
+
"type": "folder",
|
|
458
|
+
"children": [
|
|
459
|
+
{
|
|
460
|
+
"id": "folder_test1",
|
|
461
|
+
"name": "Design Resources",
|
|
462
|
+
"type": "folder",
|
|
463
|
+
"children": [
|
|
464
|
+
{
|
|
465
|
+
"id": "folder_test2",
|
|
466
|
+
"name": "Project Files",
|
|
467
|
+
"type": "folder",
|
|
468
|
+
"children": [
|
|
469
|
+
{
|
|
470
|
+
"id": "folder_test3",
|
|
471
|
+
"name": "Work in Progress",
|
|
472
|
+
"type": "folder",
|
|
473
|
+
"children": [
|
|
474
|
+
{
|
|
475
|
+
"id": "folder_test4",
|
|
476
|
+
"name": "Latest Updates",
|
|
477
|
+
"type": "folder",
|
|
478
|
+
"children": [
|
|
479
|
+
{
|
|
480
|
+
"id": "file_test4_1",
|
|
481
|
+
"name": "astronaut.svg",
|
|
482
|
+
"type": "file",
|
|
483
|
+
"size": 1500000,
|
|
484
|
+
"modified": "2024-03-27T10:00:00Z",
|
|
485
|
+
"url": "svg/astronaut.svg",
|
|
486
|
+
"thumbnail": "svg/astronaut.svg"
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"id": "file_test4_2",
|
|
490
|
+
"name": "cook.svg",
|
|
491
|
+
"type": "file",
|
|
492
|
+
"size": 1500000,
|
|
493
|
+
"modified": "2024-03-27T10:01:00Z",
|
|
494
|
+
"url": "svg/cook.svg",
|
|
495
|
+
"thumbnail": "svg/cook.svg"
|
|
496
|
+
}
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
]
|
|
500
|
+
}
|
|
501
|
+
]
|
|
502
|
+
}
|
|
503
|
+
]
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
"id": "file_mno825",
|
|
507
|
+
"name": "image 40.jpg",
|
|
508
|
+
"type": "file",
|
|
509
|
+
"size": 2800000,
|
|
510
|
+
"width": 1024,
|
|
511
|
+
"height": 904,
|
|
512
|
+
"modified": "2023-09-22T11:00:00Z",
|
|
513
|
+
"url": "image/image 40.jpg",
|
|
514
|
+
"thumbnail": "thumbnail/image 40.jpg",
|
|
515
|
+
"hash": "A1 08 12 16 82 40 57 88 7C 77 87 78 78 78 87 87 78 87 08 81 87 00 98"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
"id": "file_mno826",
|
|
519
|
+
"name": "CooperHewitt-Bold.otf",
|
|
520
|
+
"type": "file",
|
|
521
|
+
"size": 150000,
|
|
522
|
+
"modified": "2024-09-28T12:00:00Z",
|
|
523
|
+
"url": "font/CooperHewitt/CooperHewitt-Bold.otf",
|
|
524
|
+
"thumbnail": "aA",
|
|
525
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"id": "file_mno827",
|
|
529
|
+
"name": "CooperHewitt-BoldItalic.otf",
|
|
530
|
+
"type": "file",
|
|
531
|
+
"size": 150000,
|
|
532
|
+
"modified": "2024-03-27T10:01:00Z",
|
|
533
|
+
"url": "font/CooperHewitt/CooperHewitt-BoldItalic.otf",
|
|
534
|
+
"thumbnail": "aA",
|
|
535
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"id": "file_mno828",
|
|
539
|
+
"name": "CooperHewitt-Book.otf",
|
|
540
|
+
"type": "file",
|
|
541
|
+
"size": 150000,
|
|
542
|
+
"modified": "2024-03-27T10:02:00Z",
|
|
543
|
+
"url": "font/CooperHewitt/CooperHewitt-Book.otf",
|
|
544
|
+
"thumbnail": "aA",
|
|
545
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
"id": "file_mno829",
|
|
549
|
+
"name": "CooperHewitt-BookItalic.otf",
|
|
550
|
+
"type": "file",
|
|
551
|
+
"size": 150000,
|
|
552
|
+
"modified": "2024-03-27T10:03:00Z",
|
|
553
|
+
"url": "font/CooperHewitt/CooperHewitt-BookItalic.otf",
|
|
554
|
+
"thumbnail": "aA",
|
|
555
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
"id": "file_mno830",
|
|
559
|
+
"name": "CooperHewitt-Heavy.otf",
|
|
560
|
+
"type": "file",
|
|
561
|
+
"size": 150000,
|
|
562
|
+
"modified": "2024-03-27T10:04:00Z",
|
|
563
|
+
"url": "font/CooperHewitt/CooperHewitt-Heavy.otf",
|
|
564
|
+
"thumbnail": "aA",
|
|
565
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
"id": "file_mno831",
|
|
569
|
+
"name": "CooperHewitt-HeavyItalic.otf",
|
|
570
|
+
"type": "file",
|
|
571
|
+
"size": 150000,
|
|
572
|
+
"modified": "2024-03-27T10:05:00Z",
|
|
573
|
+
"url": "font/CooperHewitt/CooperHewitt-HeavyItalic.otf",
|
|
574
|
+
"thumbnail": "aA",
|
|
575
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
"id": "file_mno832",
|
|
579
|
+
"name": "CooperHewitt-Light.otf",
|
|
580
|
+
"type": "file",
|
|
581
|
+
"size": 150000,
|
|
582
|
+
"modified": "2024-03-27T10:06:00Z",
|
|
583
|
+
"url": "font/CooperHewitt/CooperHewitt-Light.otf",
|
|
584
|
+
"thumbnail": "aA",
|
|
585
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
"id": "file_mno833",
|
|
589
|
+
"name": "CooperHewitt-LightItalic.otf",
|
|
590
|
+
"type": "file",
|
|
591
|
+
"size": 150000,
|
|
592
|
+
"modified": "2024-03-27T10:07:00Z",
|
|
593
|
+
"url": "font/CooperHewitt/CooperHewitt-LightItalic.otf",
|
|
594
|
+
"thumbnail": "aA",
|
|
595
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
"id": "file_mno834",
|
|
599
|
+
"name": "CooperHewitt-Medium.otf",
|
|
600
|
+
"type": "file",
|
|
601
|
+
"size": 150000,
|
|
602
|
+
"modified": "2024-03-27T10:08:00Z",
|
|
603
|
+
"url": "font/CooperHewitt/CooperHewitt-Medium.otf",
|
|
604
|
+
"thumbnail": "aA",
|
|
605
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
"id": "file_mno835",
|
|
609
|
+
"name": "CooperHewitt-MediumItalic.otf",
|
|
610
|
+
"type": "file",
|
|
611
|
+
"size": 150000,
|
|
612
|
+
"modified": "2024-03-27T10:09:00Z",
|
|
613
|
+
"url": "font/CooperHewitt/CooperHewitt-MediumItalic.otf",
|
|
614
|
+
"thumbnail": "aA",
|
|
615
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"id": "file_mno836",
|
|
619
|
+
"name": "CooperHewitt-Semibold.otf",
|
|
620
|
+
"type": "file",
|
|
621
|
+
"size": 150000,
|
|
622
|
+
"modified": "2024-03-27T10:10:00Z",
|
|
623
|
+
"url": "font/CooperHewitt/CooperHewitt-Semibold.otf",
|
|
624
|
+
"thumbnail": "aA",
|
|
625
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
"id": "file_mno837",
|
|
629
|
+
"name": "CooperHewitt-SemiboldItalic.otf",
|
|
630
|
+
"type": "file",
|
|
631
|
+
"size": 150000,
|
|
632
|
+
"modified": "2024-03-27T10:11:00Z",
|
|
633
|
+
"url": "font/CooperHewitt/CooperHewitt-SemiboldItalic.otf",
|
|
634
|
+
"thumbnail": "aA",
|
|
635
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
"id": "file_mno838",
|
|
639
|
+
"name": "CooperHewitt-Thin.otf",
|
|
640
|
+
"type": "file",
|
|
641
|
+
"size": 150000,
|
|
642
|
+
"modified": "2024-03-27T10:12:00Z",
|
|
643
|
+
"url": "font/CooperHewitt/CooperHewitt-Thin.otf",
|
|
644
|
+
"thumbnail": "aA",
|
|
645
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
"id": "file_mno839",
|
|
649
|
+
"name": "CooperHewitt-ThinItalic.otf",
|
|
650
|
+
"type": "file",
|
|
651
|
+
"size": 150000,
|
|
652
|
+
"modified": "2024-03-27T10:13:00Z",
|
|
653
|
+
"url": "font/CooperHewitt/CooperHewitt-ThinItalic.otf",
|
|
654
|
+
"thumbnail": "aA",
|
|
655
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
"id": "file_mno840",
|
|
659
|
+
"name": "Kimpo-Bold.otf",
|
|
660
|
+
"type": "file",
|
|
661
|
+
"size": 150000,
|
|
662
|
+
"modified": "2024-03-27T10:14:00Z",
|
|
663
|
+
"url": "font/Kimpo/Kimpo-Bold.otf",
|
|
664
|
+
"thumbnail": "aA",
|
|
665
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
"id": "file_mno841",
|
|
669
|
+
"name": "Kimpo-Regular.otf",
|
|
670
|
+
"type": "file",
|
|
671
|
+
"size": 150000,
|
|
672
|
+
"modified": "2024-03-27T10:15:00Z",
|
|
673
|
+
"url": "font/Kimpo/Kimpo-Regular.otf",
|
|
674
|
+
"thumbnail": "aA",
|
|
675
|
+
"previewText": "The quick brown fox jumps over the lazy dog"
|
|
676
|
+
}
|
|
677
|
+
]
|
|
678
|
+
}
|
|
679
|
+
]
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
"id": "file_mno842",
|
|
683
|
+
"name": "image 41.jpg",
|
|
684
|
+
"type": "file",
|
|
685
|
+
"size": 3200000,
|
|
686
|
+
"width": 1024,
|
|
687
|
+
"height": 1536,
|
|
688
|
+
"modified": "2024-09-23T16:45:00Z",
|
|
689
|
+
"url": "image/image 41.jpg",
|
|
690
|
+
"thumbnail": "thumbnail/image 41.jpg",
|
|
691
|
+
"hash": "93 18 0A 15 02 5F 87 AE 78 38 86 58 65 62 69 87 08 59 66 70 64"
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
"id": "file_pqr844",
|
|
695
|
+
"name": "celebration.mp4",
|
|
696
|
+
"type": "file",
|
|
697
|
+
"size": 150000000,
|
|
698
|
+
"modified": "2023-09-24T16:30:00Z",
|
|
699
|
+
"url": "video/video-file.mp4",
|
|
700
|
+
"thumbnail": "video/video-file.png",
|
|
701
|
+
"hash": "AE F7 09 06 80 A6 F9 6B 8B 88 76 AE 77 72 76 98 76 99 AE 8D D0 A9 08"
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
"id": "folder_stu910",
|
|
705
|
+
"name": "Photo Collection",
|
|
706
|
+
"type": "folder",
|
|
707
|
+
"children": [
|
|
708
|
+
{
|
|
709
|
+
"id": "file_stu911",
|
|
710
|
+
"name": "image 1.jpg",
|
|
711
|
+
"type": "file",
|
|
712
|
+
"size": 2100000,
|
|
713
|
+
"width": 731,
|
|
714
|
+
"height": 1024,
|
|
715
|
+
"modified": "2023-10-01T10:30:00Z",
|
|
716
|
+
"url": "image/image 1.jpg",
|
|
717
|
+
"thumbnail": "thumbnail/image 1.jpg",
|
|
718
|
+
"hash": "21 F8 0D 1D 04 76 78 7F 77 98 77 97 89 87 68 77 99 85 A0 48 08"
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
"id": "file_stu912",
|
|
722
|
+
"name": "image 2.jpg",
|
|
723
|
+
"type": "file",
|
|
724
|
+
"size": 2300000,
|
|
725
|
+
"width": 683,
|
|
726
|
+
"height": 1024,
|
|
727
|
+
"modified": "2023-10-01T11:45:00Z",
|
|
728
|
+
"url": "image/image 2.jpg",
|
|
729
|
+
"thumbnail": "thumbnail/image 2.jpg",
|
|
730
|
+
"hash": "5E 29 02 0D 00 B6 C8 8C 88 F7 39 97 67 89 77 37 69 80 95 05 38"
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
"id": "file_stu913",
|
|
734
|
+
"name": "image 3.jpg",
|
|
735
|
+
"type": "file",
|
|
736
|
+
"size": 2500000,
|
|
737
|
+
"width": 682,
|
|
738
|
+
"height": 1024,
|
|
739
|
+
"modified": "2023-10-01T13:15:00Z",
|
|
740
|
+
"url": "image/image 3.jpg",
|
|
741
|
+
"thumbnail": "thumbnail/image 3.jpg",
|
|
742
|
+
"hash": "CA F7 05 0D 02 23 69 88 67 09 88 69 88 89 98 68 8F 97 AC F9 85"
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
"id": "file_stu914",
|
|
746
|
+
"name": "image 4.jpg",
|
|
747
|
+
"type": "file",
|
|
748
|
+
"size": 2200000,
|
|
749
|
+
"width": 683,
|
|
750
|
+
"height": 1024,
|
|
751
|
+
"modified": "2023-10-02T09:30:00Z",
|
|
752
|
+
"url": "image/image 4.jpg",
|
|
753
|
+
"thumbnail": "thumbnail/image 4.jpg",
|
|
754
|
+
"hash": "74 08 06 1D 02 A4 88 9F 76 67 87 67 77 99 78 87 49 60 A8 06 B6"
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
"id": "file_stu915",
|
|
758
|
+
"name": "image 5.jpg",
|
|
759
|
+
"type": "file",
|
|
760
|
+
"size": 2400000,
|
|
761
|
+
"width": 716,
|
|
762
|
+
"height": 1024,
|
|
763
|
+
"modified": "2023-10-02T10:45:00Z",
|
|
764
|
+
"url": "image/image 5.jpg",
|
|
765
|
+
"thumbnail": "thumbnail/image 5.jpg",
|
|
766
|
+
"hash": "AF 28 06 15 06 D6 59 7E 66 98 67 08 98 7B 68 87 38 80 77 03 68"
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
"id": "file_stu916",
|
|
770
|
+
"name": "image 6.jpg",
|
|
771
|
+
"type": "file",
|
|
772
|
+
"size": 2600000,
|
|
773
|
+
"width": 819,
|
|
774
|
+
"height": 1024,
|
|
775
|
+
"modified": "2023-10-02T14:00:00Z",
|
|
776
|
+
"url": "image/image 6.jpg",
|
|
777
|
+
"thumbnail": "thumbnail/image 6.jpg",
|
|
778
|
+
"hash": "5E 29 06 0E 04 48 76 C6 64 96 05 59 AA A5 79 85 A6 B8 06 22 56 05 63"
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
"id": "file_stu917",
|
|
782
|
+
"name": "image 7.jpg",
|
|
783
|
+
"type": "file",
|
|
784
|
+
"size": 2350000,
|
|
785
|
+
"width": 819,
|
|
786
|
+
"height": 1024,
|
|
787
|
+
"modified": "2023-10-03T11:30:00Z",
|
|
788
|
+
"url": "image/image 7.jpg",
|
|
789
|
+
"thumbnail": "thumbnail/image 7.jpg",
|
|
790
|
+
"hash": "23 29 0A 0E 02 57 BB 08 8A 77 97 8A 55 54 98 76 88 89 9C 70 A5 09 48"
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
"id": "file_stu918",
|
|
794
|
+
"name": "image 8.jpg",
|
|
795
|
+
"type": "file",
|
|
796
|
+
"size": 2450000,
|
|
797
|
+
"width": 1024,
|
|
798
|
+
"height": 1010,
|
|
799
|
+
"modified": "2023-10-03T13:45:00Z",
|
|
800
|
+
"url": "image/image 8.jpg",
|
|
801
|
+
"thumbnail": "thumbnail/image 8.jpg",
|
|
802
|
+
"hash": "95 E7 01 0F 80 68 54 7A 0D 77 78 4E B3 79 97 19 B8 86 5D F7 84 38 7F 03"
|
|
803
|
+
},
|
|
804
|
+
{
|
|
805
|
+
"id": "file_stu919",
|
|
806
|
+
"name": "image 9.jpg",
|
|
807
|
+
"type": "file",
|
|
808
|
+
"size": 2550000,
|
|
809
|
+
"width": 768,
|
|
810
|
+
"height": 1024,
|
|
811
|
+
"modified": "2023-10-03T15:15:00Z",
|
|
812
|
+
"url": "image/image 9.jpg",
|
|
813
|
+
"thumbnail": "thumbnail/image 9.jpg",
|
|
814
|
+
"hash": "31 08 0A 05 00 65 77 70 88 88 99 87 77 68 88 78 4B AF B9 30 09"
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
"id": "file_stu920",
|
|
818
|
+
"name": "image 10.jpg",
|
|
819
|
+
"type": "file",
|
|
820
|
+
"size": 2150000,
|
|
821
|
+
"width": 768,
|
|
822
|
+
"height": 1024,
|
|
823
|
+
"modified": "2023-10-04T09:00:00Z",
|
|
824
|
+
"url": "image/image 10.jpg",
|
|
825
|
+
"thumbnail": "thumbnail/image 10.jpg",
|
|
826
|
+
"hash": "57 39 06 15 0A 62 B6 F1 99 E5 64 37 99 6A 87 89 78 8F 69 F7 B9"
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
"id": "file_stu921",
|
|
830
|
+
"name": "image 11.jpg",
|
|
831
|
+
"type": "file",
|
|
832
|
+
"size": 2250000,
|
|
833
|
+
"width": 683,
|
|
834
|
+
"height": 1024,
|
|
835
|
+
"modified": "2023-10-04T10:30:00Z",
|
|
836
|
+
"url": "image/image 11.jpg",
|
|
837
|
+
"thumbnail": "thumbnail/image 11.jpg",
|
|
838
|
+
"hash": "E4 29 0A 25 06 69 87 5F 77 A8 66 78 79 66 69 88 76 70 45 08 78"
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
"id": "file_stu922",
|
|
842
|
+
"name": "image 12.jpg",
|
|
843
|
+
"type": "file",
|
|
844
|
+
"size": 2350000,
|
|
845
|
+
"width": 731,
|
|
846
|
+
"height": 1024,
|
|
847
|
+
"modified": "2023-10-04T12:00:00Z",
|
|
848
|
+
"url": "image/image 12.jpg",
|
|
849
|
+
"thumbnail": "thumbnail/image 12.jpg",
|
|
850
|
+
"hash": "98 28 0A 0D 04 C8 97 7F 87 A8 6A A7 89 77 97 77 ED 20 E9 0E 82"
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
"id": "file_stu923",
|
|
854
|
+
"name": "image 13.jpg",
|
|
855
|
+
"type": "file",
|
|
856
|
+
"size": 2400000,
|
|
857
|
+
"width": 683,
|
|
858
|
+
"height": 1024,
|
|
859
|
+
"modified": "2023-10-05T11:15:00Z",
|
|
860
|
+
"url": "image/image 13.jpg",
|
|
861
|
+
"thumbnail": "thumbnail/image 13.jpg",
|
|
862
|
+
"hash": "5A E7 0D 25 04 97 79 85 77 08 88 C8 77 86 97 57 5B 90 DA 04 AA"
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
"id": "file_stu924",
|
|
866
|
+
"name": "image 14.jpg",
|
|
867
|
+
"type": "file",
|
|
868
|
+
"size": 2500000,
|
|
869
|
+
"width": 1024,
|
|
870
|
+
"height": 683,
|
|
871
|
+
"modified": "2023-10-05T13:30:00Z",
|
|
872
|
+
"url": "image/image 14.jpg",
|
|
873
|
+
"thumbnail": "thumbnail/image 14.jpg",
|
|
874
|
+
"hash": "9F 28 0E 1D 86 C7 B7 47 62 87 88 58 84 07 88 90 86 6F 67 F8 76"
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
"id": "file_stu925",
|
|
878
|
+
"name": "image 15.jpg",
|
|
879
|
+
"type": "file",
|
|
880
|
+
"size": 2600000,
|
|
881
|
+
"width": 1024,
|
|
882
|
+
"height": 694,
|
|
883
|
+
"modified": "2023-10-05T15:45:00Z",
|
|
884
|
+
"url": "image/image 15.jpg",
|
|
885
|
+
"thumbnail": "thumbnail/image 15.jpg",
|
|
886
|
+
"hash": "A2 18 12 15 82 67 88 87 7F 77 88 89 88 98 87 79 47 7F 7A F4 87"
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
"id": "file_stu926",
|
|
890
|
+
"name": "image 16.jpg",
|
|
891
|
+
"type": "file",
|
|
892
|
+
"size": 2300000,
|
|
893
|
+
"width": 1024,
|
|
894
|
+
"height": 683,
|
|
895
|
+
"modified": "2023-10-06T10:00:00Z",
|
|
896
|
+
"url": "image/image 16.jpg",
|
|
897
|
+
"thumbnail": "thumbnail/image 16.jpg",
|
|
898
|
+
"hash": "AD E7 05 0D 82 55 78 78 77 77 87 AF 88 57 88 65 66 76 6F 45 F7"
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
"id": "file_stu927",
|
|
902
|
+
"name": "image 17.jpg",
|
|
903
|
+
"type": "file",
|
|
904
|
+
"size": 2400000,
|
|
905
|
+
"width": 1024,
|
|
906
|
+
"height": 767,
|
|
907
|
+
"modified": "2023-10-06T11:30:00Z",
|
|
908
|
+
"url": "image/image 17.jpg",
|
|
909
|
+
"thumbnail": "thumbnail/image 17.jpg",
|
|
910
|
+
"hash": "17 E8 0D 35 8E 09 68 A7 88 88 77 87 77 89 88 87 07 88 67 80 88"
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
"id": "file_stu928",
|
|
914
|
+
"name": "image 18.jpg",
|
|
915
|
+
"type": "file",
|
|
916
|
+
"size": 2500000,
|
|
917
|
+
"width": 683,
|
|
918
|
+
"height": 1024,
|
|
919
|
+
"modified": "2023-10-06T13:00:00Z",
|
|
920
|
+
"url": "image/image 18.jpg",
|
|
921
|
+
"thumbnail": "thumbnail/image 18.jpg",
|
|
922
|
+
"hash": "0F 39 06 15 04 04 85 58 5D 68 A5 B9 A7 55 5B 75 08 A9 70 92 0A"
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
"id": "file_stu929",
|
|
926
|
+
"name": "image 19.jpg",
|
|
927
|
+
"type": "file",
|
|
928
|
+
"size": 2350000,
|
|
929
|
+
"width": 1024,
|
|
930
|
+
"height": 683,
|
|
931
|
+
"modified": "2023-10-07T09:45:00Z",
|
|
932
|
+
"url": "image/image 19.jpg",
|
|
933
|
+
"thumbnail": "thumbnail/image 19.jpg",
|
|
934
|
+
"hash": "54 08 0E 0D 04 73 63 8F 66 46 79 68 97 96 77 88 40 AE 22 F1 49"
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
"id": "file_stu930",
|
|
938
|
+
"name": "image 20.jpg",
|
|
939
|
+
"type": "file",
|
|
940
|
+
"size": 2450000,
|
|
941
|
+
"width": 678,
|
|
942
|
+
"height": 1024,
|
|
943
|
+
"modified": "2023-10-07T11:15:00Z",
|
|
944
|
+
"url": "image/image 20.jpg",
|
|
945
|
+
"thumbnail": "thumbnail/image 20.jpg",
|
|
946
|
+
"hash": "A9 18 0A 15 04 87 77 8F 87 58 77 68 88 88 77 87 68 80 8D 06 C7"
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
"id": "file_stu931",
|
|
950
|
+
"name": "image 43.jpg",
|
|
951
|
+
"type": "file",
|
|
952
|
+
"size": 2750000,
|
|
953
|
+
"width": 819,
|
|
954
|
+
"height": 1024,
|
|
955
|
+
"modified": "2024-09-20T09:15:00Z",
|
|
956
|
+
"url": "image/image 43.jpg",
|
|
957
|
+
"thumbnail": "thumbnail/image 43.jpg",
|
|
958
|
+
"hash": "ED F8 05 06 00 70 77 27 76 87 78 87 78 75 78 88 67 87 4D BE 50 06 AA"
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
"id": "file_stu932",
|
|
962
|
+
"name": "image 44.jpg",
|
|
963
|
+
"type": "file",
|
|
964
|
+
"size": 2800000,
|
|
965
|
+
"width": 1024,
|
|
966
|
+
"height": 681,
|
|
967
|
+
"modified": "2024-09-20T11:30:00Z",
|
|
968
|
+
"url": "image/image 44.jpg",
|
|
969
|
+
"thumbnail": "thumbnail/image 44.jpg",
|
|
970
|
+
"hash": "60 F8 0D 0D 80 9C 57 87 7F 98 78 85 76 C8 87 6A 02 07 E5 52 B0"
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
"id": "file_stu933",
|
|
974
|
+
"name": "image 45.jpg",
|
|
975
|
+
"type": "file",
|
|
976
|
+
"size": 2650000,
|
|
977
|
+
"width": 683,
|
|
978
|
+
"height": 1024,
|
|
979
|
+
"modified": "2024-09-20T14:45:00Z",
|
|
980
|
+
"url": "image/image 45.jpg",
|
|
981
|
+
"thumbnail": "thumbnail/image 45.jpg",
|
|
982
|
+
"hash": "97 49 0A 1D 04 1D 98 90 78 F9 75 57 89 64 79 79 8F A3 FC 37 AA"
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
"id": "file_stu934",
|
|
986
|
+
"name": "image 46.jpg",
|
|
987
|
+
"type": "file",
|
|
988
|
+
"size": 2900000,
|
|
989
|
+
"width": 683,
|
|
990
|
+
"height": 1024,
|
|
991
|
+
"modified": "2024-09-21T08:00:00Z",
|
|
992
|
+
"url": "image/image 46.jpg",
|
|
993
|
+
"thumbnail": "thumbnail/image 46.jpg",
|
|
994
|
+
"hash": "22 18 12 05 02 78 78 7F 77 87 88 98 88 75 88 78 0A 7E 8D D1 07"
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
"id": "file_stu935",
|
|
998
|
+
"name": "image 47.jpg",
|
|
999
|
+
"type": "file",
|
|
1000
|
+
"size": 2700000,
|
|
1001
|
+
"width": 1024,
|
|
1002
|
+
"height": 679,
|
|
1003
|
+
"modified": "2024-09-21T10:15:00Z",
|
|
1004
|
+
"url": "image/image 47.jpg",
|
|
1005
|
+
"thumbnail": "thumbnail/image 47.jpg",
|
|
1006
|
+
"hash": "F2 E7 05 0D 82 88 07 C6 7F 84 7A 8D 79 CA C7 84 08 76 86 80 77"
|
|
1007
|
+
},
|
|
1008
|
+
{
|
|
1009
|
+
"id": "file_stu936",
|
|
1010
|
+
"name": "image 48.jpg",
|
|
1011
|
+
"type": "file",
|
|
1012
|
+
"size": 2850000,
|
|
1013
|
+
"width": 731,
|
|
1014
|
+
"height": 1024,
|
|
1015
|
+
"modified": "2024-09-21T13:30:00Z",
|
|
1016
|
+
"url": "image/image 48.jpg",
|
|
1017
|
+
"thumbnail": "thumbnail/image 48.jpg",
|
|
1018
|
+
"hash": "93 08 0A 0D 00 6C 85 60 AC 27 17 66 A8 4A B8 58 C5 8F 3C FF D9"
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
"id": "file_stu937",
|
|
1022
|
+
"name": "image 49.jpg",
|
|
1023
|
+
"type": "file",
|
|
1024
|
+
"size": 2950000,
|
|
1025
|
+
"width": 1024,
|
|
1026
|
+
"height": 683,
|
|
1027
|
+
"modified": "2024-09-22T09:45:00Z",
|
|
1028
|
+
"url": "image/image 49.jpg",
|
|
1029
|
+
"thumbnail": "thumbnail/image 49.jpg",
|
|
1030
|
+
"hash": "16 39 0E 0D 82 F6 76 98 79 88 87 94 87 8A 69 77 CF 7A CF 8A F7"
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
"id": "file_stu938",
|
|
1034
|
+
"name": "image 50.jpg",
|
|
1035
|
+
"type": "file",
|
|
1036
|
+
"size": 2600000,
|
|
1037
|
+
"width": 1024,
|
|
1038
|
+
"height": 682,
|
|
1039
|
+
"modified": "2024-09-22T12:00:00Z",
|
|
1040
|
+
"url": "image/image 50.jpg",
|
|
1041
|
+
"thumbnail": "thumbnail/image 50.jpg",
|
|
1042
|
+
"hash": "DC 28 0A 0D 82 F5 A9 67 7B 79 85 B5 75 69 88 86 28 2F 97 F0 71"
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
"id": "file_stu939",
|
|
1046
|
+
"name": "image 51.jpg",
|
|
1047
|
+
"type": "file",
|
|
1048
|
+
"size": 2750000,
|
|
1049
|
+
"width": 683,
|
|
1050
|
+
"height": 1024,
|
|
1051
|
+
"modified": "2024-09-22T15:15:00Z",
|
|
1052
|
+
"url": "image/image 51.jpg",
|
|
1053
|
+
"thumbnail": "thumbnail/image 51.jpg",
|
|
1054
|
+
"hash": "63 08 0A 0D 02 7C 84 7E 67 76 67 37 85 50 B6 59 78 6F B8 F5 64"
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
"id": "file_stu940",
|
|
1058
|
+
"name": "image 52.jpg",
|
|
1059
|
+
"type": "file",
|
|
1060
|
+
"size": 2800000,
|
|
1061
|
+
"width": 680,
|
|
1062
|
+
"height": 1024,
|
|
1063
|
+
"modified": "2024-09-23T08:30:00Z",
|
|
1064
|
+
"url": "image/image 52.jpg",
|
|
1065
|
+
"thumbnail": "thumbnail/image 52.jpg",
|
|
1066
|
+
"hash": "13 49 0E 0D 02 07 97 8B 76 89 78 88 88 88 77 87 90 C7 03 8A 4D"
|
|
1067
|
+
},
|
|
1068
|
+
{
|
|
1069
|
+
"id": "file_stu941",
|
|
1070
|
+
"name": "image 53.jpg",
|
|
1071
|
+
"type": "file",
|
|
1072
|
+
"size": 2900000,
|
|
1073
|
+
"width": 800,
|
|
1074
|
+
"height": 1024,
|
|
1075
|
+
"modified": "2024-09-23T11:45:00Z",
|
|
1076
|
+
"url": "image/image 53.jpg",
|
|
1077
|
+
"thumbnail": "thumbnail/image 53.jpg",
|
|
1078
|
+
"hash": "B2 E7 09 05 00 87 89 8F 77 C8 88 37 86 85 97 89 6F 68 F1 16 15"
|
|
1079
|
+
},
|
|
1080
|
+
{
|
|
1081
|
+
"id": "file_stu942",
|
|
1082
|
+
"name": "image 54.jpg",
|
|
1083
|
+
"type": "file",
|
|
1084
|
+
"size": 2650000,
|
|
1085
|
+
"width": 683,
|
|
1086
|
+
"height": 1024,
|
|
1087
|
+
"modified": "2024-09-23T14:00:00Z",
|
|
1088
|
+
"url": "image/image 54.jpg",
|
|
1089
|
+
"thumbnail": "thumbnail/image 54.jpg",
|
|
1090
|
+
"hash": "A3 86 05 2D 0A 0C 99 BD 7B D7 86 88 78 7A 76 97 08 97 89 90 89"
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
"id": "file_stu943",
|
|
1094
|
+
"name": "image 55.jpg",
|
|
1095
|
+
"type": "file",
|
|
1096
|
+
"size": 2700000,
|
|
1097
|
+
"width": 819,
|
|
1098
|
+
"height": 1024,
|
|
1099
|
+
"modified": "2024-09-24T09:15:00Z",
|
|
1100
|
+
"url": "image/image 55.jpg",
|
|
1101
|
+
"thumbnail": "thumbnail/image 55.jpg",
|
|
1102
|
+
"hash": "20 B9 05 0E 00 7F 86 C8 95 87 E7 74 79 B4 86 77 89 77 6F 5B 5F 49 F7"
|
|
1103
|
+
},
|
|
1104
|
+
{
|
|
1105
|
+
"id": "file_stu944",
|
|
1106
|
+
"name": "image 56.jpg",
|
|
1107
|
+
"type": "file",
|
|
1108
|
+
"size": 2850000,
|
|
1109
|
+
"width": 819,
|
|
1110
|
+
"height": 1024,
|
|
1111
|
+
"modified": "2024-09-24T12:30:00Z",
|
|
1112
|
+
"url": "image/image 56.jpg",
|
|
1113
|
+
"thumbnail": "thumbnail/image 56.jpg",
|
|
1114
|
+
"hash": "15 08 1A 0E 00 A0 69 98 76 78 87 77 87 79 78 96 87 77 80 87 16 30 48"
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
"id": "file_stu945",
|
|
1118
|
+
"name": "image 57.jpg",
|
|
1119
|
+
"type": "file",
|
|
1120
|
+
"size": 2950000,
|
|
1121
|
+
"width": 1024,
|
|
1122
|
+
"height": 768,
|
|
1123
|
+
"modified": "2024-09-24T15:45:00Z",
|
|
1124
|
+
"url": "image/image 57.jpg",
|
|
1125
|
+
"thumbnail": "thumbnail/image 57.jpg",
|
|
1126
|
+
"hash": "95 18 06 0D 82 45 A5 96 4C 96 98 90 89 87 87 87 81 36 00 66 02"
|
|
1127
|
+
},
|
|
1128
|
+
{
|
|
1129
|
+
"id": "file_stu946",
|
|
1130
|
+
"name": "image 58.jpg",
|
|
1131
|
+
"type": "file",
|
|
1132
|
+
"size": 2600000,
|
|
1133
|
+
"width": 683,
|
|
1134
|
+
"height": 1024,
|
|
1135
|
+
"modified": "2024-09-25T08:00:00Z",
|
|
1136
|
+
"url": "image/image 58.jpg",
|
|
1137
|
+
"thumbnail": "thumbnail/image 58.jpg",
|
|
1138
|
+
"hash": "1A F8 0D 0D 00 2A 65 8F 75 98 76 88 77 77 87 67 B4 6F 97 F0 9A"
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
"id": "file_stu947",
|
|
1142
|
+
"name": "image 59.jpg",
|
|
1143
|
+
"type": "file",
|
|
1144
|
+
"size": 2750000,
|
|
1145
|
+
"width": 1024,
|
|
1146
|
+
"height": 683,
|
|
1147
|
+
"modified": "2024-09-25T11:15:00Z",
|
|
1148
|
+
"url": "image/image 59.jpg",
|
|
1149
|
+
"thumbnail": "thumbnail/image 59.jpg",
|
|
1150
|
+
"hash": "1A 18 0E 15 82 7A 78 78 AF 78 87 8B 88 87 67 76 48 90 63 03 4A"
|
|
1151
|
+
},
|
|
1152
|
+
{
|
|
1153
|
+
"id": "file_stu948",
|
|
1154
|
+
"name": "image 60.jpg",
|
|
1155
|
+
"type": "file",
|
|
1156
|
+
"size": 2800000,
|
|
1157
|
+
"width": 683,
|
|
1158
|
+
"height": 1024,
|
|
1159
|
+
"modified": "2024-09-25T14:30:00Z",
|
|
1160
|
+
"url": "image/image 60.jpg",
|
|
1161
|
+
"thumbnail": "thumbnail/image 60.jpg",
|
|
1162
|
+
"hash": "4F 08 06 0D 00 80 77 95 85 38 86 88 7A 68 47 98 80 99 10 88 0A"
|
|
1163
|
+
},
|
|
1164
|
+
{
|
|
1165
|
+
"id": "file_stu949",
|
|
1166
|
+
"name": "image 61.jpg",
|
|
1167
|
+
"type": "file",
|
|
1168
|
+
"size": 2900000,
|
|
1169
|
+
"width": 1024,
|
|
1170
|
+
"height": 683,
|
|
1171
|
+
"modified": "2024-09-26T09:45:00Z",
|
|
1172
|
+
"url": "image/image 61.jpg",
|
|
1173
|
+
"thumbnail": "thumbnail/image 61.jpg",
|
|
1174
|
+
"hash": "33 08 0A 05 80 F6 29 A6 8C 77 88 78 74 9B 88 77 DA 65 9F 8F E6"
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
"id": "file_stu950",
|
|
1178
|
+
"name": "image 62.jpg",
|
|
1179
|
+
"type": "file",
|
|
1180
|
+
"size": 2650000,
|
|
1181
|
+
"width": 679,
|
|
1182
|
+
"height": 1024,
|
|
1183
|
+
"modified": "2024-09-26T12:00:00Z",
|
|
1184
|
+
"url": "image/image 62.jpg",
|
|
1185
|
+
"thumbnail": "thumbnail/image 62.jpg",
|
|
1186
|
+
"hash": "96 08 12 15 02 66 69 7F 77 78 77 A7 76 89 77 78 67 8E 50 C3 08"
|
|
1187
|
+
},
|
|
1188
|
+
{
|
|
1189
|
+
"id": "file_stu951",
|
|
1190
|
+
"name": "image 63.jpg",
|
|
1191
|
+
"type": "file",
|
|
1192
|
+
"size": 2700000,
|
|
1193
|
+
"width": 910,
|
|
1194
|
+
"height": 1024,
|
|
1195
|
+
"modified": "2024-09-26T15:15:00Z",
|
|
1196
|
+
"url": "image/image 63.jpg",
|
|
1197
|
+
"thumbnail": "thumbnail/image 63.jpg",
|
|
1198
|
+
"hash": "48 49 06 16 02 31 6A 47 66 79 88 87 78 A0 78 94 69 49 20 63 06 01 56"
|
|
1199
|
+
},
|
|
1200
|
+
{
|
|
1201
|
+
"id": "file_stu952",
|
|
1202
|
+
"name": "image 64.jpg",
|
|
1203
|
+
"type": "file",
|
|
1204
|
+
"size": 2850000,
|
|
1205
|
+
"width": 766,
|
|
1206
|
+
"height": 1024,
|
|
1207
|
+
"modified": "2024-09-26T17:30:00Z",
|
|
1208
|
+
"url": "image/image 64.jpg",
|
|
1209
|
+
"thumbnail": "thumbnail/image 64.jpg",
|
|
1210
|
+
"hash": "26 08 1A 1D 08 78 78 8F 78 68 77 68 87 88 87 78 66 90 78 06 88"
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
"id": "file_stu953",
|
|
1214
|
+
"name": "image 65.jpg",
|
|
1215
|
+
"type": "file",
|
|
1216
|
+
"size": 2950000,
|
|
1217
|
+
"width": 768,
|
|
1218
|
+
"height": 1024,
|
|
1219
|
+
"modified": "2024-09-26T19:45:00Z",
|
|
1220
|
+
"url": "image/image 65.jpg",
|
|
1221
|
+
"thumbnail": "thumbnail/image 65.jpg",
|
|
1222
|
+
"hash": "53 49 0A 1D 06 49 74 70 78 08 86 68 87 89 C9 79 85 80 58 08 88"
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
"id": "file_stu954",
|
|
1226
|
+
"name": "image 66.jpg",
|
|
1227
|
+
"type": "file",
|
|
1228
|
+
"size": 2600000,
|
|
1229
|
+
"width": 683,
|
|
1230
|
+
"height": 1024,
|
|
1231
|
+
"modified": "2024-09-26T21:00:00Z",
|
|
1232
|
+
"url": "image/image 66.jpg",
|
|
1233
|
+
"thumbnail": "thumbnail/image 66.jpg",
|
|
1234
|
+
"hash": "68 08 16 0D 02 76 77 8F 78 88 77 58 88 87 A8 77 98 70 65 08 78"
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
"id": "file_stu955",
|
|
1238
|
+
"name": "image 67.jpg",
|
|
1239
|
+
"type": "file",
|
|
1240
|
+
"size": 2750000,
|
|
1241
|
+
"width": 1024,
|
|
1242
|
+
"height": 778,
|
|
1243
|
+
"modified": "2024-09-26T22:15:00Z",
|
|
1244
|
+
"url": "image/image 67.jpg",
|
|
1245
|
+
"thumbnail": "thumbnail/image 67.jpg",
|
|
1246
|
+
"hash": "E2 28 06 0D 80 0A 94 76 7D A8 97 63 8B A5 56 C2 62 0A 4E B2 D0"
|
|
1247
|
+
},
|
|
1248
|
+
{
|
|
1249
|
+
"id": "file_stu956",
|
|
1250
|
+
"name": "image 68.jpg",
|
|
1251
|
+
"type": "file",
|
|
1252
|
+
"size": 2800000,
|
|
1253
|
+
"width": 683,
|
|
1254
|
+
"height": 1024,
|
|
1255
|
+
"modified": "2024-09-26T23:30:00Z",
|
|
1256
|
+
"url": "image/image 68.jpg",
|
|
1257
|
+
"thumbnail": "thumbnail/image 68.jpg",
|
|
1258
|
+
"hash": "A3 18 0E 0D 02 7F 57 AD 85 98 77 89 88 87 78 68 4A 98 90 83 08"
|
|
1259
|
+
}
|
|
1260
|
+
]
|
|
1261
|
+
},
|
|
1262
|
+
{
|
|
1263
|
+
"id": "file_stu95d7",
|
|
1264
|
+
"name": "Project Assets",
|
|
1265
|
+
"type": "folder",
|
|
1266
|
+
"children": [
|
|
1267
|
+
{
|
|
1268
|
+
"id": "file_stu957",
|
|
1269
|
+
"name": "image 21.jpg",
|
|
1270
|
+
"type": "file",
|
|
1271
|
+
"size": 3500000,
|
|
1272
|
+
"width": 683,
|
|
1273
|
+
"height": 1024,
|
|
1274
|
+
"modified": "2023-10-08T09:45:00Z",
|
|
1275
|
+
"url": "image/image 21.jpg",
|
|
1276
|
+
"thumbnail": "thumbnail/image 21.jpg",
|
|
1277
|
+
"hash": "5C D7 11 2D 08 86 77 7F 88 77 77 58 77 87 98 67 76 70 65 06 57"
|
|
1278
|
+
},
|
|
1279
|
+
{
|
|
1280
|
+
"id": "file_stu958",
|
|
1281
|
+
"name": "image 22.jpg",
|
|
1282
|
+
"type": "file",
|
|
1283
|
+
"size": 2900000,
|
|
1284
|
+
"width": 683,
|
|
1285
|
+
"height": 1024,
|
|
1286
|
+
"modified": "2023-10-08T10:15:00Z",
|
|
1287
|
+
"url": "image/image 22.jpg",
|
|
1288
|
+
"thumbnail": "thumbnail/image 22.jpg",
|
|
1289
|
+
"hash": "1C F8 0D 15 02 88 77 6F 78 E8 77 48 87 86 58 78 88 60 85 06 46"
|
|
1290
|
+
},
|
|
1291
|
+
{
|
|
1292
|
+
"id": "file_stu959",
|
|
1293
|
+
"name": "image 23.jpg",
|
|
1294
|
+
"type": "file",
|
|
1295
|
+
"size": 3100000,
|
|
1296
|
+
"width": 683,
|
|
1297
|
+
"height": 1024,
|
|
1298
|
+
"modified": "2023-10-08T11:00:00Z",
|
|
1299
|
+
"url": "image/image 23.jpg",
|
|
1300
|
+
"thumbnail": "thumbnail/image 23.jpg",
|
|
1301
|
+
"hash": "D1 E7 09 15 02 47 77 80 78 48 97 B8 88 75 88 88 65 80 65 06 98"
|
|
1302
|
+
}
|
|
1303
|
+
]
|
|
1304
|
+
},
|
|
1305
|
+
{
|
|
1306
|
+
"id": "file_stu95e",
|
|
1307
|
+
"name": "Archived Content",
|
|
1308
|
+
"type": "folder",
|
|
1309
|
+
"children": [
|
|
1310
|
+
{
|
|
1311
|
+
"id": "file_stu960",
|
|
1312
|
+
"name": "image 24.jpg",
|
|
1313
|
+
"type": "file",
|
|
1314
|
+
"size": 2800000,
|
|
1315
|
+
"width": 819,
|
|
1316
|
+
"height": 1024,
|
|
1317
|
+
"modified": "2023-10-09T14:30:00Z",
|
|
1318
|
+
"url": "image/image 24.jpg",
|
|
1319
|
+
"thumbnail": "thumbnail/image 24.jpg",
|
|
1320
|
+
"hash": "10 08 0E 0E 02 89 67 09 85 97 B7 88 78 76 77 78 77 88 09 84 86 20 77"
|
|
1321
|
+
},
|
|
1322
|
+
{
|
|
1323
|
+
"id": "file_stu961",
|
|
1324
|
+
"name": "image 25.jpg",
|
|
1325
|
+
"type": "file",
|
|
1326
|
+
"size": 3300000,
|
|
1327
|
+
"width": 1024,
|
|
1328
|
+
"height": 683,
|
|
1329
|
+
"modified": "2023-10-09T15:45:00Z",
|
|
1330
|
+
"url": "image/image 25.jpg",
|
|
1331
|
+
"thumbnail": "thumbnail/image 25.jpg",
|
|
1332
|
+
"hash": "DB B6 19 1D 86 86 78 77 7F 87 77 8A 77 87 87 77 8F 3C FA D8 C4"
|
|
1333
|
+
}
|
|
1334
|
+
]
|
|
1335
|
+
},
|
|
1336
|
+
{
|
|
1337
|
+
"id": "file_stu962",
|
|
1338
|
+
"name": "image 26.jpg",
|
|
1339
|
+
"type": "file",
|
|
1340
|
+
"size": 3400000,
|
|
1341
|
+
"width": 768,
|
|
1342
|
+
"height": 1024,
|
|
1343
|
+
"modified": "2023-10-10T09:00:00Z",
|
|
1344
|
+
"url": "image/image 26.jpg",
|
|
1345
|
+
"thumbnail": "thumbnail/image 26.jpg",
|
|
1346
|
+
"hash": "AA 18 06 0D 02 F3 B9 AC 74 D7 67 88 86 4B 57 76 07 77 82 90 16"
|
|
1347
|
+
},
|
|
1348
|
+
{
|
|
1349
|
+
"id": "file_stu963",
|
|
1350
|
+
"name": "image 27.jpg",
|
|
1351
|
+
"type": "file",
|
|
1352
|
+
"size": 2950000,
|
|
1353
|
+
"width": 1024,
|
|
1354
|
+
"height": 683,
|
|
1355
|
+
"modified": "2023-10-10T10:30:00Z",
|
|
1356
|
+
"url": "image/image 27.jpg",
|
|
1357
|
+
"thumbnail": "thumbnail/image 27.jpg",
|
|
1358
|
+
"hash": "F4 F7 05 05 80 F5 1A C7 7E 76 89 83 83 8C A6 86 05 71 7A 12 F7"
|
|
1359
|
+
},
|
|
1360
|
+
{
|
|
1361
|
+
"id": "file_stu964",
|
|
1362
|
+
"name": "image 28.jpg",
|
|
1363
|
+
"type": "file",
|
|
1364
|
+
"size": 3150000,
|
|
1365
|
+
"width": 1024,
|
|
1366
|
+
"height": 683,
|
|
1367
|
+
"modified": "2024-09-27T11:45:00Z",
|
|
1368
|
+
"url": "image/image 28.jpg",
|
|
1369
|
+
"thumbnail": "thumbnail/image 28.jpg",
|
|
1370
|
+
"hash": "55 38 06 15 86 72 96 58 9F 56 A5 49 B7 C6 46 94 FA 9B BC AF C9"
|
|
1371
|
+
},
|
|
1372
|
+
{
|
|
1373
|
+
"id": "file_stu364",
|
|
1374
|
+
"name": "image 28.jpg",
|
|
1375
|
+
"type": "file",
|
|
1376
|
+
"size": 3150000,
|
|
1377
|
+
"width": 1024,
|
|
1378
|
+
"height": 683,
|
|
1379
|
+
"modified": "2024-09-27T11:45:00Z",
|
|
1380
|
+
"url": "image/image 28.jpg",
|
|
1381
|
+
"thumbnail": "thumbnail/image 28.jpg",
|
|
1382
|
+
"hash": "55 38 06 15 86 72 96 58 9F 56 A5 49 B7 C6 46 94 FA 9B BC AF C9"
|
|
1383
|
+
}
|
|
1384
|
+
]
|
|
1385
|
+
}
|
|
1386
|
+
};
|
|
1387
|
+
|
|
1388
|
+
// Initialize instance-specific navigation store
|
|
1389
|
+
const navigationStore = getNavigationStore(instanceId);
|
|
1390
|
+
const navPathStore = createCurrentPathStore(navigationStore);
|
|
1391
|
+
const canGoBackStore = createCanGoBackStore(navigationStore);
|
|
1392
|
+
const canGoForwardStore = createCanGoForwardStore(navigationStore);
|
|
1393
|
+
|
|
1394
|
+
// Current path
|
|
1395
|
+
let currentPath: string[] = []; // Current directory path
|
|
1396
|
+
let currentPathNames: string[] = []; // Names corresponding to currentPath IDs
|
|
1397
|
+
let currentFolderContent: FileSystemItem; // Content of current folder
|
|
1398
|
+
|
|
1399
|
+
// Initialize filter with a function to check localStorage first
|
|
1400
|
+
let filter: FileFilterType = (() => {
|
|
1401
|
+
if (persistHistory) {
|
|
1402
|
+
try {
|
|
1403
|
+
if (isBrowser) {
|
|
1404
|
+
const storedFilter = getFromStorage(FILTER_STORAGE_KEY(instanceId), null);
|
|
1405
|
+
if (storedFilter) {
|
|
1406
|
+
// Validate that the stored filter is a valid FileFilterType
|
|
1407
|
+
const isValidFilter = FILTER_OPTIONS.some(option => option === storedFilter);
|
|
1408
|
+
if (isValidFilter) {
|
|
1409
|
+
if(showLogs && showFiltersLogs) console.log('Initializing with stored filter preference:', storedFilter);
|
|
1410
|
+
return storedFilter as FileFilterType;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
} catch (error) {
|
|
1415
|
+
if(showLogs) console.error('Error retrieving stored filter preference during initialization:', error);
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
if(showLogs && showFiltersLogs) console.log('Initializing with default filter:', initialFilter);
|
|
1419
|
+
return initialFilter;
|
|
1420
|
+
})();
|
|
1421
|
+
|
|
1422
|
+
let isLoading = true; // Loading state indicator
|
|
1423
|
+
let filteredFiles: FileSystemItem[] = []; // Files filtered by type
|
|
1424
|
+
let sortedFilteredFiles: FileSystemItem[] = []; // Final sorted and filtered files
|
|
1425
|
+
let isEmpty = false; // Empty folder indicator
|
|
1426
|
+
let allowedUploadTypes: string[] = []; // Allowed file extensions for upload
|
|
1427
|
+
let recentFiles: FileSystemItem[] = []; // Recently modified files
|
|
1428
|
+
let previewFile: FileSystemItem | null = null; // Currently previewed file
|
|
1429
|
+
|
|
1430
|
+
let dragCounter = 0; // Track drag enter/leave events
|
|
1431
|
+
let mainContainerWidth = 0;
|
|
1432
|
+
let columnWidth = 40;
|
|
1433
|
+
let columns = 12;
|
|
1434
|
+
// Subscribe to folder counts
|
|
1435
|
+
let counts: Map<string, number> = new Map();
|
|
1436
|
+
folderCounts.subscribe((value: Map<string, number>) => {
|
|
1437
|
+
counts = value;
|
|
1438
|
+
});
|
|
1439
|
+
|
|
1440
|
+
// Add these variables near the top with other state variables
|
|
1441
|
+
let itemToMove: FileSystemItem | null = null;
|
|
1442
|
+
let folderStructure: FileSystemItem[] = [];
|
|
1443
|
+
|
|
1444
|
+
// Add a reference to the scroll container(parent of the VirtualList)
|
|
1445
|
+
let scrollContainer: HTMLElement | null = null;
|
|
1446
|
+
|
|
1447
|
+
// Add a reference to the content container(VirtualList)
|
|
1448
|
+
let contentContainer: HTMLElement | null = null;
|
|
1449
|
+
|
|
1450
|
+
// Add near other state variables
|
|
1451
|
+
let previewSource: 'main' | 'recent' = 'main';
|
|
1452
|
+
|
|
1453
|
+
// Add near other state variables
|
|
1454
|
+
let tabletBreakpoint = 744; // Default value
|
|
1455
|
+
let mobileBreakpoint = 393; // Default value
|
|
1456
|
+
let desktopBreakpoint = 1156; // Default value
|
|
1457
|
+
|
|
1458
|
+
// Add near other state variables
|
|
1459
|
+
let numberOfRecentFiles = 10;
|
|
1460
|
+
|
|
1461
|
+
// Add to script section at the top with other variables
|
|
1462
|
+
let mainContainer: HTMLElement;
|
|
1463
|
+
|
|
1464
|
+
// Add near the top with other state variables
|
|
1465
|
+
let isMobile = false;
|
|
1466
|
+
let isTablet = false;
|
|
1467
|
+
let sourceItems: FileSystemItem[] = [];
|
|
1468
|
+
|
|
1469
|
+
/**
|
|
1470
|
+
* REACTIVE STATEMENTS
|
|
1471
|
+
*/
|
|
1472
|
+
// Update skeletonCount to show 5 rows of 3 columns
|
|
1473
|
+
$: skeletonCount = 18; // 3 columns * 6 rows
|
|
1474
|
+
|
|
1475
|
+
|
|
1476
|
+
/**
|
|
1477
|
+
* Sets allowed file types based on current filter
|
|
1478
|
+
* Updates upload restrictions when filter changes
|
|
1479
|
+
* @param currentFilter Current file type filter
|
|
1480
|
+
*/
|
|
1481
|
+
function setAllowedUploadTypes(currentFilter: FileFilterType) {
|
|
1482
|
+
if (currentFilter === 'all') {
|
|
1483
|
+
allowedUploadTypes = getAllowedFileTypes('all');
|
|
1484
|
+
} else {
|
|
1485
|
+
allowedUploadTypes = FILE_TYPES[currentFilter];
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
// Reactive statement for upload type restrictions
|
|
1490
|
+
$: {
|
|
1491
|
+
if (restrictUpload) {
|
|
1492
|
+
setAllowedUploadTypes(filter);
|
|
1493
|
+
} else {
|
|
1494
|
+
allowedUploadTypes = getAllowedFileTypes('all');
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
// REACTIVE STATEMENTS for DEBUG GRID
|
|
1499
|
+
// $: if(showLogs) console.log('FileBrowser: Grid columnWidth', columnWidth);
|
|
1500
|
+
// $: if(showLogs) console.log('FileBrowser: Grid columns', columns);
|
|
1501
|
+
|
|
1502
|
+
// Modal visibility states
|
|
1503
|
+
let showModal = false; // Selected files modal
|
|
1504
|
+
let showSearchModal = false; // Search interface
|
|
1505
|
+
let showRenameDialog = false; // Rename dialog
|
|
1506
|
+
let showMoveDialog = false; // Move file/folder dialog
|
|
1507
|
+
let showDeleteConfirmation = false; // Delete confirmation
|
|
1508
|
+
let showNewFolderDialog = false; // New folder creation
|
|
1509
|
+
let selectedItem: FileSystemItem | null = null; // Item for modal operations
|
|
1510
|
+
|
|
1511
|
+
// UI state calculations
|
|
1512
|
+
// let controlsVisible: boolean;
|
|
1513
|
+
// $: controlsVisible = showFilters || showSorting;
|
|
1514
|
+
// console.log("File Browser component: controlsVisible", showFilters, showSorting, controlsVisible);
|
|
1515
|
+
|
|
1516
|
+
/**
|
|
1517
|
+
* LIFE CYCLE HOOKS
|
|
1518
|
+
*/
|
|
1519
|
+
onMount(async () => {
|
|
1520
|
+
if(showLogs) console.log('FileBrowser onMount instanceId: ', instanceId);
|
|
1521
|
+
// if(showLogs) console.log('FileBrowser onMount start:', performance.now() - startTime, 'ms');
|
|
1522
|
+
|
|
1523
|
+
if (enableLocalCache) {
|
|
1524
|
+
const existing = getFileBrowserUploadConfig();
|
|
1525
|
+
if (existing?.accessToken) {
|
|
1526
|
+
setFileBrowserUploadConfig({ ...existing, enableLocalCache: true });
|
|
1527
|
+
} else {
|
|
1528
|
+
try {
|
|
1529
|
+
const sessionStr = typeof localStorage !== 'undefined' ? localStorage.getItem('session') : null;
|
|
1530
|
+
if (sessionStr) {
|
|
1531
|
+
const session = JSON.parse(sessionStr);
|
|
1532
|
+
const token = session?.accessToken || session?.access_token;
|
|
1533
|
+
if (token) {
|
|
1534
|
+
// Scope Dexie only — do not invent an empty apiBasePath upload config.
|
|
1535
|
+
const { setCacheOwner } = await import('@widgetic/cache-layer');
|
|
1536
|
+
const payloadPart = token.split('.')[1];
|
|
1537
|
+
if (payloadPart) {
|
|
1538
|
+
const normalized = payloadPart.replace(/-/g, '+').replace(/_/g, '/');
|
|
1539
|
+
const payload = JSON.parse(atob(normalized)) as { sub?: string; userId?: string };
|
|
1540
|
+
const ownerId = payload.sub || payload.userId;
|
|
1541
|
+
if (ownerId) setCacheOwner(ownerId);
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
} catch (cacheErr) {
|
|
1546
|
+
console.warn('[FileBrowser] enableLocalCache session scope failed:', cacheErr);
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
// load demo content from localStorage if no data is passed
|
|
1552
|
+
// if(showLogs) console.log('FileBrowser onMount data & useDemoContent: ', data, useDemoContent);
|
|
1553
|
+
if (!data) {
|
|
1554
|
+
const uploadConfig = getFileBrowserUploadConfig();
|
|
1555
|
+
const widgeticLibraryMode = Boolean(
|
|
1556
|
+
uploadConfig?.accessToken && uploadConfig?.apiBasePath,
|
|
1557
|
+
);
|
|
1558
|
+
|
|
1559
|
+
if (widgeticLibraryMode || !useDemoContent) {
|
|
1560
|
+
let files = await loadUserUploads();
|
|
1561
|
+
if (uploadConfig?.accessToken && uploadConfig?.apiBasePath) {
|
|
1562
|
+
try {
|
|
1563
|
+
const remoteFiles = await fetchUserUploadsFromApi(uploadConfig, { limit: 100 });
|
|
1564
|
+
const byId = new Map(files.map((file) => [file.id, file]));
|
|
1565
|
+
for (const remoteFile of remoteFiles) {
|
|
1566
|
+
byId.set(remoteFile.id, remoteFile);
|
|
1567
|
+
saveUserUpload(remoteFile);
|
|
1568
|
+
}
|
|
1569
|
+
files = Array.from(byId.values());
|
|
1570
|
+
if (showLogs) {
|
|
1571
|
+
console.log('[FileBrowser] Hydrated uploads from API:', remoteFiles.length);
|
|
1572
|
+
}
|
|
1573
|
+
} catch (hydrateError) {
|
|
1574
|
+
console.warn('[FileBrowser] Upload hydration failed, using local cache:', hydrateError);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
data = await createUserUploadsFileSystemRoot(files);
|
|
1578
|
+
basePath = '';
|
|
1579
|
+
if (showLogs) {
|
|
1580
|
+
console.log('[FileBrowser] Widgetic library mode — user uploads only');
|
|
1581
|
+
}
|
|
1582
|
+
} else if (useDemoContent) {
|
|
1583
|
+
data = demoContent;
|
|
1584
|
+
if (!basePath.startsWith('http') && !dev) {
|
|
1585
|
+
basePath = `/node_modules/@widgetic/file-browser/dist/static${basePath}`;
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
// GET BREAKPOINTS from CSS variables to set breakpoints
|
|
1591
|
+
const element = document.querySelector('.widgetic-breakpoints');
|
|
1592
|
+
if (element) {
|
|
1593
|
+
const styles = getComputedStyle(element);
|
|
1594
|
+
|
|
1595
|
+
const value = styles.getPropertyValue('--breakpoint-tablet').trim();
|
|
1596
|
+
tabletBreakpoint = parseInt(value) || 744;
|
|
1597
|
+
|
|
1598
|
+
const mobileValue = styles.getPropertyValue('--breakpoint-mobile').trim();
|
|
1599
|
+
mobileBreakpoint = parseInt(mobileValue) || 393;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
// check if browser environment is available
|
|
1603
|
+
if (!isBrowser) return;
|
|
1604
|
+
|
|
1605
|
+
// Remove the keydown event listener setup from here as we'll use Svelte's event handling
|
|
1606
|
+
isMobile = window.innerWidth <= mobileBreakpoint;
|
|
1607
|
+
isTablet = window.innerWidth <= tabletBreakpoint;
|
|
1608
|
+
|
|
1609
|
+
|
|
1610
|
+
// ADD EVENT LISTENERS
|
|
1611
|
+
// Add event listener for window resize
|
|
1612
|
+
window.addEventListener('resize', handleResize);
|
|
1613
|
+
|
|
1614
|
+
// Set up window key handler
|
|
1615
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
1616
|
+
|
|
1617
|
+
if (data) {
|
|
1618
|
+
isLoading = false;
|
|
1619
|
+
isVirtualListInitialized = true;
|
|
1620
|
+
}
|
|
1621
|
+
});
|
|
1622
|
+
|
|
1623
|
+
function init() {
|
|
1624
|
+
// RESTORE PREVIEW MODAL
|
|
1625
|
+
if ($modalState?.isOpen && $modalState?.modalType === 'filePreview' && $modalState?.data) {
|
|
1626
|
+
previewFile = $modalState.data.file;
|
|
1627
|
+
previewSource = 'main';
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
// LOAD DATA
|
|
1631
|
+
// if(showLogs) console.log('FileBrowser: onMount data:', data);
|
|
1632
|
+
// check if data is already loaded or got from props
|
|
1633
|
+
if(data) {
|
|
1634
|
+
isLoading = false;
|
|
1635
|
+
isVirtualListInitialized = true;
|
|
1636
|
+
}
|
|
1637
|
+
// Fetch data from local mock API
|
|
1638
|
+
// else { isLoading = true; data = await fetchFilesData(); isLoading = false; }
|
|
1639
|
+
|
|
1640
|
+
// console.log('FileBrowser: init:', basePath, data);
|
|
1641
|
+
|
|
1642
|
+
// PROCESS DATA
|
|
1643
|
+
if(data) {
|
|
1644
|
+
// set base path
|
|
1645
|
+
data.basePath = basePath;
|
|
1646
|
+
|
|
1647
|
+
// save as demo content if not already saved
|
|
1648
|
+
if(!getFromStorage(demoContentKey, null)) {
|
|
1649
|
+
// console.log('FileBrowser: saving demo content to localStorage:', data);
|
|
1650
|
+
saveToStorage(demoContentKey, data);
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
if(showLogs) console.log('FileBrowser: init data:', data);
|
|
1654
|
+
|
|
1655
|
+
// Deduplicate before setting in store
|
|
1656
|
+
const dedupedData = deduplicateFileSystemItems(data);
|
|
1657
|
+
|
|
1658
|
+
// set data in store
|
|
1659
|
+
fileStore.set(dedupedData);
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
|
|
1663
|
+
// SET SORT CRITERIA
|
|
1664
|
+
sortCriteria.set(initialSortCriteria);
|
|
1665
|
+
|
|
1666
|
+
|
|
1667
|
+
// RESTORE NAVIGATION PATH
|
|
1668
|
+
// Store the path we want to navigate to after loading
|
|
1669
|
+
let pathToNavigate: string[] = [];
|
|
1670
|
+
|
|
1671
|
+
// Check if we have a stored path to restore
|
|
1672
|
+
if (persistHistory) {
|
|
1673
|
+
const storedState = getStoredState(instanceId);
|
|
1674
|
+
if (storedState) {
|
|
1675
|
+
pathToNavigate = storedState.pathsArray[storedState.currentIndex] || [];
|
|
1676
|
+
if(showLogs) console.log('FileBrowser: init: Found stored path to restore after loading:', pathToNavigate);
|
|
1677
|
+
|
|
1678
|
+
// CRITICAL: If path is root, handle immediately and prevent overwrites
|
|
1679
|
+
if (pathToNavigate.length === 0) {
|
|
1680
|
+
navigationStore.reset();
|
|
1681
|
+
currentFolder.set([]);
|
|
1682
|
+
currentPath = [];
|
|
1683
|
+
return;
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
// We no longer need to restore the filter here since we initialize it with the stored value
|
|
1688
|
+
// The filter is now initialized in the variable declaration
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
// Handle navigation
|
|
1692
|
+
// Navigation state handling
|
|
1693
|
+
const navStartTime = performance.now();
|
|
1694
|
+
|
|
1695
|
+
// if there is no stored path, reset navigation to root
|
|
1696
|
+
if (!persistHistory || pathToNavigate.length === 0) {
|
|
1697
|
+
// if(showLogs) console.log('FileBrowser onMount: No valid stored path, resetting navigation to root');
|
|
1698
|
+
navigationStore.reset();
|
|
1699
|
+
currentFolder.set([]);
|
|
1700
|
+
currentPath = [];
|
|
1701
|
+
}
|
|
1702
|
+
// if there is a stored path, navigate to it
|
|
1703
|
+
else {
|
|
1704
|
+
// if(showLogs) console.log('FileBrowser onMount: Navigating to stored path:', pathToNavigate);
|
|
1705
|
+
|
|
1706
|
+
// Force navigation to the stored path
|
|
1707
|
+
navigationStore.navigateToFolder(pathToNavigate, true);
|
|
1708
|
+
currentFolder.set(pathToNavigate);
|
|
1709
|
+
currentPath = pathToNavigate;
|
|
1710
|
+
// if(showLogs) console.log('Successfully navigated to stored path:', pathToNavigate);
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
// if(showLogs) console.log('Navigation handling complete:', performance.now() - navStartTime, 'ms');
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
// onDestroy: cleanup event listener on component destroy
|
|
1717
|
+
onDestroy(() => {
|
|
1718
|
+
|
|
1719
|
+
// check if browser environment is available
|
|
1720
|
+
if (!isBrowser) return;
|
|
1721
|
+
|
|
1722
|
+
// console.log('FileBrowser onDestroy: ', window);
|
|
1723
|
+
|
|
1724
|
+
// REMOVE EVENT LISTENERS
|
|
1725
|
+
window.removeEventListener('resize', handleResize);
|
|
1726
|
+
window.removeEventListener('keydown', handleKeyDown);
|
|
1727
|
+
});
|
|
1728
|
+
|
|
1729
|
+
// Add logging to key reactive statements
|
|
1730
|
+
$: {
|
|
1731
|
+
if ($fileStore?.root) {
|
|
1732
|
+
const updateStart = performance.now();
|
|
1733
|
+
updateFolderCounts($fileStore.root, filter);
|
|
1734
|
+
// if(showLogs) console.log('Folder counts update time:', performance.now() - updateStart, 'ms');
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
$: {
|
|
1739
|
+
if (currentFolderContent?.children) {
|
|
1740
|
+
const filterStart = performance.now();
|
|
1741
|
+
filteredFiles = currentFolderContent.children?.filter((item: FileSystemItem) => {
|
|
1742
|
+
if (item.type === 'folder') {
|
|
1743
|
+
return true;
|
|
1744
|
+
}
|
|
1745
|
+
return fileMatchesFilter(item);
|
|
1746
|
+
}) ?? [];
|
|
1747
|
+
// if(showLogs) console.log('File filtering time:', performance.now() - filterStart, 'ms');
|
|
1748
|
+
|
|
1749
|
+
const sortStart = performance.now();
|
|
1750
|
+
sortedFilteredFiles = sortFiles(filteredFiles);
|
|
1751
|
+
// if(showLogs) console.log('File sorting time:', performance.now() - sortStart, 'ms');
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
// Reactive statement to re-sort when sort criteria or direction changes
|
|
1756
|
+
$: if (filteredFiles.length > 0 && ($sortCriteria || $sortDirection)) {
|
|
1757
|
+
sortedFilteredFiles = sortFiles(filteredFiles);
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
/**
|
|
1761
|
+
* Search and Navigation Functions
|
|
1762
|
+
* These functions handle user interactions with search and folder navigation
|
|
1763
|
+
*/
|
|
1764
|
+
|
|
1765
|
+
/**
|
|
1766
|
+
* Opens the search modal for file/folder search
|
|
1767
|
+
*/
|
|
1768
|
+
function handleSearch() {
|
|
1769
|
+
if (!showModal) { // Don't show if selected files modal is open
|
|
1770
|
+
showSearchModal = true;
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
/**
|
|
1775
|
+
* Closes the search modal and resets search state
|
|
1776
|
+
*/
|
|
1777
|
+
function handleSearchClose() {
|
|
1778
|
+
showSearchModal = false;
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
/**
|
|
1782
|
+
* Handles navigation from search results
|
|
1783
|
+
* Processes the path and updates current location
|
|
1784
|
+
* @param event CustomEvent containing the selected path
|
|
1785
|
+
*/
|
|
1786
|
+
function handleSearchNavigate(event: CustomEvent) {
|
|
1787
|
+
const path = event.detail.path;
|
|
1788
|
+
// if(showLogs) console.log('handleSearchNavigate received path:', path);
|
|
1789
|
+
|
|
1790
|
+
if (!path || !Array.isArray(path)) {
|
|
1791
|
+
// console.error('Invalid path received:', path);
|
|
1792
|
+
return;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
// Remove 'Root' from the beginning of the path if it exists
|
|
1796
|
+
const newPath = path.length > 0 && path[0].toLowerCase() === 'root'
|
|
1797
|
+
? path.slice(1)
|
|
1798
|
+
: path;
|
|
1799
|
+
|
|
1800
|
+
// if(showLogs) console.log('Processing path:', newPath);
|
|
1801
|
+
// if(showLogs) console.log('Search Navigation Details:', {
|
|
1802
|
+
// from: currentPath,
|
|
1803
|
+
// to: newPath,
|
|
1804
|
+
// fromSearch: true
|
|
1805
|
+
// });
|
|
1806
|
+
|
|
1807
|
+
// Use navigation store to handle the path change
|
|
1808
|
+
navigationStore.navigateToFolder(newPath, true);
|
|
1809
|
+
currentFolder.set(newPath);
|
|
1810
|
+
currentPath = newPath;
|
|
1811
|
+
showSearchModal = false;
|
|
1812
|
+
|
|
1813
|
+
// If there's a preview item, handle it the same way for both search and selected files
|
|
1814
|
+
if (event.detail.preview) {
|
|
1815
|
+
// Wait for the folder content to update
|
|
1816
|
+
setTimeout(() => {
|
|
1817
|
+
const file = event.detail.preview;
|
|
1818
|
+
previewFile = file; // Open preview
|
|
1819
|
+
scrollItemIntoView(file.id); // Scroll into view
|
|
1820
|
+
}, 100);
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
/**
|
|
1825
|
+
* Folder Creation and Navigation Functions
|
|
1826
|
+
*/
|
|
1827
|
+
|
|
1828
|
+
/**
|
|
1829
|
+
* Opens the new folder creation dialog
|
|
1830
|
+
*/
|
|
1831
|
+
function handleNewFolderClick() {
|
|
1832
|
+
showNewFolderDialog = true;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
/**
|
|
1836
|
+
* Toggles sort direction between ascending and descending
|
|
1837
|
+
*/
|
|
1838
|
+
function toggleSortDirection() {
|
|
1839
|
+
$sortDirection = $sortDirection === 'asc' ? 'desc' : 'asc';
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
/**
|
|
1843
|
+
* Navigates to a subfolder
|
|
1844
|
+
* Updates path using folder ID instead of name
|
|
1845
|
+
* @param folder Folder to navigate to
|
|
1846
|
+
*/
|
|
1847
|
+
function navigateToFolder(folder: FileSystemItem) {
|
|
1848
|
+
// if(showLogs) console.log('Navigating to folder:', folder);
|
|
1849
|
+
const newPath = [...currentPath, folder.id];
|
|
1850
|
+
// if(showLogs) console.log('Navigation Details:', {
|
|
1851
|
+
// from: currentPath,
|
|
1852
|
+
// to: newPath,
|
|
1853
|
+
// folderId: folder.id
|
|
1854
|
+
// });
|
|
1855
|
+
navigationStore.navigateToFolder(newPath, true);
|
|
1856
|
+
currentFolder.set(newPath);
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
/**
|
|
1860
|
+
* Handles breadcrumb navigation
|
|
1861
|
+
* Updates path to selected breadcrumb level
|
|
1862
|
+
* @param event CustomEvent containing the breadcrumb index
|
|
1863
|
+
*/
|
|
1864
|
+
function navigateToBreadcrumb(event: CustomEvent<number>) {
|
|
1865
|
+
if ($isModalOpen) {
|
|
1866
|
+
if(showLogs) console.log('Modal is open, skipping navigation');
|
|
1867
|
+
return;
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
const newPath = currentPath.slice(0, event.detail + 1);
|
|
1871
|
+
if(showLogs) console.log('Breadcrumb Navigation Details:', {
|
|
1872
|
+
from: currentPath,
|
|
1873
|
+
to: newPath,
|
|
1874
|
+
breadcrumbIndex: event.detail
|
|
1875
|
+
});
|
|
1876
|
+
navigationStore.navigateToFolder(newPath, true);
|
|
1877
|
+
currentFolder.set(newPath);
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
/**
|
|
1881
|
+
* File Operations Section
|
|
1882
|
+
* Handles core file manipulation functionality
|
|
1883
|
+
*/
|
|
1884
|
+
|
|
1885
|
+
/**
|
|
1886
|
+
* Sorts files based on current criteria while maintaining folder priority
|
|
1887
|
+
* @param files Array of files to sort
|
|
1888
|
+
* @returns Sorted array of files with folders always first
|
|
1889
|
+
*/
|
|
1890
|
+
function sortFiles(files: FileSystemItem[]): FileSystemItem[] {
|
|
1891
|
+
return [...files].sort((a, b) => {
|
|
1892
|
+
// Always keep folders at the top
|
|
1893
|
+
if (a.type === 'folder' && b.type !== 'folder') return -1;
|
|
1894
|
+
if (a.type !== 'folder' && b.type === 'folder') return 1;
|
|
1895
|
+
|
|
1896
|
+
let comparison = 0;
|
|
1897
|
+
// Apply sort criteria based on current selection
|
|
1898
|
+
switch ($sortCriteria) {
|
|
1899
|
+
case 'name':
|
|
1900
|
+
comparison = a.name.localeCompare(b.name);
|
|
1901
|
+
break;
|
|
1902
|
+
case 'date':
|
|
1903
|
+
comparison = new Date(b.modified || 0).getTime() - new Date(a.modified || 0).getTime();
|
|
1904
|
+
break;
|
|
1905
|
+
case 'size':
|
|
1906
|
+
comparison = (b.size || 0) - (a.size || 0);
|
|
1907
|
+
break;
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
return $sortDirection === 'asc' ? comparison : -comparison;
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
/**
|
|
1915
|
+
* Checks if a file matches the current filter criteria
|
|
1916
|
+
* @param file File to check against current filter
|
|
1917
|
+
* @returns boolean indicating if file matches filter
|
|
1918
|
+
*/
|
|
1919
|
+
function fileMatchesFilter(file: FileSystemItem): boolean {
|
|
1920
|
+
if (filter === 'all') return true;
|
|
1921
|
+
return getFileType(file.url || file.name) === filter;
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
/**
|
|
1925
|
+
* Counts items (both files and folders) at the immediate level of a folder
|
|
1926
|
+
* Files must match the current filter, folders are always counted
|
|
1927
|
+
* @param folder Folder to count items in
|
|
1928
|
+
* @returns Number of matching files and all folders at immediate level
|
|
1929
|
+
*/
|
|
1930
|
+
function countMatchingFiles(folder: FileSystemItem): number {
|
|
1931
|
+
return folder.children?.reduce((count, item) => {
|
|
1932
|
+
if (isFileSystemItem(item)) {
|
|
1933
|
+
if (item.type === 'folder' || fileMatchesFilter(item)) {
|
|
1934
|
+
return count + 1;
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
return count;
|
|
1938
|
+
}, 0) ?? 0;
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
/**
|
|
1942
|
+
* Reactive Statements Section
|
|
1943
|
+
* Handles automatic updates of derived state
|
|
1944
|
+
*/
|
|
1945
|
+
|
|
1946
|
+
/**
|
|
1947
|
+
* Syncs current path with store updates
|
|
1948
|
+
* Ensures UI stays in sync with navigation state
|
|
1949
|
+
*/
|
|
1950
|
+
let isNavigating = false;
|
|
1951
|
+
|
|
1952
|
+
// Subscribe to navigation store changes
|
|
1953
|
+
$: {
|
|
1954
|
+
if ($navPathStore) {
|
|
1955
|
+
isNavigating = true;
|
|
1956
|
+
currentPath = $navPathStore;
|
|
1957
|
+
if (JSON.stringify($currentFolder) !== JSON.stringify($navPathStore)) {
|
|
1958
|
+
currentFolder.set($navPathStore);
|
|
1959
|
+
}
|
|
1960
|
+
// Reset the flag after the update
|
|
1961
|
+
setTimeout(() => {
|
|
1962
|
+
isNavigating = false;
|
|
1963
|
+
}, 0);
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
// Only update current path when folder changes
|
|
1968
|
+
$: {
|
|
1969
|
+
if ($currentFolder && !isNavigating) {
|
|
1970
|
+
currentPath = $currentFolder;
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
/**
|
|
1975
|
+
* Updates current folder content based on path changes
|
|
1976
|
+
* Traverses folder hierarchy to find current location using IDs
|
|
1977
|
+
*/
|
|
1978
|
+
$: {
|
|
1979
|
+
if ($sortedFiles?.root) {
|
|
1980
|
+
currentFolderContent = currentPath.reduce((folder: FileSystemItem, id: string) => {
|
|
1981
|
+
const foundFolder = folder?.children?.find(item => item.type === 'folder' && item.id === id);
|
|
1982
|
+
return foundFolder || folder;
|
|
1983
|
+
}, $sortedFiles.root);
|
|
1984
|
+
} else {
|
|
1985
|
+
currentFolderContent = $sortedFiles.root;
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
// Reset scroll position when folder content changes
|
|
1989
|
+
if (scrollContainer) {
|
|
1990
|
+
scrollContainer.scrollTop = 0;
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
/**
|
|
1995
|
+
* Filters current folder contents based on active filter
|
|
1996
|
+
* Folders are always included regardless of filter
|
|
1997
|
+
*/
|
|
1998
|
+
$: {
|
|
1999
|
+
if (filter && currentFolderContent?.children) {
|
|
2000
|
+
filteredFiles = currentFolderContent.children.filter((item: FileSystemItem) => {
|
|
2001
|
+
if (item.type === 'folder') {
|
|
2002
|
+
return true;
|
|
2003
|
+
}
|
|
2004
|
+
return fileMatchesFilter(item);
|
|
2005
|
+
});
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
/**
|
|
2010
|
+
* Updates final file list and empty state
|
|
2011
|
+
* Triggers recent files update when content changes
|
|
2012
|
+
*/
|
|
2013
|
+
$: {
|
|
2014
|
+
sortedFilteredFiles = sortFiles(filteredFiles);
|
|
2015
|
+
isEmpty = !isLoading && sortedFilteredFiles.length === 0;
|
|
2016
|
+
// Footer FileUploader requires this flag; empty folders never mount VirtualList.
|
|
2017
|
+
if (!isLoading && isEmpty && !isVirtualListInitialized) {
|
|
2018
|
+
isVirtualListInitialized = true;
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
function handleRecentFileClick(event: CustomEvent<FileSystemItem>) {
|
|
2023
|
+
const file = event.detail;
|
|
2024
|
+
previewFile = file;
|
|
2025
|
+
previewSource = 'recent';
|
|
2026
|
+
// No scrolling for recent files
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
function handleFolderClick(folder: FolderItemWithCount) {
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
$: allSelectedFiles = $fileStore?.root ? $validSelections(filter, getAllFiles($fileStore.root)) : [];
|
|
2033
|
+
$: currentSelections = $fileStore?.root ? $validSelections(filter, sortedFilteredFiles) : [];
|
|
2034
|
+
|
|
2035
|
+
function toggleFileSelection(file: FileSystemItem) {
|
|
2036
|
+
if (!allowSelecting) return;
|
|
2037
|
+
|
|
2038
|
+
const currentIds = persistentSelectStore.getSelected(filter);
|
|
2039
|
+
const isSelected = currentIds.includes(file.id);
|
|
2040
|
+
|
|
2041
|
+
if (!isSelected && maxSelections === 1) {
|
|
2042
|
+
persistentSelectStore.clearSelections(filter);
|
|
2043
|
+
persistentSelectStore.setSelections(filter, [file.id]);
|
|
2044
|
+
if (filter !== 'all') {
|
|
2045
|
+
persistentSelectStore.setSelections('all', [file.id]);
|
|
2046
|
+
}
|
|
2047
|
+
return;
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
if (!isSelected && maxSelections && currentIds.length >= maxSelections) {
|
|
2051
|
+
return;
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
persistentSelectStore.toggleSelection(file, filter);
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
/**
|
|
2058
|
+
* Opens file preview modal and scrolls to the file
|
|
2059
|
+
* @param file File to preview
|
|
2060
|
+
*/
|
|
2061
|
+
function handleFileClick(file: FileSystemItem) {
|
|
2062
|
+
previewFile = file;
|
|
2063
|
+
previewSource = 'main';
|
|
2064
|
+
// Wait for the preview modal to open before scrolling
|
|
2065
|
+
setTimeout(() => {
|
|
2066
|
+
scrollItemIntoView(file.id);
|
|
2067
|
+
}, 100);
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
/**
|
|
2071
|
+
* Handles file selection from UI
|
|
2072
|
+
* @param file File selected by user
|
|
2073
|
+
*/
|
|
2074
|
+
function handleFileSelect(file: FileSystemItem) {
|
|
2075
|
+
if (allowSelecting) {
|
|
2076
|
+
toggleFileSelection(file);
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
/**
|
|
2081
|
+
* Closes the file preview modal
|
|
2082
|
+
*/
|
|
2083
|
+
function closePreview() {
|
|
2084
|
+
if (previewFile) {
|
|
2085
|
+
// Only scroll and animate if preview was opened from main view
|
|
2086
|
+
if (previewSource === 'main') {
|
|
2087
|
+
scrollItemIntoView(previewFile.id, 'goodbye');
|
|
2088
|
+
}
|
|
2089
|
+
setTimeout(() => {
|
|
2090
|
+
previewFile = null;
|
|
2091
|
+
previewSource = 'main'; // Reset the source
|
|
2092
|
+
}, 200);
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
function sendToEditor() {
|
|
2097
|
+
const filesToSend = [...allSelectedFiles];
|
|
2098
|
+
dispatch('select', { files: filesToSend });
|
|
2099
|
+
persistentSelectStore.clearSelections(filter);
|
|
2100
|
+
selectedFiles.set([]);
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2103
|
+
/**
|
|
2104
|
+
* Recursively retrieves all files from folder structure
|
|
2105
|
+
* @param folder Folder to get files from
|
|
2106
|
+
* @returns Array of all files in folder and subfolders
|
|
2107
|
+
*/
|
|
2108
|
+
function getAllFiles(folder: FileSystemItem): FileSystemItem[] {
|
|
2109
|
+
let files: FileSystemItem[] = [];
|
|
2110
|
+
if (folder.children) {
|
|
2111
|
+
for (const item of folder.children) {
|
|
2112
|
+
if (item.type === 'file') {
|
|
2113
|
+
files.push(item);
|
|
2114
|
+
} else if (item.type === 'folder') {
|
|
2115
|
+
files = files.concat(getAllFiles(item));
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
return files;
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
/**
|
|
2123
|
+
* Gets the most recently modified files matching current filter
|
|
2124
|
+
* @returns Array of up to 3 most recent files
|
|
2125
|
+
*/
|
|
2126
|
+
function getRecentFiles(): FileSystemItem[] {
|
|
2127
|
+
if (!$fileStore.root) return [];
|
|
2128
|
+
|
|
2129
|
+
if(showLogs && showRecentFilesLogs) console.log('Getting recent files with filter:', filter);
|
|
2130
|
+
|
|
2131
|
+
// Get all files first
|
|
2132
|
+
const allFiles = getAllFiles($fileStore.root);
|
|
2133
|
+
if(showLogs && showRecentFilesLogs) console.log('Total files:', allFiles.length);
|
|
2134
|
+
|
|
2135
|
+
// Filter by type
|
|
2136
|
+
const typeFilteredFiles = allFiles.filter(file => {
|
|
2137
|
+
if (filter === 'all') return true;
|
|
2138
|
+
const fileType = getFileType(file.url || file.name);
|
|
2139
|
+
return fileType === filter;
|
|
2140
|
+
});
|
|
2141
|
+
if(showLogs && showRecentFilesLogs) console.log('Files after type filtering:', typeFilteredFiles.length);
|
|
2142
|
+
|
|
2143
|
+
// Sort by date and take first numberOfRecentFiles
|
|
2144
|
+
const result = typeFilteredFiles
|
|
2145
|
+
.sort((a, b) => new Date(b.modified || 0).getTime() - new Date(a.modified || 0).getTime())
|
|
2146
|
+
.slice(0, numberOfRecentFiles);
|
|
2147
|
+
|
|
2148
|
+
if(showLogs && showRecentFilesLogs) console.log('Final recent files:', result.length);
|
|
2149
|
+
return result;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
// Update reactive statement to trigger on filter changes
|
|
2153
|
+
$: {
|
|
2154
|
+
if (!isLoading && $fileStore.root && currentPath.length === 0) {
|
|
2155
|
+
if(showLogs && showRecentFilesLogs) console.log('Updating recent files due to filter change:', filter);
|
|
2156
|
+
recentFiles = getRecentFiles();
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
// Remove the duplicate reactive statement
|
|
2161
|
+
$: {
|
|
2162
|
+
if (!isLoading && $fileStore.root) {
|
|
2163
|
+
recentFiles = currentPath.length === 0 ? getRecentFiles() : [];
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
function getCorrectFileUrl(item: FileSystemItem): string {
|
|
2168
|
+
const storeBasePath = $fileStore?.basePath ?? basePath;
|
|
2169
|
+
return resolveFileItemUrl(item, storeBasePath);
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2172
|
+
/**
|
|
2173
|
+
* Type guard for FileSystemItem
|
|
2174
|
+
* Ensures safe type checking for file operations
|
|
2175
|
+
* @param item Item to check for FileSystemItem interface compliance
|
|
2176
|
+
*/
|
|
2177
|
+
function isFileSystemItem(item: any): item is FileSystemItem {
|
|
2178
|
+
return item && typeof item === 'object' && 'type' in item && 'name' in item;
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
// Track selected files count for UI updates
|
|
2182
|
+
$: selectedFilesCount = $selectedFiles.length;
|
|
2183
|
+
|
|
2184
|
+
function toggleModal() {
|
|
2185
|
+
if (!showSearchModal) { // Don't show if search modal is open
|
|
2186
|
+
showModal = !showModal;
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
/**
|
|
2191
|
+
* Processes file/folder operations from context menu
|
|
2192
|
+
* Routes actions to appropriate handlers
|
|
2193
|
+
* @param event CustomEvent containing action and item details
|
|
2194
|
+
*/
|
|
2195
|
+
function handleItemAction(event: CustomEvent) {
|
|
2196
|
+
console.log('handleItemAction', event);
|
|
2197
|
+
const { action, item } = event.detail;
|
|
2198
|
+
|
|
2199
|
+
if (isFileSystemItem(item)) {
|
|
2200
|
+
// Use allSelectedFiles instead of validSelectedFiles to get ALL selected files across ALL folders
|
|
2201
|
+
const validSelectedFiles = allSelectedFiles;
|
|
2202
|
+
console.log('Current valid selections across all folders:', validSelectedFiles);
|
|
2203
|
+
|
|
2204
|
+
switch (action) {
|
|
2205
|
+
case 'rename':
|
|
2206
|
+
selectedItem = item;
|
|
2207
|
+
showRenameDialog = true;
|
|
2208
|
+
break;
|
|
2209
|
+
case 'move':
|
|
2210
|
+
console.log('Move action triggered:', {
|
|
2211
|
+
item,
|
|
2212
|
+
currentSelections,
|
|
2213
|
+
allSelectedFiles,
|
|
2214
|
+
validSelectedFiles: validSelectedFiles
|
|
2215
|
+
});
|
|
2216
|
+
|
|
2217
|
+
// Reset state before starting new move operation
|
|
2218
|
+
sourceItems = [];
|
|
2219
|
+
selectedItem = null;
|
|
2220
|
+
itemToMove = null;
|
|
2221
|
+
|
|
2222
|
+
if (item.type === 'folder') {
|
|
2223
|
+
console.log('Moving folder:', item.name);
|
|
2224
|
+
selectedItem = item;
|
|
2225
|
+
// Clear all selections when moving a folder
|
|
2226
|
+
persistentSelectStore.clearSelections(filter);
|
|
2227
|
+
selectedFiles.set([]);
|
|
2228
|
+
itemToMove = item;
|
|
2229
|
+
sourceItems = [item];
|
|
2230
|
+
showMoveDialog = true;
|
|
2231
|
+
console.log('Set source items for folder:', sourceItems);
|
|
2232
|
+
} else {
|
|
2233
|
+
console.log('Moving file(s)');
|
|
2234
|
+
// Filter out any folders from valid selections
|
|
2235
|
+
const validFiles = validSelectedFiles.filter(f => f.type === 'file');
|
|
2236
|
+
console.log('Valid selected files across all folders:', validFiles);
|
|
2237
|
+
selectedItem = null;
|
|
2238
|
+
|
|
2239
|
+
// If no files are selected or the clicked file isn't in the selection
|
|
2240
|
+
if (validFiles.length === 0 || !validFiles.some(f => f.id === item.id)) {
|
|
2241
|
+
console.log('No files selected or clicked file not in selection, selecting current file:', item.name);
|
|
2242
|
+
persistentSelectStore.toggleSelection(item, filter);
|
|
2243
|
+
sourceItems = [item];
|
|
2244
|
+
} else {
|
|
2245
|
+
console.log('Using existing selected files:', validFiles);
|
|
2246
|
+
sourceItems = [...validFiles];
|
|
2247
|
+
}
|
|
2248
|
+
itemToMove = item;
|
|
2249
|
+
|
|
2250
|
+
// Ensure sourceItems is set before opening dialog
|
|
2251
|
+
if (sourceItems.length === 0) {
|
|
2252
|
+
console.log('No source items set, using current selections');
|
|
2253
|
+
sourceItems = [...validFiles];
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
showMoveDialog = true;
|
|
2257
|
+
console.log('Final source items:', sourceItems);
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
break;
|
|
2261
|
+
case 'delete':
|
|
2262
|
+
// For missing files, directly handle deletion without confirmation
|
|
2263
|
+
if (item.isMissing || (item.type === 'file' && $selectedFiles.some(f => f.id === item.id && f.isMissing))) {
|
|
2264
|
+
handleDelete(new CustomEvent('delete', { detail: { item } }));
|
|
2265
|
+
} else {
|
|
2266
|
+
// For non-missing files/folders, show confirmation dialog
|
|
2267
|
+
if (item.type === 'folder') {
|
|
2268
|
+
selectedItem = item;
|
|
2269
|
+
selectedFiles.set([]);
|
|
2270
|
+
} else {
|
|
2271
|
+
selectedItem = null;
|
|
2272
|
+
// Only set selected files if they're not already set
|
|
2273
|
+
if ($selectedFiles.length === 0) {
|
|
2274
|
+
selectedFiles.set([item]);
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
showDeleteConfirmation = true;
|
|
2278
|
+
}
|
|
2279
|
+
break;
|
|
2280
|
+
}
|
|
2281
|
+
} else {
|
|
2282
|
+
console.error('Invalid item selected for action:', action);
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
function handleRename(event: CustomEvent) {
|
|
2287
|
+
const { newName } = event.detail;
|
|
2288
|
+
if (selectedItem && isFileSystemItem(selectedItem)) {
|
|
2289
|
+
console.log(`Renaming ${selectedItem.name} to ${newName}`);
|
|
2290
|
+
|
|
2291
|
+
// Store the item's ID before resetting selection
|
|
2292
|
+
const itemId = selectedItem.id;
|
|
2293
|
+
const oldName = selectedItem.name;
|
|
2294
|
+
|
|
2295
|
+
// Close the dialog and reset selection immediately to prevent UI blocking
|
|
2296
|
+
showRenameDialog = false;
|
|
2297
|
+
selectedItem = null;
|
|
2298
|
+
|
|
2299
|
+
// console.log('call showToast method:', showToast);
|
|
2300
|
+
|
|
2301
|
+
// Show initial toast notification
|
|
2302
|
+
showToast('success', `Renaming "${oldName}"...`, {
|
|
2303
|
+
description: 'This will happen in the background',
|
|
2304
|
+
// duration: 1500
|
|
2305
|
+
});
|
|
2306
|
+
|
|
2307
|
+
// Perform the rename operation
|
|
2308
|
+
renameItem(itemId, newName)
|
|
2309
|
+
.then(success => {
|
|
2310
|
+
if (success) {
|
|
2311
|
+
showToast('success', 'Item renamed', {
|
|
2312
|
+
description: `Successfully renamed "${oldName}" to "${newName}"`,
|
|
2313
|
+
});
|
|
2314
|
+
} else {
|
|
2315
|
+
showToast('error', 'Rename failed', {
|
|
2316
|
+
description: 'No changes were made',
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2319
|
+
})
|
|
2320
|
+
.catch(error => {
|
|
2321
|
+
console.error('Error during rename operation:', error);
|
|
2322
|
+
showToast('error', 'Rename failed', {
|
|
2323
|
+
description: error instanceof Error ? error.message : 'An unknown error occurred',
|
|
2324
|
+
});
|
|
2325
|
+
});
|
|
2326
|
+
} else {
|
|
2327
|
+
console.error('No valid item selected for rename operation');
|
|
2328
|
+
showToast('error', 'Rename failed', {
|
|
2329
|
+
description: 'No valid item selected',
|
|
2330
|
+
});
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
async function handleDelete(event: CustomEvent<{ item?: FileSystemItem, items?: FileSystemItem[] }>) {
|
|
2335
|
+
// Determine what items to delete based on the event and selected files
|
|
2336
|
+
// Check if we received multiple items in the event
|
|
2337
|
+
const eventItems = event.detail.items || (event.detail.item ? [event.detail.item] : []);
|
|
2338
|
+
|
|
2339
|
+
const itemsToDelete = selectedItem?.type === 'folder'
|
|
2340
|
+
? [selectedItem]
|
|
2341
|
+
: $selectedFiles.length > 0
|
|
2342
|
+
? $selectedFiles
|
|
2343
|
+
: eventItems;
|
|
2344
|
+
|
|
2345
|
+
// Clear items from persistent selection store
|
|
2346
|
+
itemsToDelete.forEach(item => {
|
|
2347
|
+
persistentSelectStore.toggleSelection(item, filter);
|
|
2348
|
+
});
|
|
2349
|
+
|
|
2350
|
+
// Clear selected files and selectedItem immediately to allow UI to continue
|
|
2351
|
+
selectedFiles.set([]);
|
|
2352
|
+
selectedItem = null;
|
|
2353
|
+
showDeleteConfirmation = false;
|
|
2354
|
+
|
|
2355
|
+
// Show initial toast notification
|
|
2356
|
+
const initialToastMessage = itemsToDelete.length === 1
|
|
2357
|
+
? `Deleting "${itemsToDelete[0].name}"...`
|
|
2358
|
+
: `Deleting ${itemsToDelete.length} items...`;
|
|
2359
|
+
|
|
2360
|
+
showToast('success', initialToastMessage, {
|
|
2361
|
+
description: 'This will happen in the background',
|
|
2362
|
+
});
|
|
2363
|
+
|
|
2364
|
+
// Process deletions in the background
|
|
2365
|
+
setTimeout(async () => {
|
|
2366
|
+
try {
|
|
2367
|
+
let successCount = 0;
|
|
2368
|
+
const deletedItems: string[] = [];
|
|
2369
|
+
const failedItems: string[] = [];
|
|
2370
|
+
|
|
2371
|
+
// Process each item for deletion
|
|
2372
|
+
for (const item of itemsToDelete) {
|
|
2373
|
+
try {
|
|
2374
|
+
const success = await deleteItem(item.id);
|
|
2375
|
+
if (success) {
|
|
2376
|
+
successCount++;
|
|
2377
|
+
deletedItems.push(item.name);
|
|
2378
|
+
|
|
2379
|
+
// If we deleted a folder, clean up navigation history
|
|
2380
|
+
if (item.type === 'folder') {
|
|
2381
|
+
console.log(`Starting folder deletion navigation cleanup for "${item.name}"...`);
|
|
2382
|
+
navigationStore.cleanupPaths(item.id);
|
|
2383
|
+
|
|
2384
|
+
// Update current location to root (last path)
|
|
2385
|
+
currentFolder.set([]);
|
|
2386
|
+
currentPath = [];
|
|
2387
|
+
}
|
|
2388
|
+
} else {
|
|
2389
|
+
failedItems.push(item.name);
|
|
2390
|
+
}
|
|
2391
|
+
} catch (itemError) {
|
|
2392
|
+
console.error(`Error deleting ${item.name}:`, itemError);
|
|
2393
|
+
failedItems.push(item.name);
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
if (successCount > 0) {
|
|
2398
|
+
// Show appropriate toast notification for successful deletions
|
|
2399
|
+
let toastMessage = '';
|
|
2400
|
+
let toastDescription = '';
|
|
2401
|
+
|
|
2402
|
+
if (deletedItems.length === 1) {
|
|
2403
|
+
// Single item deletion
|
|
2404
|
+
const isFolder = itemsToDelete.find(item => item.name === deletedItems[0])?.type === 'folder';
|
|
2405
|
+
toastMessage = isFolder
|
|
2406
|
+
? `Deleted folder "${deletedItems[0]}"`
|
|
2407
|
+
: `Deleted "${deletedItems[0]}"`;
|
|
2408
|
+
toastDescription = isFolder
|
|
2409
|
+
? 'Folder and its contents were deleted successfully'
|
|
2410
|
+
: 'Item was deleted successfully';
|
|
2411
|
+
} else {
|
|
2412
|
+
// Multiple item deletion
|
|
2413
|
+
toastMessage = `Deleted ${successCount} items`;
|
|
2414
|
+
toastDescription = `${successCount} items were deleted successfully`;
|
|
2415
|
+
|
|
2416
|
+
// Add details if small number of items deleted (up to 3)
|
|
2417
|
+
if (successCount <= 3) {
|
|
2418
|
+
toastDescription = `Deleted: ${deletedItems.join(', ')}`;
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2422
|
+
showToast('success', toastMessage, {
|
|
2423
|
+
description: toastDescription,
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
// Show error toast if any deletions failed
|
|
2428
|
+
if (failedItems.length > 0) {
|
|
2429
|
+
const errorMessage = failedItems.length === 1
|
|
2430
|
+
? `Failed to delete "${failedItems[0]}"`
|
|
2431
|
+
: `Failed to delete ${failedItems.length} items`;
|
|
2432
|
+
|
|
2433
|
+
const errorDescription = failedItems.length <= 3
|
|
2434
|
+
? `Failed to delete: ${failedItems.join(', ')}`
|
|
2435
|
+
: 'Some items could not be deleted';
|
|
2436
|
+
|
|
2437
|
+
showToast('error', errorMessage, {
|
|
2438
|
+
description: errorDescription,
|
|
2439
|
+
});
|
|
2440
|
+
}
|
|
2441
|
+
} catch (error) {
|
|
2442
|
+
console.error('Error deleting items:', error);
|
|
2443
|
+
showToast('error', 'Failed to delete items', {
|
|
2444
|
+
description: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
2445
|
+
});
|
|
2446
|
+
}
|
|
2447
|
+
}, 100); // Small delay to ensure UI updates first
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
function isWidgeticLibraryMode(): boolean {
|
|
2451
|
+
const uploadConfig = getFileBrowserUploadConfig();
|
|
2452
|
+
return Boolean(uploadConfig?.accessToken && uploadConfig?.apiBasePath) || !useDemoContent;
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
function persistMyUploadsTree() {
|
|
2456
|
+
const store = get(fileStore);
|
|
2457
|
+
const myUploads = store.root?.children?.find((c) => c.id === 'folder_my_uploads');
|
|
2458
|
+
if (myUploads?.children) {
|
|
2459
|
+
saveLibraryTreeChildren(myUploads.children);
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2463
|
+
function handleNewFolderLocal(folderName: string) {
|
|
2464
|
+
const newFolder: FileSystemItem = {
|
|
2465
|
+
id: `folder_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
|
|
2466
|
+
name: folderName,
|
|
2467
|
+
type: 'folder',
|
|
2468
|
+
children: [],
|
|
2469
|
+
modified: new Date().toISOString(),
|
|
2470
|
+
};
|
|
2471
|
+
|
|
2472
|
+
fileStore.update((store) => {
|
|
2473
|
+
if (!store.root) return store;
|
|
2474
|
+
let currentFolder = store.root;
|
|
2475
|
+
for (const pathSegment of currentPath) {
|
|
2476
|
+
const nextFolder = currentFolder.children?.find(
|
|
2477
|
+
(item) => item.type === 'folder' && item.id === pathSegment,
|
|
2478
|
+
);
|
|
2479
|
+
if (!nextFolder) return store;
|
|
2480
|
+
currentFolder = nextFolder;
|
|
2481
|
+
}
|
|
2482
|
+
currentFolder.children = [...(currentFolder.children || []), newFolder];
|
|
2483
|
+
return store;
|
|
2484
|
+
});
|
|
2485
|
+
|
|
2486
|
+
persistMyUploadsTree();
|
|
2487
|
+
showNewFolderDialog = false;
|
|
2488
|
+
showToast('success', 'Folder created', {
|
|
2489
|
+
description: `Created folder "${folderName}"`,
|
|
2490
|
+
});
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
async function handleNewFolder(event: CustomEvent<{ itemName: string }>) {
|
|
2494
|
+
const { itemName: folderName } = event.detail;
|
|
2495
|
+
|
|
2496
|
+
if (isWidgeticLibraryMode()) {
|
|
2497
|
+
handleNewFolderLocal(folderName);
|
|
2498
|
+
return;
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
try {
|
|
2502
|
+
const response = await fetch(ENDPOINTS.CREATE_FOLDER, {
|
|
2503
|
+
method: 'POST',
|
|
2504
|
+
headers: {
|
|
2505
|
+
'Content-Type': 'application/json',
|
|
2506
|
+
},
|
|
2507
|
+
body: JSON.stringify({
|
|
2508
|
+
folderName,
|
|
2509
|
+
path: currentPath
|
|
2510
|
+
})
|
|
2511
|
+
});
|
|
2512
|
+
|
|
2513
|
+
if (!response.ok) {
|
|
2514
|
+
const error = await response.json();
|
|
2515
|
+
throw new Error(error.message || 'Failed to create folder');
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2518
|
+
const { folder } = await response.json();
|
|
2519
|
+
|
|
2520
|
+
// Update the file store with the new folder
|
|
2521
|
+
fileStore.update(store => {
|
|
2522
|
+
if (!store.root) return store;
|
|
2523
|
+
|
|
2524
|
+
let currentFolder = store.root;
|
|
2525
|
+
for (const pathSegment of currentPath) {
|
|
2526
|
+
const nextFolder = currentFolder.children?.find(
|
|
2527
|
+
item => item.type === 'folder' && item.id === pathSegment
|
|
2528
|
+
);
|
|
2529
|
+
if (!nextFolder) return store;
|
|
2530
|
+
currentFolder = nextFolder;
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
if (currentFolder.children) {
|
|
2534
|
+
currentFolder.children = [...currentFolder.children, folder];
|
|
2535
|
+
}
|
|
2536
|
+
return store;
|
|
2537
|
+
});
|
|
2538
|
+
|
|
2539
|
+
showNewFolderDialog = false;
|
|
2540
|
+
showToast('success', 'Folder created', {
|
|
2541
|
+
description: `Created folder "${folderName}"`,
|
|
2542
|
+
});
|
|
2543
|
+
} catch (error) {
|
|
2544
|
+
if(showLogs) console.error('Error creating folder:', error);
|
|
2545
|
+
showToast('error', 'Failed to create folder', {
|
|
2546
|
+
description: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
2547
|
+
});
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
function handleRecentFileSelect(event: CustomEvent<FileSystemItem>) {
|
|
2552
|
+
const file = event.detail;
|
|
2553
|
+
if(showLogs) console.log('Recent file selected:', file);
|
|
2554
|
+
|
|
2555
|
+
// Make sure we don't try to select folders
|
|
2556
|
+
if (file.type === 'file') {
|
|
2557
|
+
handleFileSelect(file);
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
function handleRecentFileAction(event: CustomEvent) {
|
|
2562
|
+
handleItemAction(event);
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
const handleResize = () => {
|
|
2566
|
+
isMobile = window.innerWidth <= mobileBreakpoint;
|
|
2567
|
+
isTablet = window.innerWidth <= tabletBreakpoint;
|
|
2568
|
+
};
|
|
2569
|
+
|
|
2570
|
+
function handleKeyDown(event: KeyboardEvent) {
|
|
2571
|
+
// if(showLogs) console.log('handleKeyDown:', {
|
|
2572
|
+
// key: event.key,
|
|
2573
|
+
// currentPath,
|
|
2574
|
+
// activeElement: document.activeElement?.tagName,
|
|
2575
|
+
// isInputFocused: isInputFocused(),
|
|
2576
|
+
// modalOpen: $isModalOpen
|
|
2577
|
+
// });
|
|
2578
|
+
|
|
2579
|
+
// Backspace key handler
|
|
2580
|
+
if (event.key === 'Backspace' && currentPath.length > 0 && !isInputFocused() && !$isModalOpen) {
|
|
2581
|
+
event.preventDefault();
|
|
2582
|
+
event.stopPropagation();
|
|
2583
|
+
|
|
2584
|
+
if(showLogs) console.log('Navigating back via backspace');
|
|
2585
|
+
handleNavigateBack();
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
// rest of the key handlers
|
|
2589
|
+
handleKeyboardShortcuts(event);
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2592
|
+
/**
|
|
2593
|
+
* Checks if an input element is currently focused
|
|
2594
|
+
* Prevents unintended backspace navigation when typing
|
|
2595
|
+
* @returns boolean indicating if an input element has focus
|
|
2596
|
+
*/
|
|
2597
|
+
function isInputFocused() {
|
|
2598
|
+
const activeElement = document.activeElement;
|
|
2599
|
+
return (
|
|
2600
|
+
activeElement instanceof HTMLInputElement ||
|
|
2601
|
+
activeElement instanceof HTMLTextAreaElement ||
|
|
2602
|
+
activeElement instanceof HTMLSelectElement ||
|
|
2603
|
+
activeElement?.hasAttribute('contenteditable')
|
|
2604
|
+
);
|
|
2605
|
+
}
|
|
2606
|
+
|
|
2607
|
+
/**
|
|
2608
|
+
* Icon Management Section
|
|
2609
|
+
* Handles icon and thumbnail resolution for files/folders
|
|
2610
|
+
*/
|
|
2611
|
+
|
|
2612
|
+
/**
|
|
2613
|
+
* Gets appropriate icon for any file system item
|
|
2614
|
+
* @param item File or folder to get icon for
|
|
2615
|
+
* @returns URL or path to icon/thumbnail
|
|
2616
|
+
*/
|
|
2617
|
+
function getItemIcon(item: FileSystemItem): string {
|
|
2618
|
+
if (item.type === 'folder') {
|
|
2619
|
+
return getFolderIcon({
|
|
2620
|
+
...item,
|
|
2621
|
+
matchingFileCount: counts.get(item.id) || 0
|
|
2622
|
+
}, filter);
|
|
2623
|
+
}
|
|
2624
|
+
return getThumbnailOrIcon(item);
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
/**
|
|
2628
|
+
* Resolves thumbnail or fallback icon for files
|
|
2629
|
+
* Prioritizes thumbnails for media files
|
|
2630
|
+
* @param item File to get thumbnail/icon for
|
|
2631
|
+
* @returns URL to thumbnail or appropriate icon
|
|
2632
|
+
*/
|
|
2633
|
+
function getThumbnailOrIcon(item: FileSystemItem): string {
|
|
2634
|
+
if (item.type === 'folder') {
|
|
2635
|
+
return getFolderIcon(item, filter);
|
|
2636
|
+
}
|
|
2637
|
+
const fileType = getFileType(item.url || item.name);
|
|
2638
|
+
|
|
2639
|
+
if (fileType === 'video' && item.url) {
|
|
2640
|
+
// For video files, construct the thumbnail path by replacing the video extension with .png
|
|
2641
|
+
const videoPath = item.url;
|
|
2642
|
+
const thumbnailPath = videoPath.replace(/\.[^/.]+$/, '.png');
|
|
2643
|
+
return thumbnailPath;
|
|
2644
|
+
}
|
|
2645
|
+
|
|
2646
|
+
if ((fileType === 'image' || fileType === 'svg') && item.url) {
|
|
2647
|
+
return item.url;
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
return getFileIcon(item.name);
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
$: fileTypesText = formatFileTypesForDisplay();
|
|
2654
|
+
|
|
2655
|
+
function handleModalClose() {
|
|
2656
|
+
showModal = false;
|
|
2657
|
+
}
|
|
2658
|
+
|
|
2659
|
+
function handleSearchModalClose() {
|
|
2660
|
+
showSearchModal = false;
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
/**
|
|
2664
|
+
* Handles successful file upload
|
|
2665
|
+
* Updates file list and sorts according to current criteria
|
|
2666
|
+
*/
|
|
2667
|
+
function handleFileUploaded(event: CustomEvent) {
|
|
2668
|
+
const { file, success } = event.detail;
|
|
2669
|
+
|
|
2670
|
+
if (success && file) {
|
|
2671
|
+
saveUserUpload(file);
|
|
2672
|
+
|
|
2673
|
+
// Update the fileStore with the new file
|
|
2674
|
+
fileStore.update(store => {
|
|
2675
|
+
if (!store.root) return store;
|
|
2676
|
+
|
|
2677
|
+
// Find the target folder in the store
|
|
2678
|
+
let currentFolder = store.root;
|
|
2679
|
+
|
|
2680
|
+
if (isWidgeticLibraryMode()) {
|
|
2681
|
+
const myUploads = store.root.children?.find(
|
|
2682
|
+
(item) => item.type === 'folder' && item.id === 'folder_my_uploads',
|
|
2683
|
+
);
|
|
2684
|
+
if (!myUploads) return store;
|
|
2685
|
+
currentFolder = myUploads;
|
|
2686
|
+
} else {
|
|
2687
|
+
// Traverse to the target folder using currentPath
|
|
2688
|
+
for (const pathSegment of currentPath) {
|
|
2689
|
+
const nextFolder = currentFolder.children?.find(
|
|
2690
|
+
item => item.type === 'folder' && item.id === pathSegment
|
|
2691
|
+
);
|
|
2692
|
+
if (!nextFolder) return store; // Path not found, return unchanged store
|
|
2693
|
+
currentFolder = nextFolder;
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
// Add the new file to the current folder's children
|
|
2698
|
+
if (currentFolder.children) {
|
|
2699
|
+
// Check for duplicates before adding
|
|
2700
|
+
const isDuplicate = currentFolder.children.some(
|
|
2701
|
+
existingFile => existingFile.name === file.name
|
|
2702
|
+
);
|
|
2703
|
+
|
|
2704
|
+
if (!isDuplicate) {
|
|
2705
|
+
// Add the new file and maintain sorting
|
|
2706
|
+
currentFolder.children = [...currentFolder.children, file].sort((a, b) => {
|
|
2707
|
+
// Keep folders at the top
|
|
2708
|
+
if (a.type === 'folder' && b.type !== 'folder') return -1;
|
|
2709
|
+
if (a.type !== 'folder' && b.type === 'folder') return 1;
|
|
2710
|
+
|
|
2711
|
+
// Apply current sort criteria
|
|
2712
|
+
switch ($sortCriteria) {
|
|
2713
|
+
case 'name':
|
|
2714
|
+
return $sortDirection === 'asc'
|
|
2715
|
+
? a.name.localeCompare(b.name)
|
|
2716
|
+
: b.name.localeCompare(a.name);
|
|
2717
|
+
case 'date':
|
|
2718
|
+
const aDate = a.modified ? new Date(a.modified).getTime() : 0;
|
|
2719
|
+
const bDate = b.modified ? new Date(b.modified).getTime() : 0;
|
|
2720
|
+
return $sortDirection === 'asc'
|
|
2721
|
+
? aDate - bDate
|
|
2722
|
+
: bDate - aDate;
|
|
2723
|
+
case 'size':
|
|
2724
|
+
return $sortDirection === 'asc'
|
|
2725
|
+
? (a.size || 0) - (b.size || 0)
|
|
2726
|
+
: (b.size || 0) - (a.size || 0);
|
|
2727
|
+
default:
|
|
2728
|
+
return 0;
|
|
2729
|
+
}
|
|
2730
|
+
});
|
|
2731
|
+
|
|
2732
|
+
// Force a reactive update of the current folder content
|
|
2733
|
+
currentFolderContent = { ...currentFolder };
|
|
2734
|
+
|
|
2735
|
+
// Update recent files if we're in the root folder
|
|
2736
|
+
if (currentPath.length === 0) {
|
|
2737
|
+
recentFiles = getRecentFiles();
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
// Ensure the file appears in the virtual list by forcing an update
|
|
2741
|
+
sortedFilteredFiles = [...sortedFilteredFiles, file].sort((a, b) => {
|
|
2742
|
+
if (a.type === 'folder' && b.type !== 'folder') return -1;
|
|
2743
|
+
if (a.type !== 'folder' && b.type === 'folder') return 1;
|
|
2744
|
+
return 0;
|
|
2745
|
+
});
|
|
2746
|
+
|
|
2747
|
+
// Log the file addition
|
|
2748
|
+
if(showLogs) console.log('Added file:', {
|
|
2749
|
+
name: file.name,
|
|
2750
|
+
path: currentPath,
|
|
2751
|
+
url: file.url
|
|
2752
|
+
});
|
|
2753
|
+
|
|
2754
|
+
// Scroll to and highlight the new file after a short delay to ensure rendering
|
|
2755
|
+
setTimeout(() => {
|
|
2756
|
+
scrollItemIntoView(file.id);
|
|
2757
|
+
const itemElement = document.querySelector(`[data-item-id="${file.id}"]`);
|
|
2758
|
+
if (itemElement) {
|
|
2759
|
+
itemElement.classList.add('wave-goodbye');
|
|
2760
|
+
setTimeout(() => {
|
|
2761
|
+
itemElement.classList.remove('wave-goodbye');
|
|
2762
|
+
}, 600);
|
|
2763
|
+
}
|
|
2764
|
+
}, 100);
|
|
2765
|
+
} else {
|
|
2766
|
+
if(showLogs) console.log('Duplicate file skipped:', file.name);
|
|
2767
|
+
}
|
|
2768
|
+
} else {
|
|
2769
|
+
// Initialize children array if it doesn't exist
|
|
2770
|
+
currentFolder.children = [file];
|
|
2771
|
+
// Force a reactive update
|
|
2772
|
+
currentFolderContent = { ...currentFolder };
|
|
2773
|
+
sortedFilteredFiles = [file];
|
|
2774
|
+
if(showLogs) console.log('Created new children array with file:', file.name);
|
|
2775
|
+
}
|
|
2776
|
+
|
|
2777
|
+
return store;
|
|
2778
|
+
});
|
|
2779
|
+
persistMyUploadsTree();
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
// Add these variables for drag state management
|
|
2784
|
+
let dragActive = false;
|
|
2785
|
+
let dragInvalid = false;
|
|
2786
|
+
let hasValidFiles = false;
|
|
2787
|
+
let isDraggingFolder = false;
|
|
2788
|
+
|
|
2789
|
+
// Change the type annotation to be more specific
|
|
2790
|
+
let fileUploaderComponent: {
|
|
2791
|
+
handleDragEnter: (e: DragEvent) => void;
|
|
2792
|
+
handleDragLeave: (e: DragEvent) => void;
|
|
2793
|
+
handleDragOver: (e: DragEvent) => void;
|
|
2794
|
+
handleDrop: (e: DragEvent) => void;
|
|
2795
|
+
} | null = null;
|
|
2796
|
+
|
|
2797
|
+
function handleDragEnter(e: DragEvent) {
|
|
2798
|
+
e.preventDefault();
|
|
2799
|
+
e.stopPropagation();
|
|
2800
|
+
dragCounter++;
|
|
2801
|
+
if (e.dataTransfer?.types.includes('Files')) {
|
|
2802
|
+
isDraggingFiles.set(true);
|
|
2803
|
+
fileUploaderComponent?.handleDragEnter(e);
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
function handleDragLeave(e: DragEvent) {
|
|
2808
|
+
e.preventDefault();
|
|
2809
|
+
e.stopPropagation();
|
|
2810
|
+
dragCounter--;
|
|
2811
|
+
if (dragCounter === 0) {
|
|
2812
|
+
isDraggingFiles.set(false);
|
|
2813
|
+
fileUploaderComponent?.handleDragLeave(e);
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2817
|
+
function handleDrop(e: DragEvent) {
|
|
2818
|
+
e.preventDefault();
|
|
2819
|
+
e.stopPropagation();
|
|
2820
|
+
dragCounter = 0;
|
|
2821
|
+
isDraggingFiles.set(false);
|
|
2822
|
+
fileUploaderComponent?.handleDrop(e);
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
function handleDragOver(e: DragEvent) {
|
|
2826
|
+
e.preventDefault();
|
|
2827
|
+
e.stopPropagation();
|
|
2828
|
+
fileUploaderComponent?.handleDragOver(e);
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
// Update counts when filter changes
|
|
2832
|
+
$: if ($fileStore?.root) {
|
|
2833
|
+
updateFolderCounts($fileStore.root, filter);
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
$: currentViewFiles = sortedFilteredFiles.filter((item) => item?.type === 'file');
|
|
2837
|
+
|
|
2838
|
+
// Add this reactive statement to update folderStructure
|
|
2839
|
+
$: {
|
|
2840
|
+
if ($sortedFiles.root.children) {
|
|
2841
|
+
folderStructure = $sortedFiles.root.children;
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
|
|
2845
|
+
/**
|
|
2846
|
+
* Scrolls an item into view with optional smooth animation
|
|
2847
|
+
* @param itemId ID of the item to scroll into view
|
|
2848
|
+
* @param animationType 'goodbye' animation for closing preview only
|
|
2849
|
+
* @param smoothScroll whether to use smooth scrolling (default: true)
|
|
2850
|
+
*/
|
|
2851
|
+
function scrollItemIntoView(itemId: string, animationType?: 'goodbye', smoothScroll: boolean = true) {
|
|
2852
|
+
// if(showLogs) console.log('Attempting to scroll item into view:', itemId);
|
|
2853
|
+
|
|
2854
|
+
requestAnimationFrame(() => {
|
|
2855
|
+
const itemElement = document.querySelector(`[data-item-id="${itemId}"]`) as HTMLElement;
|
|
2856
|
+
const scrollableArea = document.querySelector('.overflow-y-auto') as HTMLElement;
|
|
2857
|
+
|
|
2858
|
+
if (itemElement && scrollableArea) {
|
|
2859
|
+
// Handle animation first if it's a goodbye animation
|
|
2860
|
+
if (animationType === 'goodbye') {
|
|
2861
|
+
itemElement.classList.add('wave-goodbye');
|
|
2862
|
+
setTimeout(() => {
|
|
2863
|
+
itemElement.classList.remove('wave-goodbye');
|
|
2864
|
+
}, 600);
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
const scrollTop = scrollableArea.scrollTop;
|
|
2868
|
+
|
|
2869
|
+
// Get positions relative to the scrollable area
|
|
2870
|
+
const scrollableRect = scrollableArea.getBoundingClientRect();
|
|
2871
|
+
const itemRect = itemElement.getBoundingClientRect();
|
|
2872
|
+
|
|
2873
|
+
// Calculate positions relative to the scrollable area
|
|
2874
|
+
const itemTop = itemRect.top - scrollableRect.top + scrollTop;
|
|
2875
|
+
const itemHeight = itemRect.height;
|
|
2876
|
+
const itemBottom = itemTop + itemHeight;
|
|
2877
|
+
|
|
2878
|
+
// Calculate visible area
|
|
2879
|
+
const visibleTop = scrollTop;
|
|
2880
|
+
const visibleBottom = scrollTop + scrollableRect.height;
|
|
2881
|
+
|
|
2882
|
+
// Check if item is fully visible
|
|
2883
|
+
const isTopVisible = itemTop >= visibleTop;
|
|
2884
|
+
const isBottomVisible = itemBottom <= visibleBottom;
|
|
2885
|
+
const isFullyVisible = isTopVisible && isBottomVisible;
|
|
2886
|
+
|
|
2887
|
+
if (!isFullyVisible) {
|
|
2888
|
+
let newScrollTop;
|
|
2889
|
+
|
|
2890
|
+
// If bottom is cut off
|
|
2891
|
+
if (!isBottomVisible) {
|
|
2892
|
+
newScrollTop = itemBottom - scrollableRect.height;
|
|
2893
|
+
}
|
|
2894
|
+
// If top is cut off
|
|
2895
|
+
else if (!isTopVisible) {
|
|
2896
|
+
newScrollTop = itemTop;
|
|
2897
|
+
}
|
|
2898
|
+
// Default to centering
|
|
2899
|
+
else {
|
|
2900
|
+
newScrollTop = itemTop - (scrollableRect.height - itemHeight) / 2;
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
scrollableArea.scrollTo({
|
|
2904
|
+
top: newScrollTop,
|
|
2905
|
+
behavior: smoothScroll ? 'smooth' : 'auto'
|
|
2906
|
+
});
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
|
+
});
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
// Update the preview navigation handler to maintain the source context
|
|
2913
|
+
function handlePreviewNavigate(event: CustomEvent) {
|
|
2914
|
+
const nextFile = event.detail;
|
|
2915
|
+
previewFile = nextFile;
|
|
2916
|
+
// Only scroll if preview was opened from main view
|
|
2917
|
+
if (previewSource === 'main') {
|
|
2918
|
+
scrollItemIntoView(nextFile.id);
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
// Add these new handlers
|
|
2923
|
+
function handleNavigateBack() {
|
|
2924
|
+
// if (modalOpen) {
|
|
2925
|
+
// if(showLogs) console.log('Modal is open, skipping back navigation');
|
|
2926
|
+
// return;
|
|
2927
|
+
// }
|
|
2928
|
+
|
|
2929
|
+
if(showLogs) console.log('Handling back navigation');
|
|
2930
|
+
navigationStore.navigateBack();
|
|
2931
|
+
const newPath = $navPathStore;
|
|
2932
|
+
if (!Array.isArray(newPath)) {
|
|
2933
|
+
if(showLogs) console.error('Invalid path received from navigation store:', newPath);
|
|
2934
|
+
return;
|
|
2935
|
+
}
|
|
2936
|
+
if(showLogs) console.log('Back Navigation Details:', {
|
|
2937
|
+
from: currentPath,
|
|
2938
|
+
to: newPath
|
|
2939
|
+
});
|
|
2940
|
+
currentFolder.set(newPath);
|
|
2941
|
+
currentPath = newPath;
|
|
2942
|
+
}
|
|
2943
|
+
|
|
2944
|
+
function handleNavigateForward() {
|
|
2945
|
+
// if (modalOpen) {
|
|
2946
|
+
// console.log('Modal is open, skipping forward navigation');
|
|
2947
|
+
// return;
|
|
2948
|
+
// }
|
|
2949
|
+
|
|
2950
|
+
if(showLogs) console.log('Handling forward navigation');
|
|
2951
|
+
navigationStore.navigateForward();
|
|
2952
|
+
const newPath = $navPathStore;
|
|
2953
|
+
if (!Array.isArray(newPath)) {
|
|
2954
|
+
if(showLogs) console.error('Invalid path received from navigation store:', newPath);
|
|
2955
|
+
return;
|
|
2956
|
+
}
|
|
2957
|
+
if(showLogs) console.log('Forward Navigation Details:', {
|
|
2958
|
+
from: currentPath,
|
|
2959
|
+
to: newPath
|
|
2960
|
+
});
|
|
2961
|
+
currentFolder.set(newPath);
|
|
2962
|
+
currentPath = newPath;
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
// Add currentPathNames derived from currentPath
|
|
2966
|
+
$: {
|
|
2967
|
+
if (Array.isArray(currentPath)) {
|
|
2968
|
+
// Pass the loading state to prevent flicker
|
|
2969
|
+
const names = getPathNamesFromIds(currentPath, isLoading);
|
|
2970
|
+
|
|
2971
|
+
// Only do additional processing if we have actual names
|
|
2972
|
+
// If all names are empty, we're still loading data
|
|
2973
|
+
const hasNames = names.some(name => name !== '');
|
|
2974
|
+
|
|
2975
|
+
if (!hasNames && isLoading) {
|
|
2976
|
+
// During loading with no names, use empty strings
|
|
2977
|
+
currentPathNames = names;
|
|
2978
|
+
} else {
|
|
2979
|
+
// For non-loading state, use the names directly without placeholders
|
|
2980
|
+
// If a name is the same as the ID, it means we couldn't find a proper name
|
|
2981
|
+
// In that case, we'll just use the ID as is
|
|
2982
|
+
currentPathNames = names;
|
|
2983
|
+
}
|
|
2984
|
+
} else {
|
|
2985
|
+
currentPathNames = [];
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
// Update the deduplication function to handle items with the same name
|
|
2990
|
+
function deduplicateFileSystemItems(data: any) {
|
|
2991
|
+
if (!data.root?.children) return data;
|
|
2992
|
+
|
|
2993
|
+
// Create a Map to store unique items by ID
|
|
2994
|
+
const uniqueItems = new Map();
|
|
2995
|
+
|
|
2996
|
+
data.root.children.forEach((item: FileSystemItem) => {
|
|
2997
|
+
// Use item.id as the unique key
|
|
2998
|
+
if (!uniqueItems.has(item.id)) {
|
|
2999
|
+
uniqueItems.set(item.id, item);
|
|
3000
|
+
}
|
|
3001
|
+
});
|
|
3002
|
+
|
|
3003
|
+
// Convert Map back to array
|
|
3004
|
+
data.root.children = Array.from(uniqueItems.values());
|
|
3005
|
+
|
|
3006
|
+
return data;
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
// Add this function to handle reset
|
|
3010
|
+
function handleResetNavigation() {
|
|
3011
|
+
if(showLogs) console.log('Resetting navigation history');
|
|
3012
|
+
|
|
3013
|
+
// Reset the navigation store
|
|
3014
|
+
navigationStore.reset();
|
|
3015
|
+
|
|
3016
|
+
// Clear localStorage navigation history
|
|
3017
|
+
if (persistHistory) {
|
|
3018
|
+
try {
|
|
3019
|
+
removeFromStorage(instanceId);
|
|
3020
|
+
if(showLogs) console.log('Cleared navigation history from localStorage');
|
|
3021
|
+
} catch (error) {
|
|
3022
|
+
if(showLogs) console.error('Error clearing navigation history:', error);
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
|
|
3026
|
+
// Only add the source path to history if it's not root
|
|
3027
|
+
if (currentPath.length > 0) {
|
|
3028
|
+
// Check if we're already in this path
|
|
3029
|
+
const isSamePath = currentPath.length === currentPath.length &&
|
|
3030
|
+
currentPath.every((id, index) => id === currentPath[index]);
|
|
3031
|
+
|
|
3032
|
+
if (isSamePath) {
|
|
3033
|
+
if(showLogs) console.log('Already in current path, skipping addition to history');
|
|
3034
|
+
return;
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3037
|
+
// Add the current path as the first entry in navigation history
|
|
3038
|
+
// This will make it the "back" destination after moving
|
|
3039
|
+
navigationStore.navigateToFolder(currentPath);
|
|
3040
|
+
if(showLogs) console.log('Navigation history reset with source path:', currentPath);
|
|
3041
|
+
} else {
|
|
3042
|
+
if(showLogs) console.log('Source path is root, skipping addition to history');
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
|
|
3046
|
+
|
|
3047
|
+
|
|
3048
|
+
// Compute if header should be visible
|
|
3049
|
+
$: showHeader = showBreadcrumbs;//|| (allowSelecting && allSelectedFiles.length > 0);
|
|
3050
|
+
|
|
3051
|
+
// Add this function in the script section near other event handlers
|
|
3052
|
+
function handleContainerClick() {
|
|
3053
|
+
// Only clear selection if no modal is open
|
|
3054
|
+
if (!$isModalOpen && window.getSelection) {
|
|
3055
|
+
const selection = window.getSelection();
|
|
3056
|
+
if (selection && selection.toString().length > 0) {
|
|
3057
|
+
selection.removeAllRanges();
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
// Add these functions in the script section
|
|
3063
|
+
function handleContainerMouseDown(event: MouseEvent) {
|
|
3064
|
+
// Skip if a modal is open or if clicking in an input field
|
|
3065
|
+
if ($isModalOpen) return;
|
|
3066
|
+
|
|
3067
|
+
const target = event.target as HTMLElement;
|
|
3068
|
+
if (
|
|
3069
|
+
target instanceof HTMLInputElement ||
|
|
3070
|
+
target instanceof HTMLTextAreaElement ||
|
|
3071
|
+
target instanceof HTMLSelectElement ||
|
|
3072
|
+
target.isContentEditable ||
|
|
3073
|
+
target.closest('input') ||
|
|
3074
|
+
target.closest('textarea') ||
|
|
3075
|
+
target.closest('select') ||
|
|
3076
|
+
target.closest('[contenteditable="true"]')
|
|
3077
|
+
) {
|
|
3078
|
+
return;
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
// Focus the container when clicking anywhere inside it
|
|
3082
|
+
mainContainer?.focus();
|
|
3083
|
+
}
|
|
3084
|
+
|
|
3085
|
+
// Update the keyboard shortcuts handler to batch updates
|
|
3086
|
+
function handleKeyboardShortcuts(event: KeyboardEvent) {
|
|
3087
|
+
// if(showLogs) console.log('FileBrowser handleKeyboardShortcuts:', event, $isModalOpen);
|
|
3088
|
+
|
|
3089
|
+
// Skip if a modal is open
|
|
3090
|
+
if ($isModalOpen) return;
|
|
3091
|
+
|
|
3092
|
+
// Skip keyboard shortcuts if select is focused
|
|
3093
|
+
// if (document.activeElement instanceof HTMLSelectElement) {
|
|
3094
|
+
// return;
|
|
3095
|
+
// }
|
|
3096
|
+
|
|
3097
|
+
// Handle CMD/CTRL + A for selecting all files
|
|
3098
|
+
if ((event.metaKey || event.ctrlKey) && event.key === 'a') {
|
|
3099
|
+
console.log('FileBrowser Handle CMD/CTRL + A:', event, $isModalOpen);
|
|
3100
|
+
|
|
3101
|
+
event.preventDefault();
|
|
3102
|
+
event.stopPropagation();
|
|
3103
|
+
|
|
3104
|
+
if (isInputFocused()) return;
|
|
3105
|
+
if (maxSelections === 1) return;
|
|
3106
|
+
|
|
3107
|
+
// Clear any text selection
|
|
3108
|
+
if (window.getSelection) {
|
|
3109
|
+
const selection = window.getSelection();
|
|
3110
|
+
if (selection && selection.toString().length > 0) {
|
|
3111
|
+
selection.removeAllRanges();
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
|
|
3115
|
+
// Batch the updates by preparing all items first
|
|
3116
|
+
const itemsToSelect = sortedFilteredFiles.filter(
|
|
3117
|
+
file => file.type === 'file' && !currentSelections.some(f => f.id === file.id)
|
|
3118
|
+
);
|
|
3119
|
+
|
|
3120
|
+
// Use requestAnimationFrame to batch the updates
|
|
3121
|
+
requestAnimationFrame(() => {
|
|
3122
|
+
itemsToSelect.forEach(file => {
|
|
3123
|
+
persistentSelectStore.toggleSelection(file, filter);
|
|
3124
|
+
});
|
|
3125
|
+
});
|
|
3126
|
+
}
|
|
3127
|
+
|
|
3128
|
+
// Handle CMD/CTRL + SHIFT + P to clear PDF cache (hidden developer shortcut)
|
|
3129
|
+
if ((event.metaKey || event.ctrlKey) && event.shiftKey && event.key === 'p') {
|
|
3130
|
+
event.preventDefault();
|
|
3131
|
+
event.stopPropagation();
|
|
3132
|
+
|
|
3133
|
+
// Import the PDF cache store from the design system
|
|
3134
|
+
import('@widgetic/design-system/stores').then((module) => {
|
|
3135
|
+
const pdfCacheStore = module.pdfCache;
|
|
3136
|
+
pdfCacheStore.clear();
|
|
3137
|
+
if(showLogs) console.log('PDF cache cleared via keyboard shortcut');
|
|
3138
|
+
}).catch(err => {
|
|
3139
|
+
if(showLogs) console.error('Failed to load PDF cache module:', err);
|
|
3140
|
+
});
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
// Add new reactive statement to properly track selections
|
|
3145
|
+
$: {
|
|
3146
|
+
// console.log('Selection state changed:', {
|
|
3147
|
+
// currentSelections,
|
|
3148
|
+
// sourceItems,
|
|
3149
|
+
// showMoveDialog,
|
|
3150
|
+
// itemToMove
|
|
3151
|
+
// });
|
|
3152
|
+
|
|
3153
|
+
// Only update sourceItems for file moves (not folders) and when dialog is open
|
|
3154
|
+
if (showMoveDialog && itemToMove?.type !== 'folder') {
|
|
3155
|
+
const validFileSelections = currentSelections.filter((item) => item?.type === 'file');
|
|
3156
|
+
sourceItems = [...validFileSelections];
|
|
3157
|
+
// console.log('Updated source items (files only):', sourceItems);
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
|
|
3161
|
+
|
|
3162
|
+
// Helper recursive function to search through the folder structure
|
|
3163
|
+
const findFolderPath = (targetId: string, folder: FileSystemItem, path: string[] = []): string[] | null => {
|
|
3164
|
+
// If this is the target folder, return the path to it
|
|
3165
|
+
if (folder.id === targetId) {
|
|
3166
|
+
return path;
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
// If this folder has children, search through them
|
|
3170
|
+
if (folder.children) {
|
|
3171
|
+
for (const child of folder.children) {
|
|
3172
|
+
if (child.type === 'folder') {
|
|
3173
|
+
const result = findFolderPath(targetId, child, [...path, child.id]);
|
|
3174
|
+
if (result !== null) {
|
|
3175
|
+
return result;
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
|
|
3181
|
+
// If we've checked all children and still haven't found the target, return null
|
|
3182
|
+
return null;
|
|
3183
|
+
};
|
|
3184
|
+
|
|
3185
|
+
// Update handleMove success handler to reset state
|
|
3186
|
+
async function handleMove(event: CustomEvent<{ targetFolderId: string }>) {
|
|
3187
|
+
const { targetFolderId } = event.detail;
|
|
3188
|
+
if(showLogs) console.log('handleMove called with targetFolderId:', targetFolderId);
|
|
3189
|
+
|
|
3190
|
+
try {
|
|
3191
|
+
// For root folder, use empty path
|
|
3192
|
+
const newPath = targetFolderId === 'root' ? [] : findFolderPath(targetFolderId, $fileStore.root);
|
|
3193
|
+
if(showLogs) console.log('Found path for target folder:', { targetFolderId, newPath });
|
|
3194
|
+
|
|
3195
|
+
if (newPath !== null) {
|
|
3196
|
+
// Reset state after successful move
|
|
3197
|
+
sourceItems = [];
|
|
3198
|
+
selectedItem = null;
|
|
3199
|
+
itemToMove = null;
|
|
3200
|
+
showMoveDialog = false;
|
|
3201
|
+
|
|
3202
|
+
// Navigate to the new folder
|
|
3203
|
+
if(showLogs) console.log('Navigating to new path:', newPath);
|
|
3204
|
+
navigationStore.navigateToFolder(newPath, true);
|
|
3205
|
+
currentFolder.set(newPath);
|
|
3206
|
+
currentPath = newPath;
|
|
3207
|
+
} else {
|
|
3208
|
+
if(showLogs) console.error('Could not find path for folder:', targetFolderId);
|
|
3209
|
+
showToast('error', 'Navigation failed', {
|
|
3210
|
+
description: 'Could not find the target folder location',
|
|
3211
|
+
});
|
|
3212
|
+
}
|
|
3213
|
+
} catch (error) {
|
|
3214
|
+
if(showLogs) console.error('Error during move navigation:', error);
|
|
3215
|
+
showToast('error', 'Navigation failed', {
|
|
3216
|
+
description: 'An error occurred while navigating to the target folder',
|
|
3217
|
+
});
|
|
3218
|
+
}
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
// Add cleanup when dialog closes
|
|
3222
|
+
$: if (!showMoveDialog) {
|
|
3223
|
+
// if(showLogs) console.log('Move dialog closed, resetting state');
|
|
3224
|
+
// Check if we were moving a folder before clearing state
|
|
3225
|
+
const wasMovingFolder = itemToMove?.type === 'folder';
|
|
3226
|
+
|
|
3227
|
+
// Reset all state
|
|
3228
|
+
sourceItems = [];
|
|
3229
|
+
selectedItem = null;
|
|
3230
|
+
itemToMove = null;
|
|
3231
|
+
|
|
3232
|
+
// Clear selections if we were moving a folder
|
|
3233
|
+
if (wasMovingFolder) {
|
|
3234
|
+
persistentSelectStore.clearSelections(filter);
|
|
3235
|
+
selectedFiles.set([]);
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
3238
|
+
|
|
3239
|
+
// Add in script section after other filter-related code
|
|
3240
|
+
// Format filter type for display
|
|
3241
|
+
function formatFilterType(filterType: FileFilterType): string {
|
|
3242
|
+
if (filterType === 'all') return 'All';
|
|
3243
|
+
// Capitalize first letter
|
|
3244
|
+
return filterType.charAt(0).toUpperCase() + filterType.slice(1);
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
// Filter options for the dropdown
|
|
3248
|
+
const filterOptions = [
|
|
3249
|
+
{ value: 'all', label: 'All' },
|
|
3250
|
+
{ value: 'image', label: 'Images' },
|
|
3251
|
+
{ value: 'video', label: 'Videos' },
|
|
3252
|
+
{ value: 'document', label: 'Documents' },
|
|
3253
|
+
{ value: 'audio', label: 'Audio' },
|
|
3254
|
+
{ value: 'font', label: 'Fonts' },
|
|
3255
|
+
{ value: 'svg', label: 'SVG' }
|
|
3256
|
+
];
|
|
3257
|
+
|
|
3258
|
+
// Add these state variables
|
|
3259
|
+
let filterDropdownOpen = false;
|
|
3260
|
+
|
|
3261
|
+
// Replace the existing reactive statement for filter
|
|
3262
|
+
$: {
|
|
3263
|
+
if (persistHistory && filter) {
|
|
3264
|
+
try {
|
|
3265
|
+
// Store the current filter preference in localStorage
|
|
3266
|
+
if (isBrowser) {
|
|
3267
|
+
saveToStorage(FILTER_STORAGE_KEY(instanceId), filter);
|
|
3268
|
+
if(showLogs && showFiltersLogs) console.log('Saved filter preference:', filter);
|
|
3269
|
+
}
|
|
3270
|
+
} catch (error) {
|
|
3271
|
+
if(showLogs && showFiltersLogs) console.error('Error saving filter preference:', error);
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
|
|
3276
|
+
// Add a reactive statement to ensure filter is properly applied after data is loaded
|
|
3277
|
+
$: {
|
|
3278
|
+
if (!isLoading) {
|
|
3279
|
+
if(showLogs && showFiltersLogs) console.log('Data loaded, current filter is:', filter);
|
|
3280
|
+
}
|
|
3281
|
+
}
|
|
3282
|
+
|
|
3283
|
+
// Update the filter change handler in the dropdown
|
|
3284
|
+
function handleFilterChange(newFilter: FileFilterType) {
|
|
3285
|
+
if(showLogs && showFiltersLogs) console.log('Filter changed from', filter, 'to', newFilter);
|
|
3286
|
+
|
|
3287
|
+
// Preserve selections when changing filters
|
|
3288
|
+
if (newFilter !== filter) {
|
|
3289
|
+
// Get current selections before filter change
|
|
3290
|
+
const currentSelections = persistentSelectStore.getSelected(filter);
|
|
3291
|
+
if(showLogs && showFiltersLogs) console.log('Current selections before filter change:', currentSelections);
|
|
3292
|
+
|
|
3293
|
+
// If we're changing from 'all' to a specific filter type, we should ensure
|
|
3294
|
+
// that previously selected files of the new filter type remain selected
|
|
3295
|
+
if (filter === 'all' && newFilter !== 'all') {
|
|
3296
|
+
// Get all files in the system
|
|
3297
|
+
const allFiles = getAllFiles($fileStore.root);
|
|
3298
|
+
|
|
3299
|
+
// Find the files that match the new filter type
|
|
3300
|
+
const matchingFiles = allFiles.filter(file =>
|
|
3301
|
+
getFileType(file.url || file.name) === newFilter
|
|
3302
|
+
);
|
|
3303
|
+
|
|
3304
|
+
// Get IDs of matching files that were previously selected
|
|
3305
|
+
const selectedMatchingIds = currentSelections.filter(id =>
|
|
3306
|
+
matchingFiles.some(file => file.id === id)
|
|
3307
|
+
);
|
|
3308
|
+
|
|
3309
|
+
if(showLogs && showFiltersLogs) console.log(`Found ${selectedMatchingIds.length} selected files matching filter type ${newFilter}`);
|
|
3310
|
+
|
|
3311
|
+
// Apply the filtered selections to the new filter type
|
|
3312
|
+
persistentSelectStore.setSelections(newFilter, selectedMatchingIds);
|
|
3313
|
+
}
|
|
3314
|
+
// If we're changing from a specific filter to 'all', ensure deselections are preserved
|
|
3315
|
+
else if (filter !== 'all' && newFilter === 'all') {
|
|
3316
|
+
if(showLogs && showFiltersLogs) console.log('Switching from specific filter to "all" filter, preserving deselections');
|
|
3317
|
+
|
|
3318
|
+
// We don't need to do anything special here because the toggleSelection and clearSelections
|
|
3319
|
+
// methods now handle keeping "all" in sync with specific filters
|
|
3320
|
+
}
|
|
3321
|
+
// If we're changing between specific filters, preserve relevant selections
|
|
3322
|
+
else if (filter !== 'all' && newFilter !== 'all' && filter !== newFilter) {
|
|
3323
|
+
if(showLogs && showFiltersLogs) console.log(`Switching between specific filters: ${filter} to ${newFilter}`);
|
|
3324
|
+
// Get all files in the system
|
|
3325
|
+
const allFiles = getAllFiles($fileStore.root);
|
|
3326
|
+
|
|
3327
|
+
// Find the files that match the new filter type
|
|
3328
|
+
const matchingFiles = allFiles.filter(file =>
|
|
3329
|
+
getFileType(file.url || file.name) === newFilter
|
|
3330
|
+
);
|
|
3331
|
+
|
|
3332
|
+
// Get selected files from the "all" filter (which should be the master list)
|
|
3333
|
+
const allFilterSelections = persistentSelectStore.getSelected('all');
|
|
3334
|
+
|
|
3335
|
+
// Get IDs of matching files that are selected in the "all" filter
|
|
3336
|
+
const selectedMatchingIds = allFilterSelections.filter(id =>
|
|
3337
|
+
matchingFiles.some(file => file.id === id)
|
|
3338
|
+
);
|
|
3339
|
+
|
|
3340
|
+
if(showLogs && showFiltersLogs) console.log(`Found ${selectedMatchingIds.length} selected files matching filter type ${newFilter}`);
|
|
3341
|
+
|
|
3342
|
+
// Apply the filtered selections to the new filter type
|
|
3343
|
+
persistentSelectStore.setSelections(newFilter, selectedMatchingIds);
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3347
|
+
// Update the filter
|
|
3348
|
+
filter = newFilter;
|
|
3349
|
+
filterDropdownOpen = false;
|
|
3350
|
+
|
|
3351
|
+
// Update recent files when filter changes
|
|
3352
|
+
if (!isLoading && $fileStore.root) {
|
|
3353
|
+
recentFiles = currentPath.length === 0 ? getRecentFiles() : [];
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3357
|
+
// Track if VirtualList is initialized
|
|
3358
|
+
let isVirtualListInitialized = false;
|
|
3359
|
+
|
|
3360
|
+
// Add a reactive statement to properly update visible selections when filter changes
|
|
3361
|
+
$: {
|
|
3362
|
+
if (filter) {
|
|
3363
|
+
// Force a recomputation of the current and all selected files when filter changes
|
|
3364
|
+
currentSelections = $fileStore?.root ? $validSelections(filter, sortedFilteredFiles) : [];
|
|
3365
|
+
allSelectedFiles = $fileStore?.root ? $validSelections(filter, getAllFiles($fileStore.root)) : [];
|
|
3366
|
+
// if(showLogs && showFiltersLogs) console.log(`Filter changed to ${filter}. Current visible selections:`, currentSelections.length);
|
|
3367
|
+
// if(showLogs && showFiltersLogs) console.log(`Total selected files of type ${filter} across all folders:`, allSelectedFiles.length);
|
|
3368
|
+
if (allSelectedFiles.length > 0) {
|
|
3369
|
+
// Since we don't have direct folder info on the FileSystemItem type, just log the selected files' IDs
|
|
3370
|
+
// if(showLogs && showFiltersLogs) console.log(`Selected files IDs:`, allSelectedFiles.map(f => f.id));
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
|
|
3375
|
+
// Add a reactive statement to update sourceItems when showMoveDialog changes
|
|
3376
|
+
$: if (showMoveDialog && !selectedItem) {
|
|
3377
|
+
const validFileSelections = allSelectedFiles.filter((item) => item?.type === 'file');
|
|
3378
|
+
if (validFileSelections.length > 0) {
|
|
3379
|
+
// if(showLogs) console.log('Updating sourceItems for move dialog with all selected files:', validFileSelections.length);
|
|
3380
|
+
sourceItems = [...validFileSelections];
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
|
|
3384
|
+
// Update the navigation history clearing code
|
|
3385
|
+
function clearNavigationHistory() {
|
|
3386
|
+
// Clear localStorage navigation history
|
|
3387
|
+
if (persistHistory) {
|
|
3388
|
+
try {
|
|
3389
|
+
removeFromStorage(instanceId);
|
|
3390
|
+
if(showLogs) console.log('Cleared navigation history from localStorage');
|
|
3391
|
+
} catch (error) {
|
|
3392
|
+
if(showLogs) console.error('Error clearing navigation history:', error);
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3396
|
+
// Reset navigation store
|
|
3397
|
+
navigationStore.reset();
|
|
3398
|
+
|
|
3399
|
+
// Navigate to root folder - need to find the root folder in the file store
|
|
3400
|
+
const rootFolder = $fileStore.root;
|
|
3401
|
+
if (rootFolder) {
|
|
3402
|
+
navigationStore.navigateToFolder([], true);
|
|
3403
|
+
currentFolder.set([]);
|
|
3404
|
+
currentPath = [];
|
|
3405
|
+
}
|
|
3406
|
+
}
|
|
3407
|
+
|
|
3408
|
+
// Update numberOfRecentFiles based on screen width
|
|
3409
|
+
function updateNumberOfRecentFiles() {
|
|
3410
|
+
if (mainContainerWidth > desktopBreakpoint) {
|
|
3411
|
+
// For large desktop screens, show more files
|
|
3412
|
+
const availableWidth = mainContainerWidth;
|
|
3413
|
+
// Calculate how many columns would fit nicely
|
|
3414
|
+
const gridColumns = Math.min(6, Math.floor(availableWidth / 300));
|
|
3415
|
+
// Set max files to fill at least one row
|
|
3416
|
+
numberOfRecentFiles = gridColumns * 2; // Two rows of content
|
|
3417
|
+
} else if (mainContainerWidth > tabletBreakpoint) {
|
|
3418
|
+
// Standard desktop
|
|
3419
|
+
numberOfRecentFiles = 6; // Two rows of 3
|
|
3420
|
+
} else {
|
|
3421
|
+
// Tablet and below
|
|
3422
|
+
numberOfRecentFiles = 4; // Two rows of 2
|
|
3423
|
+
}
|
|
3424
|
+
|
|
3425
|
+
if(showLogs && showRecentFilesLogs) console.log('Updated number of recent files:', numberOfRecentFiles);
|
|
3426
|
+
}
|
|
3427
|
+
|
|
3428
|
+
// Call updateNumberOfRecentFiles when mainContainerWidth changes
|
|
3429
|
+
$: {
|
|
3430
|
+
if (mainContainerWidth) {
|
|
3431
|
+
updateNumberOfRecentFiles();
|
|
3432
|
+
// Update recent files if we're in the root folder
|
|
3433
|
+
if (!isLoading && $fileStore.root && currentPath.length === 0) {
|
|
3434
|
+
recentFiles = getRecentFiles();
|
|
3435
|
+
}
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
</script>
|
|
3439
|
+
|
|
3440
|
+
<!-- COMPONENT HTML TEMPLATE -->
|
|
3441
|
+
|
|
3442
|
+
<!-- DEBUG GRID DEBUG GRID -->
|
|
3443
|
+
<DebugGrid
|
|
3444
|
+
class="file-browser-debug-grid "
|
|
3445
|
+
portalTarget={rootContainerClass}
|
|
3446
|
+
headerHeight="56px"
|
|
3447
|
+
bind:columnWidth
|
|
3448
|
+
bind:columns
|
|
3449
|
+
gridClass="app-grid"
|
|
3450
|
+
headerGridClass="app-header-grid"
|
|
3451
|
+
mainGridClass="app-main-grid"
|
|
3452
|
+
/>
|
|
3453
|
+
|
|
3454
|
+
<!-- FILE BROWSER MAIN CONTAINER -->
|
|
3455
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
3456
|
+
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
3457
|
+
<div
|
|
3458
|
+
bind:this={mainContainer}
|
|
3459
|
+
bind:clientWidth={mainContainerWidth}
|
|
3460
|
+
class="{rootContainerClass} {className ? className + ' ' : ''}w-full h-full bg-white overflow-hidden flex flex-col relative {
|
|
3461
|
+
dragActive
|
|
3462
|
+
? (dragInvalid
|
|
3463
|
+
? 'ring-1 ring-red-500/30'
|
|
3464
|
+
: hasValidFiles
|
|
3465
|
+
? 'ring-1 ring-blue-500/30'
|
|
3466
|
+
: 'ring-1 ring-gray-300/30')
|
|
3467
|
+
: ''
|
|
3468
|
+
} transition-all duration-300 focus:outline-none"
|
|
3469
|
+
style="{style ? style + ' ' : ''}height:100%;"
|
|
3470
|
+
ondragenter={!$isModalOpen ? handleDragEnter : null}
|
|
3471
|
+
ondragleave={!$isModalOpen ? handleDragLeave : null}
|
|
3472
|
+
ondrop={!$isModalOpen ? handleDrop : null}
|
|
3473
|
+
ondragover={!$isModalOpen ? handleDragOver : null}
|
|
3474
|
+
onclick={handleContainerClick}
|
|
3475
|
+
onmousedown={handleContainerMouseDown}
|
|
3476
|
+
onkeydown={handleKeyDown}
|
|
3477
|
+
tabindex="-1"
|
|
3478
|
+
>
|
|
3479
|
+
|
|
3480
|
+
<!-- FILE BROWSER HEADER -->
|
|
3481
|
+
<Header bind:this={headerEl}
|
|
3482
|
+
class="file-browser-header"
|
|
3483
|
+
style="display: {showHeader ? 'flex' : 'none'};"
|
|
3484
|
+
{currentPath}
|
|
3485
|
+
{currentPathNames}
|
|
3486
|
+
selectedFilesCount={allSelectedFiles.length}
|
|
3487
|
+
showSelectedFiles={allowSelecting}
|
|
3488
|
+
{isLoading}
|
|
3489
|
+
on:navigate={navigateToBreadcrumb}
|
|
3490
|
+
on:navigateBack={handleNavigateBack}
|
|
3491
|
+
on:navigateForward={handleNavigateForward}
|
|
3492
|
+
canGoBack={$canGoBackStore}
|
|
3493
|
+
canGoForward={$canGoForwardStore}
|
|
3494
|
+
on:toggleSelectedFiles={(e : CustomEvent) => allowSelecting && toggleModal()}
|
|
3495
|
+
showBreadcrumbs={showBreadcrumbs}
|
|
3496
|
+
/>
|
|
3497
|
+
|
|
3498
|
+
<!-- FILE BROWSER CONTROLS -->
|
|
3499
|
+
<div class="file-browser-controls flex justify-between items-center p-6 pb-0 h-[64px] widgetic-colors widgetic-radius widgetic-colors">
|
|
3500
|
+
<!-- Search Bar - Always visible -->
|
|
3501
|
+
<div class={`search-bar-container flex items-center ${(showFilters || showSorting) && mainContainerWidth > tabletBreakpoint ? 'w-2/3' : 'w-full'}`}>
|
|
3502
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
3503
|
+
<div onclick={handleSearch} class="w-full cursor-pointer">
|
|
3504
|
+
<SearchInput
|
|
3505
|
+
placeholder="Search..."
|
|
3506
|
+
value=""
|
|
3507
|
+
containerClass="w-full"
|
|
3508
|
+
onInput={() => {}}
|
|
3509
|
+
onKeydown={() => {}}
|
|
3510
|
+
onClear={() => {}}
|
|
3511
|
+
onPaste={() => {}}
|
|
3512
|
+
/>
|
|
3513
|
+
</div>
|
|
3514
|
+
</div>
|
|
3515
|
+
|
|
3516
|
+
<!-- Controls - Only show if enabled and above tablet breakpoint -->
|
|
3517
|
+
{#if (showFilters || showSorting) && mainContainerWidth > tabletBreakpoint}
|
|
3518
|
+
<div class="controls-container flex items-center gap-4">
|
|
3519
|
+
|
|
3520
|
+
<!-- Filter Controls Container -->
|
|
3521
|
+
{#if showFilters}
|
|
3522
|
+
<div class="filter-controls-container flex items-center pointer-events-auto relative z-10 widgetic-colors widgetic-radius">
|
|
3523
|
+
<!-- Filter Button -->
|
|
3524
|
+
<button
|
|
3525
|
+
class="filter-button group flex items-center gap-2 border-none bg-transparent py-2.5 rounded-small subtext text-[hsl(var(--grey5))] hover:text-[hsl(var(--grey7))] transition-colors duration-200"
|
|
3526
|
+
onclick={(e) => {
|
|
3527
|
+
e.stopPropagation();
|
|
3528
|
+
filterDropdownOpen = !filterDropdownOpen;
|
|
3529
|
+
}}
|
|
3530
|
+
>
|
|
3531
|
+
<span>Filter by {formatFilterType(filter)}</span>
|
|
3532
|
+
<IconAdjustmentsHorizontal class="h-5 w-5 text-[hsl(var(--grey5))] ml-1 transition-colors duration-200 group-hover:text-[hsl(var(--grey7))]" />
|
|
3533
|
+
</button>
|
|
3534
|
+
|
|
3535
|
+
<!-- Filter Dropdown -->
|
|
3536
|
+
{#if filterDropdownOpen}
|
|
3537
|
+
<div
|
|
3538
|
+
class="filter-dropdown absolute right-0 mt-2 w-48 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none z-50"
|
|
3539
|
+
role="menu"
|
|
3540
|
+
aria-orientation="vertical"
|
|
3541
|
+
aria-labelledby="filter-menu"
|
|
3542
|
+
>
|
|
3543
|
+
<div class="filter-dropdown-list py-1" role="none">
|
|
3544
|
+
{#each filterOptions as option}
|
|
3545
|
+
<button
|
|
3546
|
+
class="filter-dropdown-item flex items-center justify-between w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
|
3547
|
+
role="menuitem"
|
|
3548
|
+
onclick={() => {
|
|
3549
|
+
handleFilterChange(option.value as FileFilterType);
|
|
3550
|
+
}}
|
|
3551
|
+
>
|
|
3552
|
+
<span>{option.label}</span>
|
|
3553
|
+
{#if filter === option.value}
|
|
3554
|
+
<IconCheck class="h-4 w-4" />
|
|
3555
|
+
{/if}
|
|
3556
|
+
</button>
|
|
3557
|
+
{/each}
|
|
3558
|
+
</div>
|
|
3559
|
+
</div>
|
|
3560
|
+
{/if}
|
|
3561
|
+
</div>
|
|
3562
|
+
{/if}
|
|
3563
|
+
|
|
3564
|
+
<!-- Sort Controls Container -->
|
|
3565
|
+
{#if showSorting}
|
|
3566
|
+
<div class="sort-controls-container flex items-center gap-2">
|
|
3567
|
+
<select
|
|
3568
|
+
class="bg-white border border-gray-300 rounded-md px-3 py-1.5 text-sm"
|
|
3569
|
+
bind:value={$sortCriteria}
|
|
3570
|
+
>
|
|
3571
|
+
<option value="name">Name</option>
|
|
3572
|
+
<option value="date">Date</option>
|
|
3573
|
+
<option value="size">Size</option>
|
|
3574
|
+
</select>
|
|
3575
|
+
|
|
3576
|
+
<!-- Sort Direction Button -->
|
|
3577
|
+
<Button
|
|
3578
|
+
variant="ghost"
|
|
3579
|
+
size="sm"
|
|
3580
|
+
onclick={toggleSortDirection}
|
|
3581
|
+
>
|
|
3582
|
+
{$sortDirection === 'asc' ? '↑' : '↓'}
|
|
3583
|
+
</Button>
|
|
3584
|
+
</div>
|
|
3585
|
+
{/if}
|
|
3586
|
+
</div>
|
|
3587
|
+
{/if}
|
|
3588
|
+
</div>
|
|
3589
|
+
|
|
3590
|
+
<!-- FILE BROWSER CONTENT -->
|
|
3591
|
+
<div class="file-browser-content flex min-h-0 flex-col grow mr-[4px] overflow-hidden relative widgetic-colors">
|
|
3592
|
+
<!-- Loader Container -->
|
|
3593
|
+
{#if isLoading}
|
|
3594
|
+
<div class="loader-container p-6">
|
|
3595
|
+
<div class="grid grid-cols-3 gap-8">
|
|
3596
|
+
{#each Array(skeletonCount) as _}
|
|
3597
|
+
<div class="flex items-start">
|
|
3598
|
+
<LoadingSkeleton width="62px" height="54px" className="mr-4" />
|
|
3599
|
+
<div class="grow">
|
|
3600
|
+
<LoadingSkeleton width="100%" height="20px" className="mb-2" />
|
|
3601
|
+
<LoadingSkeleton width="60%" height="16px" />
|
|
3602
|
+
</div>
|
|
3603
|
+
</div>
|
|
3604
|
+
{/each}
|
|
3605
|
+
</div>
|
|
3606
|
+
</div>
|
|
3607
|
+
|
|
3608
|
+
<!-- Files container -->
|
|
3609
|
+
{:else}
|
|
3610
|
+
<!-- Main content container with Files Inside --> <!-- {!showAddToEditor ? 'overflow-y-auto px-6' : ''} -->
|
|
3611
|
+
<WScrollArea class="scroll-area-container min-h-0 flex-1" bind:element={scrollContainer} type="always">
|
|
3612
|
+
<div class="main-content-container flex flex-col p-6 pr-1" bind:this={contentContainer}>
|
|
3613
|
+
|
|
3614
|
+
<!-- Drag Select for selecting files -->
|
|
3615
|
+
{#if allowSelecting}
|
|
3616
|
+
<DragSelect
|
|
3617
|
+
container={contentContainer}
|
|
3618
|
+
enabled={allowSelecting && !$isModalOpen && maxSelections !== 1}
|
|
3619
|
+
items={[...sortedFilteredFiles, ...recentFiles]}
|
|
3620
|
+
{scrollContainer}
|
|
3621
|
+
currentFilter={filter}
|
|
3622
|
+
on:select={({ detail } : CustomEvent<{added: FileSystemItem[]}>) => {
|
|
3623
|
+
if(showLogs) console.log('FileBrowser received selection event with items:', detail.added.map(item => item.id));
|
|
3624
|
+
|
|
3625
|
+
// Get current selections from the store
|
|
3626
|
+
const currentSelectedIds = persistentSelectStore.getSelected(filter);
|
|
3627
|
+
if(showLogs) console.log('Current selected IDs in store:', currentSelectedIds);
|
|
3628
|
+
|
|
3629
|
+
if (detail.added.length > 0) {
|
|
3630
|
+
// Create a custom version of add-only to store
|
|
3631
|
+
detail.added.forEach((item : FileSystemItem) => {
|
|
3632
|
+
if (!isMobile) {
|
|
3633
|
+
if (!currentSelectedIds.includes(item.id)) {
|
|
3634
|
+
// if(showLogs) console.log('Adding new item to selection:', item.id);
|
|
3635
|
+
persistentSelectStore.toggleSelection(item, filter);
|
|
3636
|
+
} else {
|
|
3637
|
+
// if(showLogs) console.log('Item already in selection, skipping:', item.id);
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
});
|
|
3641
|
+
}
|
|
3642
|
+
}}
|
|
3643
|
+
/>
|
|
3644
|
+
{/if}
|
|
3645
|
+
|
|
3646
|
+
{#if !isEmpty}
|
|
3647
|
+
<!-- Files GRID List(VirtualList) -->
|
|
3648
|
+
<VirtualList class="content-container grow"
|
|
3649
|
+
{scrollContainer}
|
|
3650
|
+
items={[{ type: 'new-folder' }, ...sortedFilteredFiles]}
|
|
3651
|
+
itemHeight={GRID_ITEM_HEIGHT}
|
|
3652
|
+
columns={mainContainerWidth <= mobileBreakpoint ? 2 :
|
|
3653
|
+
mainContainerWidth <= tabletBreakpoint ? 3 : 4}
|
|
3654
|
+
gap={isTablet ? 24 : 26}
|
|
3655
|
+
let:item
|
|
3656
|
+
on:rangechange={() => {
|
|
3657
|
+
if (!isVirtualListInitialized) {
|
|
3658
|
+
// if(showLogs) console.log('VirtualList initialized');
|
|
3659
|
+
isVirtualListInitialized = true;
|
|
3660
|
+
}
|
|
3661
|
+
}}
|
|
3662
|
+
>
|
|
3663
|
+
<!-- Item content -->
|
|
3664
|
+
<div data-item-id={item.id}
|
|
3665
|
+
class="item-container {allowSelecting && currentSelections.some(f => f.id === item.id) ? 'selected' : ''}"
|
|
3666
|
+
>
|
|
3667
|
+
{#if item.type === 'new-folder'}
|
|
3668
|
+
<NewFolderButton on:click={handleNewFolderClick} />
|
|
3669
|
+
{:else if item.type === 'folder'}
|
|
3670
|
+
<FolderItem
|
|
3671
|
+
item={{...item, matchingFileCount: countMatchingFiles(item)} as FolderItemWithCount}
|
|
3672
|
+
currentFilter={filter as FileFilterType}
|
|
3673
|
+
gridLayout={true}
|
|
3674
|
+
on:click={() => navigateToFolder(item)}
|
|
3675
|
+
on:action={handleItemAction}
|
|
3676
|
+
/>
|
|
3677
|
+
{:else}
|
|
3678
|
+
<FileItem
|
|
3679
|
+
item={{
|
|
3680
|
+
...item,
|
|
3681
|
+
url: getCorrectFileUrl(item),
|
|
3682
|
+
thumbnail: item.thumbnail
|
|
3683
|
+
? resolveFileItemUrl({ ...item, url: item.thumbnail }, $fileStore?.basePath ?? basePath)
|
|
3684
|
+
: undefined,
|
|
3685
|
+
}}
|
|
3686
|
+
selected={allowSelecting && currentSelections.some(f => f.id === item.id)}
|
|
3687
|
+
{allowSelecting}
|
|
3688
|
+
gridLayout={true}
|
|
3689
|
+
on:click={() => handleFileClick(item)}
|
|
3690
|
+
on:select={() => handleFileSelect(item)}
|
|
3691
|
+
on:action={handleItemAction}
|
|
3692
|
+
on:delete={handleDelete}
|
|
3693
|
+
/>
|
|
3694
|
+
{/if}
|
|
3695
|
+
</div>
|
|
3696
|
+
</VirtualList>
|
|
3697
|
+
|
|
3698
|
+
<!-- Recent Files -->
|
|
3699
|
+
{#if currentPath.length === 0 && recentFiles.length > 0 && mainContainerWidth > tabletBreakpoint}
|
|
3700
|
+
<RecentFiles class="recent-files-container"
|
|
3701
|
+
{recentFiles}
|
|
3702
|
+
selectedFiles={allSelectedFiles}
|
|
3703
|
+
currentFilter={filter}
|
|
3704
|
+
{allowSelecting}
|
|
3705
|
+
{columnWidth}
|
|
3706
|
+
on:fileClick={handleRecentFileClick}
|
|
3707
|
+
on:select={handleRecentFileSelect}
|
|
3708
|
+
on:action={handleRecentFileAction}
|
|
3709
|
+
/>
|
|
3710
|
+
{/if}
|
|
3711
|
+
|
|
3712
|
+
{:else}
|
|
3713
|
+
<!-- Empty state content -->
|
|
3714
|
+
<div class="empty-content-container">
|
|
3715
|
+
|
|
3716
|
+
<!-- New Folder Button -->
|
|
3717
|
+
<div class="grid grid-cols-3 gap-8 relative z-20 pointer-events-auto">
|
|
3718
|
+
<NewFolderButton on:click={handleNewFolderClick} />
|
|
3719
|
+
</div>
|
|
3720
|
+
|
|
3721
|
+
<!-- Empty State Container -->
|
|
3722
|
+
<div class="empty-state-wrapper w-full flex justify-center items-center">
|
|
3723
|
+
<EmptyState
|
|
3724
|
+
message="No files in this folder!"
|
|
3725
|
+
height="auto"
|
|
3726
|
+
>
|
|
3727
|
+
</EmptyState>
|
|
3728
|
+
</div>
|
|
3729
|
+
</div>
|
|
3730
|
+
{/if}
|
|
3731
|
+
</div> <!-- END OF MAIN CONTENT CONTAINER -->
|
|
3732
|
+
</WScrollArea>
|
|
3733
|
+
|
|
3734
|
+
{/if}
|
|
3735
|
+
</div>
|
|
3736
|
+
|
|
3737
|
+
<!-- FILE BROWSER FOOTER -->
|
|
3738
|
+
<div class="file-browser-footer relative z-20 flex shrink-0 flex-col">
|
|
3739
|
+
{#if allowSelecting && allSelectedFiles.length > 0}
|
|
3740
|
+
<div class="control-toolbar-row flex justify-center px-4 pb-2 pt-1">
|
|
3741
|
+
<div class="control-toolbar-wrapper max-w-full overflow-x-auto">
|
|
3742
|
+
<ControlToolbar
|
|
3743
|
+
selectedFiles={allSelectedFiles}
|
|
3744
|
+
currentFilter={filter}
|
|
3745
|
+
filter={filter}
|
|
3746
|
+
allowSelecting={allowSelecting}
|
|
3747
|
+
{showAddToEditor}
|
|
3748
|
+
{addToEditorLabel}
|
|
3749
|
+
{activeFileId}
|
|
3750
|
+
{maxSelections}
|
|
3751
|
+
compact={mainContainerWidth > 0 && mainContainerWidth < 700}
|
|
3752
|
+
on:toggleSelectedFiles={toggleModal}
|
|
3753
|
+
on:send={sendToEditor}
|
|
3754
|
+
on:move={(e : any) => handleItemAction(new CustomEvent('action', { detail: { action: 'move', item: e.detail.items[0] } }))}
|
|
3755
|
+
on:delete={(e : any) => {
|
|
3756
|
+
selectedItem = null;
|
|
3757
|
+
showDeleteConfirmation = true;
|
|
3758
|
+
}}
|
|
3759
|
+
on:rename={(e : any) => handleItemAction(new CustomEvent('action', { detail: { action: 'rename', item: e.detail.item } }))}
|
|
3760
|
+
/>
|
|
3761
|
+
</div>
|
|
3762
|
+
</div>
|
|
3763
|
+
{/if}
|
|
3764
|
+
|
|
3765
|
+
<!-- FILE UPLOADER -->
|
|
3766
|
+
{#if !isLoading}
|
|
3767
|
+
<div class="file-uploader-container shrink-0 bg-white border-t border-[hsl(var(--grey1))] {isTablet ? 'px-2' : 'px-6'} {isTablet ? 'py-2' : 'py-6'} error widgetic-colors">
|
|
3768
|
+
<FileUploader
|
|
3769
|
+
bind:this={fileUploaderComponent}
|
|
3770
|
+
allowedTypes={allowedUploadTypes}
|
|
3771
|
+
currentPath={currentPath}
|
|
3772
|
+
{filter}
|
|
3773
|
+
portalTarget={mainContainer}
|
|
3774
|
+
on:fileUploaded={handleFileUploaded}
|
|
3775
|
+
on:error={(event: CustomEvent<{message: string}>) => console.error('Upload error:', event.detail)}
|
|
3776
|
+
bind:dragActive
|
|
3777
|
+
bind:dragInvalid
|
|
3778
|
+
bind:hasValidFiles
|
|
3779
|
+
bind:isDraggingFolder
|
|
3780
|
+
/>
|
|
3781
|
+
</div>
|
|
3782
|
+
{/if}
|
|
3783
|
+
</div>
|
|
3784
|
+
|
|
3785
|
+
|
|
3786
|
+
<!-- MODALS -->
|
|
3787
|
+
|
|
3788
|
+
{#if allowSelecting}
|
|
3789
|
+
<SelectedFilesModal
|
|
3790
|
+
bind:open={showModal}
|
|
3791
|
+
currentFilter={filter}
|
|
3792
|
+
target={rootContainerClass}
|
|
3793
|
+
allFiles={getAllFiles($fileStore.root)}
|
|
3794
|
+
{showAddToEditor}
|
|
3795
|
+
{addToEditorLabel}
|
|
3796
|
+
on:close={handleModalClose}
|
|
3797
|
+
on:fileUploaded={handleFileUploaded}
|
|
3798
|
+
on:navigate={handleSearchNavigate}
|
|
3799
|
+
/>
|
|
3800
|
+
{/if}
|
|
3801
|
+
|
|
3802
|
+
<SearchModal
|
|
3803
|
+
bind:open={showSearchModal}
|
|
3804
|
+
target={rootContainerClass}
|
|
3805
|
+
currentFilter={filter}
|
|
3806
|
+
on:close={handleSearchModalClose}
|
|
3807
|
+
on:navigate={handleSearchNavigate}
|
|
3808
|
+
on:preview={(event : any) => handleFileClick(event.detail)}
|
|
3809
|
+
/>
|
|
3810
|
+
|
|
3811
|
+
{#if previewFile}
|
|
3812
|
+
<FilePreview
|
|
3813
|
+
file={previewFile}
|
|
3814
|
+
on:close={closePreview}
|
|
3815
|
+
{allowSelecting}
|
|
3816
|
+
currentFilter={filter}
|
|
3817
|
+
currentFiles={previewSource === 'recent' ? recentFiles : currentViewFiles}
|
|
3818
|
+
target={rootContainerClass}
|
|
3819
|
+
on:select={(event : any) => handleFileSelect(event.detail)}
|
|
3820
|
+
on:navigate={handlePreviewNavigate}
|
|
3821
|
+
/>
|
|
3822
|
+
{/if}
|
|
3823
|
+
|
|
3824
|
+
<RenameDialog
|
|
3825
|
+
isOpen={showRenameDialog}
|
|
3826
|
+
itemName={selectedItem?.name ?? ''}
|
|
3827
|
+
itemType={selectedItem?.type === 'folder' ? 'folder' : 'file'}
|
|
3828
|
+
itemId={selectedItem?.id ?? ''}
|
|
3829
|
+
confirmLabel="Rename"
|
|
3830
|
+
cancelLabel="Cancel"
|
|
3831
|
+
target={rootContainerClass}
|
|
3832
|
+
shouldUseCustomRenameFunction={true}
|
|
3833
|
+
on:rename={handleRename}
|
|
3834
|
+
on:cancel={() => { showRenameDialog = false; selectedItem = null; }}
|
|
3835
|
+
/>
|
|
3836
|
+
|
|
3837
|
+
<MoveDialog
|
|
3838
|
+
bind:isOpen={showMoveDialog}
|
|
3839
|
+
itemName={itemToMove?.name || ''}
|
|
3840
|
+
{folderStructure}
|
|
3841
|
+
currentFilter={filter}
|
|
3842
|
+
{sourceItems}
|
|
3843
|
+
currentPath={currentPath}
|
|
3844
|
+
target={rootContainerClass}
|
|
3845
|
+
on:resetNavigation={handleResetNavigation}
|
|
3846
|
+
on:navigate={({ detail }: CustomEvent<NavigateEventDetail>) => {
|
|
3847
|
+
const newPath = Array.isArray(detail.targetFolderId)
|
|
3848
|
+
? detail.targetFolderId
|
|
3849
|
+
: [detail.targetFolderId];
|
|
3850
|
+
|
|
3851
|
+
// Check if we're already in this path
|
|
3852
|
+
const isSamePath = newPath.length === currentPath.length &&
|
|
3853
|
+
newPath.every((id: string, index: number) => id === currentPath[index]);
|
|
3854
|
+
|
|
3855
|
+
if (isSamePath) {
|
|
3856
|
+
if(showLogs) console.log('Already in target path, skipping navigation');
|
|
3857
|
+
return;
|
|
3858
|
+
}
|
|
3859
|
+
|
|
3860
|
+
navigationStore.navigateToFolder(newPath, true);
|
|
3861
|
+
currentFolder.set(newPath);
|
|
3862
|
+
currentPath = newPath;
|
|
3863
|
+
|
|
3864
|
+
if(showLogs) console.log('Navigating to folder:', newPath);
|
|
3865
|
+
|
|
3866
|
+
// Wait for the navigation and DOM update
|
|
3867
|
+
setTimeout(() => {
|
|
3868
|
+
if (detail.movedItems) {
|
|
3869
|
+
// Scroll the first moved item into view with instant scrolling
|
|
3870
|
+
const firstMovedItem = detail.movedItems[0];
|
|
3871
|
+
if (firstMovedItem) {
|
|
3872
|
+
scrollItemIntoView(firstMovedItem.id, undefined, false);
|
|
3873
|
+
|
|
3874
|
+
// Add wave animation to all moved items
|
|
3875
|
+
detail.movedItems.forEach((item: { id: string }) => {
|
|
3876
|
+
const itemElement = document.querySelector(`[data-item-id="${item.id}"]`);
|
|
3877
|
+
if (itemElement) {
|
|
3878
|
+
itemElement.classList.add('wave-goodbye');
|
|
3879
|
+
setTimeout(() => {
|
|
3880
|
+
itemElement.classList.remove('wave-goodbye');
|
|
3881
|
+
}, 600);
|
|
3882
|
+
}
|
|
3883
|
+
});
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
}, 100);
|
|
3887
|
+
}}
|
|
3888
|
+
/>
|
|
3889
|
+
|
|
3890
|
+
<ActionModal
|
|
3891
|
+
bind:isOpen={showDeleteConfirmation}
|
|
3892
|
+
title={selectedItem?.type === 'folder' ? 'Delete folder' : (allSelectedFiles.length > 1 ? 'Delete items' : 'Delete file')}
|
|
3893
|
+
message={selectedItem?.type === 'folder'
|
|
3894
|
+
? `Delete '${selectedItem?.name}' and all content inside?`
|
|
3895
|
+
: (allSelectedFiles.length > 1
|
|
3896
|
+
? `Are you sure you want to delete ${allSelectedFiles.length} items?`
|
|
3897
|
+
: `Delete '${allSelectedFiles[0]?.name}'?`)}
|
|
3898
|
+
items={selectedItem?.type === 'folder' ? [selectedItem] : allSelectedFiles}
|
|
3899
|
+
target={rootContainerClass}
|
|
3900
|
+
on:confirm={handleDelete}
|
|
3901
|
+
on:cancel={() => {
|
|
3902
|
+
showDeleteConfirmation = false;
|
|
3903
|
+
}}
|
|
3904
|
+
actionType="delete"
|
|
3905
|
+
confirmVariant="attention"
|
|
3906
|
+
modalType="delete"
|
|
3907
|
+
/>
|
|
3908
|
+
|
|
3909
|
+
<NewItemDialog
|
|
3910
|
+
bind:isOpen={showNewFolderDialog}
|
|
3911
|
+
itemType="folder"
|
|
3912
|
+
modalType="newFolder"
|
|
3913
|
+
placeholder="folder name..."
|
|
3914
|
+
target={rootContainerClass}
|
|
3915
|
+
{currentPath}
|
|
3916
|
+
{currentPathNames}
|
|
3917
|
+
showTitle={false}
|
|
3918
|
+
confirmLabel="Create"
|
|
3919
|
+
cancelLabel="Cancel"
|
|
3920
|
+
on:create={handleNewFolder}
|
|
3921
|
+
on:cancel={() => { showNewFolderDialog = false; }}
|
|
3922
|
+
/>
|
|
3923
|
+
|
|
3924
|
+
|
|
3925
|
+
<!-- STYLES -->
|
|
3926
|
+
<style>
|
|
3927
|
+
|
|
3928
|
+
/* Enable text selection in modals */
|
|
3929
|
+
:global(.modal-content-inner-container),
|
|
3930
|
+
:global(.base-modal-portal),
|
|
3931
|
+
:global(.modal-content-root-container),
|
|
3932
|
+
:global(.modal-backdrop-container) {
|
|
3933
|
+
user-select: text !important;
|
|
3934
|
+
-webkit-user-select: text !important;
|
|
3935
|
+
-moz-user-select: text !important;
|
|
3936
|
+
-ms-user-select: text !important;
|
|
3937
|
+
}
|
|
3938
|
+
|
|
3939
|
+
/* Enable text selection in input fields */
|
|
3940
|
+
:global(input),
|
|
3941
|
+
:global(textarea),
|
|
3942
|
+
:global(select),
|
|
3943
|
+
:global([contenteditable="true"]) {
|
|
3944
|
+
user-select: text !important;
|
|
3945
|
+
-webkit-user-select: text !important;
|
|
3946
|
+
-moz-user-select: text !important;
|
|
3947
|
+
-ms-user-select: text !important;
|
|
3948
|
+
cursor: text !important;
|
|
3949
|
+
}
|
|
3950
|
+
|
|
3951
|
+
/* Ensure smooth transitions for search button */
|
|
3952
|
+
.search-bar-container button,
|
|
3953
|
+
.search-bar-container button span,
|
|
3954
|
+
.search-bar-container button :global(svg) {
|
|
3955
|
+
transition: color 300ms ease, background-color 300ms ease, border-color 300ms ease !important;
|
|
3956
|
+
}
|
|
3957
|
+
|
|
3958
|
+
/* Add styles for the SearchInput component to make it read-only and clickable */
|
|
3959
|
+
:global(.search-bar-container .w-full input) {
|
|
3960
|
+
cursor: pointer !important;
|
|
3961
|
+
pointer-events: all !important;
|
|
3962
|
+
user-select: none !important;
|
|
3963
|
+
}
|
|
3964
|
+
|
|
3965
|
+
/* Prevent scrolling when showing empty state */
|
|
3966
|
+
.empty-state-wrapper {
|
|
3967
|
+
position: absolute;
|
|
3968
|
+
top: 0;
|
|
3969
|
+
left: 0;
|
|
3970
|
+
right: 0;
|
|
3971
|
+
bottom: 0;
|
|
3972
|
+
display: flex;
|
|
3973
|
+
flex-direction: column;
|
|
3974
|
+
align-items: center;
|
|
3975
|
+
justify-content: center;
|
|
3976
|
+
overflow: hidden;
|
|
3977
|
+
padding-top: 80px;
|
|
3978
|
+
padding-bottom: 80px;
|
|
3979
|
+
z-index: 10;
|
|
3980
|
+
}
|
|
3981
|
+
|
|
3982
|
+
/* Ensure the empty-content-container doesn't block interactions */
|
|
3983
|
+
.empty-content-container {
|
|
3984
|
+
position: relative;
|
|
3985
|
+
width: 100%;
|
|
3986
|
+
height: 100%;
|
|
3987
|
+
}
|
|
3988
|
+
</style>
|
|
3989
|
+
</div>
|