Showing preview only (2,081K chars total). Download the full file or copy to clipboard to get everything.
Repository: cozy/cozy-drive
Branch: master
Commit: bba1ddfdfaef
Files: 674
Total size: 1.8 MB
Directory structure:
gitextract_5cx5gfwh/
├── .bundlemonrc
├── .editorconfig
├── .github/
│ └── workflows/
│ ├── ci-cd.yml
│ ├── codeql-analysis.yml
│ └── create-bump-pr.yml
├── .gitignore
├── .nvmrc
├── .transifexrc.tpl
├── .tx/
│ └── config
├── CHANGELOG.md
├── CODEOWNERS
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── babel.config.js
├── docs/
│ └── nextcloud.md
├── eslint.config.mjs
├── jest.config.js
├── jestHelpers/
│ ├── ConsoleUsageReporter.js
│ ├── mocks/
│ │ ├── fileMock.js
│ │ ├── iconMock.js
│ │ ├── pdfjsWorkerMock.js
│ │ └── svgRawMock.js
│ ├── setup.js
│ └── setupFilesAfterEnv.js
├── manifest.webapp
├── package.json
├── public/
│ ├── browserconfig.xml
│ └── manifest.json
├── renovate.json
├── rsbuild.config.mjs
├── src/
│ ├── assets/
│ │ └── onlyOffice/
│ │ ├── slide.pptx
│ │ ├── spreadsheet.xlsx
│ │ └── text.docx
│ ├── components/
│ │ ├── App/
│ │ │ └── App.jsx
│ │ ├── Bar.jsx
│ │ ├── Button/
│ │ │ ├── BackButton.jsx
│ │ │ ├── MoreButton.jsx
│ │ │ ├── OpenFolderButton.tsx
│ │ │ └── index.jsx
│ │ ├── ColorPicker/
│ │ │ ├── ColorPicker.jsx
│ │ │ ├── constants.js
│ │ │ └── index.jsx
│ │ ├── Error/
│ │ │ ├── Empty.jsx
│ │ │ ├── ErrorShare.jsx
│ │ │ ├── NotFound.jsx
│ │ │ ├── Oops.jsx
│ │ │ ├── empty.styl
│ │ │ └── oops.styl
│ │ ├── FileHistory/
│ │ │ ├── HistoryModal.jsx
│ │ │ ├── index.jsx
│ │ │ └── styles.styl
│ │ ├── FilesRealTimeQueries.jsx
│ │ ├── FilesViewerLoading.jsx
│ │ ├── FolderPicker/
│ │ │ ├── FolderPicker.spec.jsx
│ │ │ ├── FolderPicker.tsx
│ │ │ ├── FolderPickerAddFolderItem.tsx
│ │ │ ├── FolderPickerBody.spec.jsx
│ │ │ ├── FolderPickerBody.tsx
│ │ │ ├── FolderPickerContentCozy.tsx
│ │ │ ├── FolderPickerContentLoadMore.tsx
│ │ │ ├── FolderPickerContentLoader.tsx
│ │ │ ├── FolderPickerContentNextcloud.tsx
│ │ │ ├── FolderPickerContentPublic.tsx
│ │ │ ├── FolderPickerContentSharedDrive.tsx
│ │ │ ├── FolderPickerContentSharedDriveRoot.tsx
│ │ │ ├── FolderPickerFooter.tsx
│ │ │ ├── FolderPickerHeader.spec.js
│ │ │ ├── FolderPickerHeader.tsx
│ │ │ ├── FolderPickerHeaderIllustration.tsx
│ │ │ ├── FolderPickerListItem.tsx
│ │ │ ├── FolderPickerTopbar.spec.jsx
│ │ │ ├── FolderPickerTopbar.tsx
│ │ │ ├── helpers.spec.js
│ │ │ ├── helpers.ts
│ │ │ └── types.ts
│ │ ├── IconPicker/
│ │ │ ├── IconColorPicker.jsx
│ │ │ ├── IconIndex.js
│ │ │ ├── IconPicker.jsx
│ │ │ ├── NoneIcon.jsx
│ │ │ ├── constants.js
│ │ │ └── index.jsx
│ │ ├── IconStack/
│ │ │ ├── index.jsx
│ │ │ └── styles.styl
│ │ ├── Icons/
│ │ │ ├── Drive.jsx
│ │ │ └── DriveText.jsx
│ │ ├── LoaderModal.jsx
│ │ ├── Migration/
│ │ │ ├── MigrationProgressBanner.jsx
│ │ │ └── MigrationProgressBanner.spec.jsx
│ │ ├── MoreMenu.tsx
│ │ ├── MoveValidationModals/
│ │ │ └── index.tsx
│ │ ├── PushBanner/
│ │ │ ├── PushBanner.spec.jsx
│ │ │ ├── PushBannerProvider.jsx
│ │ │ ├── QuotaBanner.jsx
│ │ │ ├── QuotaBanner.spec.jsx
│ │ │ └── index.jsx
│ │ ├── RightClick/
│ │ │ ├── RightClickAddMenu.jsx
│ │ │ ├── RightClickFileMenu.jsx
│ │ │ └── RightClickProvider.jsx
│ │ ├── SideBarAccordion.jsx
│ │ ├── TrashedBanner.jsx
│ │ ├── pushClient/
│ │ │ ├── Banner.jsx
│ │ │ ├── Button.jsx
│ │ │ ├── __mocks__/
│ │ │ │ └── index.js
│ │ │ ├── index.d.ts
│ │ │ ├── index.js
│ │ │ └── index.spec.js
│ │ ├── useDocument.jsx
│ │ └── useHead.jsx
│ ├── config/
│ │ ├── config.json
│ │ └── sort.js
│ ├── constants/
│ │ └── config.js
│ ├── contexts/
│ │ ├── ClipboardProvider.spec.tsx
│ │ └── ClipboardProvider.tsx
│ ├── declarations.d.ts
│ ├── hooks/
│ │ ├── helpers.d.ts
│ │ ├── helpers.js
│ │ ├── index.js
│ │ ├── useCurrentFileId.jsx
│ │ ├── useCurrentFileId.spec.jsx
│ │ ├── useCurrentFolderId.jsx
│ │ ├── useCurrentFolderId.spec.jsx
│ │ ├── useDebounce.jsx
│ │ ├── useDisplayedFolder.spec.jsx
│ │ ├── useDisplayedFolder.tsx
│ │ ├── useFolderSort/
│ │ │ ├── index.spec.jsx
│ │ │ └── index.ts
│ │ ├── useKeyboardShortcuts.spec.jsx
│ │ ├── useKeyboardShortcuts.tsx
│ │ ├── useMoreMenuActions.jsx
│ │ ├── useOnLongPress/
│ │ │ ├── helpers.js
│ │ │ ├── helpers.spec.jsx
│ │ │ └── index.js
│ │ ├── useParentFolder.jsx
│ │ ├── useParentFolder.spec.jsx
│ │ ├── useRecentFiles.jsx
│ │ ├── useRecentFiles.spec.jsx
│ │ ├── useRecentIcons.jsx
│ │ ├── useRecentIcons.spec.jsx
│ │ ├── useRedirectLink.jsx
│ │ ├── useRedirectLink.spec.jsx
│ │ ├── useShiftSelection/
│ │ │ ├── helpers.spec.ts
│ │ │ ├── helpers.ts
│ │ │ ├── index.spec.tsx
│ │ │ └── index.tsx
│ │ ├── useTransformFolderListHasSharedDriveShortcuts/
│ │ │ ├── index.spec.jsx
│ │ │ └── index.tsx
│ │ └── useUpdateFavicon/
│ │ ├── constants.ts
│ │ ├── helpers.spec.js
│ │ ├── helpers.ts
│ │ ├── index.spec.jsx
│ │ └── index.tsx
│ ├── lib/
│ │ ├── AcceptingSharingContext.jsx
│ │ ├── DriveProvider.jsx
│ │ ├── FabProvider.jsx
│ │ ├── FuzzyPathSearch.js
│ │ ├── FuzzyPathSearch.spec.js
│ │ ├── ModalContext.tsx
│ │ ├── ThumbnailSizeContext.tsx
│ │ ├── ViewSwitcherContext.tsx
│ │ ├── appMetadata.js
│ │ ├── dacc/
│ │ │ ├── dacc-run.js
│ │ │ ├── dacc-run.spec.js
│ │ │ ├── dacc.js
│ │ │ ├── dacc.spec.js
│ │ │ └── query.js
│ │ ├── doctypes.js
│ │ ├── entries.js
│ │ ├── entries.spec.js
│ │ ├── extraDoctypes.js
│ │ ├── flags.js
│ │ ├── getFileMimetype.js
│ │ ├── getMimeTypeIcon.js
│ │ ├── konnectors.js
│ │ ├── logger.js
│ │ ├── migration/
│ │ │ ├── qualification.js
│ │ │ └── qualification.spec.js
│ │ ├── path.js
│ │ ├── path.spec.js
│ │ ├── queries.js
│ │ ├── react-cozy-helpers/
│ │ │ ├── ModalManager.jsx
│ │ │ ├── QueryParameter.js
│ │ │ ├── QueryParameter.spec.js
│ │ │ └── index.js
│ │ ├── registerClientPlugins.js
│ │ └── sentry.js
│ ├── locales/
│ │ ├── ar.json
│ │ ├── de.json
│ │ ├── en.json
│ │ ├── es.json
│ │ ├── fr.json
│ │ ├── index.js
│ │ ├── it.json
│ │ ├── ja.json
│ │ ├── ko.json
│ │ ├── nl.json
│ │ ├── nl_NL.json
│ │ ├── pl.json
│ │ ├── ru.json
│ │ ├── vi.json
│ │ ├── zh_CN.json
│ │ └── zh_TW.json
│ ├── models/
│ │ ├── Contact.js
│ │ ├── Contact.spec.js
│ │ └── index.js
│ ├── modules/
│ │ ├── actionmenu/
│ │ │ └── ActionMenuWithHeader.jsx
│ │ ├── actions/
│ │ │ ├── addItems.jsx
│ │ │ ├── components/
│ │ │ │ ├── addToFavorites.tsx
│ │ │ │ ├── duplicateTo.tsx
│ │ │ │ ├── moveTo.jsx
│ │ │ │ ├── personalizeFolder.js
│ │ │ │ ├── removeFromFavorites.tsx
│ │ │ │ └── selectable.tsx
│ │ │ ├── details.jsx
│ │ │ ├── divider.jsx
│ │ │ ├── download.jsx
│ │ │ ├── helpers.js
│ │ │ ├── helpers.spec.js
│ │ │ ├── index.js
│ │ │ ├── index.spec.js
│ │ │ ├── infos.jsx
│ │ │ ├── policies.spec.ts
│ │ │ ├── policies.ts
│ │ │ ├── qualify.jsx
│ │ │ ├── rename.jsx
│ │ │ ├── restore.jsx
│ │ │ ├── select.jsx
│ │ │ ├── selectAll.jsx
│ │ │ ├── share.jsx
│ │ │ ├── summariseByAI.jsx
│ │ │ ├── trash.jsx
│ │ │ ├── types.ts
│ │ │ ├── utils.js
│ │ │ ├── utils.spec.js
│ │ │ └── versions.jsx
│ │ ├── breadcrumb/
│ │ │ ├── components/
│ │ │ │ ├── Breadcrumb.jsx
│ │ │ │ ├── Breadcrumb.spec.jsx
│ │ │ │ ├── DesktopBreadcrumb.jsx
│ │ │ │ ├── DesktopBreadcrumb.spec.jsx
│ │ │ │ ├── DesktopBreadcrumbItem.jsx
│ │ │ │ ├── MobileAwareBreadcrumb.jsx
│ │ │ │ ├── MobileAwareBreadcrumb.spec.jsx
│ │ │ │ ├── MobileBreadcrumb.jsx
│ │ │ │ ├── MobileBreadcrumb.spec.jsx
│ │ │ │ └── __snapshots__/
│ │ │ │ └── Breadcrumb.spec.jsx.snap
│ │ │ ├── hooks/
│ │ │ │ ├── useBreadcrumbPath.jsx
│ │ │ │ └── useBreadcrumbPath.spec.jsx
│ │ │ ├── styles/
│ │ │ │ └── breadcrumb.styl
│ │ │ └── utils/
│ │ │ ├── fetchFolder.js
│ │ │ └── fetchFolder.spec.js
│ │ ├── certifications/
│ │ │ ├── CertificationTooltip.jsx
│ │ │ ├── index.jsx
│ │ │ ├── useExtraColumns.jsx
│ │ │ └── useExtraColumns.spec.jsx
│ │ ├── drive/
│ │ │ ├── AddMenu/
│ │ │ │ ├── AddMenu.jsx
│ │ │ │ ├── AddMenuContent.jsx
│ │ │ │ ├── AddMenuContent.spec.jsx
│ │ │ │ ├── AddMenuProvider.jsx
│ │ │ │ └── AddMenuProvider.spec.jsx
│ │ │ ├── DeleteConfirm.jsx
│ │ │ ├── DeleteConfirm.spec.jsx
│ │ │ ├── FabWithAddMenuContext.jsx
│ │ │ ├── RenameInput.jsx
│ │ │ ├── RenameInput.spec.jsx
│ │ │ ├── Toolbar/
│ │ │ │ ├── components/
│ │ │ │ │ ├── AddButton.jsx
│ │ │ │ │ ├── AddFolderItem.jsx
│ │ │ │ │ ├── AddMenuItem.jsx
│ │ │ │ │ ├── CreateDocsItem.jsx
│ │ │ │ │ ├── CreateNoteItem.jsx
│ │ │ │ │ ├── CreateOnlyOfficeItem.jsx
│ │ │ │ │ ├── CreateShortcut.jsx
│ │ │ │ │ ├── DownloadButtonItem.jsx
│ │ │ │ │ ├── FavoritesItem.jsx
│ │ │ │ │ ├── InsideRegularFolder.jsx
│ │ │ │ │ ├── InsideRegularFolder.spec.jsx
│ │ │ │ │ ├── LeaveSharedDriveButtonItem.jsx
│ │ │ │ │ ├── MoreMenu.jsx
│ │ │ │ │ ├── MoreMenu.spec.jsx
│ │ │ │ │ ├── Scanner/
│ │ │ │ │ │ ├── Scanner.spec.tsx
│ │ │ │ │ │ ├── ScannerMenuItem.tsx
│ │ │ │ │ │ ├── ScannerProvider.tsx
│ │ │ │ │ │ └── useScannerService.ts
│ │ │ │ │ ├── SearchButton.jsx
│ │ │ │ │ ├── ShortcutCreationModal.jsx
│ │ │ │ │ ├── ShortcutCreationModal.spec.jsx
│ │ │ │ │ ├── UploadItem.jsx
│ │ │ │ │ └── ViewSwitcher.jsx
│ │ │ │ ├── delete/
│ │ │ │ │ ├── DeleteItem.jsx
│ │ │ │ │ ├── DeleteItem.spec.jsx
│ │ │ │ │ ├── delete.jsx
│ │ │ │ │ └── delete.spec.jsx
│ │ │ │ ├── index.jsx
│ │ │ │ ├── move/
│ │ │ │ │ └── MoveItem.jsx
│ │ │ │ ├── personalizeFolder/
│ │ │ │ │ └── PersonalizeFolderItem.jsx
│ │ │ │ ├── selectable/
│ │ │ │ │ └── SelectableItem.jsx
│ │ │ │ └── share/
│ │ │ │ ├── ShareButton.jsx
│ │ │ │ ├── ShareItem.jsx
│ │ │ │ ├── SharedRecipients.jsx
│ │ │ │ ├── helpers.js
│ │ │ │ └── helpers.spec.js
│ │ │ ├── helpers.ts
│ │ │ └── rename.js
│ │ ├── duplicate/
│ │ │ └── components/
│ │ │ └── DuplicateModal.tsx
│ │ ├── filelist/
│ │ │ ├── AddFolder.jsx
│ │ │ ├── AddFolder.spec.jsx
│ │ │ ├── AddFolderCard.jsx
│ │ │ ├── AddFolderRow.jsx
│ │ │ ├── File.jsx
│ │ │ ├── File.spec.jsx
│ │ │ ├── FileList.jsx
│ │ │ ├── FileListBody.jsx
│ │ │ ├── FileListHeader.jsx
│ │ │ ├── FileListHeaderDesktop.jsx
│ │ │ ├── FileListHeaderMobile.jsx
│ │ │ ├── FileListRowsPlaceholder.jsx
│ │ │ ├── FileOpener.jsx
│ │ │ ├── FileOpener.spec.jsx
│ │ │ ├── FilePlaceholder.jsx
│ │ │ ├── FilenameInput.jsx
│ │ │ ├── FilenameInput.spec.jsx
│ │ │ ├── HeaderCell.jsx
│ │ │ ├── LoadMore.jsx
│ │ │ ├── LoadMoreV2.jsx
│ │ │ ├── MobileSortMenu.jsx
│ │ │ ├── cells/
│ │ │ │ ├── CarbonCopy.jsx
│ │ │ │ ├── CertificationsIcons.jsx
│ │ │ │ ├── CertificationsIcons.spec.js
│ │ │ │ ├── ElectronicSafe.jsx
│ │ │ │ ├── Empty.jsx
│ │ │ │ ├── FileAction.jsx
│ │ │ │ ├── FileName.jsx
│ │ │ │ ├── LastUpdate.jsx
│ │ │ │ ├── SelectBox.jsx
│ │ │ │ ├── ShareContent.jsx
│ │ │ │ ├── SharingShortcutBadge.jsx
│ │ │ │ ├── Size.jsx
│ │ │ │ ├── Status.jsx
│ │ │ │ └── index.jsx
│ │ │ ├── duck.js
│ │ │ ├── fileopener.styl
│ │ │ ├── getCaretPositionFromPoint.js
│ │ │ ├── headers/
│ │ │ │ ├── CarbonCopy.jsx
│ │ │ │ ├── ElectronicSafe.jsx
│ │ │ │ └── index.jsx
│ │ │ ├── helpers.ts
│ │ │ ├── icons/
│ │ │ │ ├── BadgeKonnector.jsx
│ │ │ │ ├── FileIcon.jsx
│ │ │ │ ├── FileIcon.spec.jsx
│ │ │ │ ├── FileIconMime.jsx
│ │ │ │ ├── FileIconShortcut.jsx
│ │ │ │ ├── FileThumbnail.tsx
│ │ │ │ └── SharingShortcutIcon.jsx
│ │ │ ├── useFormattedUpdatedAt.js
│ │ │ └── virtualized/
│ │ │ ├── AddFolderRow.jsx
│ │ │ ├── GridFile.jsx
│ │ │ └── cells/
│ │ │ ├── Cell.jsx
│ │ │ ├── FileAction.jsx
│ │ │ ├── FileName.jsx
│ │ │ ├── FileNamePath.jsx
│ │ │ ├── LastUpdate.jsx
│ │ │ ├── Share.jsx
│ │ │ ├── ShareContent.jsx
│ │ │ ├── SharingShortcutBadge.jsx
│ │ │ └── Size.jsx
│ │ ├── folder/
│ │ │ ├── components/
│ │ │ │ └── FolderBody.jsx
│ │ │ └── hooks/
│ │ │ ├── useNeedsToWait.jsx
│ │ │ └── useScrollToTop.jsx
│ │ ├── layout/
│ │ │ ├── DummyLayout.tsx
│ │ │ ├── Layout.jsx
│ │ │ ├── Main.jsx
│ │ │ └── Topbar.jsx
│ │ ├── move/
│ │ │ ├── MoveInsideSharedFolderModal.jsx
│ │ │ ├── MoveModal.jsx
│ │ │ ├── MoveModal.spec.jsx
│ │ │ ├── MoveOutsideSharedFolderModal.jsx
│ │ │ ├── MoveSharedFolderInsideAnotherModal.jsx
│ │ │ ├── components/
│ │ │ │ └── MoveModalSuccessAction.tsx
│ │ │ ├── helpers.js
│ │ │ ├── helpers.spec.js
│ │ │ └── hooks/
│ │ │ ├── useCancelable.jsx
│ │ │ └── useMove.tsx
│ │ ├── navigation/
│ │ │ ├── AppRoute.jsx
│ │ │ ├── ExternalNavItem.jsx
│ │ │ ├── ExternalRedirect.jsx
│ │ │ ├── FavoriteList.tsx
│ │ │ ├── FavoriteListItem.tsx
│ │ │ ├── Index.jsx
│ │ │ ├── Index.spec.js
│ │ │ ├── Nav.jsx
│ │ │ ├── NavContent.tsx
│ │ │ ├── NavContext.jsx
│ │ │ ├── NavItem.jsx
│ │ │ ├── NavLink.jsx
│ │ │ ├── PublicNoteRedirect.tsx
│ │ │ ├── SharingsNavItem.jsx
│ │ │ ├── components/
│ │ │ │ ├── ExternalDriveListItem.tsx
│ │ │ │ ├── ExternalDrivesList.tsx
│ │ │ │ └── FileLink.tsx
│ │ │ ├── duck/
│ │ │ │ ├── actions.jsx
│ │ │ │ ├── actions.spec.jsx
│ │ │ │ ├── async.js
│ │ │ │ ├── index.js
│ │ │ │ ├── reducer.js
│ │ │ │ ├── utils.js
│ │ │ │ └── utils.spec.js
│ │ │ ├── helpers.js
│ │ │ └── hooks/
│ │ │ ├── helpers.spec.js
│ │ │ ├── helpers.ts
│ │ │ ├── useFileLink.tsx
│ │ │ └── useSharedDriveLink.tsx
│ │ ├── nextcloud/
│ │ │ ├── components/
│ │ │ │ ├── NextcloudBanner.tsx
│ │ │ │ ├── NextcloudBreadcrumb.jsx
│ │ │ │ ├── NextcloudDeleteConfirm.jsx
│ │ │ │ ├── NextcloudFolderBody.jsx
│ │ │ │ ├── NextcloudToolbar.jsx
│ │ │ │ ├── NextcloudTrashFolderBody.tsx
│ │ │ │ └── actions/
│ │ │ │ ├── addFolder.jsx
│ │ │ │ ├── deleteNextcloudFile.tsx
│ │ │ │ ├── downloadNextcloudFile.jsx
│ │ │ │ ├── downloadNextcloudFolder.jsx
│ │ │ │ ├── duplicateNextcloudFile.jsx
│ │ │ │ ├── moveNextcloud.jsx
│ │ │ │ ├── openWithinNextcloud.jsx
│ │ │ │ ├── rename.jsx
│ │ │ │ ├── restoreNextcloudFile.tsx
│ │ │ │ ├── shareNextcloudFile.jsx
│ │ │ │ ├── trash.jsx
│ │ │ │ └── upload.jsx
│ │ │ ├── helpers.ts
│ │ │ └── hooks/
│ │ │ ├── useNextcloudCurrentFolder.tsx
│ │ │ ├── useNextcloudEntries.tsx
│ │ │ ├── useNextcloudFolder.tsx
│ │ │ ├── useNextcloudInfos.jsx
│ │ │ └── useNextcloudPath.jsx
│ │ ├── paste/
│ │ │ ├── index.js
│ │ │ ├── index.spec.js
│ │ │ ├── utils.js
│ │ │ └── utils.spec.js
│ │ ├── public/
│ │ │ ├── DownloadFilesButton.jsx
│ │ │ ├── LightFileViewer.jsx
│ │ │ ├── LightFileViewer.spec.jsx
│ │ │ ├── PublicLayout.jsx
│ │ │ ├── PublicProvider.tsx
│ │ │ ├── PublicToolbar.jsx
│ │ │ ├── PublicToolbarByLink.jsx
│ │ │ ├── PublicToolbarCozyToCozy.jsx
│ │ │ ├── PublicToolbarMoreMenu.jsx
│ │ │ └── helpers.js
│ │ ├── routeUtils.js
│ │ ├── search/
│ │ │ ├── components/
│ │ │ │ ├── BarSearchAutosuggest.jsx
│ │ │ │ ├── BarSearchInputGroup.jsx
│ │ │ │ ├── SearchEmpty.jsx
│ │ │ │ ├── SuggestionItem.jsx
│ │ │ │ ├── SuggestionItemSkeleton.jsx
│ │ │ │ ├── SuggestionItemTextHighlighted.jsx
│ │ │ │ ├── SuggestionItemTextSecondary.jsx
│ │ │ │ ├── SuggestionListSkeleton.jsx
│ │ │ │ ├── helpers.js
│ │ │ │ ├── helpers.spec.jsx
│ │ │ │ └── styles.styl
│ │ │ └── hooks/
│ │ │ └── useSearch.jsx
│ │ ├── selection/
│ │ │ ├── RectangularSelection.jsx
│ │ │ ├── RectangularSelection.styl
│ │ │ ├── SelectionBar.tsx
│ │ │ ├── SelectionProvider.d.ts
│ │ │ ├── SelectionProvider.jsx
│ │ │ ├── SelectionProvider.spec.jsx
│ │ │ └── types.ts
│ │ ├── selectors.js
│ │ ├── selectors.spec.js
│ │ ├── services/
│ │ │ ├── components/
│ │ │ │ ├── Embeder.jsx
│ │ │ │ └── IntentHandler.jsx
│ │ │ ├── index.jsx
│ │ │ └── services.styl
│ │ ├── shareddrives/
│ │ │ ├── components/
│ │ │ │ ├── SharedDriveBreadcrumb.jsx
│ │ │ │ ├── SharedDriveFolderBody.jsx
│ │ │ │ └── actions/
│ │ │ │ ├── leaveSharedDrive.js
│ │ │ │ └── shareSharedDrive.js
│ │ │ ├── helpers.ts
│ │ │ └── hooks/
│ │ │ ├── useQueryMultipleSharedDriveFolders.tsx
│ │ │ ├── useSharedDriveFolder.spec.jsx
│ │ │ ├── useSharedDriveFolder.tsx
│ │ │ ├── useSharedDriveFolderHelpers.ts
│ │ │ └── useSharedDrives.js
│ │ ├── trash/
│ │ │ └── components/
│ │ │ ├── DestroyConfirm.tsx
│ │ │ ├── EmptyTrashConfirm.tsx
│ │ │ ├── TrashBreadcrumb.tsx
│ │ │ ├── TrashToolbar.spec.jsx
│ │ │ ├── TrashToolbar.tsx
│ │ │ └── actions/
│ │ │ ├── destroy.tsx
│ │ │ └── emptyTrash.tsx
│ │ ├── upload/
│ │ │ ├── Dropzone.jsx
│ │ │ ├── DropzoneDnD.jsx
│ │ │ ├── DropzoneTeaser.jsx
│ │ │ ├── NewItemHighlightProvider.jsx
│ │ │ ├── UploadButton.jsx
│ │ │ ├── UploadLimitDialog.jsx
│ │ │ ├── UploadQueue.jsx
│ │ │ ├── index.js
│ │ │ └── index.spec.js
│ │ ├── viewer/
│ │ │ ├── CallToAction.jsx
│ │ │ ├── CallToAction.spec.jsx
│ │ │ ├── Fallback.jsx
│ │ │ ├── FileOpenerExternal.jsx
│ │ │ ├── FilesViewer.jsx
│ │ │ ├── FilesViewer.spec.jsx
│ │ │ ├── MoreMenu.jsx
│ │ │ ├── NoViewerButton.jsx
│ │ │ ├── barviewer.styl
│ │ │ ├── helpers.js
│ │ │ └── styles.styl
│ │ └── views/
│ │ ├── AI/
│ │ │ └── AIAssistantPaywallView.tsx
│ │ ├── Drive/
│ │ │ ├── DriveFolderView.jsx
│ │ │ ├── DriveFolderView.spec.jsx
│ │ │ ├── FilesViewerDrive.jsx
│ │ │ ├── HarvestBanner.jsx
│ │ │ ├── KonnectorRoutes.jsx
│ │ │ ├── SharedDrivesFolderView.tsx
│ │ │ └── useTrashRedirect.jsx
│ │ ├── Favorites/
│ │ │ └── FavoritesView.tsx
│ │ ├── Folder/
│ │ │ ├── ColoredFolder.jsx
│ │ │ ├── CustomizedIcon.jsx
│ │ │ ├── FolderCustomizer.jsx
│ │ │ ├── FolderDuplicateView.tsx
│ │ │ ├── FolderView.jsx
│ │ │ ├── FolderViewBody.jsx
│ │ │ ├── FolderViewBreadcrumb.jsx
│ │ │ ├── FolderViewBreadcrumb.spec.jsx
│ │ │ ├── FolderViewHeader.jsx
│ │ │ ├── OldFolderViewBreadcrumb.jsx
│ │ │ ├── PublicFolderDuplicateView.tsx
│ │ │ ├── helpers.js
│ │ │ ├── helpers.spec.js
│ │ │ ├── hooks/
│ │ │ │ ├── useFileSorting.js
│ │ │ │ └── useFileSorting.spec.js
│ │ │ ├── syncHelpers.js
│ │ │ ├── syncHelpers.spec.js
│ │ │ ├── useSyncingFakeFile.js
│ │ │ └── virtualized/
│ │ │ ├── AddFolderWrapper.jsx
│ │ │ ├── FolderViewBody.jsx
│ │ │ ├── FolderViewBodyContent.jsx
│ │ │ ├── Grid.jsx
│ │ │ ├── GridWrapper.jsx
│ │ │ ├── Table.jsx
│ │ │ ├── helpers.js
│ │ │ ├── useScrollToHighlightedItem.jsx
│ │ │ └── useScrollToHighlightedItem.spec.jsx
│ │ ├── Modal/
│ │ │ ├── DuplicateSharedDriveFilesView.jsx
│ │ │ ├── MoveFilesView.jsx
│ │ │ ├── MovePublicFilesView.tsx
│ │ │ ├── MoveSharedDriveFilesView.jsx
│ │ │ ├── QualifyFileView.jsx
│ │ │ ├── ShareDisplayedFolderView.jsx
│ │ │ └── ShareFileView.jsx
│ │ ├── Nextcloud/
│ │ │ ├── NextcloudDeleteView.jsx
│ │ │ ├── NextcloudDestroyView.tsx
│ │ │ ├── NextcloudDuplicateView.tsx
│ │ │ ├── NextcloudFolderView.jsx
│ │ │ ├── NextcloudMoveView.jsx
│ │ │ ├── NextcloudTrashEmptyView.tsx
│ │ │ └── NextcloudTrashView.tsx
│ │ ├── OnlyOffice/
│ │ │ ├── Create.jsx
│ │ │ ├── Editor.jsx
│ │ │ ├── Editor.spec.jsx
│ │ │ ├── Error.jsx
│ │ │ ├── Loading.jsx
│ │ │ ├── OnlyOfficeAIAssistantPanel.tsx
│ │ │ ├── OnlyOfficePaywallView.jsx
│ │ │ ├── OnlyOfficeProvider.jsx
│ │ │ ├── ReadOnlyFab.jsx
│ │ │ ├── Title.jsx
│ │ │ ├── Toolbar/
│ │ │ │ ├── BackButton.jsx
│ │ │ │ ├── EditButton.jsx
│ │ │ │ ├── FileIcon.jsx
│ │ │ │ ├── FileName.jsx
│ │ │ │ ├── HomeIcon.jsx
│ │ │ │ ├── HomeLinker.jsx
│ │ │ │ ├── Separator.jsx
│ │ │ │ ├── Sharing.jsx
│ │ │ │ ├── SummarizeByAIButtonWrapper.tsx
│ │ │ │ ├── helpers.js
│ │ │ │ ├── index.jsx
│ │ │ │ ├── index.spec.jsx
│ │ │ │ └── styles.styl
│ │ │ ├── View.jsx
│ │ │ ├── components/
│ │ │ │ ├── FileDeletedModal.jsx
│ │ │ │ └── FileDivergedModal.jsx
│ │ │ ├── config.js
│ │ │ ├── helpers.js
│ │ │ ├── helpers.spec.js
│ │ │ ├── index.jsx
│ │ │ ├── styles.styl
│ │ │ ├── useConfig.jsx
│ │ │ └── useCreateFile.jsx
│ │ ├── Public/
│ │ │ ├── PublicFileViewer.jsx
│ │ │ ├── PublicFolderView.jsx
│ │ │ ├── PublicFolderView.spec.jsx
│ │ │ ├── usePublicFileByIdsQuery.spec.jsx
│ │ │ ├── usePublicFileByIdsQuery.tsx
│ │ │ ├── usePublicFilesQuery.jsx
│ │ │ ├── usePublicFilesQuery.spec.jsx
│ │ │ └── usePublicWritePermissions.jsx
│ │ ├── Recent/
│ │ │ ├── FilesViewerRecent.jsx
│ │ │ ├── index.jsx
│ │ │ └── index.spec.jsx
│ │ ├── Search/
│ │ │ └── SearchView.jsx
│ │ ├── SharedDrive/
│ │ │ ├── CreateSharedDriveButton.jsx
│ │ │ ├── FilesViewerSharedDrive.jsx
│ │ │ └── SharedDriveFolderView.jsx
│ │ ├── Sharings/
│ │ │ ├── FilesViewerSharings.jsx
│ │ │ ├── SharingsFolderView.jsx
│ │ │ ├── index.jsx
│ │ │ ├── index.spec.jsx
│ │ │ └── withSharedDocumentIds.jsx
│ │ ├── Trash/
│ │ │ ├── FilesViewerTrash.jsx
│ │ │ ├── TrashDestroyView.tsx
│ │ │ ├── TrashEmptyView.tsx
│ │ │ ├── TrashFolderView.jsx
│ │ │ └── TrashFolderView.spec.jsx
│ │ ├── Upload/
│ │ │ ├── UploadTypes.ts
│ │ │ ├── UploadUtils.ts
│ │ │ ├── UploaderComponent.tsx
│ │ │ ├── __mocks__/
│ │ │ │ └── cozy-intent.ts
│ │ │ ├── useResumeFromFlagship.spec.tsx
│ │ │ ├── useResumeFromFlagship.ts
│ │ │ └── useUploadFromFlagship.ts
│ │ ├── testUtils.jsx
│ │ ├── useUpdateDocumentTitle.jsx
│ │ └── useUpdateDocumentTitle.spec.js
│ ├── queries/
│ │ └── index.ts
│ ├── store/
│ │ ├── __mocks__/
│ │ │ └── configureStore.js
│ │ ├── configureStore.js
│ │ ├── persistedState.js
│ │ └── rootReducer.js
│ ├── styles/
│ │ ├── actionmenu.styl
│ │ ├── coz-bar-size.styl
│ │ ├── dropzone.styl
│ │ ├── filelist.styl
│ │ ├── filenameinput.styl
│ │ ├── folder-customizer.styl
│ │ ├── folder-picker.styl
│ │ ├── folder-view.styl
│ │ ├── main.styl
│ │ ├── toolbar.styl
│ │ └── topbar.styl
│ └── targets/
│ ├── browser/
│ │ ├── index.ejs
│ │ ├── index.jsx
│ │ ├── setupAppContext.js
│ │ └── wdyr.js
│ ├── intents/
│ │ ├── index.ejs
│ │ └── index.jsx
│ ├── public/
│ │ ├── components/
│ │ │ ├── AppRouter.jsx
│ │ │ └── AppRouter.spec.jsx
│ │ ├── index.ejs
│ │ ├── index.jsx
│ │ ├── localeHelper.js
│ │ └── localeHelper.spec.js
│ └── services/
│ ├── dacc.js
│ └── qualificationMigration.js
├── test/
│ ├── __mocks__/
│ │ ├── fileMock.js
│ │ └── mockedRouter.js
│ ├── components/
│ │ ├── AppLike.jsx
│ │ ├── FolderContent.jsx
│ │ ├── FolderContent.spec.jsx
│ │ └── __snapshots__/
│ │ └── File.spec.js.snap
│ ├── data.js
│ ├── dummies/
│ │ ├── dummyBreadcrumbPath.js
│ │ └── dummyFile.js
│ ├── generate.js
│ ├── helpers/
│ │ └── index.js
│ ├── jestLib/
│ │ └── json-transformer.js
│ └── setup.jsx
├── transifex.yml
└── tsconfig.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .bundlemonrc
================================================
{
"baseDir": "./build",
"pathLabels": {
"chunkId": "[\\d-]+"
},
"files": [
{
"path": "static/js/<chunkId>.<hash>.js"
},
{
"path": "static/js/cozy.<hash>.js"
},
{
"path": "static/js/main.<hash>.js"
},
{
"path": "static/js/lib-react.<hash>.js"
},
{
"path": "static/js/lib-router.<hash>.js"
},
{
"path": "static/css/cozy.<hash>.css"
},
{
"path": "static/css/main.<hash>.css"
},
{
"path": "public/<hash>.js"
},
{
"path": "public/static/js/<chunkId>.<hash>.js"
},
{
"path": "public/static/js/public.<hash>.js"
},
{
"path": "public/static/js/cozy.<hash>.js"
},
{
"path": "public/static/js/lib-react.<hash>.js"
},
{
"path": "public/static/js/lib-router.<hash>.js"
},
{
"path": "public/static/css/cozy.<hash>.css"
},
{
"path": "public/static/css/public.<hash>.css"
},
{
"path": "services/dacc.js"
},
{
"path": "services/qualificationMigration.js"
},
{
"path": "<hash>.js"
},
{
"path": "index.html"
},
{
"path": "assets/manifest.json"
},
{
"path": "manifest.webapp"
}
],
"groups": [
{
"path": "**/*.js"
},
{
"path": "**/*.css"
},
{
"path": "**/*.{png,svg,ico}"
}
],
"reportOutput": [
"github"
]
}
================================================
FILE: .editorconfig
================================================
root = true
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
[*.{jade,pug}]
trim_trailing_whitespace = false
[*.styl]
indent_size = 4
[*.xml]
indent_size = 4
================================================
FILE: .github/workflows/ci-cd.yml
================================================
name: CI/CD
on:
pull_request:
push:
branches:
- master
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
env:
MATTERMOST_CHANNEL: '{"dev":"appvengers","beta":"appvengers,publication","stable":"appvengers,publication"}'
MATTERMOST_HOOK_URL: ${{ secrets.MATTERMOST_HOOK_URL }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
jobs:
build:
name: Build and publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint
run: yarn lint
- name: Test
run: yarn test
- name: Build
run: yarn build
- name: BundleMon
uses: lironer/bundlemon-action@v1
continue-on-error: true
- name: Set SSH for downcloud
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.DOWNCLOUD_SSH_KEY }}
- name: Publish
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
run: yarn run cozyPublish --yes
================================================
FILE: .github/workflows/codeql-analysis.yml
================================================
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ master, prod ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '26 3 * * 1'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
================================================
FILE: .github/workflows/create-bump-pr.yml
================================================
name: 'Create Bump PR'
on:
workflow_dispatch:
inputs:
version:
description: 'New version'
required: true
permissions:
contents: write
pull-requests: write
jobs:
bump:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Create new branch
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
git checkout -b chore/bump-version-${{ inputs.version }}
- name: Bump version
run: |
sed -i 's/"version": "[^"]*"/"version": "${{ inputs.version }}"/g' package.json
sed -i 's/"version": "[^"]*"/"version": "${{ inputs.version }}"/g' manifest.webapp
- name: Commit changes
run: |
git add package.json
git add manifest.webapp
git commit -m "chore: Bump version to ${{ inputs.version }}"
- name: Push changes
run: git push origin chore/bump-version-${{ inputs.version }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Pull Request
run: gh pr create -B master -H chore/bump-version-${{ inputs.version }} --title 'Bump ${{ inputs.version }}' --body 'This PR bumps the version to ${{ inputs.version }}.'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
================================================
FILE: .gitignore
================================================
# NPM
node_modules/
npm-debug.log
yarn-error.log
# Build
build/
# Test
coverage/
.consoleUsageReporter.json
# Stack
./storage/
storage/
# Reports
reports/
# Default
!.gitkeep
# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
desktop.ini
# Editors / IDEs
.floo
.flooignore
.brackets.json
.vscode
# cozy-jobs-cli
.token.json
konnector-dev-config.json
# SWC
.swc
.opencode
================================================
FILE: .nvmrc
================================================
20
================================================
FILE: .transifexrc.tpl
================================================
[https://www.transifex.com]
rest_hostname = https://rest.api.transifex.com
================================================
FILE: .tx/config
================================================
[main]
host = https://www.transifex.com
[o:cozy:p:cozy-drive:r:e8e90edbf54aede8b7b026659d6fe40a]
file_filter = src/locales/<lang>.json
source_file = src/locales/en.json
source_lang = en
type = KEYVALUEJSON
================================================
FILE: CHANGELOG.md
================================================
# 1.45.0
## ✨ Features
## 🐛 Bug Fixes
## 🔧 Tech
# 1.44.0
## ✨ Features
* Improvements to DACC service
## 🐛 Bug Fixes
* Remove double elevator on file list on public pages
* Fix issue on file upload
* Fix display when moving element to the root
## 🔧 Tech
* Use new DACC API
* Remove verbose mode
* Add all files for bundlemon and make it drastically sensitive
# 1.43.0
## ✨ Features
* Upgrade cozy-bar@7.20.1 to be able to call onSelect function
* Improve speed of search suggestion by preventing fetch notes url until click
* Update cozy-stack-client and cozy-pouch-link to sync with cozy-client version
* Update cozy-ui
- Modify Viewers to handle [68.0.0 BC](https://github.com/cozy/cozy-ui/releases/tag/v68.0.0)
- Fix on progress bar when uploading files [[68.4.0]](https://github.com/cozy/cozy-ui/releases/tag/v68.4.0)
- re-enable the Viewer's download button from cozy/cozy-ui#2234 [[74.4.0]](https://github.com/cozy/cozy-ui/releases/tag/v74.4.0)
* Update cozy-scripts for Amirale development
* Add visual feedback when uploading on a public view
* Cache on clients request. Specially useful when the user didn't hide the "Install Cozy Drive for desktop" banner.
## 🐛 Bug Fixes
* Improve cozy-bar implementation to fix UI bugs in Amirale
* Fix navigation through mobile Flagship on Note creation and opening
* Remove unused contacts permissions on Photos
* fix in photos: timeline query needs select fields to be completed
## 🔧 Tech
* Move dacc-run file to a lib folder to prevent it occurring in build
* Shortcut links are now opened directly in the webview when executed inside the Flagship mobile app
* fix: Viewer issue, make search backward compatible, add cache to the clients query
# 1.42.1
## 🐛 Bug Fixes
* Fix services that were broken due to latest cozy-client update [[PR]](https://github.com/cozy/cozy-client/pull/1180)
# 1.42.0
## 🐛 Bug Fixes
* Disable sharing on public file viewer
## 🔧 Tech
* Remove useless props to Viewer + useless Viewer footer/panel code
# 1.41.0
## ✨ Features
* When displaying cozy-home from Cozy's native application, the Support Us is not displayed
* Upgrade Cozy-Scripts to enable service-worker
* Photos: Fix pagination issue
* Change Sentry url
* Display tiny thumbnail instead of small
* Display thumbnail for PDF (behind a flag)
* Support client-side encrypted files visualization
* Disable unsuported items inside encrypted folder
## 🐛 Bug Fixes
* Compute sizes in MB instead of MiB in dacc service.
* Query files based on their uploaded date in dacc service.
* Do not query encryption files when flag is not set
* Fix upload on shared folders
## 🔧 Tech
* Upgrade bundlemon to run on master pipeline and explicit delta on PR
* Add pull request template, explicit CHANGELOG.md to update
* Update several dependencies packages
* Publish in our internal communication tool, when new versions of the applications are released
* Update documentation about standalone mode and Transifex
* Add script command to execute version update for drive and photos simultaneously
* Clear mocks automatically in the configuration of Jest, our test runner
* Minor improvements in the code revealed by our linters
* Remove react-autosuggest as not used directly in this package
* Remove react-tooltip as not used directly in this package
* Upgrade eslint-cozy-config-app to use eslint@v7
* Unregister any service worker that could have been registered during development
* Improve a fragile test, breaking while some Node 16 pipeline
* Add codeowners in the repository
* Upgrade cozy-client for flagship app
* Upgrade cozy-ui for matomo
# 1.40.0
## 🐛 Bug Fixes
* Escape public name in public cozy-to-cozy sharing view
* Fix upload when file name contains characters like `#` or `&`
* Fix AppIcon issue
## 🔧 Tech
* Update several dependencies packages
* Remove cozy-jobs-cli useless devDependencies packages
* Remove piwik-react-router useless dependencies packages
* Add date attribute to dacc flag
* Add generic build command
* Move [dependabot](https://github.com/dependabot) config file to correct location
* Fix auto-merge job what disallowed used merge commits
* Remove Drive Android job
# 1.39.0
## ✨ Features
* Use MUI Breadcrumb with fully fetched path
* Add feature flag on Breadcrumb on public view
* Allow all users to see progress on upload file
* DACC service to send anonymized measures about the file sizes grouped by app/konnector
* Implement cozy-bar AA navigation
* Log sentry exception on click on add menu when offline
* Upgrade cozy-client to allow all users to see progress on upload file
* Upgrade cozy-ui to benefit of new version of material-ui component
## 🐛 Bug Fixes
* Upgrade cozy-ui to make upload progress bar size fixed
* Upload: return average remaining time each 3 seconds
## 🔧 Tech
* Format style files of the full repository to respect the Cozy Stylint config
* Update several dependencies packages
* Remove node-uuid unused package
* Configure the bot [dependabot](https://github.com/dependabot) to commit according to our convention
* Use only one syntax of data-testid
# 1.38.0
## ✨ Features
* Filename is displayed in title when hovering the line.
* Add multiple import at once for Android
* Remove Pouch adapter migration
## 🐛 Bug Fixes
* Do not update files in parallel in the qualification migration service, as it might fail in nsjail for too many files
* Fix MoveModal breadcrumb
* Display reasons of incorrect file name (illegal characters, forbidden name)
* Prevent errors during upload of file inside Dropzone
* Handle better icon inside the searchbar
* Upgrade cozy-client in order to fix albums page from photos
## 🔧 Tech
* Use `<SharingBannerPlugin />` and `useSharingInfos()` from `cozy-sharing` instead of internal components
* Fixed an error in Search result when the result contained at least one Cozy Note
* Update cordova to 8.1.2 and cordova-android to 9.1.0
* Upgrade cozy-client, cozy-scanner caniuse-lite and fix tests
* Upgrade cozy-sharing to fix typo in French
* Add locales in gitignore
* Explicit full path when importing cozy-ui component inside doc
# 1.37.0
## 🐛 Bug Fixes
* Fixed an error on mobile that was preventing users to long tap in order to trigger multiple files selection
* Fixed an error in directory tree names appearing under filenames where sometimes, the path appeared scrambled
* Fixed an error where creating a directory sent two save actions instead of one
* Added a missing loading status on delete confirm modal button
* Fixed issues related to recent view not going where it should when navigating back and forth in directory paths
## 🔧 Tech
* Add CodeQL in order to scan the code 🚫
* Add rel noopener on target blank link
================================================
FILE: CODEOWNERS
================================================
# General code owners
* @JF-Cozy @zatteo @rezk2ll @lethemanh @doubleface @lenhanphung
================================================
FILE: CONTRIBUTING.md
================================================
How to contribute to Cozy Drive?
====================================
Thank you for your interest in contributing to Cozy! There are many ways to contribute, and we appreciate all of them.
Security Issues
---------------
If you discover a security issue, please bring it to our attention right away! Please **DO NOT** file a public issue, instead send your report privately to security AT cozycloud DOT cc.
Security reports are greatly appreciated and we will publicly thank you for it. We currently do not offer a paid security bounty program, but are not ruling it out in the future.
Bug Reports
-----------
While bugs are unfortunate, they're a reality in software. We can't fix what we don't know about, so please report liberally. If you're not sure if something is a bug or not, feel free to file a bug anyway.
Opening an issue is as easy as following [this link][issues] and filling out the fields. Here are some things you can write about your bug:
- A short summary
- What did you try, step by step?
- What did you expect?
- What did happen instead?
- What is the version of the Cozy Drive?
Pull Requests
-------------
Please keep in mind that:
- Pull-Requests point to the `master` branch
- You need to cover your code and feature by tests
- You may add documentation in the `/docs` directory to explain your choices if needed
- We recommend to use [task lists][checkbox] to explain steps / features in your Pull-Request description
- you do _not_ need to build app to submit a PR
- you should update the Transifex source locale file if you modify it for your feature needs (see [Localization section in README][localization])
### Workflow
Pull requests are the primary mechanism we use to change Cozy. GitHub itself has some [great documentation][pr] on using the Pull Request feature. We use the _fork and pull_ model described there.
#### Step 1: Fork
Fork the project on GitHub and [check out your copy locally][forking].
```
$ git clone github.com/cozy/cozy-drive.git
$ cd cozy-drive
$ git remote add fork git://github.com/yourusername/cozy-drive.git
```
#### Step 2: Branch
Create a branch and start hacking:
```
$ git checkout -b my-branch origin/master
```
#### Step 3: Code
Well, we think you know how to do that. Just be sure to follow the coding guidelines from the community ([standard JS][stdjs], comment the code, etc).
#### Step 4: Test
Don't forget to add tests and be sure they are green:
```
$ cd cozy-drive
$ npm run test
```
#### Step 5: Commit
Writing [good commit messages][commitmsg] is important. A commit message should describe what changed and why.
#### Step 6: Rebase
Use `git rebase` (_not_ `git merge`) to sync your work from time to time.
```
$ git fetch origin
$ git rebase origin/master my-branch
```
#### Step 7: Push
```
$ git push -u fork my-branch
```
Go to https://github.com/yourusername/cozy-drive and select your branch. Click the 'Pull Request' button and fill out the form.
Alternatively, you can use [hub] to open the pull request from your terminal:
```
$ git pull-request -b master -m "My PR message" -o
```
Pull requests are usually reviewed within a few days. If there are comments to address, apply your changes in a separate commit and push that to your branch. Post a comment in the pull request afterwards; GitHub doesn't send out notifications when you add commits.
Writing documentation
---------------------
Documentation improvements are very welcome. We try to keep a good documentation in the `/docs` folder. But, you know, we are developers, we can forget to document important stuff that look obvious to us. And documentation can always be improved.
Translations
------------
The Cozy Drive is translated on a platform called [Transifex][tx]. [This tutorial][tx-start] can help you to learn how to make your first steps here. If you have any question, don't hesitate to ask us!
Community
---------
You can help us by making our community even more vibrant. For example, you can write a blog post, take some videos, answer the questions on [the forum][forum], organize new meetups, and speak about what you like in Cozy!
[issues]: https://github.com/cozy/cozy-drive/issues/new
[pr]: https://help.github.com/categories/collaborating-with-issues-and-pull-requests/
[forking]: http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html
[stdjs]: http://standardjs.com/
[commitmsg]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[localization]: https://github.com/cozy/cozy-drive/blob/master/README.md#localization
[hub]: https://hub.github.com/
[tx]: https://www.transifex.com/cozy/
[tx-start]: https://help.transifex.com/en/articles/6248698-getting-started-as-a-translator
[forum]: https://forum.cozy.io/
================================================
FILE: LICENSE
================================================
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.
================================================
FILE: README.md
================================================
# Twake Drive
<p align="center">
<a href="https://github.com/linagora/twake-drive">
<img src="./docs/twake-drive-banner.jpeg" alt="banner">
</a>
<p align="center">
<b align="center">The open-source alternative to Google Drive.</b>
<br />
<a href="https://twake.app"><strong>Learn more »</strong></a>
<br />
<br />
<a href="https://twake-drive.com">Website</a>
|
<a href="https://github.com/linagora/twake-drive/issues">Issues</a>
</p>
</p>
## About
<img width="100%!" alt="booking-screen" src="./docs/cozy-drive.png">
## What's Drive?
Twake Drive makes your file management easy. Main features are:
- File tree
- Files and folders upload.
- Files and folders sharing (via URLs)
- Files and folders search
## Getting Started
_:pushpin: Note:_ [Yarn] is the official Node package manager of Twake Drive. Don't hesitate to [install Yarn][yarn-install]
### Install
Starting the Drive app requires you to [setup a dev environment][setup].
You can then clone the app repository and install dependencies:
```sh
$ git clone https://github.com/linagora/twake-drive.git
$ cd twake-drive
$ yarn install
```
:pushpin: Don't forget to set the local node version indicated in the `.nvmrc` before doing a `yarn install`.
Twake Drive use a standard set of _npm scripts_ to run common tasks, like watch, lint, test, build…
### Run in dev mode
Using a watcher - with Hot Module Replacement:
```sh
$ cd twake-drive
$ yarn watch
$ cozy-stack serve --appdir drive:/<project_absolute_path>/twake-drive/build/drive --disable-csp
```
Or directly build the app (static file generated):
```sh
$ cd twake-drive
$ yarn build
$ cozy-stack serve --appdir drive:/<project_absolute_path>/twake-drive/build/drive
```
Your app is available at http://drive.cozy.localhost:8080/#/folder
Note: it's mandatory to explicit to cozy-stack the folder of the build that should be served, to be able to run the app.
### Run it inside the VM
You can view your current running app, you can use the [cozy-stack docker image][cozy-stack-docker]:
```sh
# in a terminal, run your app in watch mode
$ cd twake-drive
$ yarn watch
```
```sh
# in another terminal, run the docker container
$ docker run --rm -it -p 8080:8080 -v "$(pwd)/build/drive":/data/cozy-app/drive cozy/cozy-app-dev
```
Your app is available at http://drive.cozy.tools:8080.
## Advanced case
### Share and send mails in development
Twake Drive let users [share documents from twake to twake](https://github.com/cozy/cozy-stack/blob/master/docs/sharing.md#cozy-to-cozy-sharing).
Meet Alice and Bob.
Alice wants to share a folder with Bob.
Alice clicks on the share button and fills in the email input with Bob's email address.
Bob receives an email with a _« Accept the sharing »_ button.
Bob clicks on that button and is redirected to Alice's twake to enter his own twake url to link both twakes.
Bob sees Alice's shared folder in his own twake.
🤔 But how could we do this scenario on binary cozy-stack development environment?
If you develop with the [cozy-stack CLI](https://github.com/cozy/cozy-stack/blob/master/docs/cli/cozy-stack.md), you have to run [MailHog](https://github.com/mailhog/MailHog) on your computer and tell `cozy-stack serve` where to find the mail server with some [options](https://github.com/cozy/cozy-stack/blob/master/docs/cli/cozy-stack_serve.md#options):
```
./cozy-stack serve --appdir drive:../twake-drive/build --mail-disable-tls --mail-port 1025
```
_This commands assumes you `git clone` [twake-drive](https://github.com/linagora/twake-drive) in the same folder than you `git clone` [cozy-stack](https://github.com/cozy/cozy-stack)._
Then simply run `mailhog` and open http://cozy.tools:8025/.
#### Retrieve sent emails
With MailHog, **every email** sent by cozy-stack is caught. That means the email address _does not have to be a real one_, ie. `bob@cozy`, `bob@cozy.tools` are perfectly fine. It _could be a real one_, but the email will not reach the real recipient's inbox, say `contact@cozycloud.cc`.
### Living on the edge
[Cozy-ui] is our frontend stack library that provides common styles and components accross the whole Twake React apps. You can use it for you own application to follow the official Twake's guidelines and styles. If you need to develop / hack cozy-ui, it's sometimes more useful to develop on it through another app. You can do it by cloning cozy-ui locally and link it to yarn local index:
```sh
git clone https://github.com/cozy/cozy-ui.git
cd cozy-ui
yarn install
yarn link
```
then go back to your app project and replace the distributed cozy-ui module with the linked one:
```sh
cd twake-drive
yarn link cozy-ui
```
You can now run the watch task and your project will hot-reload each times a cozy-ui source file is touched.
###### Troubleshooting
Consider using [rlink] instead of `yarn link`
[Cozy-client] is our API library that provides an unified API on top of the cozy-stack. If you need to develop / hack cozy-client in parallel of your application, you can use the same trick that we used with [cozy-ui]: yarn linking.
### Tests
Tests are run by [jest] under the hood, and written using [chai] and [sinon]. You can easily run the tests suite with:
```sh
$ cd twake-drive
$ yarn test
```
:pushpin: Don't forget to update / create new tests when you contribute to code to keep the app the consistent.
### Open a Pull-Request
If you want to work on Drive and submit code modifications, feel free to open pull-requests! See the [contributing guide][contribute] for more information about how to properly open pull-requests.
## Community
### Localization
Localization and translations are handled by [Transifex][tx].
As a _translator_, you can login to [Transifex][tx-signin] (using your Github account) and claim access to the [app repository][tx-app]. Locales are pulled [by the pipeline][yarn tx in travis.yml] when app is build before publishing.
As a _developer_, you must configure the [Transifex CLI][tx-cli], and claim access as _maintainer_ to the [app repository][tx-app]. Then please **only update** the source locale file (usually `en.json` in client and/or server parts), and push it to Transifex repository using the `tx push -s` command.
If you were using a [transifex-client](tx-client), you must move to [Transifex CLI](tx-cli) to be compatible with the v3 API.
The transifex configuration file is still in an old version. Please use the previous client for the moment [https://github.com/transifex/transifex-client/](https://github.com/transifex/transifex-client/).
## License
Twake Drive is developed by Linagora and distributed under the [AGPL v3 license][agpl-3.0].
[cozy]: https://cozy.io 'Cozy Cloud'
[setup]: https://docs.cozy.io/en/tutorials/app/#install-the-development-environment 'Cozy dev docs: Set up the Development Environment'
[yarn]: https://yarnpkg.com/
[yarn-install]: https://yarnpkg.com/en/docs/install
[cozy-ui]: https://github.com/cozy/cozy-ui
[rlink]: https://gist.github.com/ptbrowne/add609bdcf4396d32072acc4674fff23
[cozy-client]: https://github.com/cozy/cozy-client/
[cozy-stack-docker]: https://github.com/cozy/cozy-stack/blob/master/docs/client-app-dev.md#with-docker
[doctypes]: https://cozy.github.io/cozy-doctypes/
[bill-doctype]: https://github.com/cozy/cozy-konnector-libs/blob/master/models/bill.js
[konnector-doctype]: https://github.com/cozy/cozy-konnector-libs/blob/master/models/base_model.js
[konnectors]: https://github.com/cozy/cozy-konnector-libs
[agpl-3.0]: https://www.gnu.org/licenses/agpl-3.0.html
[contribute]: CONTRIBUTING.md
[tx]: https://www.transifex.com/cozy/
[tx-signin]: https://www.transifex.com/signin/
[tx-app]: https://www.transifex.com/cozy/cozy-drive/dashboard/
[tx-translate]: https://www.transifex.com/cozy/cozy-drive/translate/
[tx-cli]: https://developers.transifex.com/docs/cli
[tx-client]: https://github.com/transifex/transifex-client
[libera]: https://web.libera.chat/#cozycloud
[forum]: https://forum.cozy.io/
[github]: https://github.com/cozy/
[twitter]: https://twitter.com/linagora
[nvm]: https://github.com/creationix/nvm
[cozy-dev]: https://github.com/cozy/cozy-dev/
[jest]: https://jestjs.io/fr/
[chai]: http://chaijs.com/
[sinon]: http://sinonjs.org/
[checkbox]: https://help.github.com/articles/basic-writing-and-formatting-syntax/#task-lists
[yarn tx in travis.yml]: .travis.yml#L41
================================================
FILE: babel.config.js
================================================
module.exports = {
presets: ['cozy-app', '@babel/env']
}
================================================
FILE: docs/nextcloud.md
================================================
# Nextcloud
The integration of Nextcloud within cozy-drive relies heavily on cozy-client and the proxy made by cozy-stack ([doc](https://docs.cozy.io/en/cozy-stack/nextcloud/)). This implies 2 main constraints that are worth mentioning if you want to understand the code better.
**1. Obtain a folder itself**
The query to `io.cozy.remote.nextcloud.files` can only retrieve the contents of one folder. To avoid this problem, we query its parent and filter by id to get data about.
**2. Reload data after mutation**
The mutations doesn't have any effect on the local store because we cannot update it with the request's response like for `io.cozy.files` and there are no real-time event that would update. To avoid this problem, we reset the affected queries with `client.reset(queryId)`.
When the query involves moving a file, the destination query is privileged. The cache of the source query will be updated when cozy-client receives the reset query answer. This avoids an additional network request. If the query does not exist, then we reset the source query.
================================================
FILE: eslint.config.mjs
================================================
import basics from 'eslint-config-cozy-app/basics'
import cozyReact from 'eslint-config-cozy-app/react'
const baseImportOrderRule = basics.find(c => c.rules?.['import/order'])?.rules[
'import/order'
]
const baseImportOrderOptions = baseImportOrderRule[1]
const basePathGroups = baseImportOrderOptions.pathGroups
export default [
...cozyReact,
{
rules: {
'import/order': [
'warn',
{
...baseImportOrderOptions,
pathGroups: [
...basePathGroups,
{ pattern: '**/*.styl', group: 'index', position: 'after' },
{ pattern: 'test/**/*', group: 'index' },
{ pattern: 'lib/**/*', group: 'index' },
{ pattern: 'hooks/**/*', group: 'index' },
{ pattern: 'components/**/*', group: 'index' },
{ pattern: 'modules/**/*', group: 'index' },
{ pattern: 'assets/**/*', group: 'index' },
{ pattern: 'models/**/*', group: 'index' },
{ pattern: 'config/**/*', group: 'index' },
{ pattern: 'constants/**/*', group: 'index' },
{ pattern: 'locales/**/*', group: 'index' },
{ pattern: 'queries', group: 'index' }
]
}
]
}
}
]
================================================
FILE: jest.config.js
================================================
module.exports = {
roots: ['<rootDir>/src'],
setupFiles: ['<rootDir>/jestHelpers/setup.js'],
setupFilesAfterEnv: ['<rootDir>/jestHelpers/setupFilesAfterEnv.js'],
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'styl'],
moduleNameMapper: {
'.(png|gif|jpe?g)$': '<rootDir>/jestHelpers/mocks/fileMock.js',
'.svg$': '<rootDir>/jestHelpers/mocks/iconMock.js',
'\\?raw$': '<rootDir>/jestHelpers/mocks/svgRawMock.js',
'.styl$': 'identity-obj-proxy',
'\\.(css|less)$': 'identity-obj-proxy',
'^locales/.*': '<rootDir>/src/locales/en.json',
'^models(.*)': '<rootDir>/src/models$1',
'^sharing(.*)': '<rootDir>/src/sharing$1',
'^authentication(.*)': '<rootDir>/src/authentication$1',
'^viewer(.*)': '<rootDir>/src/viewer$1',
'^react-cozy-helpers(.*)': '<rootDir>/src/lib/react-cozy-helpers$1',
'^components(.*)': '<rootDir>/src/components$1',
'^hooks(.*)': '<rootDir>/src/hooks$1',
'^test(.*)': '<rootDir>/test/$1',
'^lib(.*)': '<rootDir>/src/lib$1',
'react-pdf/dist/esm/pdf.worker.entry':
'<rootDir>/jestHelpers/mocks/pdfjsWorkerMock.js',
'^cozy-client$': 'cozy-client/dist/index.js',
'^react-redux': '<rootDir>/node_modules/react-redux',
'^cozy-ui/react(.*)$': '<rootDir>/node_modules/cozy-ui/transpiled/react$1',
'^config/(.*)': '<rootDir>/src/config/$1',
'^constants/(.*)': '<rootDir>/src/constants/$1',
'^modules/(.*)': '<rootDir>/src/modules/$1',
'^queries(.*)': '<rootDir>/src/queries$1',
'^@/(.*)$': '<rootDir>/src/$1'
},
clearMocks: true,
transform: {
'\\.(js|jsx|mjs)$': [
'@swc/jest',
{
jsc: {
experimental: {
plugins: [['@swc-contrib/mut-cjs-exports', {}]]
},
parser: {
jsx: true
}
}
}
],
'\\.(ts|tsx)$': [
'@swc/jest',
{
jsc: {
experimental: {
plugins: [['@swc-contrib/mut-cjs-exports', {}]]
},
parser: {
syntax: 'typescript',
tsx: true
}
}
}
],
'^.+\\.webapp$': '<rootDir>/test/jestLib/json-transformer.js'
},
transformIgnorePatterns: [
'node_modules/(?!cozy-ui|cozy-harvest-lib|cozy-keys-lib|cozy-sharing|)',
'jest-runner'
],
testEnvironment: 'jsdom',
testEnvironmentOptions: {
url: 'http://cozy.localhost:8080/'
},
testMatch: ['**/(*.)(spec|test).[jt]s?(x)'],
reporters: ['default', '<rootDir>/jestHelpers/ConsoleUsageReporter.js']
}
================================================
FILE: jestHelpers/ConsoleUsageReporter.js
================================================
/* eslint-disable class-methods-use-this */
const fs = require('fs')
const path = require('path')
const { red, reset } = require('chalk')
const TMP_FILE_PATH = path.join(process.cwd(), '.consoleUsageReporter.json')
/**
* Prevents using the console in the tests without mocking it and prevents not
* handling errors/warnings from 3rd parties.
*/
module.exports = class ConsoleUsageReporter {
static deleteTemporaryFile() {
try {
fs.unlinkSync(TMP_FILE_PATH)
} catch (e) {
// Ignored
}
}
static getTestFilesThatUsedConsole() {
try {
return JSON.parse(fs.readFileSync(TMP_FILE_PATH, 'utf8'))
} catch (e) {
return []
}
}
static recordConsoleUsedInCurrentTestFile() {
const testPath =
global.jasmine?.testPath || expect.getState()?.testPath || ''
const testFilesThatUsedConsole = this.getTestFilesThatUsedConsole()
if (!testFilesThatUsedConsole.includes(testPath)) {
testFilesThatUsedConsole.push(testPath)
fs.writeFileSync(
TMP_FILE_PATH,
JSON.stringify(testFilesThatUsedConsole),
'utf8'
)
}
}
static makeTestsFailWhenConsoleUsed() {
let consoleCalls = []
let testsRunning = true
const formatConsoleCalls = calls =>
calls
.map(({ args, callStack, method }) => {
const formattedArgs = args
.map(arg => (arg instanceof Error ? arg.stack || arg : arg))
.join(' ')
.split('\n')
.map(line => ` ${line}`)
.join('\n')
const formattedCallStack = !/^\s*(at|in) /m.test(formattedArgs)
? red(
`\n\n${callStack
.split('\n')
.map(line => ` ${line}`)
.join('\n')}`
)
: ''
return `console.${method}\n${reset(
formattedArgs
)}${formattedCallStack}`
})
.join('\n\n')
;['error', 'info', 'log', 'warn'].forEach(method => {
global.console[method] = (...args) => {
const callStack = new Error().stack
.split('\n')
.slice(2)
.map(line => line.trim())
.join('\n')
if (consoleCalls.length === 0) {
ConsoleUsageReporter.recordConsoleUsedInCurrentTestFile()
}
if (testsRunning) {
consoleCalls.push({ args, callStack, method })
} else {
process.stderr.write(
red(`
The console has been called outside a test which usually means you mishandled asynchronous actions.
Here is what have been logged:
${reset(formatConsoleCalls([{ args, callStack, method }]))}
`)
)
}
}
})
beforeAll(() => {
testsRunning = true
})
beforeEach(() => {
consoleCalls = []
})
afterEach(() => {
if (consoleCalls.length > 0) {
throw new Error(
red(`\
This test called the console which is forbidden.
Here is what have been logged:
${reset(formatConsoleCalls(consoleCalls))}
If calling the console is normal in your test case, consider mocking the \
console as is:
jest.spyOn(console, 'method').mockImplementation();
`)
)
}
})
afterAll(() => {
testsRunning = false
})
}
constructor(globalConfig) {
this.globalConfig = globalConfig
}
onRunComplete() {
const isWatchModeEnabled =
this.globalConfig.watch || this.globalConfig.watchAll
const testFilesThatUsedConsole =
ConsoleUsageReporter.getTestFilesThatUsedConsole()
ConsoleUsageReporter.deleteTemporaryFile()
if (testFilesThatUsedConsole.length > 0) {
const error = new Error(
red(
`\
The following test files called the console which is forbidden:
${testFilesThatUsedConsole.map(file => `- ${file}`).join('\n')}
You should find more information in the report of the test that called the \
console.
We list all the test files there to allow you to find the console calls that \
did not make any test fail (possibly because of async issues).
`
)
)
if (isWatchModeEnabled) {
// Prevents to freeze watch mode
console.error(error)
} else {
throw error
}
}
}
onRunStart() {
ConsoleUsageReporter.deleteTemporaryFile()
}
}
================================================
FILE: jestHelpers/mocks/fileMock.js
================================================
module.exports = {};
================================================
FILE: jestHelpers/mocks/iconMock.js
================================================
let id = 0;
module.exports = { id: `icon-${id++}` };
================================================
FILE: jestHelpers/mocks/pdfjsWorkerMock.js
================================================
module.exports = () => {};
================================================
FILE: jestHelpers/mocks/svgRawMock.js
================================================
module.exports = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"></svg>'
================================================
FILE: jestHelpers/setup.js
================================================
import React from 'react'
import { TransformStream } from 'stream/web'
global.cozy = {}
global.TransformStream = TransformStream
jest.mock('cozy-search', () => ({
AssistantDesktop: () => null,
AssistantDialog: () => null,
SearchDialog: () => null
}))
jest.mock('cozy-bar', () => ({
...jest.requireActual('cozy-bar'),
BarComponent: () => <div>Bar</div>,
BarLeft: ({ children }) => children,
BarRight: ({ children }) => children,
BarCenter: ({ children }) => children,
BarSearch: ({ children }) => children
}))
jest.mock('cozy-intent', () => ({
useWebviewIntent: jest.fn()
}))
jest.mock('cozy-dataproxy-lib', () => ({
DataProxyProvider: ({ children }) => children
}))
// Mock cozy-flags with jest mock function that supports both flag checking and test mocking
jest.mock('cozy-flags', () => {
const mockFn = jest.fn(() => {
// Return false for all other flags to avoid issues
return false
})
// Add initialize method that some tests expect
mockFn.initialize = jest.fn()
return mockFn
})
// see https://github.com/jsdom/jsdom/issues/1695
window.HTMLElement.prototype.scroll = function () {}
================================================
FILE: jestHelpers/setupFilesAfterEnv.js
================================================
import '@testing-library/jest-dom'
import ConsoleUsageReporter from './ConsoleUsageReporter'
ConsoleUsageReporter.makeTestsFailWhenConsoleUsed()
process.on('unhandledRejection', error => console.error(error))
================================================
FILE: manifest.webapp
================================================
{
"name": "Drive",
"name_prefix": "Twake",
"slug": "drive",
"version": "1.99.0",
"type": "webapp",
"licence": "AGPL-3.0",
"icon": "assets/app-icon.svg",
"categories": ["cozy"],
"source": "https://github.com/cozy/cozy-drive",
"editor": "Cozy",
"developer": {
"name": "Twake Workplace",
"url": "https://twake.app"
},
"locales": {
"en": {
"short_description": "Twake Drive helps you to save, sync and secure your files on your Twake.",
"long_description": "With Twake Drive, you can easily:\n- Store your important files and keep them secure in your Twake\n- Access to all your documents online & offline, from your desktop, and on your smartphone or tablet\n- Share links to files ans folders with who you like;\n- Automatically retrieve bills, payrolls, tax notices and other data from your main online services (internet, energy, retail, mobile, energy, travel...)\n- Upload files to your Twake from your Android",
"screenshots": [
"assets/screenshots/en/screenshot01.png",
"assets/screenshots/en/screenshot02.png",
"assets/screenshots/en/screenshot03.png",
"assets/screenshots/en/screenshot04.png"
]
},
"fr": {
"short_description": "Twake Drive est l’application de sauvegarde, de synchronisation et de sécurisation de tous vos fichiers sur Twake.",
"long_description": "Avec Twake Drive vous pourrez :\n- Sauvegarder et synchroniser gratuitement tous vos documents importants (carte d’identité, photos de vacances, avis d’imposition, fiches de salaires…);\n- Accéder à vos documents n’importe quand, n’importe ou même en mode avion depuis votre bureau, votre smartphone ou tablette;\n- Partager vos fichiers et dossiers par lien avec qui vous le souhaitez;\n- Récupérer automatiquement vos documents administratifs de vos principaux fournisseurs de service (opérateur mobile, fournisseur d’énergie, assureur, internet, santé…);\n- Rester synchronisé·e lors de vos voyages et déplacements professionnels avec nos applications mobiles.",
"screenshots": [
"assets/screenshots/fr/screenshot01.png",
"assets/screenshots/fr/screenshot02.png",
"assets/screenshots/fr/screenshot03.png",
"assets/screenshots/fr/screenshot04.png"
]
}
},
"screenshots": [
"assets/screenshots/fr/screenshot01.png",
"assets/screenshots/fr/screenshot02.png",
"assets/screenshots/fr/screenshot03.png",
"assets/screenshots/fr/screenshot04.png"
],
"langs": ["en", "fr"],
"routes": {
"/": {
"folder": "/",
"index": "index.html",
"public": false
},
"/intents": {
"folder": "/intents",
"index": "index.html",
"public": false
},
"/public": {
"folder": "/public",
"index": "index.html",
"public": true
},
"/preview": {
"folder": "/public",
"index": "index.html",
"public": true
},
"/assets": {
"folder": "/assets",
"public": true
}
},
"intents": [
{
"action": "OPEN",
"type": ["io.cozy.files"],
"href": "/intents"
},
{
"action": "OPEN",
"type": ["io.cozy.suggestions"],
"href": "/intents"
}
],
"entrypoints": [
{
"name": "new-file-type-text",
"title": {
"en": "Doc",
"fr": "Doc",
"ru": "документ",
"vi": "Doc"
},
"hash": "/onlyoffice/create/io.cozy.files.root-dir/text",
"icon": "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwNzZFRCIgZD0iTTguNCAwQTYuNCA2LjQgMCAwIDAgMiA2LjR2MTkuMkE2LjQgNi40IDAgMCAwIDguNCAzMmgxNmE2LjQgNi40IDAgMCAwIDYuNC02LjRWMTAuNEwyMC40IDBjLTQuMDEzIDAtNCAwIDAgMGgtMTJaIi8+PHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjIuOTA5IiB4PSI4IiB5PSIxMCIgZmlsbD0iI2ZmZiIgcng9IjEuNDU1Ii8+PHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjIuOTA5IiB4PSI4IiB5PSIxNS45MDkiIGZpbGw9IiNmZmYiIHJ4PSIxLjQ1NSIvPjxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIyLjkwOSIgeD0iOCIgeT0iMjEuODE4IiBmaWxsPSIjZmZmIiByeD0iMS40NTUiLz48cGF0aCBmaWxsPSIjMDA2OEQyIiBkPSJNMzAuOCAxMC44IDIwIDB2NS41ODZjMCAyLjg4IDIuMjU3IDUuMjE0IDUuMDQgNS4yMTRoNS43NloiLz48L3N2Zz4=",
"conditions": [{ "type": "flag", "name": "drive.office.enabled", "value": true }, { "type": "flag", "name": "drive.office.write", "value": true }, { "type": "flag", "name": "bar.onlyoffice.enabled", "value": true }]
},
{
"name": "new-file-type-sheet",
"title": {
"en": "Spreadsheet",
"fr": "Tableur",
"ru": "Электронная таблица",
"vi": "Bảng tính"
},
"hash": "/onlyoffice/create/io.cozy.files.root-dir/spreadsheet",
"icon": "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzBEOUUzMCIgZD0iTTguNCAwQTYuNCA2LjQgMCAwIDAgMiA2LjR2MTkuMkE2LjQgNi40IDAgMCAwIDguNCAzMmgxNmE2LjQgNi40IDAgMCAwIDYuNC02LjRWMTAuNEwyMC40IDBjLTQuMDEzIDAtNCAwIDAgMGgtMTJaIi8+PHJlY3Qgd2lkdGg9IjYuODU3IiBoZWlnaHQ9IjYuODU3IiB4PSI4IiB5PSIxMCIgZmlsbD0iI2ZmZiIgcng9Ii40NTciLz48cmVjdCB3aWR0aD0iNi44NTciIGhlaWdodD0iNi44NTciIHg9IjgiIHk9IjE5LjE0MyIgZmlsbD0iI2ZmZiIgcng9Ii40NTciLz48cmVjdCB3aWR0aD0iNi44NTciIGhlaWdodD0iNi44NTciIHg9IjE3LjE0MyIgeT0iMTkuMTQzIiBmaWxsPSIjZmZmIiByeD0iLjQ1NyIvPjxyZWN0IHdpZHRoPSI2Ljg1NyIgaGVpZ2h0PSI2Ljg1NyIgeD0iMTcuMTQzIiB5PSIxMCIgZmlsbD0iI2ZmZiIgcng9Ii40NTciLz48cGF0aCBmaWxsPSIjMDA4NDIwIiBkPSJNMzAuOCAxMC44IDIwIDB2NS41ODZjMCAyLjg4IDIuMjU3IDUuMjE0IDUuMDQgNS4yMTRoNS43NloiLz48L3N2Zz4=",
"conditions": [{ "type": "flag", "name": "drive.office.enabled", "value": true }, { "type": "flag", "name": "drive.office.write", "value": true }, { "type": "flag", "name": "bar.onlyoffice.enabled", "value": true }]
},
{
"name": "new-file-type-slide",
"title": {
"fr": "Présentation",
"en": "Presentation",
"ru": "Презентация",
"vi": "Giới thiệu"
},
"hash": "/onlyoffice/create/io.cozy.files.root-dir/slide",
"icon": "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI0ZGOTUwMCIgZD0iTTguNCAwQTYuNCA2LjQgMCAwIDAgMiA2LjR2MTkuMkE2LjQgNi40IDAgMCAwIDguNCAzMmgxNmE2LjQgNi40IDAgMCAwIDYuNC02LjRWMTAuNEwyMC40IDBjLTQuMDEzIDAtNCAwIDAgMGgtMTJaIi8+PHBhdGggZmlsbD0iI0RGNjMxMCIgZD0iTTMwLjggMTAuOCAyMCAwdjUuNTg2YzAgMi44OCAyLjI1NyA1LjIxNCA1LjA0IDUuMjE0aDUuNzZaIi8+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE1LjQyMiAxMS4xNTdhNy40MjIgNy40MjIgMCAxIDAgNy40MjEgNy40MjFoLTcuNDIxdi03LjQyMVoiLz48cGF0aCBmaWxsPSIjZmZmIiBkPSJNMTYuNTc4IDEwdjcuNDIySDI0QTcuNDIyIDcuNDIyIDAgMCAwIDE2LjU3OCAxMFoiLz48L3N2Zz4=",
"conditions": [{ "type": "flag", "name": "drive.office.enabled", "value": true }, { "type": "flag", "name": "drive.office.write", "value": true }, { "type": "flag", "name": "bar.onlyoffice.enabled", "value": true }]
}
],
"services": {
"qualificationMigration": {
"type": "node",
"file": "services/qualificationMigration/drive.js"
},
"dacc": {
"type": "node",
"file": "services/dacc/drive.js",
"trigger": "@monthly on the 5-7 between 2pm and 7pm"
}
},
"permissions": {
"files": {
"description": "Required to access the files",
"type": "io.cozy.files",
"verbs": ["ALL"]
},
"allFiles": {
"description": "Required to access the files",
"type": "io.cozy.files.*",
"verbs": ["ALL"]
},
"apps": {
"description": "Required by the cozy-bar to display the icons of the apps",
"type": "io.cozy.apps",
"verbs": ["GET"]
},
"sharings": {
"description": "Required to have access to the sharings in realtime",
"type": "io.cozy.sharings",
"verbs": ["GET"]
},
"albums": {
"description": "Required to manage photos albums",
"type": "io.cozy.photos.albums",
"verbs": ["PUT", "GET"]
},
"contacts": {
"type": "io.cozy.contacts",
"verbs": ["GET", "POST"]
},
"groups": {
"type": "io.cozy.contacts.groups",
"verbs": ["GET"]
},
"settings": {
"description": "Required by the cozy-bar to display Claudy and know which applications are coming soon",
"type": "io.cozy.settings",
"verbs": ["GET"]
},
"oauth": {
"description": "Required to display the cozy-desktop banner",
"type": "io.cozy.oauth.clients",
"verbs": ["GET"]
},
"errorsreporting": {
"description": "Allow to report unexpected errors to the support team",
"type": "cc.cozycloud.errors",
"verbs": ["POST"]
},
"mail": {
"description": "Send feedback emails to the support team",
"type": "io.cozy.jobs",
"verbs": ["POST"],
"selector": "worker",
"values": ["sendmail"]
},
"konnectors": {
"description": "Required to display additional information in the viewer for files automatically retrieved by services",
"type": "io.cozy.konnectors",
"verbs": ["GET"]
},
"accounts": {
"description": "Required to display additional information in the viewer for files automatically retrieved by services",
"type": "io.cozy.accounts",
"verbs": ["ALL"]
},
"jobs": {
"type": "io.cozy.jobs",
"verbs": ["ALL"]
},
"triggers": {
"description": "Required to display additional information in the viewer for files automatically retrieved by services",
"type": "io.cozy.triggers",
"verbs": ["ALL"]
},
"dacc": {
"type": "cc.cozycloud.dacc_v2",
"verbs": ["POST"],
"description": "Remote-doctype required to send anonymized measures to the DACC shared among mycozy.cloud's Cozy."
},
"dacc-eu": {
"type": "eu.mycozy.dacc_v2",
"verbs": ["POST"],
"description": "Remote-doctype required to send anonymized measures to the DACC shared among mycozy.eu's Cozy."
},
"chatConversations": {
"description": "Required by the cozy Assistant",
"type": "io.cozy.ai.chat.conversations",
"verbs": ["GET", "POST"]
},
"chatEvents": {
"description": "Required by the cozy Assistant",
"type": "io.cozy.ai.chat.events",
"verbs": ["GET"]
},
"driveSettings": {
"description": "Required to access the drive settings",
"type": "io.cozy.drive.settings",
"verbs": ["ALL"]
},
"nextcloud_migrations": {
"description": "Read Nextcloud migration documents and subscribe to updates",
"type": "io.cozy.nextcloud.migrations",
"verbs": ["GET"]
}
},
"accept_from_flagship": true,
"accept_documents_from_flagship": {
"accepted_mime_types": ["*/*"],
"max_number_of_files": 10,
"max_size_per_file_in_MB": 100,
"route_to_upload": "/#/upload?fromFlagshipUpload=true"
}
}
================================================
FILE: package.json
================================================
{
"name": "cozy-drive",
"version": "1.99.0",
"main": "src/main.jsx",
"scripts": {
"build": "rsbuild build",
"watch": "rsbuild build --watch --mode development",
"start": "rsbuild dev",
"analyze": "RSDOCTOR=true yarn build",
"cozyPublish": "cozy-app-publish --token $REGISTRY_TOKEN --prepublish downcloud --postpublish mattermost",
"tx": "tx pull --all || true",
"lint": "npm-run-all --parallel 'lint:*'",
"lint:styles": "stylint src --config ./node_modules/stylus-config-cozy-app/.stylintrc",
"lint:js": "eslint '{src,test}/**/*.{js,jsx,ts,tsx}'",
"test": "env NODE_ENV='test' jest",
"service": "yarn cozy-konnector-dev -m ./manifest.webapp"
},
"repository": {
"type": "git",
"url": "git+https://github.com/cozy/cozy-drive.git"
},
"author": "Cozy Cloud <contact@cozycloud.cc> (https://cozy.io/)",
"contributors": [
"CPatchane",
"enguerran",
"GoOz",
"goldoraf",
"gregorylegarec",
"kossi",
"m4dz",
"nono",
"ptbrowne",
"y_lohse",
"trollepierre"
],
"license": "AGPL-3.0",
"bugs": {
"url": "https://github.com/cozy/cozy-drive/issues"
},
"homepage": "https://github.com/cozy/cozy-drive#readme",
"devDependencies": {
"@rsbuild/core": "^1.5.15",
"@swc-contrib/mut-cjs-exports": "^14.7.0",
"@swc/core": "^1.15.18",
"@swc/jest": "^0.2.39",
"@testing-library/jest-dom": "5.17.0",
"@testing-library/react": "14.3.1",
"@types/react-redux": "7.1.26",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"@welldone-software/why-did-you-render": "^10.0.1",
"babel-preset-cozy-app": "2.1.0",
"bundlemon": "3.1.0",
"cozy-app-publish": "^0.40.1",
"cozy-jobs-cli": "^2.4.3",
"cozy-tsconfig": "^1.8.1",
"css-mediaquery": "0.1.2",
"eslint": "10.0.2",
"eslint-config-cozy-app": "7.0.0",
"husky": "0.14.3",
"identity-obj-proxy": "3.0.0",
"jest": "^30.0.0",
"jest-environment-jsdom": "^30.0.0",
"mockdate": "^3.0.5",
"npm-run-all2": "5.0.0",
"prettier": "2.8.8",
"rsbuild-config-cozy-app": "^0.7.1",
"stylint": "1.5.9",
"stylus-config-cozy-app": "^0.1.0",
"typescript": "4.9.5",
"worker-loader": "2.0.0"
},
"dependencies": {
"@sentry/react": "7.119.0",
"classnames": "2.3.1",
"cozy-bar": "^33.3.0",
"cozy-client": "^60.23.1",
"cozy-dataproxy-lib": "^4.13.0",
"cozy-device-helper": "^4.0.1",
"cozy-devtools": "^1.2.1",
"cozy-doctypes": "1.85.4",
"cozy-flags": "^4.6.1",
"cozy-harvest-lib": "^37.0.6",
"cozy-intent": "^2.30.1",
"cozy-interapp": "^0.17.1",
"cozy-keys-lib": "^7.0.0",
"cozy-logger": "^1.17.0",
"cozy-minilog": "3.9.1",
"cozy-pouch-link": "^60.19.0",
"cozy-realtime": "^5.8.0",
"cozy-search": "^0.25.3",
"cozy-sharing": "^30.3.1",
"cozy-stack-client": "^60.23.0",
"cozy-ui": "^138.10.0",
"cozy-ui-plus": "^7.1.0",
"cozy-viewer": "^28.0.7",
"date-fns": "2.30.0",
"diacritics": "1.3.0",
"filesize": "10.1.6",
"leaflet": "1.9.4",
"localforage": "1.10.0",
"lodash": "4.17.21",
"mime-types": "2.1.35",
"node-fetch": "2.6.7",
"node-polyglot": "2.4.2",
"prop-types": "15.8.1",
"react": "18.2.0",
"react-autosuggest": "10.1.0",
"react-dnd": "16.0.1",
"react-dnd-html5-backend": "16.0.1",
"react-dom": "18.2.0",
"react-dropzone": "14.3.8",
"react-inspector": "5.1.1",
"react-pdf": "^5.7.2",
"react-redux": "7.2.0",
"react-remove-scroll": "2.4.4",
"react-router-dom": "6.14.2",
"react-selecto": "^1.26.3",
"redux": "3.7.2",
"redux-logger": "3.0.6",
"redux-mock-store": "1.5.4",
"redux-thunk": "2.4.2",
"twake-i18n": "^0.3.4",
"whatwg-fetch": "3.0.0"
}
}
================================================
FILE: public/browserconfig.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png"/>
<TileColor>#2d89ef</TileColor>
</tile>
</msapplication>
</browserconfig>
================================================
FILE: public/manifest.json
================================================
{
"name": "",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
================================================
FILE: renovate.json
================================================
{
"extends": ["cozy"]
}
================================================
FILE: rsbuild.config.mjs
================================================
import { defineConfig, mergeRsbuildConfig } from '@rsbuild/core'
import { getRsbuildConfig } from 'rsbuild-config-cozy-app'
const config = getRsbuildConfig({
title: 'Twake Drive',
hasServices: true,
hasPublic: true,
hasIntents: true
})
const mergedConfig = mergeRsbuildConfig(config, {
environments: {
main: {
output: {
copy: [
{
from: 'src/assets/onlyOffice',
to: 'onlyOffice'
},
{
from: 'src/assets/favicons',
to: 'favicons'
}
]
}
}
},
resolve: {
alias: {
'react-pdf$': 'react-pdf/dist/esm/entry.webpack'
}
}
})
export default defineConfig(mergedConfig)
================================================
FILE: src/components/App/App.jsx
================================================
import PropTypes from 'prop-types'
import React, { Fragment } from 'react'
import { DndProvider } from 'react-dnd'
import { HTML5Backend } from 'react-dnd-html5-backend'
import { Provider } from 'react-redux'
import { BarProvider } from 'cozy-bar'
import flag from 'cozy-flags'
import { WebviewIntentProvider } from 'cozy-intent'
import { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints'
import MoveValidationModals from '@/components/MoveValidationModals'
import PushBannerProvider from '@/components/PushBanner/PushBannerProvider'
import ClipboardProvider from '@/contexts/ClipboardProvider'
import { AcceptingSharingProvider } from '@/lib/AcceptingSharingContext'
import DriveProvider from '@/lib/DriveProvider'
import { ModalContextProvider } from '@/lib/ModalContext'
import { ViewSwitcherContextProvider } from '@/lib/ViewSwitcherContext'
import { PublicProvider } from '@/modules/public/PublicProvider'
import { onFileUploaded } from '@/modules/views/Upload/UploadUtils'
const Providers = ({ children }) => {
const { isMobile } = useBreakpoints()
const [DnDProvider, dnDProviderProps] =
flag('drive.virtualization.enabled') && !isMobile
? [DndProvider, { backend: HTML5Backend }]
: [Fragment, {}]
return (
<BarProvider>
<PushBannerProvider>
<ClipboardProvider>
<AcceptingSharingProvider>
<ViewSwitcherContextProvider>
<ModalContextProvider>
<DnDProvider {...dnDProviderProps}>
{children}
<MoveValidationModals />
</DnDProvider>
</ModalContextProvider>
</ViewSwitcherContextProvider>
</AcceptingSharingProvider>
</ClipboardProvider>
</PushBannerProvider>
</BarProvider>
)
}
const App = ({ isPublic, store, client, lang, polyglot, children }) => {
return (
<WebviewIntentProvider
methods={{
onFileUploaded: (file, isSuccess) =>
onFileUploaded({ file, isSuccess }, store.dispatch)
}}
>
<PublicProvider isPublic={isPublic}>
<Provider store={store}>
<DriveProvider client={client} lang={lang} polyglot={polyglot}>
<Providers>{children}</Providers>
</DriveProvider>
</Provider>
</PublicProvider>
</WebviewIntentProvider>
)
}
App.propTypes = {
store: PropTypes.object,
lang: PropTypes.string,
polyglot: PropTypes.object,
client: PropTypes.object
}
export default App
================================================
FILE: src/components/Bar.jsx
================================================
import React from 'react'
import { BarRight } from 'cozy-bar'
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
export const BarRightOnMobile = ({ children }) => {
const { isMobile } = useBreakpoints()
if (isMobile) {
return <BarRight>{children}</BarRight>
}
return children
}
================================================
FILE: src/components/Button/BackButton.jsx
================================================
import React from 'react'
import Icon from 'cozy-ui/transpiled/react/Icon'
import IconButton from 'cozy-ui/transpiled/react/IconButton'
import PreviousIcon from 'cozy-ui/transpiled/react/Icons/Previous'
import { useI18n } from 'twake-i18n'
export const BackButton = ({ onClick, ...props }) => {
const { t } = useI18n()
return (
<IconButton onClick={onClick} {...props} aria-label={t('button.back')}>
<Icon icon={PreviousIcon} />
</IconButton>
)
}
export default BackButton
================================================
FILE: src/components/Button/MoreButton.jsx
================================================
import React from 'react'
import Icon from 'cozy-ui/transpiled/react/Icon'
import IconButton from 'cozy-ui/transpiled/react/IconButton'
import DotsIcon from 'cozy-ui/transpiled/react/Icons/Dots'
import { useI18n } from 'twake-i18n'
const MoreButton = ({ disabled, onClick, ...props }) => {
const { t } = useI18n()
return (
<div>
<IconButton
data-testid="more-button"
disabled={disabled}
onClick={onClick}
size="medium"
aria-label={t('Toolbar.more')}
{...props}
>
<Icon icon={DotsIcon} />
</IconButton>
</div>
)
}
export default MoreButton
================================================
FILE: src/components/Button/OpenFolderButton.tsx
================================================
import React, { FC } from 'react'
import { NavigateFunction } from 'react-router-dom'
import Button from 'cozy-ui/transpiled/react/Buttons'
import { useI18n } from 'twake-i18n'
import { File } from '@/components/FolderPicker/types'
interface OpenFolderButtonProps {
folder: File
navigate: NavigateFunction
}
const OpenFolderButton: FC<OpenFolderButtonProps> = ({ folder, navigate }) => {
const { t } = useI18n()
const handleNavigateFolder = (): void => {
if (folder._type === 'io.cozy.remote.nextcloud.files') {
return navigate(
`/nextcloud/${folder.cozyMetadata.sourceAccount}?path=${folder.path}`
)
}
return navigate(`/folder/${folder._id}`)
}
return (
<Button
color="success"
label={t('OpenFolderButton.label')}
onClick={handleNavigateFolder}
size="small"
variant="text"
style={{ color: `var(--successContrastTextColor)` }}
/>
)
}
export { OpenFolderButton }
================================================
FILE: src/components/Button/index.jsx
================================================
export { default as MoreButton } from './MoreButton'
================================================
FILE: src/components/ColorPicker/ColorPicker.jsx
================================================
import PropTypes from 'prop-types'
import React from 'react'
import Avatar from 'cozy-ui/transpiled/react/Avatar'
import GridList from 'cozy-ui/transpiled/react/GridList'
import GridListTile from 'cozy-ui/transpiled/react/GridListTile'
import Icon from 'cozy-ui/transpiled/react/Icon'
import IconButton from 'cozy-ui/transpiled/react/IconButton'
import CheckIcon from 'cozy-ui/transpiled/react/Icons/Check'
import CrossIcon from 'cozy-ui/transpiled/react/Icons/Cross'
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
import {
COLORS,
NB_COLUMNS_MOBILE,
NB_COLUMNS_DESKTOP,
CELL_HEIGHT_MOBILE,
CELL_HEIGHT_DESKTOP,
CIRCLE_SIZE_MOBILE,
CIRCLE_SIZE_DESKTOP,
ICON_SIZE_MOBILE,
ICON_SIZE_DESKTOP
} from './constants'
import styles from '@/styles/folder-customizer.styl'
/**
* ColorPicker component - displays a grid of colors and allows the user to select one
* @param {Object} props
* @param {string} props.selectedColor - Currently selected color
* @param {Function} props.onColorSelect - Callback function when a color is selected
*/
export const ColorPicker = ({ selectedColor, onColorSelect }) => {
const { isMobile } = useBreakpoints()
return (
<>
<GridList
cols={isMobile ? NB_COLUMNS_MOBILE : NB_COLUMNS_DESKTOP}
cellHeight={isMobile ? CELL_HEIGHT_MOBILE : CELL_HEIGHT_DESKTOP}
>
<GridListTile className="u-ta-center">
<Avatar
color="var(--papeBackgroundColor)"
textColor="var(--white)"
size={isMobile ? CIRCLE_SIZE_MOBILE : CIRCLE_SIZE_DESKTOP}
className={styles.noneIconFrame}
>
<IconButton onClick={() => onColorSelect()}>
<Icon
size={isMobile ? ICON_SIZE_MOBILE : ICON_SIZE_DESKTOP}
icon={CrossIcon}
color="textSecondary"
/>
</IconButton>
</Avatar>
</GridListTile>
{COLORS.map(color => (
<GridListTile key={color} className="u-ta-center">
<Avatar
color={color}
textColor="var(--white)"
size={isMobile ? CIRCLE_SIZE_MOBILE : CIRCLE_SIZE_DESKTOP}
>
<IconButton onClick={() => onColorSelect(color)}>
{selectedColor === color && (
<Icon
size={isMobile ? ICON_SIZE_MOBILE : ICON_SIZE_DESKTOP}
icon={CheckIcon}
color="white"
/>
)}
</IconButton>
</Avatar>
</GridListTile>
))}
</GridList>
</>
)
}
ColorPicker.propTypes = {
selectedColor: PropTypes.string.isRequired,
onColorSelect: PropTypes.func.isRequired
}
ColorPicker.displayName = 'ColorPicker'
================================================
FILE: src/components/ColorPicker/constants.js
================================================
export const COLORS = [
'#696c6f',
'#d3bfa4',
'#e1e3e6',
'#ff4d5e',
'#ff7750',
'#f5ac00',
'#ffd54c',
'#ffe082',
'#006bd8',
'#46a2ff',
'#91cef6',
'#afffeb',
'#2dd4ab',
'#66e49a',
'#6ad049',
'#00bf62',
'#713fa5',
'#a777e8',
'#ad95ff',
'#bfa9ff',
'#fba0b8',
'#e694e0',
'#e375cd'
]
export const NB_COLUMNS_MOBILE = 6
export const NB_COLUMNS_DESKTOP = 8
export const CELL_HEIGHT_MOBILE = 56
export const CELL_HEIGHT_DESKTOP = 40
export const CIRCLE_SIZE_MOBILE = 40
export const CIRCLE_SIZE_DESKTOP = 36
export const ICON_SIZE_MOBILE = 18
export const ICON_SIZE_DESKTOP = 12
================================================
FILE: src/components/ColorPicker/index.jsx
================================================
export { ColorPicker } from './ColorPicker'
export { COLORS } from './constants'
================================================
FILE: src/components/Error/Empty.jsx
================================================
import cx from 'classnames'
import React from 'react'
import { useLocation } from 'react-router-dom'
import flag from 'cozy-flags'
import Empty from 'cozy-ui/transpiled/react/Empty'
import Icon from 'cozy-ui/transpiled/react/Icon'
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
import { useI18n } from 'twake-i18n'
import styles from './empty.styl'
import FolderEmptyIllu from '@/assets/icons/illu-folder-empty.svg'
import TrashIllustration from '@/assets/icons/illu-trash-empty.svg'
import { TRASH_DIR_ID } from '@/constants/config'
import { useCurrentFolderId, useDisplayedFolder } from '@/hooks'
import { useSharedDriveFolder } from '@/modules/shareddrives/hooks/useSharedDriveFolder'
import UploadButton from '@/modules/upload/UploadButton'
import CreateSharedDriveButton from '@/modules/views/SharedDrive/CreateSharedDriveButton'
const EmptyCanvas = ({
type,
canUpload,
localeKey,
hasTextMobileVersion,
onUploaded,
driveId
}) => {
const { t } = useI18n()
const { isDesktop } = useBreakpoints()
const folderId = useCurrentFolderId()
const { displayedFolder } = useDisplayedFolder()
const { sharedDriveResult } = useSharedDriveFolder({ driveId, folderId })
const isSharedDriveEnabled = flag('drive.shared-drive.enabled')
const displayedSharedFolder = sharedDriveResult?.data
const IconToShow = type === 'trash' ? TrashIllustration : FolderEmptyIllu
const showSharedDriveLayout = type === 'sharing' && isSharedDriveEnabled
const showUploadLayout =
type === 'drive' || (type === 'sharing' && !isSharedDriveEnabled)
const title = localeKey ? t(`empty.${type}_title`) : undefined
const text =
(hasTextMobileVersion && !isDesktop && t(`empty.mobile_text`)) ||
(localeKey && t(`empty.${localeKey}_text`)) ||
(showUploadLayout && t('empty.text')) ||
(type === 'sharing' && isSharedDriveEnabled && t('empty.shared-drive_text'))
return (
<Empty
className={cx({ [styles['empty']]: showUploadLayout })}
data-testid="empty-folder"
icon={
<div className="u-w-100">
<Icon icon={IconToShow} size={160} />
</div>
}
iconSize={isDesktop ? 'medium' : 'large'}
centered={!isDesktop}
title={title}
text={
<>
{text}
{showUploadLayout && (
<span className="u-db u-mt-1">
<UploadButton
disabled={!canUpload}
componentsProps={{
button: { variant: 'secondary' }
}}
label={t('toolbar.menu_upload')}
displayedFolder={displayedSharedFolder || displayedFolder}
onUploaded={onUploaded}
/>
</span>
)}
{showSharedDriveLayout && (
<span className="u-db u-mt-1">
<CreateSharedDriveButton
variant="secondary"
label={t('button.create')}
/>
</span>
)}
</>
}
/>
)
}
export default EmptyCanvas
export const EmptyDrive = props => {
return <EmptyCanvas type="drive" hasTextMobileVersion {...props} />
}
export const EmptyTrash = props => (
<EmptyCanvas type="trash" localeKey="trash" {...props} />
)
export const EmptyWrapper = ({
currentFolderId,
canUpload,
refreshFolderContent,
driveId
}) => {
const { pathname } = useLocation()
if (pathname === '/sharings') {
return <EmptyCanvas type="sharing" driveId={driveId} />
}
if (currentFolderId !== TRASH_DIR_ID) {
return (
<EmptyDrive
canUpload={canUpload}
onUploaded={refreshFolderContent}
driveId={driveId}
/>
)
}
return <EmptyTrash canUpload={canUpload} onUploaded={refreshFolderContent} />
}
================================================
FILE: src/components/Error/ErrorShare.jsx
================================================
import React from 'react'
import Empty from 'cozy-ui/transpiled/react/Empty'
import CloudBrokenIcon from 'cozy-ui/transpiled/react/Icons/CloudBroken'
import { useI18n } from 'twake-i18n'
export const ErrorShare = ({ errorType }) => {
const { t } = useI18n()
return (
<Empty
data-testid="empty-share"
icon={CloudBrokenIcon}
title={t(`Error.${errorType}_title`)}
text={t(`Error.${errorType}_text`)}
componentsProps={{
icon: {
style: { height: '2rem' }
}
}}
/>
)
}
export default ErrorShare
================================================
FILE: src/components/Error/NotFound.jsx
================================================
import React from 'react'
import Empty from 'cozy-ui/transpiled/react/Empty'
import { useI18n } from 'twake-i18n'
import DesertIllustration from '@/assets/icons/illustrations-desert.svg'
const NotFound = () => {
const { t } = useI18n()
return (
<Empty
icon={DesertIllustration}
title={t('NotFound.title')}
text={t('NotFound.text')}
/>
)
}
export { NotFound }
================================================
FILE: src/components/Error/Oops.jsx
================================================
import PropTypes from 'prop-types'
import React from 'react'
import Button from 'cozy-ui/transpiled/react/Buttons'
import Empty from 'cozy-ui/transpiled/react/Empty'
import { useI18n } from 'twake-i18n'
import styles from './oops.styl'
import EmptyIcon from '@/assets/icons/icon-folder-broken.svg'
const reload = () => {
window.location.reload()
}
const Oops = ({ title, icon }) => {
const { t } = useI18n()
return (
<Empty
title={title ? title : t('error.open_folder')}
icon={icon ? icon : EmptyIcon}
className={styles['oops']}
>
<Button onClick={reload} label={t('error.button.reload')} />
</Empty>
)
}
Oops.propTypes = {
title: PropTypes.string,
icon: PropTypes.node
}
export default Oops
================================================
FILE: src/components/Error/empty.styl
================================================
@require 'settings/breakpoints'
.empty
+medium-screen('min')
border 2px dashed var(--borderMainColor)
border-radius 1rem
margin-bottom 1.5rem
width 100%
max-width calc(100% - 7rem)
================================================
FILE: src/components/Error/oops.styl
================================================
@require 'settings/breakpoints'
+medium-screen() // @stylint ignore
.oops
pointer-events auto
================================================
FILE: src/components/FileHistory/HistoryModal.jsx
================================================
import get from 'lodash/get'
import PropTypes from 'prop-types'
import React from 'react'
import { useNavigate } from 'react-router-dom'
import { withClient, useCapabilities } from 'cozy-client'
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs'
import HistoryRow from 'cozy-ui/transpiled/react/HistoryRow'
import Spinner from 'cozy-ui/transpiled/react/Spinner'
import Typography from 'cozy-ui/transpiled/react/Typography'
import { translate } from 'twake-i18n'
import styles from './styles.styl'
import { CozyFile } from '@/models'
const formatDate = (date, f) => {
return f(date, 'dd LLLL - HH:mm')
}
const HistoryModal = ({
file,
revisions,
client,
f,
t,
revisionsFetchStatus
}) => {
const fileCollection = client.collection('io.cozy.files', {
driveId: file.driveId
})
const capabilities = useCapabilities(client)
const isFileVersioningEnabled = get(
capabilities,
'capabilities.file_versioning'
)
const navigate = useNavigate()
return (
<Dialog
onClose={() => navigate('../')}
open={true}
title={file.name}
content={
<>
<Typography variant="caption" className={styles.HistoryRowCaption}>
{capabilities.fetchStatus === 'loading' && (
<span>{t('History.loading')}</span>
)}
{capabilities.fetchStatus === 'loaded' &&
isFileVersioningEnabled && (
<span>{t('History.description')}</span>
)}
{(capabilities.fetchStatus === 'failed' ||
(!isFileVersioningEnabled &&
capabilities.fetchStatus !== 'loading')) && (
<span>{t('History.noFileVersionEnabled')}</span>
)}
</Typography>
<HistoryRow
tag={t('History.current_version')}
primaryText={formatDate(file.updated_at, f)}
secondaryText={fileCollection.getBeautifulSize(file)}
downloadLink={() => {
fileCollection.download(file)
}}
/>
{revisionsFetchStatus === 'loading' && (
<div className={styles.HistoryRowRevisionLoader}>
<Spinner size="xxlarge" />
</div>
)}
{revisionsFetchStatus === 'loaded' &&
revisions.map(revision => {
return (
<HistoryRow
primaryText={formatDate(revision.updated_at, f)}
secondaryText={fileCollection.getBeautifulSize(revision)}
key={revision._id}
downloadLink={() => {
fileCollection.download(
file,
revision.id,
CozyFile.generateFileNameForRevision(file, revision, f)
)
}}
/>
)
})}
</>
}
/>
)
}
HistoryModal.propTypes = {
file: PropTypes.object.isRequired,
revisions: PropTypes.array,
client: PropTypes.object.isRequired,
f: PropTypes.func.isRequired,
t: PropTypes.func.isRequired,
revisionsFetchStatus: PropTypes.string.isRequired
}
export default translate()(withClient(HistoryModal))
================================================
FILE: src/components/FileHistory/index.jsx
================================================
import React from 'react'
import { useParams } from 'react-router-dom'
import { Query, Q } from 'cozy-client'
import HistoryModal from './HistoryModal'
const FileHistory = () => {
const { fileId, driveId } = useParams()
return (
<Query
query={() => Q('io.cozy.files').getById(fileId).sharingById(driveId)}
>
{({ data: file, fetchStatus: fileFetchStatus }) => {
return (
<Query
query={client =>
client
.all('io.cozy.files.versions')
.where({
relationships: { file: { data: { _id: fileId } } },
updated_at: { $gt: null }
})
.sortBy([
{ 'relationships.file.data._id': 'desc' },
{ updated_at: 'desc' }
])
.indexFields(['relationships.file.data._id', 'updated_at'])
}
>
{({ data: revisions, fetchStatus: revisionsFetchStatus }) => {
if (fileFetchStatus === 'loaded') {
return (
<HistoryModal
revisions={revisions}
file={file}
revisionsFetchStatus={revisionsFetchStatus}
fileFetchStatus={fileFetchStatus}
/>
)
}
return null
}}
</Query>
)
}}
</Query>
)
}
export default FileHistory
================================================
FILE: src/components/FileHistory/styles.styl
================================================
.HistoryRowRevisionLoader
display flex
justify-content center
================================================
FILE: src/components/FilesRealTimeQueries.jsx
================================================
import debounce from 'lodash/debounce'
import { memo, useEffect } from 'react'
import { useClient, Mutations } from 'cozy-client'
import { ensureFilePath } from 'cozy-client/dist/models/file'
import { receiveMutationResult } from 'cozy-client/dist/store'
import { buildFileOrFolderByIdQuery } from '@/queries'
const REALTIME_DEBOUNCE_TIME = 500
const bufferCreatedFiles = new Map()
const bufferUpdatedFiles = new Map()
const bufferDeletedFiles = new Map()
const getParentFolder = async (client, dirId) => {
let parentDir = client.getDocumentFromState('io.cozy.files', dirId)
if (!parentDir) {
// Parent is not in the store: query it
const parentQuery = buildFileOrFolderByIdQuery(dirId)
const parentResult = await client.fetchQueryAndGetFromState({
definition: parentQuery.definition(),
options: parentQuery.options
})
parentDir = parentResult.data
}
return parentDir
}
export const ensureFileHasPath = async (doc, client) => {
if (doc.path) return doc
const parentDir = await getParentFolder(client, doc.dir_id)
return ensureFilePath(doc, parentDir)
}
/**
* This method process the bufferised files after debounced realtime events
* It creates the related mutation and dispatch it to the store.
* Once done, the buffer is emptied
*
* @param {CozyClient} client - The CozyClient instance
* @param {string} mutationType - Either 'created', 'updated' or 'deleted'
* @returns {Promise<void>}
*/
const processEvents = async (client, mutationType) => {
let bufferFiles, mutationFn, multipleMutationFn
if (mutationType === 'created') {
bufferFiles = bufferCreatedFiles
mutationFn = Mutations.createDocument
multipleMutationFn = Mutations.createDocuments
}
if (mutationType === 'updated') {
bufferFiles = bufferUpdatedFiles
mutationFn = Mutations.updateDocument
multipleMutationFn = Mutations.updateDocuments
}
if (mutationType === 'deleted') {
bufferFiles = bufferDeletedFiles
mutationFn = Mutations.deleteDocument
multipleMutationFn = Mutations.deleteDocuments
}
if (bufferFiles.size === 0) return
const fileIdsToProcess = bufferFiles.keys()
let filesByFolder = {}
if (mutationType == 'deleted') {
filesByFolder['io.cozy.files.trash-dir'] = Array.from(
bufferFiles.values()
).filter(file => file.dir_id === 'io.cozy.files.trash-dir')
} else {
filesByFolder = groupFilesByFolder(bufferFiles)
}
for (const folderId in filesByFolder) {
const files = []
const folder = await getParentFolder(client, folderId)
for (const file of filesByFolder[folderId]) {
const fileWithPath = ensureFilePath(file, folder)
files.push(fileWithPath)
}
if (files.length < 1) {
// No files to process, early return
return
}
const mutation =
files.length > 1 ? multipleMutationFn(files) : mutationFn(files[0])
client.dispatch(
receiveMutationResult(
client.generateRandomId(),
{ data: files },
{},
mutation
)
)
}
// Remove processed files from buffer
// Do not clear all at once in case pending events arrived during the processing
for (const fileId of fileIdsToProcess) {
bufferFiles.delete(fileId)
}
}
const debouncedDispatchEvents = debounce(
processEvents,
REALTIME_DEBOUNCE_TIME,
{
leading: true, // Do not debounce first event
trailing: true // Execute all at the end of debounce
}
)
/**
* Associate files to their parent folder
*
* @param {Map<string, import('cozy-client/types/types').IOCozyFile} files - The files to group
* @returns {object} The grouped files
*/
const groupFilesByFolder = files => {
const filesByFolder = {}
files.forEach(file => {
const folderId = file.dir_id
if (!filesByFolder[folderId]) {
filesByFolder[folderId] = []
}
filesByFolder[folderId].push(file)
})
return filesByFolder
}
/**
* Normalizes an object representing a CouchDB document
*
* Ensures existence of `_type`
*
* @public
* @param {CouchDBDocument} couchDBDoc - object representing the document
* @returns {CozyClientDocument} full normalized document
*/
const normalizeDoc = (couchDBDoc, doctype) => {
return {
id: couchDBDoc._id,
_type: doctype,
...couchDBDoc
}
}
/**
* Component that subscribes to io.cozy.files document changes and keep the
* internal store updated. This is a copy of RealTimeQueries from cozy-client
* with a tweak to merge the changes with the existing document from the store.
* You can have more detail on the problematic we are solving here:
* https://github.com/cozy/cozy-client/issues/1412
*
* @param {object} options
* @param {string} options.doctype - The doctype to watch.
* @param {Function} [options.computeDocBeforeDispatchCreate]
* @param {Function} [options.computeDocBeforeDispatchUpdate]
* @param {Function} [options.computeDocBeforeDispatchDelete]
* @returns {null} The component does not render anything.
*/
const FilesRealTimeQueries = ({
doctype = 'io.cozy.files',
computeDocBeforeDispatchCreate = ensureFileHasPath,
computeDocBeforeDispatchUpdate = ensureFileHasPath,
computeDocBeforeDispatchDelete = (doc, client) =>
ensureFileHasPath({ ...doc, _deleted: true }, client)
}) => {
const client = useClient()
useEffect(() => {
const { realtime } = client.plugins || {}
if (!realtime) {
throw new Error(
'You must include the realtime plugin to use RealTimeQueries'
)
}
const makeHandler = (buffer, event) => couchDBDoc => {
const normalized = normalizeDoc(couchDBDoc, doctype)
buffer.set(couchDBDoc._id, normalized)
debouncedDispatchEvents(client, event)
}
const eventHandlers = {
created: makeHandler(bufferCreatedFiles, 'created'),
updated: makeHandler(bufferUpdatedFiles, 'updated'),
deleted: makeHandler(bufferDeletedFiles, 'deleted')
}
const subscribeToEvents = async () => {
await Promise.all(
Object.entries(eventHandlers).map(([event, handler]) =>
realtime.subscribe(event, doctype, handler)
)
)
}
subscribeToEvents().catch(err =>
// eslint-disable-next-line no-console
console.error('Failed to subscribe to realtime events:', err)
)
return () => {
Object.entries(eventHandlers).forEach(([event, handler]) =>
realtime.unsubscribe(event, doctype, handler)
)
}
}, [
client,
doctype,
computeDocBeforeDispatchCreate,
computeDocBeforeDispatchUpdate,
computeDocBeforeDispatchDelete
])
return null
}
export default memo(FilesRealTimeQueries)
================================================
FILE: src/components/FilesViewerLoading.jsx
================================================
import React from 'react'
import Backdrop from 'cozy-ui/transpiled/react/Backdrop'
import Spinner from 'cozy-ui/transpiled/react/Spinner'
const FilesViewerLoading = () => (
<Backdrop isOver open>
<Spinner size="xxlarge" middle noMargin color="var(--white)" />
</Backdrop>
)
export { FilesViewerLoading }
================================================
FILE: src/components/FolderPicker/FolderPicker.spec.jsx
================================================
import { render, fireEvent, screen } from '@testing-library/react'
import React from 'react'
import { createMockClient } from 'cozy-client'
import { useSharingContext } from 'cozy-sharing'
import AppLike from 'test/components/AppLike'
import { FolderPicker } from '@/components/FolderPicker/FolderPicker'
jest.mock('cozy-keys-lib', () => ({
useVaultClient: jest.fn()
}))
jest.mock('cozy-sharing', () => ({
...jest.requireActual('cozy-sharing'),
useSharingContext: jest.fn(),
SharingCollection: {
data: jest.fn().mockResolvedValue({ data: [] })
}
}))
useSharingContext.mockReturnValue({ byDocId: [] })
jest.mock('@/components/FolderPicker/FolderPickerBody', () => ({
FolderPickerBody: jest
.fn()
.mockImplementation(({ isFolderCreationDisplayed }) => (
<div data-testid="folder-picker-body">
<div>Mocked Folder Picker Body</div>
{isFolderCreationDisplayed && (
<div data-testid="name-input">
<input placeholder="Folder name" />
</div>
)}
</div>
))
}))
describe('FolderPicker', () => {
const cozyFile = {
id: 'file123',
_id: 'file123',
_type: 'io.cozy.files',
dir_id: 'folder123',
name: 'penguins.jpg'
}
const cozyFolder = {
id: 'folder123',
_id: 'folder123',
_type: 'io.cozy.files',
dir_id: 'io.cozy.files.root-dir',
name: 'Photos'
}
const rootCozyFolder = {
id: 'io.cozy.files.root-dir',
_id: 'io.cozy.files.root-dir',
_type: 'io.cozy.files'
}
const onCloseSpy = jest.fn()
const onConfirmSpy = jest.fn()
const setup = () => {
const mockClient = createMockClient({
queries: {
'io.cozy.files/io.cozy.files.root-dir': {
doctype: 'io.cozy.files',
definition: {
doctype: 'io.cozy.files',
id: 'io.cozy.files.root-dir'
},
data: [rootCozyFolder]
}
}
})
return render(
<AppLike client={mockClient}>
<FolderPicker
currentFolder={cozyFolder}
entries={[cozyFile]}
onClose={onCloseSpy}
onConfirm={onConfirmSpy}
/>
</AppLike>
)
}
it('should be able to move inside another folder', async () => {
setup()
expect(screen.getByText('Photos')).toBeInTheDocument()
const backButton = screen.getByRole('button', {
name: 'Back'
})
fireEvent.click(backButton)
await screen.findByText('Files')
const moveButton = screen.queryByRole('button', {
name: 'Move'
})
fireEvent.click(moveButton)
expect(onConfirmSpy).toHaveBeenCalledWith(rootCozyFolder)
})
it('should display the folder creation input', async () => {
setup()
const addFolderButton = screen.queryByRole('button', {
name: 'Add a folder'
})
fireEvent.click(addFolderButton)
const filenameInput = await screen.findByTestId('name-input')
expect(filenameInput).toBeInTheDocument()
})
it('should render with the provided folder', async () => {
setup()
expect(screen.getByTestId('folder-picker-body')).toBeInTheDocument()
const {
FolderPickerBody
} = require('@/components/FolderPicker/FolderPickerBody')
const props = FolderPickerBody.mock.calls[0][0]
expect(props.folder).toEqual(cozyFolder)
expect(props.entries).toEqual([cozyFile])
expect(typeof props.navigateTo).toBe('function')
})
it('should allow folder creation when canCreateFolder is true', async () => {
const mockClient = createMockClient()
render(
<AppLike client={mockClient}>
<FolderPicker
currentFolder={cozyFolder}
entries={[cozyFile]}
onClose={onCloseSpy}
onConfirm={onConfirmSpy}
canCreateFolder={true}
/>
</AppLike>
)
expect(screen.getByTestId('folder-picker-body')).toBeInTheDocument()
})
})
================================================
FILE: src/components/FolderPicker/FolderPicker.tsx
================================================
import React, { useState } from 'react'
import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
import { makeStyles } from 'cozy-ui/transpiled/react/styles'
import { FolderPickerBody } from '@/components/FolderPicker/FolderPickerBody'
import { FolderPickerFooter } from '@/components/FolderPicker/FolderPickerFooter'
import { FolderPickerHeader } from '@/components/FolderPicker/FolderPickerHeader'
import { FolderPickerTopbar } from '@/components/FolderPicker/FolderPickerTopbar'
import { File, FolderPickerEntry } from '@/components/FolderPicker/types'
interface FolderPickerSlotProps {
header?: {
title?: string
subTitle?: string
}
footer?: {
confirmLabel?: string
cancelLabel?: string
}
}
interface FolderPickerProps {
currentFolder: File
entries: FolderPickerEntry[]
onConfirm: (folder: File) => void
onClose: () => void | Promise<void>
isBusy: boolean
canCreateFolder?: boolean
slotProps?: FolderPickerSlotProps
showNextcloudFolder?: boolean
canPickEntriesParentFolder?: boolean
isPublic?: boolean
showSharedDriveFolder?: boolean
}
const useStyles = makeStyles({
paper: {
height: '100%',
'& .MuiDialogContent-root': {
padding: '0'
},
'& .MuiDialogTitle-root': {
padding: '0'
}
}
})
const FolderPicker: React.FC<FolderPickerProps> = ({
currentFolder,
entries,
onConfirm,
onClose,
isBusy,
canCreateFolder = true,
slotProps,
showNextcloudFolder = false,
canPickEntriesParentFolder = false,
isPublic = false,
showSharedDriveFolder = false
}) => {
const [folder, setFolder] = useState<File>(currentFolder)
const [isFolderCreationDisplayed, setFolderCreationDisplayed] =
useState<boolean>(false)
const classes = useStyles()
const showFolderCreation = (): void => {
setFolderCreationDisplayed(true)
}
const hideFolderCreation = (): void => {
setFolderCreationDisplayed(false)
}
const navigateTo = (folder: File): void => {
setFolder(folder)
setFolderCreationDisplayed(false)
}
return (
<FixedDialog
open
onClose={onClose}
size="large"
classes={{
paper: classes.paper
}}
title={
<>
<FolderPickerHeader entries={entries} {...slotProps?.header} />
<FolderPickerTopbar
navigateTo={navigateTo}
folder={folder}
canCreateFolder={canCreateFolder}
showFolderCreation={showFolderCreation}
/>
</>
}
content={
<FolderPickerBody
folder={folder}
navigateTo={navigateTo}
entries={entries}
isFolderCreationDisplayed={isFolderCreationDisplayed}
hideFolderCreation={hideFolderCreation}
showNextcloudFolder={showNextcloudFolder}
isPublic={isPublic}
showSharedDriveFolder={showSharedDriveFolder}
/>
}
actions={
<FolderPickerFooter
onConfirm={onConfirm}
onClose={onClose}
entries={entries}
folder={folder}
isBusy={isBusy}
canPickEntriesParentFolder={canPickEntriesParentFolder}
{...slotProps?.footer}
/>
}
/>
)
}
export { FolderPicker }
================================================
FILE: src/components/FolderPicker/FolderPickerAddFolderItem.tsx
================================================
import React, { FC } from 'react'
import { useDispatch } from 'react-redux'
import { useClient } from 'cozy-client'
import Divider from 'cozy-ui/transpiled/react/Divider'
import Icon from 'cozy-ui/transpiled/react/Icon'
import IconFolder from 'cozy-ui/transpiled/react/Icons/FileTypeFolder'
import ListItem from 'cozy-ui/transpiled/react/ListItem'
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
import { useI18n } from 'twake-i18n'
import FilenameInput from '@/modules/filelist/FilenameInput'
import { createFolder } from '@/modules/navigation/duck'
interface FolderPickerAddFolderItemProps {
currentFolderId: string
visible: boolean
afterSubmit: () => void
afterAbort: () => void
driveId?: string
}
const FolderPickerAddFolderItem: FC<FolderPickerAddFolderItemProps> = ({
currentFolderId,
visible,
afterSubmit,
afterAbort,
driveId
}) => {
const { isMobile } = useBreakpoints()
const gutters = isMobile ? 'default' : 'double'
const dispatch = useDispatch()
const { showAlert } = useAlert()
const { t } = useI18n()
const client = useClient()
const handleSubmit = (name: string): void => {
dispatch(
createFolder(client, name, currentFolderId, { showAlert, t }, driveId)
)
if (typeof afterSubmit === 'function') {
afterSubmit()
}
}
const handleAbort = (accidental: boolean): void => {
if (accidental) {
showAlert({
message: t('alert.folder_abort'),
severity: 'secondary'
})
}
if (typeof afterAbort === 'function') {
afterAbort()
}
}
if (visible) {
return (
<>
<ListItem gutters={gutters}>
<ListItemIcon>
<Icon icon={IconFolder} size={32} />
</ListItemIcon>
<FilenameInput onSubmit={handleSubmit} onAbort={handleAbort} />
</ListItem>
<Divider />
</>
)
}
return null
}
export { FolderPickerAddFolderItem }
================================================
FILE: src/components/FolderPicker/FolderPickerBody.spec.jsx
================================================
import { render, screen } from '@testing-library/react'
import React from 'react'
import { FolderPickerBody } from '@/components/FolderPicker/FolderPickerBody'
import { ROOT_DIR_ID, SHARED_DRIVES_DIR_ID } from '@/constants/config'
jest.mock('components/FolderPicker/FolderPickerContentCozy', () => ({
FolderPickerContentCozy: () => <div>FolderPickerContentCozy</div>
}))
jest.mock('components/FolderPicker/FolderPickerContentNextcloud', () => ({
FolderPickerContentNextcloud: () => <div>FolderPickerContentNextcloud</div>
}))
jest.mock('components/FolderPicker/FolderPickerContentSharedDrive', () => ({
FolderPickerContentSharedDrive: () => (
<div>FolderPickerContentSharedDrive</div>
)
}))
jest.mock('components/FolderPicker/FolderPickerContentSharedDriveRoot', () => ({
FolderPickerContentSharedDriveRoot: () => (
<div>FolderPickerContentSharedDriveRoot</div>
)
}))
describe('FolderPickerBody', () => {
const defaultProps = {
entries: [],
navigateTo: jest.fn(),
isFolderCreationDisplayed: false,
hideFolderCreation: jest.fn()
}
it('return cozy folder', () => {
const cozyFolder = {
_type: 'io.cozy.files'
}
render(<FolderPickerBody folder={cozyFolder} {...defaultProps} />)
expect(screen.getByText('FolderPickerContentCozy')).toBeInTheDocument()
})
it('return Nextcloud folder', () => {
const nextcloudFolder = {
_type: 'io.cozy.remote.nextcloud.files'
}
render(<FolderPickerBody folder={nextcloudFolder} {...defaultProps} />)
expect(screen.getByText('FolderPickerContentNextcloud')).toBeInTheDocument()
})
it("should display content of recipient's shared drive folder", () => {
const sharedDriveFolder = {
_type: 'io.cozy.files',
_id: 'folder-123',
name: 'Shared Team Folder',
driveId: 'sharing-456',
dir_id: 'parent-folder'
}
render(<FolderPickerBody folder={sharedDriveFolder} {...defaultProps} />)
expect(
screen.getByText('FolderPickerContentSharedDrive')
).toBeInTheDocument()
})
it('should display content of `Drives` folder', () => {
const drivesFolder = {
_type: 'io.cozy.files',
_id: SHARED_DRIVES_DIR_ID,
dir_id: ROOT_DIR_ID,
name: 'Drives'
}
render(
<FolderPickerBody
folder={drivesFolder}
{...defaultProps}
showSharedDriveFolder={true}
/>
)
expect(
screen.getByText('FolderPickerContentSharedDriveRoot')
).toBeInTheDocument()
})
it('should fallback to cozy content for regular folders without driveId', () => {
const regularFolder = {
_type: 'io.cozy.files',
_id: 'regular-folder-123',
name: 'My Documents',
dir_id: 'parent-folder'
}
render(<FolderPickerBody folder={regularFolder} {...defaultProps} />)
expect(screen.getByText('FolderPickerContentCozy')).toBeInTheDocument()
})
})
================================================
FILE: src/components/FolderPicker/FolderPickerBody.tsx
================================================
import React from 'react'
import { FolderPickerContentSharedDriveRoot } from './FolderPickerContentSharedDriveRoot'
import { FolderPickerContentCozy } from '@/components/FolderPicker/FolderPickerContentCozy'
import { FolderPickerContentNextcloud } from '@/components/FolderPicker/FolderPickerContentNextcloud'
import { FolderPickerContentPublic } from '@/components/FolderPicker/FolderPickerContentPublic'
import { FolderPickerContentSharedDrive } from '@/components/FolderPicker/FolderPickerContentSharedDrive'
import { File, FolderPickerEntry } from '@/components/FolderPicker/types'
import { ROOT_DIR_ID, SHARED_DRIVES_DIR_ID } from '@/constants/config'
interface FolderPickerBodyProps {
folder: File
entries: FolderPickerEntry[]
navigateTo: (folder: File) => void
isFolderCreationDisplayed: boolean
hideFolderCreation: () => void
showNextcloudFolder?: boolean
isPublic?: boolean
showSharedDriveFolder?: boolean
}
const FolderPickerBody: React.FC<FolderPickerBodyProps> = ({
folder,
entries,
navigateTo,
isFolderCreationDisplayed,
hideFolderCreation,
showNextcloudFolder,
isPublic,
showSharedDriveFolder
}) => {
if (folder._type === 'io.cozy.remote.nextcloud.files') {
return (
<FolderPickerContentNextcloud
folder={folder}
entries={entries}
navigateTo={navigateTo}
/>
)
}
if (isPublic) {
return (
<FolderPickerContentPublic
folder={folder}
isFolderCreationDisplayed={isFolderCreationDisplayed}
hideFolderCreation={hideFolderCreation}
entries={entries}
navigateTo={navigateTo}
showNextcloudFolder={showNextcloudFolder}
/>
)
}
// Display content of recipient's shared drive folder
if (folder.driveId) {
return (
<FolderPickerContentSharedDrive
folder={folder}
isFolderCreationDisplayed={isFolderCreationDisplayed}
hideFolderCreation={hideFolderCreation}
entries={entries}
navigateTo={navigateTo}
/>
)
}
if (
folder.dir_id === ROOT_DIR_ID &&
folder._id === SHARED_DRIVES_DIR_ID &&
showSharedDriveFolder
) {
return (
<FolderPickerContentSharedDriveRoot
folder={folder}
isFolderCreationDisplayed={isFolderCreationDisplayed}
hideFolderCreation={hideFolderCreation}
entries={entries}
navigateTo={navigateTo}
showNextcloudFolder={showNextcloudFolder}
/>
)
}
return (
<FolderPickerContentCozy
folder={folder}
isFolderCreationDisplayed={isFolderCreationDisplayed}
hideFolderCreation={hideFolderCreation}
entries={entries}
navigateTo={navigateTo}
showNextcloudFolder={showNextcloudFolder}
showSharedDriveFolder={showSharedDriveFolder}
/>
)
}
export { FolderPickerBody }
================================================
FILE: src/components/FolderPicker/FolderPickerContentCozy.tsx
================================================
import React, { useMemo } from 'react'
import { useQuery } from 'cozy-client'
import { isDirectory } from 'cozy-client/dist/models/file'
import { IOCozyFile } from 'cozy-client/types/types'
import List from 'cozy-ui/transpiled/react/List'
import { FolderPickerListItem } from './FolderPickerListItem'
import { FolderPickerAddFolderItem } from '@/components/FolderPicker/FolderPickerAddFolderItem'
import { FolderPickerContentLoadMore } from '@/components/FolderPicker/FolderPickerContentLoadMore'
import { FolderPickerContentLoader } from '@/components/FolderPicker/FolderPickerContentLoader'
import { isInvalidMoveTarget } from '@/components/FolderPicker/helpers'
import { computeNextcloudRootFolder } from '@/components/FolderPicker/helpers'
import type { File, FolderPickerEntry } from '@/components/FolderPicker/types'
import { ROOT_DIR_ID } from '@/constants/config'
import { buildMoveOrImportQuery, buildMagicFolderQuery } from '@/queries'
interface FolderPickerContentCozyProps {
folder: IOCozyFile
isFolderCreationDisplayed: boolean
hideFolderCreation: () => void
entries: FolderPickerEntry[]
navigateTo: (folder: import('./types').File) => void
showNextcloudFolder?: boolean
showSharedDriveFolder?: boolean
}
const FolderPickerContentCozy: React.FC<FolderPickerContentCozyProps> = ({
folder,
isFolderCreationDisplayed,
hideFolderCreation,
entries,
navigateTo,
showNextcloudFolder,
showSharedDriveFolder
}) => {
const contentQuery = buildMoveOrImportQuery(folder._id)
const {
fetchStatus,
data: filesData,
hasMore,
fetchMore
} = useQuery(contentQuery.definition, contentQuery.options) as unknown as {
fetchStatus: string
data?: IOCozyFile[]
hasMore: boolean
fetchMore: () => void
}
const sharedFolderQuery = buildMagicFolderQuery({
id: 'io.cozy.files.shared-drives-dir',
enabled: folder._id === ROOT_DIR_ID
})
const sharedFolderResult = useQuery(
sharedFolderQuery.definition,
sharedFolderQuery.options
) as unknown as {
fetchStatus: string
data?: IOCozyFile[]
}
const files: IOCozyFile[] = useMemo(() => {
if (
folder._id === ROOT_DIR_ID &&
(showNextcloudFolder || showSharedDriveFolder)
) {
return [
...(sharedFolderResult.fetchStatus === 'loaded'
? (sharedFolderResult.data ?? [])
: []),
...(filesData ?? [])
]
}
return [...(filesData ?? [])]
}, [
folder._id,
showNextcloudFolder,
showSharedDriveFolder,
filesData,
sharedFolderResult.fetchStatus,
sharedFolderResult.data
])
const handleClick = (file: File): void => {
if (isDirectory(file)) {
navigateTo(file)
}
if (
file._type === 'io.cozy.files' &&
file.cozyMetadata?.createdByApp === 'nextcloud' &&
file.cozyMetadata.sourceAccount
) {
const nextcloudRootFolder = computeNextcloudRootFolder({
sourceAccount: file.cozyMetadata.sourceAccount,
instanceName: file.metadata.instanceName
})
navigateTo(nextcloudRootFolder)
}
}
return (
<List>
<FolderPickerAddFolderItem
currentFolderId={folder._id}
visible={isFolderCreationDisplayed}
afterSubmit={hideFolderCreation}
afterAbort={hideFolderCreation}
/>
<FolderPickerContentLoader
fetchStatus={fetchStatus}
hasNoData={files.length === 0}
>
{files.map((file, index) => (
<FolderPickerListItem
key={file._id}
file={file}
disabled={isInvalidMoveTarget(entries, file)}
onClick={handleClick}
showDivider={index !== files.length - 1}
/>
))}
<FolderPickerContentLoadMore hasMore={hasMore} fetchMore={fetchMore} />
</FolderPickerContentLoader>
</List>
)
}
export { FolderPickerContentCozy }
================================================
FILE: src/components/FolderPicker/FolderPickerContentLoadMore.tsx
================================================
import React from 'react'
import LoadMoreButton from '@/modules/filelist/LoadMore'
interface FolderPickerContentLoadMoreProps {
hasMore: boolean
fetchMore: () => void
}
const FolderPickerContentLoadMore: React.FC<
FolderPickerContentLoadMoreProps
> = ({ hasMore, fetchMore }) => {
if (hasMore) {
return <LoadMoreButton onClick={fetchMore} isLoading={false} />
}
return null
}
export { FolderPickerContentLoadMore }
================================================
FILE: src/components/FolderPicker/FolderPickerContentLoader.tsx
================================================
import React, { ReactNode } from 'react'
import ListItemSkeleton from 'cozy-ui/transpiled/react/Skeletons/ListItemSkeleton'
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
import { EmptyDrive } from '@/components/Error/Empty'
import Oops from '@/components/Error/Oops'
interface FolderPickerContentLoaderProps {
fetchStatus: string
hasNoData?: boolean
children: ReactNode
}
const FolderPickerContentLoader: React.FC<FolderPickerContentLoaderProps> = ({
fetchStatus,
hasNoData,
children
}) => {
const { isMobile } = useBreakpoints()
const gutters = isMobile ? 'default' : 'double'
if (fetchStatus === 'loading')
return (
<>
{Array.from({ length: 8 }, (_, index) => (
<ListItemSkeleton
key={`key_file_placeholder_${index}`}
gutters={gutters}
hasSecondary
divider={index !== 7}
/>
))}
</>
)
else if (fetchStatus === 'failed') return <Oops />
else if (fetchStatus === 'loaded' && hasNoData)
return <EmptyDrive canUpload={false} />
else return <>{children}</>
}
export { FolderPickerContentLoader }
================================================
FILE: src/components/FolderPicker/FolderPickerContentNextcloud.tsx
================================================
import React from 'react'
import { useQuery } from 'cozy-client'
import { isDirectory } from 'cozy-client/dist/models/file'
import { NextcloudFile } from 'cozy-client/types/types'
import List from 'cozy-ui/transpiled/react/List'
import { FolderPickerListItem } from './FolderPickerListItem'
import { FolderPickerContentLoader } from '@/components/FolderPicker/FolderPickerContentLoader'
import { isInvalidMoveTarget } from '@/components/FolderPicker/helpers'
import type { File, FolderPickerEntry } from '@/components/FolderPicker/types'
import { buildNextcloudFolderQuery } from '@/queries'
interface Props {
folder: NextcloudFile
entries: FolderPickerEntry[] // Update with the appropriate type
navigateTo: (folder: import('./types').File) => void // Update with the appropriate type
}
const FolderPickerContentNextcloud: React.FC<Props> = ({
folder,
entries,
navigateTo
}) => {
const nextcloudQuery = buildNextcloudFolderQuery({
sourceAccount: folder.cozyMetadata.sourceAccount,
path: folder.path
})
const { fetchStatus, data } = useQuery(
nextcloudQuery.definition,
nextcloudQuery.options
) as {
fetchStatus: string
data?: NextcloudFile[]
}
const files = data ?? []
const handleClick = (file: File): void => {
if (isDirectory(file)) {
navigateTo(file)
}
}
return (
<List>
<FolderPickerContentLoader
fetchStatus={fetchStatus}
hasNoData={files.length === 0}
>
{files.map((file, index) => (
<FolderPickerListItem
key={file._id}
file={file}
disabled={isInvalidMoveTarget(entries, file)}
onClick={handleClick}
showDivider={index !== files.length - 1}
/>
))}
</FolderPickerContentLoader>
</List>
)
}
export { FolderPickerContentNextcloud }
================================================
FILE: src/components/FolderPicker/FolderPickerContentPublic.tsx
================================================
import React, { useMemo } from 'react'
import { isDirectory } from 'cozy-client/dist/models/file'
import { IOCozyFile } from 'cozy-client/types/types'
import List from 'cozy-ui/transpiled/react/List'
import { FolderPickerListItem } from './FolderPickerListItem'
import { FolderPickerAddFolderItem } from '@/components/FolderPicker/FolderPickerAddFolderItem'
import { FolderPickerContentLoadMore } from '@/components/FolderPicker/FolderPickerContentLoadMore'
import { FolderPickerContentLoader } from '@/components/FolderPicker/FolderPickerContentLoader'
import { isInvalidMoveTarget } from '@/components/FolderPicker/helpers'
import type { File, FolderPickerEntry } from '@/components/FolderPicker/types'
import usePublicFilesQuery from '@/modules/views/Public/usePublicFilesQuery'
interface FolderPickerContentPublicProps {
folder: IOCozyFile
isFolderCreationDisplayed: boolean
hideFolderCreation: () => void
entries: FolderPickerEntry[]
navigateTo: (folder: import('./types').File) => void
showNextcloudFolder?: boolean
}
const FolderPickerContentPublic: React.FC<FolderPickerContentPublicProps> = ({
folder,
isFolderCreationDisplayed,
hideFolderCreation,
entries,
navigateTo
}) => {
const filesResult = usePublicFilesQuery(folder._id)
const {
data: filesData,
fetchStatus,
hasMore,
fetchMore
} = filesResult as unknown as {
fetchStatus: string
data?: IOCozyFile[]
hasMore: boolean
fetchMore: () => void
}
const files: IOCozyFile[] = useMemo(() => {
return [...(filesData ?? [])]
}, [filesData])
const handleClick = (file: File): void => {
if (isDirectory(file)) {
navigateTo(file)
}
}
return (
<List>
<FolderPickerAddFolderItem
currentFolderId={folder._id}
visible={isFolderCreationDisplayed}
afterSubmit={hideFolderCreation}
afterAbort={hideFolderCreation}
/>
<FolderPickerContentLoader
fetchStatus={fetchStatus}
hasNoData={files.length === 0}
>
{files.map((file, index) => (
<FolderPickerListItem
key={file._id}
file={file}
disabled={isInvalidMoveTarget(entries, file)}
onClick={handleClick}
showDivider={index !== files.length - 1}
/>
))}
<FolderPickerContentLoadMore hasMore={hasMore} fetchMore={fetchMore} />
</FolderPickerContentLoader>
</List>
)
}
export { FolderPickerContentPublic }
================================================
FILE: src/components/FolderPicker/FolderPickerContentSharedDrive.tsx
================================================
import * as React from 'react'
import { useMemo } from 'react'
import { isDirectory } from 'cozy-client/dist/models/file'
import type { IOCozyFile } from 'cozy-client/types/types'
import List from 'cozy-ui/transpiled/react/List'
import { FolderPickerListItem } from './FolderPickerListItem'
import { FolderPickerAddFolderItem } from '@/components/FolderPicker/FolderPickerAddFolderItem'
import { FolderPickerContentLoader } from '@/components/FolderPicker/FolderPickerContentLoader'
import { isInvalidMoveTarget } from '@/components/FolderPicker/helpers'
import type { File, FolderPickerEntry } from '@/components/FolderPicker/types'
import { useSharedDriveFolder } from '@/modules/shareddrives/hooks/useSharedDriveFolder'
interface FolderPickerContentSharedDriveProps {
folder: IOCozyFile
isFolderCreationDisplayed: boolean
hideFolderCreation: () => void
entries: FolderPickerEntry[]
navigateTo: (folder: import('./types').File) => void
showNextcloudFolder?: boolean
}
const FolderPickerContentSharedDrive: React.FC<
FolderPickerContentSharedDriveProps
> = ({
folder,
isFolderCreationDisplayed,
hideFolderCreation,
entries,
navigateTo
}) => {
const driveId = folder.driveId ?? ''
const folderId = folder._id
const { sharedDriveResult } = useSharedDriveFolder({
driveId,
folderId
})
const { fetchStatus, files } = useMemo(
() =>
sharedDriveResult.included || sharedDriveResult.data
? { fetchStatus: 'loaded', files: sharedDriveResult.included ?? [] }
: { fetchStatus: 'loading', files: [] },
[sharedDriveResult]
)
const handleClick = (file: File): void => {
if (isDirectory(file)) {
navigateTo(file)
}
}
return (
<List>
<FolderPickerAddFolderItem
currentFolderId={folder._id}
visible={isFolderCreationDisplayed}
afterSubmit={hideFolderCreation}
afterAbort={hideFolderCreation}
driveId={folder.driveId}
/>
<FolderPickerContentLoader
fetchStatus={fetchStatus}
hasNoData={files.length === 0}
>
{files.map((file: IOCozyFile, index: number) => (
<FolderPickerListItem
key={file._id}
file={file}
disabled={isInvalidMoveTarget(entries, file)}
onClick={handleClick}
showDivider={index !== files.length - 1}
/>
))}
</FolderPickerContentLoader>
</List>
)
}
export { FolderPickerContentSharedDrive }
================================================
FILE: src/components/FolderPicker/FolderPickerContentSharedDriveRoot.tsx
================================================
import React, { useMemo } from 'react'
import { useQuery } from 'cozy-client'
import { isDirectory } from 'cozy-client/dist/models/file'
import { IOCozyFile } from 'cozy-client/types/types'
import { useSharingContext } from 'cozy-sharing'
import List from 'cozy-ui/transpiled/react/List'
import { FolderPickerListItem } from './FolderPickerListItem'
import { FolderPickerAddFolderItem } from '@/components/FolderPicker/FolderPickerAddFolderItem'
import { FolderPickerContentLoadMore } from '@/components/FolderPicker/FolderPickerContentLoadMore'
import { FolderPickerContentLoader } from '@/components/FolderPicker/FolderPickerContentLoader'
import { isInvalidMoveTarget } from '@/components/FolderPicker/helpers'
import { computeNextcloudRootFolder } from '@/components/FolderPicker/helpers'
import type { File, FolderPickerEntry } from '@/components/FolderPicker/types'
import { useTransformFolderListHasSharedDriveShortcuts } from '@/hooks/useTransformFolderListHasSharedDriveShortcuts'
import { buildMoveOrImportQuery } from '@/queries'
interface FolderPickerContentSharedDriveRootProps {
folder: IOCozyFile
isFolderCreationDisplayed: boolean
hideFolderCreation: () => void
entries: FolderPickerEntry[]
navigateTo: (folder: import('./types').File) => void
showNextcloudFolder?: boolean
}
const FolderPickerContentSharedDriveRoot: React.FC<
FolderPickerContentSharedDriveRootProps
> = ({
folder,
isFolderCreationDisplayed,
hideFolderCreation,
entries,
navigateTo,
showNextcloudFolder
}) => {
const { hasWriteAccess } = useSharingContext() as unknown as {
hasWriteAccess: (folderId: string, driveId?: string) => boolean
}
const contentQuery = buildMoveOrImportQuery(folder._id)
const {
fetchStatus,
data: filesData,
hasMore,
fetchMore
} = useQuery(contentQuery.definition, contentQuery.options) as unknown as {
fetchStatus: string
data?: IOCozyFile[]
hasMore: boolean
fetchMore: () => void
}
const { sharedDrives, nonSharedDriveList } =
useTransformFolderListHasSharedDriveShortcuts(
filesData,
showNextcloudFolder
) as {
sharedDrives: IOCozyFile[]
nonSharedDriveList: IOCozyFile[]
}
const files: IOCozyFile[] = useMemo(() => {
return [...sharedDrives, ...nonSharedDriveList]
}, [sharedDrives, nonSharedDriveList])
const handleClick = (file: File): void => {
if (isDirectory(file)) {
navigateTo(file)
}
if (
file._type === 'io.cozy.files' &&
file.cozyMetadata?.createdByApp === 'nextcloud' &&
file.cozyMetadata.sourceAccount
) {
const nextcloudRootFolder = computeNextcloudRootFolder({
sourceAccount: file.cozyMetadata.sourceAccount,
instanceName: file.metadata.instanceName
})
navigateTo(nextcloudRootFolder)
}
}
return (
<List>
<FolderPickerAddFolderItem
currentFolderId={folder._id}
visible={isFolderCreationDisplayed}
afterSubmit={hideFolderCreation}
afterAbort={hideFolderCreation}
/>
<FolderPickerContentLoader
fetchStatus={fetchStatus}
hasNoData={files.length === 0}
>
{files.map((file, index) => (
<FolderPickerListItem
key={file._id}
file={file}
disabled={
isInvalidMoveTarget(entries, file) ||
!hasWriteAccess(file._id, file.driveId)
}
onClick={handleClick}
showDivider={index !== files.length - 1}
/>
))}
<FolderPickerContentLoadMore hasMore={hasMore} fetchMore={fetchMore} />
</FolderPickerContentLoader>
</List>
)
}
export { FolderPickerContentSharedDriveRoot }
================================================
FILE: src/components/FolderPicker/FolderPickerFooter.tsx
================================================
import React from 'react'
import { IOCozyFile } from 'cozy-client/types/types'
import Buttons from 'cozy-ui/transpiled/react/Buttons'
import { useI18n } from 'twake-i18n'
import { areTargetsInCurrentDir } from '@/components/FolderPicker/helpers'
import { File, FolderPickerEntry } from '@/components/FolderPicker/types'
import { ROOT_DIR_ID, SHARED_DRIVES_DIR_ID } from '@/constants/config'
interface FolderPickerFooterProps {
onConfirm: (folder: File) => void
onClose: () => void | Promise<void>
entries: FolderPickerEntry[]
folder: File
isBusy?: boolean
confirmLabel?: string
cancelLabel?: string
canPickEntriesParentFolder?: boolean
}
/**
* List of actions for the move modal
*/
const FolderPickerFooter: React.FC<FolderPickerFooterProps> = ({
onConfirm,
onClose,
entries,
folder,
isBusy = false,
confirmLabel,
cancelLabel,
canPickEntriesParentFolder
}) => {
const { t } = useI18n()
const primaryText = confirmLabel ? confirmLabel : t('Move.action')
const secondaryText = cancelLabel ? cancelLabel : t('Move.cancel')
const handleClick = (): void => {
onConfirm(folder)
}
const isDisabled =
isBusy ||
((folder as IOCozyFile).dir_id === ROOT_DIR_ID &&
folder._id === SHARED_DRIVES_DIR_ID) ||
(!canPickEntriesParentFolder && areTargetsInCurrentDir(entries, folder))
return (
<>
<Buttons variant="secondary" label={secondaryText} onClick={onClose} />
<Buttons
label={primaryText}
onClick={handleClick}
disabled={isDisabled}
busy={isBusy}
/>
</>
)
}
export { FolderPickerFooter }
================================================
FILE: src/components/FolderPicker/FolderPickerHeader.spec.js
================================================
import { render } from '@testing-library/react'
import React from 'react'
import CozyClient from 'cozy-client'
import { FolderPickerHeader } from './FolderPickerHeader'
import AppLike from 'test/components/AppLike'
jest.mock('lib/logger', () => ({
error: jest.fn()
}))
describe('FolderPickerHeader', () => {
const setupComponent = ({ entries = [], title, subTitle }) => {
const props = {
entries,
title,
subTitle
}
const client = new CozyClient({})
return render(
<AppLike client={client}>
<FolderPickerHeader {...props} />
</AppLike>
)
}
it('should fallback to Move title if no title is given', () => {
const { getByText } = setupComponent({
entries: [{ file: 1 }, { file: 2 }]
})
expect(getByText('2 elements'))
})
it('should display title if title is given and no file', () => {
const { getByText } = setupComponent({
title: 'My Title'
})
expect(getByText('My Title'))
})
it('should display the right title if only one io.cozy.files', () => {
const { getByText } = setupComponent({
title: 'My Title',
entries: [
{
name: 'FileName.txt',
class: 'file'
}
]
})
expect(getByText('FileName.txt'))
})
it('should display the right title if it comes from the outside', () => {
const { getByText } = setupComponent({
title: 'My Title',
entries: [
{
name: 'FileName.txt'
}
]
})
expect(getByText('FileName.txt'))
})
it('should display the right title if more than one files', () => {
const { getByText } = setupComponent({
title: 'My Title',
entries: [
{
name: 'FileName.txt'
},
{
name: 'FileName2.txt'
}
]
})
expect(getByText('My Title'))
})
})
================================================
FILE: src/components/FolderPicker/FolderPickerHeader.tsx
================================================
import React from 'react'
import Box from 'cozy-ui/transpiled/react/Box'
import Typography from 'cozy-ui/transpiled/react/Typography'
import { useI18n } from 'twake-i18n'
import { FolderPickerHeaderIllustration } from '@/components/FolderPicker/FolderPickerHeaderIllustration'
import { FolderPickerEntry } from '@/components/FolderPicker/types'
interface FolderPickerHeaderProps {
entries: FolderPickerEntry[]
title?: string
subTitle?: string
}
const specificCardStyle: React.CSSProperties = {
marginLeft: '2rem',
marginRight: '4rem',
marginTop: '1rem',
marginBottom: '1rem',
background: 'var(--contrastBackgroundColor)',
display: 'flex',
alignItems: 'center',
gap: '1rem'
}
const FolderPickerHeader: React.FC<FolderPickerHeaderProps> = ({
entries,
title,
subTitle
}) => {
const { t } = useI18n()
const titleToUse = title
? title
: t('Move.title', { smart_count: entries.length })
const subTitleToUse = subTitle ? subTitle : t('Move.to')
return (
<Box
display="block"
border={1}
borderColor="var(--dividerColor)"
borderRadius={8}
padding={2}
className="u-m-half-s u-mv-1 u-mh-2"
style={specificCardStyle}
>
<FolderPickerHeaderIllustration entries={entries} />
<div className="u-ellipsis">
<Typography variant="h6" noWrap>
{entries.length !== 1 ? titleToUse : entries[0].name}
</Typography>
<Typography variant="caption" color="textSecondary" noWrap>
{subTitleToUse}
</Typography>
</div>
</Box>
)
}
export { FolderPickerHeader }
================================================
FILE: src/components/FolderPicker/FolderPickerHeaderIllustration.tsx
================================================
import React from 'react'
import Avatar from 'cozy-ui/transpiled/react/Avatar'
import Icon from 'cozy-ui/transpiled/react/Icon'
import DriveIcon from 'cozy-ui/transpiled/react/Icons/FileTypeFolder'
import { FolderPickerEntry } from '@/components/FolderPicker/types'
import getMimeTypeIcon from '@/lib/getMimeTypeIcon'
import FileThumbnail from '@/modules/filelist/icons/FileThumbnail'
interface FolderPickerHeaderIllustrationProps {
entries: FolderPickerEntry[]
}
const FolderPickerHeaderIllustration: React.FC<
FolderPickerHeaderIllustrationProps
> = ({ entries }) => {
if (entries.length === 1) {
const firstItem = entries[0]
// this is a cozy files
if (firstItem.class) {
return <FileThumbnail file={firstItem} isInSyncFromSharing={false} />
}
// this is a cozy-flagship file, doesn't have a class yet
if (firstItem.name && firstItem.mime) {
return (
<Icon
icon={getMimeTypeIcon(false, firstItem.name, firstItem.mime)}
size={32}
/>
)
}
return <Icon icon={DriveIcon} size={32} />
}
if (entries.length > 1) {
return (
<Avatar color="var(--dodgerBlue)" textColor="var(--white)">
<span>{entries.length > 99 ? '99+' : entries.length}</span>
</Avatar>
)
}
return null
}
export { FolderPickerHeaderIllustration }
================================================
FILE: src/components/FolderPicker/FolderPickerListItem.tsx
================================================
import { filesize } from 'filesize'
import React, { FC } from 'react'
import { isDirectory } from 'cozy-client/dist/models/file'
import Divider from 'cozy-ui/transpiled/react/Divider'
import ListItem from 'cozy-ui/transpiled/react/ListItem'
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
import { useI18n } from 'twake-i18n'
import styles from '@/styles/folder-picker.styl'
import type { File } from '@/components/FolderPicker/types'
import { getFileNameAndExtension } from '@/modules/filelist/helpers'
import FileThumbnail from '@/modules/filelist/icons/FileThumbnail'
interface FolderPickerListItemProps {
file: File
disabled?: boolean
onClick: (file: File) => void
showDivider?: boolean
}
const FolderPickerListItem: FC<FolderPickerListItemProps> = ({
file,
disabled = false,
onClick,
showDivider = false
}) => {
const { f, t } = useI18n()
const { isMobile } = useBreakpoints()
const gutters = isMobile ? 'default' : 'double'
const handleClick = (): void => {
onClick(file)
}
const formattedUpdatedAt = f(
new Date(file.updated_at),
t('table.row_update_format')
)
const formattedSize = file.size
? filesize(file.size, { base: 10 })
: undefined
const secondaryText = !isDirectory(file)
? `${formattedUpdatedAt}${formattedSize ? ` - ${formattedSize}` : ''}`
: undefined
const { title } = getFileNameAndExtension(file, t)
return (
<>
<ListItem
button
onClick={handleClick}
disabled={disabled}
gutters={gutters}
>
<ListItemIcon className="u-pos-relative">
<FileThumbnail
file={file}
showSharedBadge
componentsProps={{
sharedBadge: {
className: styles['icon-shared']
}
}}
/>
</ListItemIcon>
<ListItemText primary={title} secondary={secondaryText} />
</ListItem>
{showDivider && <Divider />}
</>
)
}
export { FolderPickerListItem }
================================================
FILE: src/components/FolderPicker/FolderPickerTopbar.spec.jsx
================================================
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
import React from 'react'
import { createMockClient } from 'cozy-client'
import AppLike from 'test/components/AppLike'
import { FolderPickerTopbar } from '@/components/FolderPicker/FolderPickerTopbar'
jest.mock('@/modules/nextcloud/hooks/useNextcloudInfos', () => ({
useNextcloudInfos: () => ({
isLoading: false,
instanceName: 'Cozycloud',
instanceUrl: 'https://cozycloud.example.com',
rootFolderName: 'Cozycloud (Nextcloud)'
})
}))
describe('FolderPickerTopbar', () => {
const navigateTo = jest.fn()
const showFolderCreation = jest.fn()
const cozyFolder = {
_id: '123',
_type: 'io.cozy.files',
type: 'directory',
dir_id: 'io.cozy.files.root-dir',
name: 'Photos'
}
const rootCozyFolder = {
id: 'io.cozy.files.root-dir',
_id: 'io.cozy.files.root-dir',
_type: 'io.cozy.files',
type: 'directory'
}
const sharedDrivesFolder = {
id: 'io.cozy.files.shared-drives-dir',
_id: 'io.cozy.files.shared-drives-dir',
_type: 'io.cozy.files',
type: 'directory',
dir_id: 'io.cozy.files.root-dir'
}
const nextcloudFolder = {
id: '123',
_id: '123',
_type: 'io.cozy.remote.nextcloud.files',
path: '/Documents',
parentPath: '/',
name: 'Documents',
cozyMetadata: {
sourceAccount: '123'
},
links: {
self: 'unknown'
},
size: 0,
type: 'directory',
updated_at: expect.any(String)
}
const rootNextcloudFolder = {
id: 'io.cozy.remote.nextcloud.files.root-dir',
_id: 'io.cozy.remote.nextcloud.files.root-dir',
_type: 'io.cozy.remote.nextcloud.files',
path: '/',
parentPath: '',
name: 'Cozycloud (Nextcloud)',
cozyMetadata: {
sourceAccount: '123'
},
links: {
self: 'unknown'
},
size: 0,
type: 'directory',
updated_at: expect.any(String)
}
const setup = ({
canCreateFolder = false,
folder,
showFolderCreation: showFolderCreationProp
} = {}) => {
const mockClient = createMockClient({
queries: {
'io.cozy.files/io.cozy.files.root-dir': {
doctype: 'io.cozy.files',
definition: {
doctype: 'io.cozy.files',
id: 'io.cozy.files.root-dir'
},
data: [rootCozyFolder]
},
'io.cozy.files/io.cozy.files.shared-drives-dir': {
doctype: 'io.cozy.files',
definition: {
doctype: 'io.cozy.files',
id: 'io.cozy.files.shared-drives-dir'
},
data: [sharedDrivesFolder]
},
'io.cozy.remote.nextcloud.files/sourceAccount/123/path/': {
doctype: 'io.cozy.remote.nextcloud.files',
data: [nextcloudFolder]
}
}
})
return render(
<AppLike client={mockClient}>
<FolderPickerTopbar
navigateTo={navigateTo}
folder={folder}
canCreateFolder={canCreateFolder}
showFolderCreation={showFolderCreationProp}
/>
</AppLike>
)
}
it('should hide back button for the root cozy folder', () => {
setup({ folder: rootCozyFolder })
expect(screen.getByText('Files')).toBeInTheDocument()
const backButton = screen.queryByRole('button', {
name: 'Back'
})
expect(backButton).toBeNull()
})
it('should show back button for a cozy folder', async () => {
setup({ folder: cozyFolder })
expect(screen.getByText('Photos')).toBeInTheDocument()
const backButton = screen.getByRole('button', {
name: 'Back'
})
fireEvent.click(backButton)
await waitFor(() => {
expect(navigateTo).toHaveBeenCalledWith(rootCozyFolder)
})
})
it('should show back button for a nextcloud folder', async () => {
setup({ folder: nextcloudFolder })
expect(screen.getByText('Documents')).toBeInTheDocument()
const backButton = screen.getByRole('button', {
name: 'Back'
})
fireEvent.click(backButton)
await waitFor(() => {
expect(navigateTo).toHaveBeenCalledWith(rootNextcloudFolder)
})
})
it('should show back button inside a deep nextcloud folder', async () => {
setup({
folder: {
_id: '123',
_type: 'io.cozy.remote.nextcloud.files',
path: '/Documents/Invoices',
parentPath: '/Documents',
name: 'Invoices',
cozyMetadata: {
sourceAccount: '123'
}
}
})
expect(screen.getByText('Invoices')).toBeInTheDocument()
const backButton = screen.getByRole('button', {
name: 'Back'
})
fireEvent.click(backButton)
await waitFor(() => {
expect(navigateTo).toHaveBeenCalledWith(
expect.objectContaining({
_id: '123',
_type: 'io.cozy.remote.nextcloud.files',
path: '/Documents',
parentPath: '/',
name: 'Documents',
cozyMetadata: {
sourceAccount: '123'
},
id: '123'
})
)
})
})
it('should show back button for a root nextcloud folder', async () => {
setup({ folder: rootNextcloudFolder })
expect(screen.getByText('Cozycloud (Nextcloud)')).toBeInTheDocument()
const backButton = screen.getByRole('button', {
name: 'Back'
})
fireEvent.click(backButton)
await waitFor(() => {
expect(navigateTo).toHaveBeenCalledWith(sharedDrivesFolder)
})
})
it('should show create folder button when canCreateFolder and inside cozy folder', async () => {
setup({ canCreateFolder: true, folder: cozyFolder, showFolderCreation })
const addFolderButton = screen.getByRole('button', {
name: 'Add a folder'
})
fireEvent.click(addFolderButton)
await waitFor(() => {
expect(showFolderCreation).toHaveBeenCalled()
})
})
it('should hide create folder button when canCreateFolder is false', () => {
setup({ canCreateFolder: false, folder: cozyFolder })
const addFolderButton = screen.queryByRole('button', {
name: 'Add a folder'
})
expect(addFolderButton).toBeNull()
})
it('should hide create folder button when canCreateFolder is true but its inside Nextcloud folder', () => {
setup({
canCreateFolder: true,
folder: nextcloudFolder
})
const addFolderButton = screen.queryByRole('button', {
name: 'Add a folder'
})
expect(addFolderButton).toBeNull()
})
})
================================================
FILE: src/components/FolderPicker/FolderPickerTopbar.tsx
================================================
import cx from 'classnames'
import React, { useCallback, useState } from 'react'
import { useClient } from 'cozy-client'
import Icon from 'cozy-ui/transpiled/react/Icon'
import IconButton from 'cozy-ui/transpiled/react/IconButton'
import FolderAddIcon from 'cozy-ui/transpiled/react/Icons/FolderAdd'
import Typography from 'cozy-ui/transpiled/react/Typography'
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
import { useI18n } from 'twake-i18n'
import { getParentFolder } from './helpers'
import BackButton from '@/components/Button/BackButton'
import { File } from '@/components/FolderPicker/types'
import { ROOT_DIR_ID } from '@/constants/config'
import { useNextcloudInfos } from '@/modules/nextcloud/hooks/useNextcloudInfos'
interface FolderPickerTopbarProps {
navigateTo: (folder: import('./types').File) => void
folder: File
showFolderCreation?: () => void
canCreateFolder?: boolean
}
const FolderPickerTopbar: React.FC<FolderPickerTopbarProps> = ({
navigateTo,
folder,
showFolderCreation,
canCreateFolder
}) => {
const { t } = useI18n()
const client = useClient()
const { isMobile } = useBreakpoints()
const [isNavigating, setNavigating] = useState(false)
const showBackButton = folder._id !== ROOT_DIR_ID
const { instanceName } = useNextcloudInfos({
sourceAccount: folder.cozyMetadata?.sourceAccount
})
const handleNavigateTo = useCallback(async () => {
setNavigating(true)
const parentFolder = await getParentFolder(client, folder, {
instanceName
})
navigateTo(parentFolder)
setNavigating(false)
}, [client, folder, navigateTo, instanceName])
const name =
folder._id === ROOT_DIR_ID ? t('breadcrumb.title_drive') : folder.name
const showCreateFolderButton =
canCreateFolder && folder._type !== 'io.cozy.remote.nextcloud.files'
return (
<div
style={{ height: '3rem' }}
className={cx('u-flex u-flex-items-center', !isMobile ? 'u-mh-1' : '')}
>
{showBackButton ? (
<BackButton onClick={handleNavigateTo} disabled={isNavigating} />
) : null}
<Typography variant="h4" className={!showBackButton ? 'u-ml-1' : ''}>
{name}
</Typography>
{showCreateFolderButton ? (
<IconButton
className="u-ml-auto"
onClick={showFolderCreation}
aria-label={t('Move.addFolder')}
>
<Icon icon={FolderAddIcon} />
</IconButton>
) : null}
</div>
)
}
export { FolderPickerTopbar }
================================================
FILE: src/components/FolderPicker/helpers.spec.js
================================================
import { areTargetsInCurrentDir } from './helpers'
describe('areTargetsInCurrentDir', () => {
it('should return false if the current folder is undefined', () => {
const targets = [
{ _id: 'folder1', path: '/folder1' },
{ _id: 'folder2', path: '/folder2' }
]
const folder = undefined
expect(areTargetsInCurrentDir(targets, folder)).toBe(false)
})
it('should return true if all targets are in the current folder', () => {
const targets = [
{ _id: 'folder1', path: '/folder1', dir_id: 'currentFolder' },
{ _id: 'folder2', path: '/folder2', dir_id: 'currentFolder' }
]
const folder = { _id: 'currentFolder', path: '/currentFolder' }
expect(areTargetsInCurrentDir(targets, folder)).toBe(true)
})
it('should return false if not all targets are in the current folder', () => {
const targets = [
{ _id: 'folder1', path: '/folder1', dir_id: 'currentFolder' },
{ _id: 'folder2', path: '/folder2', dir_id: 'otherFolder' }
]
const folder = { _id: 'currentFolder', path: '/currentFolder' }
expect(areTargetsInCurrentDir(targets, folder)).toBe(false)
})
it('should return true if all targets are in the root folder', () => {
const targets = [
{ _id: 'folder1', path: '/folder1' },
{ _id: 'file1', path: '/file1.png' }
]
const folder = { _id: 'io.cozy.files.root-dir', path: '/' }
expect(areTargetsInCurrentDir(targets, folder)).toBe(true)
})
it('should return true if all targets are in a subfolder', () => {
const targets = [
{ _id: 'folder3', path: '/folder1/folder2/folder3' },
{ _id: 'file1', path: '/folder1/folder2/file1.png' }
]
const folder = { _id: 'folder2', path: '/folder1/folder2' }
expect(areTargetsInCurrentDir(targets, folder)).toBe(true)
})
it('should return false if all targets deeper inside subfolders', () => {
const targets = [
{ _id: 'folder3', path: '/folder1/folder2/folder3' },
{ _id: 'file1', path: '/folder1/folder2/file1.png' }
]
const folder = { _id: 'folder1', path: '/folder1' }
expect(areTargetsInCurrentDir(targets, folder)).toBe(false)
})
})
================================================
FILE: src/components/FolderPicker/helpers.ts
================================================
import CozyClient from 'cozy-client/types/CozyClient'
import { IOCozyFile, NextcloudFile } from 'cozy-client/types/types'
import { FolderPickerEntry, File } from '@/components/FolderPicker/types'
import { SHARED_DRIVES_DIR_ID } from '@/constants/config'
import { getParentPath } from '@/lib/path'
import {
buildFileOrFolderByIdQuery,
buildNextcloudFolderQuery,
buildSharedDriveFileOrFolderByIdQuery
} from '@/queries'
/**
* Checks if the target is an invalid move target based on the subjects and target provided.
*
* @param subjects - The array of subjects to check against.
* @param target - The target object to check.
* @returns - Returns true if the target is an invalid move target, otherwise false.
*/
export const isInvalidMoveTarget = (
subjects: FolderPickerEntry[],
target: File
): boolean => {
const isASubject = subjects.find(subject => subject._id === target._id)
const isAFile =
target.type === 'file' &&
(target._type === 'io.cozy.remote.nextcloud.files' ||
target.cozyMetadata?.createdByApp !== 'nextcloud')
return isAFile || isASubject !== undefined
}
/**
* Returns whether one of the targeted folders is part of the current folder
*
* @param targets - List of folders
* @param folder - The id of the current folder
* @returns - Whether one of the targeted folders is part of the current folder
*/
export const areTargetsInCurrentDir = (
targets: FolderPickerEntry[],
folder?: File
): boolean => {
if (!folder) return false
return targets.every(target => {
if (target.dir_id) {
return target.dir_id === folder._id
}
if (target._type === folder._type && target.path) {
return getParentPath(target.path) === folder.path
}
return false
})
}
/**
* Retrieves the parent folder of a given file from the Cozy client.
*
* @param client - The Cozy client instance.
* @param folder - The file for which to retrieve the parent folder.
* @returns A promise that resolves to the parent folder of the given file, or undefined if not found.
*/
const getCozyParentFolder = async (
client: CozyClient | null,
id: string,
driveId?: string
): Promise<IOCozyFile> => {
const parentFolderQuery = driveId
? buildSharedDriveFileOrFolderByIdQuery({ fileId: id, driveId })
: buildFileOrFolderByIdQuery(id)
const parentFolder = (await client?.fetchQueryAndGetFromState({
definition: parentFolderQuery.definition(),
options: parentFolderQuery.options
})) as {
data?: IOCozyFile
}
if (!parentFolder.data) {
throw new Error('Parent folder not found')
}
return parentFolder.data
}
/**
* Returns the root folder object for Nextcloud.
*
* @param options - The options for getting the root folder.
* @param options.sourceAccount - The id of account that n.
* @param options.instanceName - The instance name of the Nextcloud server.
* @returns - The root folder object.
*/
export const computeNextcloudRootFolder = ({
sourceAccount,
instanceName
}: {
sourceAccount: string
instanceName?: string
}): NextcloudFile => ({
id: 'io.cozy.remote.nextcloud.files.root-dir',
_id: 'io.cozy.remote.nextcloud.files.root-dir',
_type: 'io.cozy.remote.nextcloud.files',
name: `${instanceName ?? ''} (Nextcloud)`,
path: '/',
parentPath: '',
cozyMetadata: {
sourceAccount: sourceAccount
},
type: 'directory',
links: {
self: 'unknown'
},
size: 0,
updated_at: new Date().toISOString()
})
/**
* Retrieves the parent folder of a given Nextcloud file.
*
* @param client - The CozyClient instance used to fetch the parent folder.
* @param folder - The Nextcloud file for which to retrieve the parent folder.
* @returns A Promise that resolves to the parent folder of the given Nextcloud file, or undefined if not found.
*/
const getNextcloudParentFolder = async (
client: CozyClient | null,
folder: NextcloudFile
): Promise<NextcloudFile> => {
const parentFolderQuery = buildNextcloudFolderQuery({
sourceAccount: folder.cozyMetadata.sourceAccount,
path: getParentPath(folder.parentPath) ?? 'unknown'
})
const parentFolderResult = (await client?.fetchQueryAndGetFromState({
definition: parentFolderQuery.definition(),
options: parentFolderQuery.options
})) as {
data?: NextcloudFile[]
}
const parentFolder = (parentFolderResult.data ?? []).find(
file => file.path === folder.parentPath
)
if (!parentFolder) {
throw new Error('Parent folder not found')
}
return parentFolder
}
/**
* Retrieves the parent folder of a given file.
*
* @param client - The CozyClient instance.
* @param folder - The file for which to retrieve the parent folder.
* @param instanceName - (Optional) The name of the Cozy instance.
* @returns A Promise that resolves to the parent folder of the given file, or undefined if the file is the root folder.
*/
export const getParentFolder = async (
client: CozyClient | null,
folder: File,
{ instanceName }: { instanceName?: string }
): Promise<File> => {
if (folder._type === 'io.cozy.remote.nextcloud.files') {
if (folder.path === '/') {
return await getCozyParentFolder(client, SHARED_DRIVES_DIR_ID)
}
if (folder.parentPath === '/') {
return computeNextcloudRootFolder({
sourceAccount: folder.cozyMetadata.sourceAccount,
instanceName
})
} else {
return await getNextcloudParentFolder(client, folder)
}
}
const driveId = folder.dir_id === SHARED_DRIVES_DIR_ID ? '' : folder.driveId
return await getCozyParentFolder(client, folder.dir_id, driveId)
}
================================================
FILE: src/components/FolderPicker/types.ts
================================================
import { IOCozyFile, NextcloudFile } from 'cozy-client/types/types'
export type File = IOCozyFile | NextcloudFile
export interface FolderPickerEntry {
_id?: string
_type: string
type: string
name: string
mime: string
dir_id?: string
class?: string
path?: string
driveId?: string
}
================================================
FILE: src/components/IconPicker/IconColorPicker.jsx
================================================
import PropTypes from 'prop-types'
import React from 'react'
import ClickAwayListener from 'cozy-ui/transpiled/react/ClickAwayListener'
import GridList from 'cozy-ui/transpiled/react/GridList'
import GridListTile from 'cozy-ui/transpiled/react/GridListTile'
import Icon from 'cozy-ui/transpiled/react/Icon'
import IconButton from 'cozy-ui/transpiled/react/IconButton'
import Paper from 'cozy-ui/transpiled/react/Paper'
import Popper from 'cozy-ui/transpiled/react/Popper'
import { getIcon } from './IconIndex'
import { ICON_COLORS } from './constants'
import styles from '@/styles/folder-customizer.styl'
export const IconColorPicker = ({
anchorEl,
selectedIcon,
iconSize,
isMobile,
onPickColor,
onClose
}) => {
return (
<Popper
open={true}
anchorEl={anchorEl}
placement="bottom"
disablePortal={false}
className={styles.iconColorPopper}
>
<ClickAwayListener onClickAway={onClose} mouseEvent="onMouseDown">
<Paper className={`u-p-half u-dib ${styles.iconColorPaper}`}>
<GridList cols={6} cellHeight={isMobile ? 34 : 30}>
{ICON_COLORS.map(color => (
<GridListTile key={color} className="u-ta-center">
<IconButton
className="u-p-0"
onClick={() => onPickColor(color)}
>
<Icon
size={iconSize}
icon={getIcon(selectedIcon)}
color={color}
/>
</IconButton>
</GridListTile>
))}
</GridList>
</Paper>
</ClickAwayListener>
</Popper>
)
}
IconColorPicker.propTypes = {
anchorEl: PropTypes.any,
selectedIcon: PropTypes.string,
iconSize: PropTypes.number,
isMobile: PropTypes.bool,
onPickColor: PropTypes.func,
onClose: PropTypes.func
}
IconColorPicker.displayName = 'IconColorPicker'
================================================
FILE: src/components/IconPicker/IconIndex.js
================================================
import Album from 'cozy-ui/transpiled/react/Icons/Album'
import AlbumAdd from 'cozy-ui/transpiled/react/Icons/AlbumAdd'
import AlbumRemove from 'cozy-ui/transpiled/react/Icons/AlbumRemove'
import Answer from 'cozy-ui/transpiled/react/Icons/Answer'
import Apple from 'cozy-ui/transpiled/react/Icons/Apple'
import Archive from 'cozy-ui/transpiled/react/Icons/Archive'
import ArrowUp from 'cozy-ui/transpiled/react/Icons/ArrowUp'
import AssignAdmin from 'cozy-ui/transpiled/react/Icons/AssignAdmin'
import AssignModerator from 'cozy-ui/transpiled/react/Icons/AssignModerator'
import Assistant from 'cozy-ui/transpiled/react/Icons/Assistant'
import Attachment from 'cozy-ui/transpiled/react/Icons/Attachment'
import Attention from 'cozy-ui/transpiled/react/Icons/Attention'
import Bank from 'cozy-ui/transpiled/react/Icons/Bank'
import BankCheck from 'cozy-ui/transpiled/react/Icons/BankCheck'
import Banking from 'cozy-ui/transpiled/react/Icons/Banking'
import BankingAdd from 'cozy-ui/transpiled/react/Icons/BankingAdd'
import Bell from 'cozy-ui/transpiled/react/Icons/Bell'
import Benefit from 'cozy-ui/transpiled/react/Icons/Benefit'
import Bike from 'cozy-ui/transpiled/react/Icons/Bike'
import Bill from 'cozy-ui/transpiled/react/Icons/Bill'
import Bottom from 'cozy-ui/transpiled/react/Icons/Bottom'
import BrowserBrave from 'cozy-ui/transpiled/react/Icons/BrowserBrave'
import BrowserChrome from 'cozy-ui/transpiled/react/Icons/BrowserChrome'
import BrowserDuckduckgo from 'cozy-ui/transpiled/react/Icons/BrowserDuckduckgo'
import BrowserEdge from 'cozy-ui/transpiled/react/Icons/BrowserEdge'
import BrowserEdgeChromium from 'cozy-ui/transpiled/react/Icons/BrowserEdgeChromium'
import BrowserFirefox from 'cozy-ui/transpiled/react/Icons/BrowserFirefox'
import BrowserIe from 'cozy-ui/transpiled/react/Icons/BrowserIe'
import BrowserOpera from 'cozy-ui/transpiled/react/Icons/BrowserOpera'
import BrowserSafari from 'cozy-ui/transpiled/react/Icons/BrowserSafari'
import Burger from 'cozy-ui/transpiled/react/Icons/Burger'
import Bus from 'cozy-ui/transpiled/react/Icons/Bus'
import Calendar from 'cozy-ui/transpiled/react/Icons/Calendar'
import Camera from 'cozy-ui/transpiled/react/Icons/Camera'
import Car from 'cozy-ui/transpiled/react/Icons/Car'
import CarbonCopy from 'cozy-ui/transpiled/react/Icons/CarbonCopy'
import CarPooling from 'cozy-ui/transpiled/react/Icons/Carpooling'
import Categories from 'cozy-ui/transpiled/react/Icons/Categories'
import Certified from 'cozy-ui/transpiled/react/Icons/Certified'
import Check from 'cozy-ui/transpiled/react/Icons/Check'
import CheckCircle from 'cozy-ui/transpiled/react/Icons/CheckCircle'
import CheckList from 'cozy-ui/transpiled/react/Icons/CheckList'
import CheckSquare from 'cozy-ui/transpiled/react/Icons/CheckSquare'
import Checkbox from 'cozy-ui/transpiled/react/Icons/Checkbox'
import Chess from 'cozy-ui/transpiled/react/Icons/Chess'
import Child from 'cozy-ui/transpiled/react/Icons/Child'
import CircleFilled from 'cozy-ui/transpiled/react/Icons/CircleFilled'
import Clock from 'cozy-ui/transpiled/react/Icons/Clock'
import ClockOutline from 'cozy-ui/transpiled/react/Icons/ClockOutline'
import Cloud from 'cozy-ui/transpiled/react/Icons/Cloud'
import Cloud2 from 'cozy-ui/transpiled/react/Icons/Cloud2'
import CloudHappy from 'cozy-ui/transpiled/react/Icons/CloudHappy'
import CloudPlusOutlined from 'cozy-ui/transpiled/react/Icons/CloudPlusOutlined'
import Cocktail from 'cozy-ui/transpiled/react/Icons/Cocktail'
import Collect from 'cozy-ui/transpiled/react/Icons/Collect'
import Comment from 'cozy-ui/transpiled/react/Icons/Comment'
import Company from 'cozy-ui/transpiled/react/Icons/Company'
import Compare from 'cozy-ui/transpiled/react/Icons/Compare'
import Compass from 'cozy-ui/transpiled/react/Icons/Compass'
import Connector from 'cozy-ui/transpiled/react/Icons/Connector'
import Contract from 'cozy-ui/transpiled/react/Icons/Contract'
import Contrast from 'cozy-ui/transpiled/react/Icons/Contrast'
import Copy from 'cozy-ui/transpiled/react/Icons/Copy'
import CozyCircle from 'cozy-ui/transpiled/react/Icons/CozyCircle'
import CozyLaugh from 'cozy-ui/transpiled/react/Icons/CozyLaugh'
import CozyLock from 'cozy-ui/transpiled/react/Icons/CozyLock'
import CozyText from 'cozy-ui/transpiled/react/Icons/CozyText'
import Credit from 'cozy-ui/transpiled/react/Icons/Credit'
import CreditCard from 'cozy-ui/transpiled/react/Icons/CreditCard'
import CreditCardAdd from 'cozy-ui/transpiled/react/Icons/CreditCardAdd'
import Crop from 'cozy-ui/transpiled/react/Icons/Crop'
import Cross from 'cozy-ui/transpiled/react/Icons/Cross'
import CrossCircle from 'cozy-ui/transpiled/react/Icons/CrossCircle'
import CrossCircleOutline from 'cozy-ui/transpiled/react/Icons/CrossCircleOutline'
import CrossMedium from 'cozy-ui/transpiled/react/Icons/CrossMedium'
import CrossSmall from 'cozy-ui/transpiled/react/Icons/CrossSmall'
import Cube from 'cozy-ui/transpiled/react/Icons/Cube'
import Dash from 'cozy-ui/transpiled/react/Icons/Dash'
import Dashboard from 'cozy-ui/transpiled/react/Icons/Dashboard'
import DataControl from 'cozy-ui/transpiled/react/Icons/DataControl'
import Debit from 'cozy-ui/transpiled/react/Icons/Debit'
import DesktopDownload from 'cozy-ui/transpiled/react/Icons/DesktopDownload'
import Devices from 'cozy-ui/transpiled/react/Icons/Devices'
import Discuss from 'cozy-ui/transpiled/react/Icons/Discuss'
import Dots from 'cozy-ui/transpiled/react/Icons/Dots'
import Down from 'cozy-ui/transpiled/react/Icons/Down'
import Download from 'cozy-ui/transpiled/react/Icons/Download'
import DrawingArrowUp from 'cozy-ui/transpiled/react/Icons/DrawingArrowUp'
import Dropdown from 'cozy-ui/transpiled/react/Icons/Dropdown'
import DropdownClose from 'cozy-ui/transpiled/react/Icons/DropdownClose'
import DropdownOpen from 'cozy-ui/transpiled/react/Icons/DropdownOpen'
import Dropup from 'cozy-ui/transpiled/react/Icons/Dropup'
import ElectricBike from 'cozy-ui/transpiled/react/Icons/ElectricBike'
import ElectricCar from 'cozy-ui/transpiled/react/Icons/ElectricCar'
import ElectricScooter from 'cozy-ui/transpiled/react/Icons/ElectricScooter'
import Email from 'cozy-ui/transpiled/react/Icons/Email'
import EmailNotification from 'cozy-ui/transpiled/react/Icons/EmailNotification'
import EmailOpen from 'cozy-ui/transpiled/react/Icons/EmailOpen'
import Eu from 'cozy-ui/transpiled/react/Icons/Eu'
import Euro from 'cozy-ui/transpiled/react/Icons/Euro'
import Exchange from 'cozy-ui/transpiled/react/Icons/Exchange'
import Eye from 'cozy-ui/transpiled/react/Icons/Eye'
import EyeClosed from 'cozy-ui/transpiled/react/Icons/EyeClosed'
import FaceId from 'cozy-ui/transpiled/react/Icons/FaceId'
import File from 'cozy-ui/transpiled/react/Icons/File'
import FileAdd from 'cozy-ui/transpiled/react/Icons/FileAdd'
import FileDuotone from 'cozy-ui/transpiled/react/Icons/FileDuotone'
import FileNew from 'cozy-ui/transpiled/react/Icons/FileNew'
import FileNone from 'cozy-ui/transpiled/react/Icons/FileNone'
import FileOutline from 'cozy-ui/transpiled/react/Icons/FileOutline'
import Filter from 'cozy-ui/transpiled/react/Icons/Filter'
import Fingerprint from 'cozy-ui/transpiled/react/Icons/Fingerprint'
import Fitness from 'cozy-ui/transpiled/react/Icons/Fitness'
import Flag from 'cozy-ui/transpiled/react/Icons/Flag'
import FlagOutlined from 'cozy-ui/transpiled/react/Icons/FlagOutlined'
import FlashAuto from 'cozy-ui/transpiled/react/Icons/FlashAuto'
import Flashlight from 'cozy-ui/transpiled/react/Icons/Flashlight'
import Folder from 'cozy-ui/transpiled/react/Icons/Folder'
import FolderAdd from 'cozy-ui/transpiled/react/Icons/FolderAdd'
import FolderMoveto from 'cozy-ui/transpiled/react/Icons/FolderMoveto'
import FolderOpen from 'cozy-ui/transpiled/react/Icons/FolderOpen'
import Forbidden from 'cozy-ui/transpiled/react/Icons/Forbidden'
import FromUser from 'cozy-ui/transpiled/react/Icons/FromUser'
import Gear from 'cozy-ui/transpiled/react/Icons/Gear'
import Globe from 'cozy-ui/transpiled/react/Icons/Globe'
import Gouv from 'cozy-ui/transpiled/react/Icons/Gouv'
import GraphCircle from 'cozy-ui/transpiled/react/Icons/GraphCircle'
import GridIcon from 'cozy-ui/transpiled/react/Icons/Grid'
import GroupList from 'cozy-ui/transpiled/react/Icons/GroupList'
import Groups from 'cozy-ui/transpiled/react/Icons/Groups'
import Growth from 'cozy-ui/transpiled/react/Icons/Growth'
import Hand from 'cozy-ui/transpiled/react/Icons/Hand'
import Heart from 'cozy-ui/transpiled/react/Icons/Heart'
import Help from 'cozy-ui/transpiled/react/Icons/Help'
import HelpOutlined from 'cozy-ui/transpiled/react/Icons/HelpOutlined'
import History from 'cozy-ui/transpiled/react/Icons/History'
import Home from 'cozy-ui/transpiled/react/Icons/Home'
import Hourglass from 'cozy-ui/transpiled/react/Icons/Hourglass'
import Image from 'cozy-ui/transpiled/react/Icons/Image'
import Info from 'cozy-ui/transpiled/react/Icons/Info'
import InfoOutlined from 'cozy-ui/transpiled/react/Icons/InfoOutlined'
import Justice from 'cozy-ui/transpiled/react/Icons/Justice'
import Key from 'cozy-ui/transpiled/react/Icons/Key'
import Key2 from 'cozy-ui/transpiled/react/Icons/Key2'
import LabelOutlined from 'cozy-ui/transpiled/react/Icons/LabelOutlined'
import Laptop from 'cozy-ui/transpiled/react/Icons/Laptop'
import Laudry from 'cozy-ui/transpiled/react/Icons/Laudry'
import Left from 'cozy-ui/transpiled/react/Icons/Left'
import Library from 'cozy-ui/transpiled/react/Icons/Library'
import Lightbulb from 'cozy-ui/transpiled/react/Icons/Lightbulb'
import Lightning from 'cozy-ui/transpiled/react/Icons/Lightning'
import Link from 'cozy-ui/transpiled/react/Icons/Link'
import LinkOut from 'cozy-ui/transpiled/react/Icons/LinkOut'
import List from 'cozy-ui/transpiled/react/Icons/List'
import ListMin from 'cozy-ui/transpiled/react/Icons/ListMin'
import Location from 'cozy-ui/transpiled/react/Icons/Location'
import Lock from 'cozy-ui/transpiled/react/Icons/Lock'
import LockScreen from 'cozy-ui/transpiled/react/Icons/LockScreen'
import Logout from 'cozy-ui/transpiled/react/Icons/Logout'
import MagicTrick from 'cozy-ui/transpiled/react/Icons/MagicTrick'
import Magnet from 'cozy-ui/transpiled/react/Icons/Magnet'
import Magnifier from 'cozy-ui/transpiled/react/Icons/Magnifier'
import Matrix from 'cozy-ui/transpiled/react/Icons/Matrix'
import Merge from 'cozy-ui/transpiled/react/Icons/Merge'
import Moped from 'cozy-ui/transpiled/react/Icons/Moped'
import Mosaic from 'cozy-ui/transpiled/react/Icons/Mosaic'
import MosaicMin from 'cozy-ui/transpiled/react/Icons/MosaicMin'
import Motorcycle from 'cozy-ui/transpiled/react/Icons/Motorcycle'
import Mountain from 'cozy-ui/transpiled/react/Icons/Mountain'
import Movement from 'cozy-ui/transpiled/react/Icons/Movement'
import MovementIn from 'cozy-ui/transpiled/react/Icons/MovementIn'
import MovementOut from 'cozy-ui/transpiled/react/Icons/MovementOut'
import Moveto from 'cozy-ui/transpiled/react/Icons/Moveto'
import MultiFiles from 'cozy-ui/transpiled/react/Icons/MultiFiles'
import Music from 'cozy-ui/transpiled/react/Icons/Music'
import New from 'cozy-ui/transpiled/react/Icons/New'
import Next from 'cozy-ui/transpiled/react/Icons/Next'
import Note from 'cozy-ui/transpiled/react/Icons/Note'
import NotificationEmail from 'cozy-ui/transpiled/react/Icons/NotificationEmail'
import Number from 'cozy-ui/transpiled/react/Icons/Number'
import Offline from 'cozy-ui/transpiled/react/Icons/Offline'
import Online from 'cozy-ui/transpiled/react/Icons/Online'
import Openapp from 'cozy-ui/transpiled/react/Icons/Openapp'
import Openwith from 'cozy-ui/transpiled/react/Icons/Openwith'
import Palette from 'cozy-ui/transpiled/react/Icons/Palette'
import Paper from 'cozy-ui/transpiled/react/Icons/Paper'
import Paperplane from 'cozy-ui/transpiled/react/Icons/Paperplane'
import Password from 'cozy-ui/transpiled/react/Icons/Password'
import Pen from 'cozy-ui/transpiled/react/Icons/Pen'
import People from 'cozy-ui/transpiled/react/Icons/People'
import Peoples from 'cozy-ui/transpiled/react/Icons/Peoples'
import Percent from 'cozy-ui/transpiled/react/Icons/Percent'
import PercentCircle from 'cozy-ui/transpiled/react/Icons/PercentCircle'
import PersonAdd from 'cozy-ui/transpiled/react/Icons/PersonAdd'
import PersonalData from 'cozy-ui/transpiled/react/Icons/PersonalData'
import Phone from 'cozy-ui/transpiled/react/Icons/Phone'
import PhoneDownload from 'cozy-ui/transpiled/react/Icons/PhoneDownload'
import PhoneUpload from 'cozy-ui/transpiled/react/Icons/PhoneUpload'
import PieChart from 'cozy-ui/transpiled/react/Icons/PieChart'
import Pin from 'cozy-ui/transpiled/react/Icons/Pin'
import Plane from 'cozy-ui/transpiled/react/Icons/Plane'
import Plus from 'cozy-ui/transpiled/react/Icons/Plus'
import PlusSmall from 'cozy-ui/transpiled/react/Icons/PlusSmall'
import PopInside from 'cozy-ui/transpiled/react/Icons/PopInside'
import Previous from 'cozy-ui/transpiled/react/Icons/Previous'
import Printer from 'cozy-ui/transpiled/react/Icons/Printer'
import Qualify from 'cozy-ui/transpiled/react/Icons/Qualify'
import RadioChecked from 'cozy-ui/transpiled/react/Icons/RadioChecked'
import RadioUnchecked from 'cozy-ui/transpiled/react/Icons/RadioUnchecked'
import Refresh from 'cozy-ui/transpiled/react/Icons/Refresh'
import Relationship from 'cozy-ui/transpiled/react/Icons/Relationship'
import Remboursement from 'cozy-ui/transpiled/react/Icons/Remboursement'
import Rename from 'cozy-ui/transpiled/react/Icons/Rename'
import Repare from 'cozy-ui/transpiled/react/Icons/Repare'
import Reply from 'cozy-ui/transpiled/react/Icons/Reply'
import Restaurant from 'cozy-ui/transpiled/react/Icons/Restaurant'
import Restore from 'cozy-ui/transpiled/react/Icons/Restore'
import RestoreStraight from 'cozy-ui/transpiled/react/Icons/RestoreStraight'
import Right from 'cozy-ui/transpiled/react/Icons/Right'
import Rise from 'cozy-ui/transpiled/react/Icons/Rise'
import RotateLeft from 'cozy-ui/transpiled/react/Icons/RotateLeft'
import RotateRight from 'cozy-ui/transpiled/react/Icons/RotateRight'
import SadCozy from 'cozy-ui/transpiled/react/Icons/SadCozy'
import Safe from 'cozy-ui/transpiled/react/Icons/Safe'
import School from 'cozy-ui/transpiled/react/Icons/School'
import Scooter from 'cozy-ui/transpiled/react/Icons/Scooter'
import Security from 'cozy-ui/transpiled/react/Icons/Security'
import SelectAll from 'cozy-ui/transpiled/react/Icons/SelectAll'
import Server from 'cozy-ui/transpiled/react/Icons/Server'
import Setting from 'cozy-ui/transpiled/react/Icons/Setting'
import Share from 'cozy-ui/transpiled/react/Icons/Share'
import ShareCircle from 'cozy-ui/transpiled/react/Icons/ShareCircle'
import Shield from 'cozy-ui/transpiled/react/Icons/Shield'
import Shop from 'cozy-ui/transpiled/react/Icons/Shop'
import Sound from 'cozy-ui/transpiled/react/Icons/Sound'
import Spinner from 'cozy-ui/transpiled/react/Icons/Spinner'
import SportBag from 'cozy-ui/transpiled/react/Icons/SportBag'
import Stack from 'cozy-ui/transpiled/react/Icons/Stack'
import Star from 'cozy-ui/transpiled/react/Icons/Star'
import StarOutline from 'cozy-ui/transpiled/react/Icons/StarOutline'
import Stats from 'cozy-ui/transpiled/react/Icons/Stats'
import Stop from 'cozy-ui/transpiled/react/Icons/Stop'
import Subway from 'cozy-ui/transpiled/react/Icons/Subway'
import Support from 'cozy-ui/transpiled/react/Icons/Support'
import Swap from 'cozy-ui/transpiled/react/Icons/Swap'
import Sync from 'cozy-ui/transpiled/react/Icons/Sync'
import Tab from 'cozy-ui/transpiled/react/Icons/Tab'
import Tag from 'cozy-ui/transpiled/react/Icons/Tag'
import Target from 'cozy-ui/transpiled/react/Icons/Target'
import Task from 'cozy-ui/transpiled/react/Icons/Task'
import Team from 'cozy-ui/transpiled/react/Icons/Team'
import Telecom from 'cozy-ui/transpiled/react/Icons/Telecom'
import Telephone from 'cozy-ui/transpiled/react/Icons/Telephone'
import Text from 'cozy-ui/transpiled/react/Icons/Text'
import TextInfo from 'cozy-ui/transpiled/react/Icons/TextInfo'
import ToTheCloud from 'cozy-ui/transpiled/react/Icons/ToTheCloud'
import Top from 'cozy-ui/transpiled/react/Icons/Top'
import Train from 'cozy-ui/transpiled/react/Icons/Train'
import Tram from 'cozy-ui/transpiled/react/I
gitextract_5cx5gfwh/ ├── .bundlemonrc ├── .editorconfig ├── .github/ │ └── workflows/ │ ├── ci-cd.yml │ ├── codeql-analysis.yml │ └── create-bump-pr.yml ├── .gitignore ├── .nvmrc ├── .transifexrc.tpl ├── .tx/ │ └── config ├── CHANGELOG.md ├── CODEOWNERS ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── babel.config.js ├── docs/ │ └── nextcloud.md ├── eslint.config.mjs ├── jest.config.js ├── jestHelpers/ │ ├── ConsoleUsageReporter.js │ ├── mocks/ │ │ ├── fileMock.js │ │ ├── iconMock.js │ │ ├── pdfjsWorkerMock.js │ │ └── svgRawMock.js │ ├── setup.js │ └── setupFilesAfterEnv.js ├── manifest.webapp ├── package.json ├── public/ │ ├── browserconfig.xml │ └── manifest.json ├── renovate.json ├── rsbuild.config.mjs ├── src/ │ ├── assets/ │ │ └── onlyOffice/ │ │ ├── slide.pptx │ │ ├── spreadsheet.xlsx │ │ └── text.docx │ ├── components/ │ │ ├── App/ │ │ │ └── App.jsx │ │ ├── Bar.jsx │ │ ├── Button/ │ │ │ ├── BackButton.jsx │ │ │ ├── MoreButton.jsx │ │ │ ├── OpenFolderButton.tsx │ │ │ └── index.jsx │ │ ├── ColorPicker/ │ │ │ ├── ColorPicker.jsx │ │ │ ├── constants.js │ │ │ └── index.jsx │ │ ├── Error/ │ │ │ ├── Empty.jsx │ │ │ ├── ErrorShare.jsx │ │ │ ├── NotFound.jsx │ │ │ ├── Oops.jsx │ │ │ ├── empty.styl │ │ │ └── oops.styl │ │ ├── FileHistory/ │ │ │ ├── HistoryModal.jsx │ │ │ ├── index.jsx │ │ │ └── styles.styl │ │ ├── FilesRealTimeQueries.jsx │ │ ├── FilesViewerLoading.jsx │ │ ├── FolderPicker/ │ │ │ ├── FolderPicker.spec.jsx │ │ │ ├── FolderPicker.tsx │ │ │ ├── FolderPickerAddFolderItem.tsx │ │ │ ├── FolderPickerBody.spec.jsx │ │ │ ├── FolderPickerBody.tsx │ │ │ ├── FolderPickerContentCozy.tsx │ │ │ ├── FolderPickerContentLoadMore.tsx │ │ │ ├── FolderPickerContentLoader.tsx │ │ │ ├── FolderPickerContentNextcloud.tsx │ │ │ ├── FolderPickerContentPublic.tsx │ │ │ ├── FolderPickerContentSharedDrive.tsx │ │ │ ├── FolderPickerContentSharedDriveRoot.tsx │ │ │ ├── FolderPickerFooter.tsx │ │ │ ├── FolderPickerHeader.spec.js │ │ │ ├── FolderPickerHeader.tsx │ │ │ ├── FolderPickerHeaderIllustration.tsx │ │ │ ├── FolderPickerListItem.tsx │ │ │ ├── FolderPickerTopbar.spec.jsx │ │ │ ├── FolderPickerTopbar.tsx │ │ │ ├── helpers.spec.js │ │ │ ├── helpers.ts │ │ │ └── types.ts │ │ ├── IconPicker/ │ │ │ ├── IconColorPicker.jsx │ │ │ ├── IconIndex.js │ │ │ ├── IconPicker.jsx │ │ │ ├── NoneIcon.jsx │ │ │ ├── constants.js │ │ │ └── index.jsx │ │ ├── IconStack/ │ │ │ ├── index.jsx │ │ │ └── styles.styl │ │ ├── Icons/ │ │ │ ├── Drive.jsx │ │ │ └── DriveText.jsx │ │ ├── LoaderModal.jsx │ │ ├── Migration/ │ │ │ ├── MigrationProgressBanner.jsx │ │ │ └── MigrationProgressBanner.spec.jsx │ │ ├── MoreMenu.tsx │ │ ├── MoveValidationModals/ │ │ │ └── index.tsx │ │ ├── PushBanner/ │ │ │ ├── PushBanner.spec.jsx │ │ │ ├── PushBannerProvider.jsx │ │ │ ├── QuotaBanner.jsx │ │ │ ├── QuotaBanner.spec.jsx │ │ │ └── index.jsx │ │ ├── RightClick/ │ │ │ ├── RightClickAddMenu.jsx │ │ │ ├── RightClickFileMenu.jsx │ │ │ └── RightClickProvider.jsx │ │ ├── SideBarAccordion.jsx │ │ ├── TrashedBanner.jsx │ │ ├── pushClient/ │ │ │ ├── Banner.jsx │ │ │ ├── Button.jsx │ │ │ ├── __mocks__/ │ │ │ │ └── index.js │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ └── index.spec.js │ │ ├── useDocument.jsx │ │ └── useHead.jsx │ ├── config/ │ │ ├── config.json │ │ └── sort.js │ ├── constants/ │ │ └── config.js │ ├── contexts/ │ │ ├── ClipboardProvider.spec.tsx │ │ └── ClipboardProvider.tsx │ ├── declarations.d.ts │ ├── hooks/ │ │ ├── helpers.d.ts │ │ ├── helpers.js │ │ ├── index.js │ │ ├── useCurrentFileId.jsx │ │ ├── useCurrentFileId.spec.jsx │ │ ├── useCurrentFolderId.jsx │ │ ├── useCurrentFolderId.spec.jsx │ │ ├── useDebounce.jsx │ │ ├── useDisplayedFolder.spec.jsx │ │ ├── useDisplayedFolder.tsx │ │ ├── useFolderSort/ │ │ │ ├── index.spec.jsx │ │ │ └── index.ts │ │ ├── useKeyboardShortcuts.spec.jsx │ │ ├── useKeyboardShortcuts.tsx │ │ ├── useMoreMenuActions.jsx │ │ ├── useOnLongPress/ │ │ │ ├── helpers.js │ │ │ ├── helpers.spec.jsx │ │ │ └── index.js │ │ ├── useParentFolder.jsx │ │ ├── useParentFolder.spec.jsx │ │ ├── useRecentFiles.jsx │ │ ├── useRecentFiles.spec.jsx │ │ ├── useRecentIcons.jsx │ │ ├── useRecentIcons.spec.jsx │ │ ├── useRedirectLink.jsx │ │ ├── useRedirectLink.spec.jsx │ │ ├── useShiftSelection/ │ │ │ ├── helpers.spec.ts │ │ │ ├── helpers.ts │ │ │ ├── index.spec.tsx │ │ │ └── index.tsx │ │ ├── useTransformFolderListHasSharedDriveShortcuts/ │ │ │ ├── index.spec.jsx │ │ │ └── index.tsx │ │ └── useUpdateFavicon/ │ │ ├── constants.ts │ │ ├── helpers.spec.js │ │ ├── helpers.ts │ │ ├── index.spec.jsx │ │ └── index.tsx │ ├── lib/ │ │ ├── AcceptingSharingContext.jsx │ │ ├── DriveProvider.jsx │ │ ├── FabProvider.jsx │ │ ├── FuzzyPathSearch.js │ │ ├── FuzzyPathSearch.spec.js │ │ ├── ModalContext.tsx │ │ ├── ThumbnailSizeContext.tsx │ │ ├── ViewSwitcherContext.tsx │ │ ├── appMetadata.js │ │ ├── dacc/ │ │ │ ├── dacc-run.js │ │ │ ├── dacc-run.spec.js │ │ │ ├── dacc.js │ │ │ ├── dacc.spec.js │ │ │ └── query.js │ │ ├── doctypes.js │ │ ├── entries.js │ │ ├── entries.spec.js │ │ ├── extraDoctypes.js │ │ ├── flags.js │ │ ├── getFileMimetype.js │ │ ├── getMimeTypeIcon.js │ │ ├── konnectors.js │ │ ├── logger.js │ │ ├── migration/ │ │ │ ├── qualification.js │ │ │ └── qualification.spec.js │ │ ├── path.js │ │ ├── path.spec.js │ │ ├── queries.js │ │ ├── react-cozy-helpers/ │ │ │ ├── ModalManager.jsx │ │ │ ├── QueryParameter.js │ │ │ ├── QueryParameter.spec.js │ │ │ └── index.js │ │ ├── registerClientPlugins.js │ │ └── sentry.js │ ├── locales/ │ │ ├── ar.json │ │ ├── de.json │ │ ├── en.json │ │ ├── es.json │ │ ├── fr.json │ │ ├── index.js │ │ ├── it.json │ │ ├── ja.json │ │ ├── ko.json │ │ ├── nl.json │ │ ├── nl_NL.json │ │ ├── pl.json │ │ ├── ru.json │ │ ├── vi.json │ │ ├── zh_CN.json │ │ └── zh_TW.json │ ├── models/ │ │ ├── Contact.js │ │ ├── Contact.spec.js │ │ └── index.js │ ├── modules/ │ │ ├── actionmenu/ │ │ │ └── ActionMenuWithHeader.jsx │ │ ├── actions/ │ │ │ ├── addItems.jsx │ │ │ ├── components/ │ │ │ │ ├── addToFavorites.tsx │ │ │ │ ├── duplicateTo.tsx │ │ │ │ ├── moveTo.jsx │ │ │ │ ├── personalizeFolder.js │ │ │ │ ├── removeFromFavorites.tsx │ │ │ │ └── selectable.tsx │ │ │ ├── details.jsx │ │ │ ├── divider.jsx │ │ │ ├── download.jsx │ │ │ ├── helpers.js │ │ │ ├── helpers.spec.js │ │ │ ├── index.js │ │ │ ├── index.spec.js │ │ │ ├── infos.jsx │ │ │ ├── policies.spec.ts │ │ │ ├── policies.ts │ │ │ ├── qualify.jsx │ │ │ ├── rename.jsx │ │ │ ├── restore.jsx │ │ │ ├── select.jsx │ │ │ ├── selectAll.jsx │ │ │ ├── share.jsx │ │ │ ├── summariseByAI.jsx │ │ │ ├── trash.jsx │ │ │ ├── types.ts │ │ │ ├── utils.js │ │ │ ├── utils.spec.js │ │ │ └── versions.jsx │ │ ├── breadcrumb/ │ │ │ ├── components/ │ │ │ │ ├── Breadcrumb.jsx │ │ │ │ ├── Breadcrumb.spec.jsx │ │ │ │ ├── DesktopBreadcrumb.jsx │ │ │ │ ├── DesktopBreadcrumb.spec.jsx │ │ │ │ ├── DesktopBreadcrumbItem.jsx │ │ │ │ ├── MobileAwareBreadcrumb.jsx │ │ │ │ ├── MobileAwareBreadcrumb.spec.jsx │ │ │ │ ├── MobileBreadcrumb.jsx │ │ │ │ ├── MobileBreadcrumb.spec.jsx │ │ │ │ └── __snapshots__/ │ │ │ │ └── Breadcrumb.spec.jsx.snap │ │ │ ├── hooks/ │ │ │ │ ├── useBreadcrumbPath.jsx │ │ │ │ └── useBreadcrumbPath.spec.jsx │ │ │ ├── styles/ │ │ │ │ └── breadcrumb.styl │ │ │ └── utils/ │ │ │ ├── fetchFolder.js │ │ │ └── fetchFolder.spec.js │ │ ├── certifications/ │ │ │ ├── CertificationTooltip.jsx │ │ │ ├── index.jsx │ │ │ ├── useExtraColumns.jsx │ │ │ └── useExtraColumns.spec.jsx │ │ ├── drive/ │ │ │ ├── AddMenu/ │ │ │ │ ├── AddMenu.jsx │ │ │ │ ├── AddMenuContent.jsx │ │ │ │ ├── AddMenuContent.spec.jsx │ │ │ │ ├── AddMenuProvider.jsx │ │ │ │ └── AddMenuProvider.spec.jsx │ │ │ ├── DeleteConfirm.jsx │ │ │ ├── DeleteConfirm.spec.jsx │ │ │ ├── FabWithAddMenuContext.jsx │ │ │ ├── RenameInput.jsx │ │ │ ├── RenameInput.spec.jsx │ │ │ ├── Toolbar/ │ │ │ │ ├── components/ │ │ │ │ │ ├── AddButton.jsx │ │ │ │ │ ├── AddFolderItem.jsx │ │ │ │ │ ├── AddMenuItem.jsx │ │ │ │ │ ├── CreateDocsItem.jsx │ │ │ │ │ ├── CreateNoteItem.jsx │ │ │ │ │ ├── CreateOnlyOfficeItem.jsx │ │ │ │ │ ├── CreateShortcut.jsx │ │ │ │ │ ├── DownloadButtonItem.jsx │ │ │ │ │ ├── FavoritesItem.jsx │ │ │ │ │ ├── InsideRegularFolder.jsx │ │ │ │ │ ├── InsideRegularFolder.spec.jsx │ │ │ │ │ ├── LeaveSharedDriveButtonItem.jsx │ │ │ │ │ ├── MoreMenu.jsx │ │ │ │ │ ├── MoreMenu.spec.jsx │ │ │ │ │ ├── Scanner/ │ │ │ │ │ │ ├── Scanner.spec.tsx │ │ │ │ │ │ ├── ScannerMenuItem.tsx │ │ │ │ │ │ ├── ScannerProvider.tsx │ │ │ │ │ │ └── useScannerService.ts │ │ │ │ │ ├── SearchButton.jsx │ │ │ │ │ ├── ShortcutCreationModal.jsx │ │ │ │ │ ├── ShortcutCreationModal.spec.jsx │ │ │ │ │ ├── UploadItem.jsx │ │ │ │ │ └── ViewSwitcher.jsx │ │ │ │ ├── delete/ │ │ │ │ │ ├── DeleteItem.jsx │ │ │ │ │ ├── DeleteItem.spec.jsx │ │ │ │ │ ├── delete.jsx │ │ │ │ │ └── delete.spec.jsx │ │ │ │ ├── index.jsx │ │ │ │ ├── move/ │ │ │ │ │ └── MoveItem.jsx │ │ │ │ ├── personalizeFolder/ │ │ │ │ │ └── PersonalizeFolderItem.jsx │ │ │ │ ├── selectable/ │ │ │ │ │ └── SelectableItem.jsx │ │ │ │ └── share/ │ │ │ │ ├── ShareButton.jsx │ │ │ │ ├── ShareItem.jsx │ │ │ │ ├── SharedRecipients.jsx │ │ │ │ ├── helpers.js │ │ │ │ └── helpers.spec.js │ │ │ ├── helpers.ts │ │ │ └── rename.js │ │ ├── duplicate/ │ │ │ └── components/ │ │ │ └── DuplicateModal.tsx │ │ ├── filelist/ │ │ │ ├── AddFolder.jsx │ │ │ ├── AddFolder.spec.jsx │ │ │ ├── AddFolderCard.jsx │ │ │ ├── AddFolderRow.jsx │ │ │ ├── File.jsx │ │ │ ├── File.spec.jsx │ │ │ ├── FileList.jsx │ │ │ ├── FileListBody.jsx │ │ │ ├── FileListHeader.jsx │ │ │ ├── FileListHeaderDesktop.jsx │ │ │ ├── FileListHeaderMobile.jsx │ │ │ ├── FileListRowsPlaceholder.jsx │ │ │ ├── FileOpener.jsx │ │ │ ├── FileOpener.spec.jsx │ │ │ ├── FilePlaceholder.jsx │ │ │ ├── FilenameInput.jsx │ │ │ ├── FilenameInput.spec.jsx │ │ │ ├── HeaderCell.jsx │ │ │ ├── LoadMore.jsx │ │ │ ├── LoadMoreV2.jsx │ │ │ ├── MobileSortMenu.jsx │ │ │ ├── cells/ │ │ │ │ ├── CarbonCopy.jsx │ │ │ │ ├── CertificationsIcons.jsx │ │ │ │ ├── CertificationsIcons.spec.js │ │ │ │ ├── ElectronicSafe.jsx │ │ │ │ ├── Empty.jsx │ │ │ │ ├── FileAction.jsx │ │ │ │ ├── FileName.jsx │ │ │ │ ├── LastUpdate.jsx │ │ │ │ ├── SelectBox.jsx │ │ │ │ ├── ShareContent.jsx │ │ │ │ ├── SharingShortcutBadge.jsx │ │ │ │ ├── Size.jsx │ │ │ │ ├── Status.jsx │ │ │ │ └── index.jsx │ │ │ ├── duck.js │ │ │ ├── fileopener.styl │ │ │ ├── getCaretPositionFromPoint.js │ │ │ ├── headers/ │ │ │ │ ├── CarbonCopy.jsx │ │ │ │ ├── ElectronicSafe.jsx │ │ │ │ └── index.jsx │ │ │ ├── helpers.ts │ │ │ ├── icons/ │ │ │ │ ├── BadgeKonnector.jsx │ │ │ │ ├── FileIcon.jsx │ │ │ │ ├── FileIcon.spec.jsx │ │ │ │ ├── FileIconMime.jsx │ │ │ │ ├── FileIconShortcut.jsx │ │ │ │ ├── FileThumbnail.tsx │ │ │ │ └── SharingShortcutIcon.jsx │ │ │ ├── useFormattedUpdatedAt.js │ │ │ └── virtualized/ │ │ │ ├── AddFolderRow.jsx │ │ │ ├── GridFile.jsx │ │ │ └── cells/ │ │ │ ├── Cell.jsx │ │ │ ├── FileAction.jsx │ │ │ ├── FileName.jsx │ │ │ ├── FileNamePath.jsx │ │ │ ├── LastUpdate.jsx │ │ │ ├── Share.jsx │ │ │ ├── ShareContent.jsx │ │ │ ├── SharingShortcutBadge.jsx │ │ │ └── Size.jsx │ │ ├── folder/ │ │ │ ├── components/ │ │ │ │ └── FolderBody.jsx │ │ │ └── hooks/ │ │ │ ├── useNeedsToWait.jsx │ │ │ └── useScrollToTop.jsx │ │ ├── layout/ │ │ │ ├── DummyLayout.tsx │ │ │ ├── Layout.jsx │ │ │ ├── Main.jsx │ │ │ └── Topbar.jsx │ │ ├── move/ │ │ │ ├── MoveInsideSharedFolderModal.jsx │ │ │ ├── MoveModal.jsx │ │ │ ├── MoveModal.spec.jsx │ │ │ ├── MoveOutsideSharedFolderModal.jsx │ │ │ ├── MoveSharedFolderInsideAnotherModal.jsx │ │ │ ├── components/ │ │ │ │ └── MoveModalSuccessAction.tsx │ │ │ ├── helpers.js │ │ │ ├── helpers.spec.js │ │ │ └── hooks/ │ │ │ ├── useCancelable.jsx │ │ │ └── useMove.tsx │ │ ├── navigation/ │ │ │ ├── AppRoute.jsx │ │ │ ├── ExternalNavItem.jsx │ │ │ ├── ExternalRedirect.jsx │ │ │ ├── FavoriteList.tsx │ │ │ ├── FavoriteListItem.tsx │ │ │ ├── Index.jsx │ │ │ ├── Index.spec.js │ │ │ ├── Nav.jsx │ │ │ ├── NavContent.tsx │ │ │ ├── NavContext.jsx │ │ │ ├── NavItem.jsx │ │ │ ├── NavLink.jsx │ │ │ ├── PublicNoteRedirect.tsx │ │ │ ├── SharingsNavItem.jsx │ │ │ ├── components/ │ │ │ │ ├── ExternalDriveListItem.tsx │ │ │ │ ├── ExternalDrivesList.tsx │ │ │ │ └── FileLink.tsx │ │ │ ├── duck/ │ │ │ │ ├── actions.jsx │ │ │ │ ├── actions.spec.jsx │ │ │ │ ├── async.js │ │ │ │ ├── index.js │ │ │ │ ├── reducer.js │ │ │ │ ├── utils.js │ │ │ │ └── utils.spec.js │ │ │ ├── helpers.js │ │ │ └── hooks/ │ │ │ ├── helpers.spec.js │ │ │ ├── helpers.ts │ │ │ ├── useFileLink.tsx │ │ │ └── useSharedDriveLink.tsx │ │ ├── nextcloud/ │ │ │ ├── components/ │ │ │ │ ├── NextcloudBanner.tsx │ │ │ │ ├── NextcloudBreadcrumb.jsx │ │ │ │ ├── NextcloudDeleteConfirm.jsx │ │ │ │ ├── NextcloudFolderBody.jsx │ │ │ │ ├── NextcloudToolbar.jsx │ │ │ │ ├── NextcloudTrashFolderBody.tsx │ │ │ │ └── actions/ │ │ │ │ ├── addFolder.jsx │ │ │ │ ├── deleteNextcloudFile.tsx │ │ │ │ ├── downloadNextcloudFile.jsx │ │ │ │ ├── downloadNextcloudFolder.jsx │ │ │ │ ├── duplicateNextcloudFile.jsx │ │ │ │ ├── moveNextcloud.jsx │ │ │ │ ├── openWithinNextcloud.jsx │ │ │ │ ├── rename.jsx │ │ │ │ ├── restoreNextcloudFile.tsx │ │ │ │ ├── shareNextcloudFile.jsx │ │ │ │ ├── trash.jsx │ │ │ │ └── upload.jsx │ │ │ ├── helpers.ts │ │ │ └── hooks/ │ │ │ ├── useNextcloudCurrentFolder.tsx │ │ │ ├── useNextcloudEntries.tsx │ │ │ ├── useNextcloudFolder.tsx │ │ │ ├── useNextcloudInfos.jsx │ │ │ └── useNextcloudPath.jsx │ │ ├── paste/ │ │ │ ├── index.js │ │ │ ├── index.spec.js │ │ │ ├── utils.js │ │ │ └── utils.spec.js │ │ ├── public/ │ │ │ ├── DownloadFilesButton.jsx │ │ │ ├── LightFileViewer.jsx │ │ │ ├── LightFileViewer.spec.jsx │ │ │ ├── PublicLayout.jsx │ │ │ ├── PublicProvider.tsx │ │ │ ├── PublicToolbar.jsx │ │ │ ├── PublicToolbarByLink.jsx │ │ │ ├── PublicToolbarCozyToCozy.jsx │ │ │ ├── PublicToolbarMoreMenu.jsx │ │ │ └── helpers.js │ │ ├── routeUtils.js │ │ ├── search/ │ │ │ ├── components/ │ │ │ │ ├── BarSearchAutosuggest.jsx │ │ │ │ ├── BarSearchInputGroup.jsx │ │ │ │ ├── SearchEmpty.jsx │ │ │ │ ├── SuggestionItem.jsx │ │ │ │ ├── SuggestionItemSkeleton.jsx │ │ │ │ ├── SuggestionItemTextHighlighted.jsx │ │ │ │ ├── SuggestionItemTextSecondary.jsx │ │ │ │ ├── SuggestionListSkeleton.jsx │ │ │ │ ├── helpers.js │ │ │ │ ├── helpers.spec.jsx │ │ │ │ └── styles.styl │ │ │ └── hooks/ │ │ │ └── useSearch.jsx │ │ ├── selection/ │ │ │ ├── RectangularSelection.jsx │ │ │ ├── RectangularSelection.styl │ │ │ ├── SelectionBar.tsx │ │ │ ├── SelectionProvider.d.ts │ │ │ ├── SelectionProvider.jsx │ │ │ ├── SelectionProvider.spec.jsx │ │ │ └── types.ts │ │ ├── selectors.js │ │ ├── selectors.spec.js │ │ ├── services/ │ │ │ ├── components/ │ │ │ │ ├── Embeder.jsx │ │ │ │ └── IntentHandler.jsx │ │ │ ├── index.jsx │ │ │ └── services.styl │ │ ├── shareddrives/ │ │ │ ├── components/ │ │ │ │ ├── SharedDriveBreadcrumb.jsx │ │ │ │ ├── SharedDriveFolderBody.jsx │ │ │ │ └── actions/ │ │ │ │ ├── leaveSharedDrive.js │ │ │ │ └── shareSharedDrive.js │ │ │ ├── helpers.ts │ │ │ └── hooks/ │ │ │ ├── useQueryMultipleSharedDriveFolders.tsx │ │ │ ├── useSharedDriveFolder.spec.jsx │ │ │ ├── useSharedDriveFolder.tsx │ │ │ ├── useSharedDriveFolderHelpers.ts │ │ │ └── useSharedDrives.js │ │ ├── trash/ │ │ │ └── components/ │ │ │ ├── DestroyConfirm.tsx │ │ │ ├── EmptyTrashConfirm.tsx │ │ │ ├── TrashBreadcrumb.tsx │ │ │ ├── TrashToolbar.spec.jsx │ │ │ ├── TrashToolbar.tsx │ │ │ └── actions/ │ │ │ ├── destroy.tsx │ │ │ └── emptyTrash.tsx │ │ ├── upload/ │ │ │ ├── Dropzone.jsx │ │ │ ├── DropzoneDnD.jsx │ │ │ ├── DropzoneTeaser.jsx │ │ │ ├── NewItemHighlightProvider.jsx │ │ │ ├── UploadButton.jsx │ │ │ ├── UploadLimitDialog.jsx │ │ │ ├── UploadQueue.jsx │ │ │ ├── index.js │ │ │ └── index.spec.js │ │ ├── viewer/ │ │ │ ├── CallToAction.jsx │ │ │ ├── CallToAction.spec.jsx │ │ │ ├── Fallback.jsx │ │ │ ├── FileOpenerExternal.jsx │ │ │ ├── FilesViewer.jsx │ │ │ ├── FilesViewer.spec.jsx │ │ │ ├── MoreMenu.jsx │ │ │ ├── NoViewerButton.jsx │ │ │ ├── barviewer.styl │ │ │ ├── helpers.js │ │ │ └── styles.styl │ │ └── views/ │ │ ├── AI/ │ │ │ └── AIAssistantPaywallView.tsx │ │ ├── Drive/ │ │ │ ├── DriveFolderView.jsx │ │ │ ├── DriveFolderView.spec.jsx │ │ │ ├── FilesViewerDrive.jsx │ │ │ ├── HarvestBanner.jsx │ │ │ ├── KonnectorRoutes.jsx │ │ │ ├── SharedDrivesFolderView.tsx │ │ │ └── useTrashRedirect.jsx │ │ ├── Favorites/ │ │ │ └── FavoritesView.tsx │ │ ├── Folder/ │ │ │ ├── ColoredFolder.jsx │ │ │ ├── CustomizedIcon.jsx │ │ │ ├── FolderCustomizer.jsx │ │ │ ├── FolderDuplicateView.tsx │ │ │ ├── FolderView.jsx │ │ │ ├── FolderViewBody.jsx │ │ │ ├── FolderViewBreadcrumb.jsx │ │ │ ├── FolderViewBreadcrumb.spec.jsx │ │ │ ├── FolderViewHeader.jsx │ │ │ ├── OldFolderViewBreadcrumb.jsx │ │ │ ├── PublicFolderDuplicateView.tsx │ │ │ ├── helpers.js │ │ │ ├── helpers.spec.js │ │ │ ├── hooks/ │ │ │ │ ├── useFileSorting.js │ │ │ │ └── useFileSorting.spec.js │ │ │ ├── syncHelpers.js │ │ │ ├── syncHelpers.spec.js │ │ │ ├── useSyncingFakeFile.js │ │ │ └── virtualized/ │ │ │ ├── AddFolderWrapper.jsx │ │ │ ├── FolderViewBody.jsx │ │ │ ├── FolderViewBodyContent.jsx │ │ │ ├── Grid.jsx │ │ │ ├── GridWrapper.jsx │ │ │ ├── Table.jsx │ │ │ ├── helpers.js │ │ │ ├── useScrollToHighlightedItem.jsx │ │ │ └── useScrollToHighlightedItem.spec.jsx │ │ ├── Modal/ │ │ │ ├── DuplicateSharedDriveFilesView.jsx │ │ │ ├── MoveFilesView.jsx │ │ │ ├── MovePublicFilesView.tsx │ │ │ ├── MoveSharedDriveFilesView.jsx │ │ │ ├── QualifyFileView.jsx │ │ │ ├── ShareDisplayedFolderView.jsx │ │ │ └── ShareFileView.jsx │ │ ├── Nextcloud/ │ │ │ ├── NextcloudDeleteView.jsx │ │ │ ├── NextcloudDestroyView.tsx │ │ │ ├── NextcloudDuplicateView.tsx │ │ │ ├── NextcloudFolderView.jsx │ │ │ ├── NextcloudMoveView.jsx │ │ │ ├── NextcloudTrashEmptyView.tsx │ │ │ └── NextcloudTrashView.tsx │ │ ├── OnlyOffice/ │ │ │ ├── Create.jsx │ │ │ ├── Editor.jsx │ │ │ ├── Editor.spec.jsx │ │ │ ├── Error.jsx │ │ │ ├── Loading.jsx │ │ │ ├── OnlyOfficeAIAssistantPanel.tsx │ │ │ ├── OnlyOfficePaywallView.jsx │ │ │ ├── OnlyOfficeProvider.jsx │ │ │ ├── ReadOnlyFab.jsx │ │ │ ├── Title.jsx │ │ │ ├── Toolbar/ │ │ │ │ ├── BackButton.jsx │ │ │ │ ├── EditButton.jsx │ │ │ │ ├── FileIcon.jsx │ │ │ │ ├── FileName.jsx │ │ │ │ ├── HomeIcon.jsx │ │ │ │ ├── HomeLinker.jsx │ │ │ │ ├── Separator.jsx │ │ │ │ ├── Sharing.jsx │ │ │ │ ├── SummarizeByAIButtonWrapper.tsx │ │ │ │ ├── helpers.js │ │ │ │ ├── index.jsx │ │ │ │ ├── index.spec.jsx │ │ │ │ └── styles.styl │ │ │ ├── View.jsx │ │ │ ├── components/ │ │ │ │ ├── FileDeletedModal.jsx │ │ │ │ └── FileDivergedModal.jsx │ │ │ ├── config.js │ │ │ ├── helpers.js │ │ │ ├── helpers.spec.js │ │ │ ├── index.jsx │ │ │ ├── styles.styl │ │ │ ├── useConfig.jsx │ │ │ └── useCreateFile.jsx │ │ ├── Public/ │ │ │ ├── PublicFileViewer.jsx │ │ │ ├── PublicFolderView.jsx │ │ │ ├── PublicFolderView.spec.jsx │ │ │ ├── usePublicFileByIdsQuery.spec.jsx │ │ │ ├── usePublicFileByIdsQuery.tsx │ │ │ ├── usePublicFilesQuery.jsx │ │ │ ├── usePublicFilesQuery.spec.jsx │ │ │ └── usePublicWritePermissions.jsx │ │ ├── Recent/ │ │ │ ├── FilesViewerRecent.jsx │ │ │ ├── index.jsx │ │ │ └── index.spec.jsx │ │ ├── Search/ │ │ │ └── SearchView.jsx │ │ ├── SharedDrive/ │ │ │ ├── CreateSharedDriveButton.jsx │ │ │ ├── FilesViewerSharedDrive.jsx │ │ │ └── SharedDriveFolderView.jsx │ │ ├── Sharings/ │ │ │ ├── FilesViewerSharings.jsx │ │ │ ├── SharingsFolderView.jsx │ │ │ ├── index.jsx │ │ │ ├── index.spec.jsx │ │ │ └── withSharedDocumentIds.jsx │ │ ├── Trash/ │ │ │ ├── FilesViewerTrash.jsx │ │ │ ├── TrashDestroyView.tsx │ │ │ ├── TrashEmptyView.tsx │ │ │ ├── TrashFolderView.jsx │ │ │ └── TrashFolderView.spec.jsx │ │ ├── Upload/ │ │ │ ├── UploadTypes.ts │ │ │ ├── UploadUtils.ts │ │ │ ├── UploaderComponent.tsx │ │ │ ├── __mocks__/ │ │ │ │ └── cozy-intent.ts │ │ │ ├── useResumeFromFlagship.spec.tsx │ │ │ ├── useResumeFromFlagship.ts │ │ │ └── useUploadFromFlagship.ts │ │ ├── testUtils.jsx │ │ ├── useUpdateDocumentTitle.jsx │ │ └── useUpdateDocumentTitle.spec.js │ ├── queries/ │ │ └── index.ts │ ├── store/ │ │ ├── __mocks__/ │ │ │ └── configureStore.js │ │ ├── configureStore.js │ │ ├── persistedState.js │ │ └── rootReducer.js │ ├── styles/ │ │ ├── actionmenu.styl │ │ ├── coz-bar-size.styl │ │ ├── dropzone.styl │ │ ├── filelist.styl │ │ ├── filenameinput.styl │ │ ├── folder-customizer.styl │ │ ├── folder-picker.styl │ │ ├── folder-view.styl │ │ ├── main.styl │ │ ├── toolbar.styl │ │ └── topbar.styl │ └── targets/ │ ├── browser/ │ │ ├── index.ejs │ │ ├── index.jsx │ │ ├── setupAppContext.js │ │ └── wdyr.js │ ├── intents/ │ │ ├── index.ejs │ │ └── index.jsx │ ├── public/ │ │ ├── components/ │ │ │ ├── AppRouter.jsx │ │ │ └── AppRouter.spec.jsx │ │ ├── index.ejs │ │ ├── index.jsx │ │ ├── localeHelper.js │ │ └── localeHelper.spec.js │ └── services/ │ ├── dacc.js │ └── qualificationMigration.js ├── test/ │ ├── __mocks__/ │ │ ├── fileMock.js │ │ └── mockedRouter.js │ ├── components/ │ │ ├── AppLike.jsx │ │ ├── FolderContent.jsx │ │ ├── FolderContent.spec.jsx │ │ └── __snapshots__/ │ │ └── File.spec.js.snap │ ├── data.js │ ├── dummies/ │ │ ├── dummyBreadcrumbPath.js │ │ └── dummyFile.js │ ├── generate.js │ ├── helpers/ │ │ └── index.js │ ├── jestLib/ │ │ └── json-transformer.js │ └── setup.jsx ├── transifex.yml └── tsconfig.json
SYMBOL INDEX (314 symbols across 120 files)
FILE: jestHelpers/ConsoleUsageReporter.js
constant TMP_FILE_PATH (line 7) | const TMP_FILE_PATH = path.join(process.cwd(), '.consoleUsageReporter.js...
method deleteTemporaryFile (line 14) | static deleteTemporaryFile() {
method getTestFilesThatUsedConsole (line 22) | static getTestFilesThatUsedConsole() {
method recordConsoleUsedInCurrentTestFile (line 30) | static recordConsoleUsedInCurrentTestFile() {
method makeTestsFailWhenConsoleUsed (line 45) | static makeTestsFailWhenConsoleUsed() {
method constructor (line 133) | constructor(globalConfig) {
method onRunComplete (line 137) | onRunComplete() {
method onRunStart (line 170) | onRunStart() {
FILE: src/components/Button/OpenFolderButton.tsx
type OpenFolderButtonProps (line 9) | interface OpenFolderButtonProps {
FILE: src/components/ColorPicker/constants.js
constant COLORS (line 1) | const COLORS = [
constant NB_COLUMNS_MOBILE (line 27) | const NB_COLUMNS_MOBILE = 6
constant NB_COLUMNS_DESKTOP (line 28) | const NB_COLUMNS_DESKTOP = 8
constant CELL_HEIGHT_MOBILE (line 29) | const CELL_HEIGHT_MOBILE = 56
constant CELL_HEIGHT_DESKTOP (line 30) | const CELL_HEIGHT_DESKTOP = 40
constant CIRCLE_SIZE_MOBILE (line 31) | const CIRCLE_SIZE_MOBILE = 40
constant CIRCLE_SIZE_DESKTOP (line 32) | const CIRCLE_SIZE_DESKTOP = 36
constant ICON_SIZE_MOBILE (line 33) | const ICON_SIZE_MOBILE = 18
constant ICON_SIZE_DESKTOP (line 34) | const ICON_SIZE_DESKTOP = 12
FILE: src/components/FilesRealTimeQueries.jsx
constant REALTIME_DEBOUNCE_TIME (line 10) | const REALTIME_DEBOUNCE_TIME = 500
FILE: src/components/FolderPicker/FolderPicker.tsx
type FolderPickerSlotProps (line 12) | interface FolderPickerSlotProps {
type FolderPickerProps (line 23) | interface FolderPickerProps {
FILE: src/components/FolderPicker/FolderPickerAddFolderItem.tsx
type FolderPickerAddFolderItemProps (line 17) | interface FolderPickerAddFolderItemProps {
FILE: src/components/FolderPicker/FolderPickerBody.tsx
type FolderPickerBodyProps (line 12) | interface FolderPickerBodyProps {
FILE: src/components/FolderPicker/FolderPickerContentCozy.tsx
type FolderPickerContentCozyProps (line 19) | interface FolderPickerContentCozyProps {
FILE: src/components/FolderPicker/FolderPickerContentLoadMore.tsx
type FolderPickerContentLoadMoreProps (line 5) | interface FolderPickerContentLoadMoreProps {
FILE: src/components/FolderPicker/FolderPickerContentLoader.tsx
type FolderPickerContentLoaderProps (line 9) | interface FolderPickerContentLoaderProps {
FILE: src/components/FolderPicker/FolderPickerContentNextcloud.tsx
type Props (line 15) | interface Props {
FILE: src/components/FolderPicker/FolderPickerContentPublic.tsx
type FolderPickerContentPublicProps (line 16) | interface FolderPickerContentPublicProps {
FILE: src/components/FolderPicker/FolderPickerContentSharedDrive.tsx
type FolderPickerContentSharedDriveProps (line 16) | interface FolderPickerContentSharedDriveProps {
FILE: src/components/FolderPicker/FolderPickerContentSharedDriveRoot.tsx
type FolderPickerContentSharedDriveRootProps (line 20) | interface FolderPickerContentSharedDriveRootProps {
FILE: src/components/FolderPicker/FolderPickerFooter.tsx
type FolderPickerFooterProps (line 11) | interface FolderPickerFooterProps {
FILE: src/components/FolderPicker/FolderPickerHeader.tsx
type FolderPickerHeaderProps (line 10) | interface FolderPickerHeaderProps {
FILE: src/components/FolderPicker/FolderPickerHeaderIllustration.tsx
type FolderPickerHeaderIllustrationProps (line 11) | interface FolderPickerHeaderIllustrationProps {
FILE: src/components/FolderPicker/FolderPickerListItem.tsx
type FolderPickerListItemProps (line 18) | interface FolderPickerListItemProps {
FILE: src/components/FolderPicker/FolderPickerTopbar.tsx
type FolderPickerTopbarProps (line 19) | interface FolderPickerTopbarProps {
FILE: src/components/FolderPicker/types.ts
type File (line 3) | type File = IOCozyFile | NextcloudFile
type FolderPickerEntry (line 5) | interface FolderPickerEntry {
FILE: src/components/IconPicker/IconIndex.js
function getIcon (line 561) | function getIcon(iconName) {
function getIconList (line 565) | function getIconList() {
FILE: src/components/IconPicker/constants.js
constant ICON_COLORS (line 1) | const ICON_COLORS = [
constant NB_COLUMNS_MOBILE (line 16) | const NB_COLUMNS_MOBILE = 6
constant NB_COLUMNS_DESKTOP (line 17) | const NB_COLUMNS_DESKTOP = 8
constant CELL_HEIGHT_MOBILE (line 18) | const CELL_HEIGHT_MOBILE = 56
constant CELL_HEIGHT_DESKTOP (line 19) | const CELL_HEIGHT_DESKTOP = 42
constant ICON_SIZE_MOBILE (line 20) | const ICON_SIZE_MOBILE = 20
constant ICON_SIZE_DESKTOP (line 21) | const ICON_SIZE_DESKTOP = 18
FILE: src/components/Icons/Drive.jsx
function SvgDrive (line 4) | function SvgDrive(props) {
FILE: src/components/Icons/DriveText.jsx
function SvgDriveText (line 4) | function SvgDriveText(props) {
FILE: src/components/Migration/MigrationProgressBanner.jsx
constant SNACKBAR_AUTO_HIDE_MS (line 16) | const SNACKBAR_AUTO_HIDE_MS = 6000
FILE: src/components/Migration/MigrationProgressBanner.spec.jsx
constant RUNNING_DOC (line 23) | const RUNNING_DOC = {
FILE: src/components/MoreMenu.tsx
type MoreMenuProps (line 10) | interface MoreMenuProps {
FILE: src/components/pushClient/Banner.jsx
class BannerClient (line 27) | class BannerClient extends Component {
method constructor (line 31) | constructor(props) {
method componentDidMount (line 36) | async componentDidMount() {
method componentWillUnmount (line 46) | componentWillUnmount() {
method markAsSeen (line 50) | markAsSeen() {
method render (line 55) | render() {
FILE: src/components/pushClient/__mocks__/index.js
constant DESKTOP_BANNER (line 7) | const DESKTOP_BANNER = 'desktop_banner'
constant NOVIEWER_DESKTOP_CTA (line 8) | const NOVIEWER_DESKTOP_CTA = 'noviewer_desktop_cta'
FILE: src/components/pushClient/index.js
constant DESKTOP_SOFTWARE_ID (line 4) | const DESKTOP_SOFTWARE_ID = 'github.com/cozy-labs/cozy-desktop'
constant DESKTOP_BANNER (line 22) | const DESKTOP_BANNER = 'desktop_banner'
constant DESKTOP_SMALL_BANNER (line 23) | const DESKTOP_SMALL_BANNER = 'desktop_small_banner'
constant NOVIEWER_DESKTOP_CTA (line 24) | const NOVIEWER_DESKTOP_CTA = 'noviewer_desktop_cta'
FILE: src/config/sort.js
constant SORTABLE_ATTRIBUTES (line 1) | const SORTABLE_ATTRIBUTES = [
constant DEFAULT_SORT (line 7) | const DEFAULT_SORT = { attribute: 'name', order: 'asc' }
constant SORT_BY_UPDATE_DATE (line 8) | const SORT_BY_UPDATE_DATE = { attribute: 'updated_at', order: 'desc' }
FILE: src/constants/config.js
constant ROOT_DIR_ID (line 6) | const ROOT_DIR_ID = 'io.cozy.files.root-dir'
constant TRASH_DIR_ID (line 7) | const TRASH_DIR_ID = 'io.cozy.files.trash-dir'
constant SHAREDWITHME_DIR_ID (line 8) | const SHAREDWITHME_DIR_ID = 'io.cozy.files.shared-with-me-dir'
constant SHARED_DRIVES_DIR_ID (line 9) | const SHARED_DRIVES_DIR_ID = 'io.cozy.files.shared-drives-dir' // This f...
constant SHARED_DRIVES_DIR_PATH (line 10) | const SHARED_DRIVES_DIR_PATH = 'io.cozy.files.shared-drives-dir'
constant SETTINGS_DIR_PATH (line 11) | const SETTINGS_DIR_PATH = '/Settings'
constant NEXTCLOUD_FILE_ID (line 12) | const NEXTCLOUD_FILE_ID = 'io.cozy.remote.nextcloud.files'
constant RECENT_FOLDER_ID (line 13) | const RECENT_FOLDER_ID = 'recent'
constant APPS_DIR_PATH (line 14) | const APPS_DIR_PATH = '/.cozy_apps'
constant TRASH_DIR_PATH (line 15) | const TRASH_DIR_PATH = '/.cozy_trash'
constant KONNECTORS_DIR_PATH (line 16) | const KONNECTORS_DIR_PATH = '/.cozy_konnectors'
constant FILES_FETCH_LIMIT (line 17) | const FILES_FETCH_LIMIT = 100
constant MAX_PAYLOAD_SIZE_IN_GB (line 18) | const MAX_PAYLOAD_SIZE_IN_GB = 5
constant MAX_PAYLOAD_SIZE (line 19) | const MAX_PAYLOAD_SIZE = MAX_PAYLOAD_SIZE_IN_GB * 1024 * 1024 * 1024
constant MAX_UPLOAD_FILE_COUNT (line 20) | const MAX_UPLOAD_FILE_COUNT = 500
constant SHARING_TAB_ALL (line 21) | const SHARING_TAB_ALL = 0
constant SHARING_TAB_DRIVES (line 22) | const SHARING_TAB_DRIVES = 1
constant DEFAULT_UPLOAD_PROGRESS_HIDE_DELAY (line 23) | const DEFAULT_UPLOAD_PROGRESS_HIDE_DELAY = 5000
constant SHARINGS_VIEW_ROUTE (line 24) | const SHARINGS_VIEW_ROUTE = '/sharings'
FILE: src/contexts/ClipboardProvider.tsx
constant OPERATION_CUT (line 11) | const OPERATION_CUT = 'cut' as const
constant OPERATION_COPY (line 12) | const OPERATION_COPY = 'copy' as const
type MoveValidationModal (line 14) | interface MoveValidationModal {
type ClipboardState (line 23) | interface ClipboardState {
type ClipboardContextValue (line 33) | interface ClipboardContextValue {
constant COPY_FILES (line 55) | const COPY_FILES = 'COPY_FILES'
constant CUT_FILES (line 56) | const CUT_FILES = 'CUT_FILES'
constant CLEAR_CLIPBOARD (line 57) | const CLEAR_CLIPBOARD = 'CLEAR_CLIPBOARD'
constant SHOW_SHARING_MODAL (line 58) | const SHOW_SHARING_MODAL = 'SHOW_SHARING_MODAL'
constant HIDE_SHARING_MODAL (line 59) | const HIDE_SHARING_MODAL = 'HIDE_SHARING_MODAL'
type ClipboardAction (line 61) | type ClipboardAction =
type ClipboardProviderProps (line 165) | interface ClipboardProviderProps {
FILE: src/declarations.d.ts
type showAlertProps (line 34) | interface showAlertProps {
type showAlertFunction (line 48) | type showAlertFunction = (props: showAlertProps) => void
type Action (line 128) | interface Action<T = import('cozy-client/types/types').IOCozyFile> {
class CozyRealtime (line 197) | class CozyRealtime {
FILE: src/hooks/useDisplayedFolder.tsx
type DisplayedFolderResult (line 8) | interface DisplayedFolderResult {
FILE: src/hooks/useFolderSort/index.ts
type Sort (line 12) | interface Sort {
type DriveSettings (line 17) | interface DriveSettings {
type QueryResult (line 22) | interface QueryResult {
FILE: src/hooks/useKeyboardShortcuts.tsx
type PasteResultFile (line 27) | interface PasteResultFile {
type PasteOperationResult (line 32) | interface PasteOperationResult {
type UseKeyboardShortcutsProps (line 39) | interface UseKeyboardShortcutsProps {
FILE: src/hooks/useOnLongPress/helpers.js
constant DOUBLECLICKDELAY (line 1) | const DOUBLECLICKDELAY = 400
FILE: src/hooks/useRecentIcons.jsx
constant STORAGE_KEY (line 5) | const STORAGE_KEY = 'iconPicker_recent_icons'
constant MAX_RECENT_ICONS (line 6) | const MAX_RECENT_ICONS = 8
FILE: src/hooks/useRecentIcons.spec.jsx
constant STORAGE_KEY (line 11) | const STORAGE_KEY = 'iconPicker_recent_icons'
constant MAX_RECENT_ICONS (line 12) | const MAX_RECENT_ICONS = 8
FILE: src/hooks/useShiftSelection/helpers.ts
constant FORWARD_DIRECTION (line 7) | const FORWARD_DIRECTION = 1 as const
constant BACKWARD_DIRECTION (line 8) | const BACKWARD_DIRECTION = -1 as const
type HandleShiftSelectionResponse (line 10) | interface HandleShiftSelectionResponse {
type FindNextBoundaryIndexParams (line 15) | interface FindNextBoundaryIndexParams {
type ToggleSelectionParams (line 24) | interface ToggleSelectionParams {
type HandleShiftArrowParams (line 33) | interface HandleShiftArrowParams {
type HandleShiftClickParams (line 41) | interface HandleShiftClickParams {
FILE: src/hooks/useShiftSelection/index.tsx
type ViewType (line 25) | type ViewType = 'list' | 'grid'
type UseShiftSelectionParams (line 27) | interface UseShiftSelectionParams {
type UseShiftSelectionReturn (line 32) | interface UseShiftSelectionReturn {
FILE: src/hooks/useTransformFolderListHasSharedDriveShortcuts/index.tsx
type SharingRule (line 10) | interface SharingRule {
type SharedDrive (line 15) | interface SharedDrive {
type TransformedSharedDrive (line 20) | interface TransformedSharedDrive extends IOCozyFile {
type UseTransformFolderListReturn (line 24) | interface UseTransformFolderListReturn {
FILE: src/hooks/useUpdateFavicon/constants.ts
constant FAVICON_BY_MIMETYPE (line 1) | const FAVICON_BY_MIMETYPE: Record<string, string | undefined> = {
FILE: src/lib/FuzzyPathSearch.js
class FuzzyPathSearch (line 4) | class FuzzyPathSearch {
method constructor (line 5) | constructor(files = []) {
method search (line 12) | search(query) {
method isAugmentingPreviousQuery (line 49) | isAugmentingPreviousQuery(query) {
method sortQueryByRevelance (line 67) | sortQueryByRevelance(query) {
method sortQuerybyLength (line 99) | sortQuerybyLength(query) {
method filterAndScore (line 103) | filterAndScore(files, words) {
FILE: src/lib/ModalContext.tsx
type TModalContext (line 3) | interface TModalContext {
type ModalContextProviderProps (line 13) | interface ModalContextProviderProps {
FILE: src/lib/ThumbnailSizeContext.tsx
type ThumbnailSizeContextProps (line 3) | interface ThumbnailSizeContextProps {
FILE: src/lib/ViewSwitcherContext.tsx
type QueryResult (line 9) | interface QueryResult {
constant DEFAULT_VIEW_TYPE (line 19) | const DEFAULT_VIEW_TYPE = 'list'
type ViewSwitcherContextProps (line 21) | interface ViewSwitcherContextProps {
FILE: src/lib/doctypes.js
constant DOCTYPE_FILES (line 4) | const DOCTYPE_FILES = 'io.cozy.files'
constant DOCTYPE_FILES_SETTINGS (line 5) | const DOCTYPE_FILES_SETTINGS = 'io.cozy.files.settings'
constant DOCTYPE_DRIVE_SETTINGS (line 6) | const DOCTYPE_DRIVE_SETTINGS = 'io.cozy.drive.settings'
constant DOCTYPE_FILES_ENCRYPTION (line 7) | const DOCTYPE_FILES_ENCRYPTION = 'io.cozy.files.encryption'
constant DOCTYPE_FILES_SHORTCUT (line 8) | const DOCTYPE_FILES_SHORTCUT = 'io.cozy.files.shortcuts'
constant DOCTYPE_ALBUMS (line 9) | const DOCTYPE_ALBUMS = 'io.cozy.photos.albums'
constant DOCTYPE_PHOTOS_SETTINGS (line 10) | const DOCTYPE_PHOTOS_SETTINGS = 'io.cozy.photos.settings'
constant DOCTYPE_APPS (line 11) | const DOCTYPE_APPS = 'io.cozy.apps'
constant DOCTYPE_CONTACTS (line 12) | const DOCTYPE_CONTACTS = 'io.cozy.contacts'
constant DOCTYPE_KONNECTORS (line 13) | const DOCTYPE_KONNECTORS = 'io.cozy.konnectors'
constant NEXTCLOUD_MIGRATIONS_DOCTYPE (line 14) | const NEXTCLOUD_MIGRATIONS_DOCTYPE = 'io.cozy.nextcloud.migrations'
constant DOCTYPE_CONTACTS_VERSION (line 15) | const DOCTYPE_CONTACTS_VERSION = 2
FILE: src/lib/path.js
function joinPath (line 7) | function joinPath(start, end) {
FILE: src/lib/react-cozy-helpers/ModalManager.jsx
constant SHOW_MODAL (line 4) | const SHOW_MODAL = 'SHOW_MODAL'
constant HIDE_MODAL (line 5) | const HIDE_MODAL = 'HIDE_MODAL'
FILE: src/models/Contact.js
class Contact (line 4) | class Contact extends DoctypeContact {
method getInitials (line 5) | static getInitials(contactOrRecipient, defaultValue = '') {
method getDisplayName (line 17) | static getDisplayName(contact, defaultValue = '') {
FILE: src/modules/actions/components/addToFavorites.tsx
type addToFavoritesProps (line 13) | interface addToFavoritesProps {
FILE: src/modules/actions/components/duplicateTo.tsx
type duplicateToProps (line 13) | interface duplicateToProps {
FILE: src/modules/actions/components/removeFromFavorites.tsx
type removeFromFavoritesProps (line 13) | interface removeFromFavoritesProps {
FILE: src/modules/actions/components/selectable.tsx
type selectableProps (line 10) | interface selectableProps {
FILE: src/modules/actions/policies.ts
constant ACTION_POLICIES (line 118) | const ACTION_POLICIES: ActionPolicyDefinition[] = [
FILE: src/modules/actions/types.ts
type ActionPolicyContext (line 10) | interface ActionPolicyContext {
type ActionPolicyDefinition (line 31) | interface ActionPolicyDefinition {
type DriveActionPolicyFlags (line 47) | interface DriveActionPolicyFlags {
type ActionContext (line 58) | interface ActionContext {
type ActionComponentProps (line 97) | interface ActionComponentProps {
type DriveAction (line 105) | interface DriveAction extends DriveActionPolicyFlags {
type ActionWithPolicy (line 134) | type ActionWithPolicy<T = IOCozyFile> = CozyAction<T> &
FILE: src/modules/breadcrumb/components/Breadcrumb.jsx
function handleClickOutside (line 32) | function handleClickOutside(event) {
FILE: src/modules/drive/Toolbar/components/Scanner/ScannerMenuItem.tsx
type ScannerMenuItemProps (line 19) | interface ScannerMenuItemProps {
FILE: src/modules/drive/Toolbar/components/Scanner/ScannerProvider.tsx
type ScannerContextValue (line 5) | interface ScannerContextValue {
type ScannerProviderProps (line 10) | interface ScannerProviderProps {
FILE: src/modules/drive/Toolbar/components/ShortcutCreationModal.jsx
constant ENTER_KEY (line 19) | const ENTER_KEY = 13
FILE: src/modules/drive/Toolbar/components/ShortcutCreationModal.spec.jsx
function createMatchMedia (line 39) | function createMatchMedia(width) {
FILE: src/modules/drive/Toolbar/share/helpers.js
function getPathToShareDisplayedFolder (line 8) | function getPathToShareDisplayedFolder(pathname) {
FILE: src/modules/drive/helpers.ts
type ErrorWithMessage (line 13) | interface ErrorWithMessage {
FILE: src/modules/drive/rename.js
constant START_RENAMING (line 3) | const START_RENAMING = 'START_RENAMING'
constant ABORT_RENAMING (line 4) | const ABORT_RENAMING = 'ABORT_RENAMING'
FILE: src/modules/duplicate/components/DuplicateModal.tsx
type DuplicateModalProps (line 15) | interface DuplicateModalProps {
FILE: src/modules/filelist/FilenameInput.jsx
constant ENTER_KEY (line 15) | const ENTER_KEY = 13
constant ESC_KEY (line 16) | const ESC_KEY = 27
FILE: src/modules/filelist/duck.js
constant SHOW_NEW_FOLDER_INPUT (line 1) | const SHOW_NEW_FOLDER_INPUT = 'SHOW_NEW_FOLDER_INPUT'
constant HIDE_NEW_FOLDER_INPUT (line 2) | const HIDE_NEW_FOLDER_INPUT = 'HIDE_NEW_FOLDER_INPUT'
FILE: src/modules/filelist/helpers.ts
type FileWithAntivirusScan (line 67) | interface FileWithAntivirusScan {
FILE: src/modules/filelist/icons/FileThumbnail.tsx
type FileThumbnailProps (line 29) | interface FileThumbnailProps {
FILE: src/modules/move/components/MoveModalSuccessAction.tsx
type MoveModalSuccessActionProps (line 14) | interface MoveModalSuccessActionProps {
FILE: src/modules/move/hooks/useMove.tsx
type useMoveProps (line 10) | interface useMoveProps {
type showSuccessProps (line 14) | interface showSuccessProps {
type useMoveReturn (line 21) | interface useMoveReturn {
FILE: src/modules/navigation/FavoriteList.tsx
type FavoriteListProps (line 11) | interface FavoriteListProps {
FILE: src/modules/navigation/FavoriteListItem.tsx
type FavoriteListItemProps (line 21) | interface FavoriteListItemProps {
FILE: src/modules/navigation/NavContent.tsx
type NavContentProps (line 8) | interface NavContentProps {
FILE: src/modules/navigation/components/ExternalDriveListItem.tsx
type ExternalDriveListItemProps (line 13) | interface ExternalDriveListItemProps {
FILE: src/modules/navigation/components/ExternalDrivesList.tsx
type ExternalDriveListProps (line 13) | interface ExternalDriveListProps {
FILE: src/modules/navigation/components/FileLink.tsx
type FileLinkProps (line 6) | interface FileLinkProps {
FILE: src/modules/navigation/duck/actions.jsx
constant SORT_FOLDER (line 22) | const SORT_FOLDER = 'SORT_FOLDER'
constant OPERATION_REDIRECTED (line 23) | const OPERATION_REDIRECTED = 'navigation/OPERATION_REDIRECTED'
constant HTTP_CODE_CONFLICT (line 25) | const HTTP_CODE_CONFLICT = 409
FILE: src/modules/navigation/duck/reducer.js
constant RESET_OPERATION_REDIRECTED (line 6) | const RESET_OPERATION_REDIRECTED =
FILE: src/modules/navigation/hooks/helpers.ts
type ComputeFileTypeOptions (line 21) | interface ComputeFileTypeOptions {
type ComputePathOptions (line 27) | interface ComputePathOptions {
FILE: src/modules/navigation/hooks/useFileLink.tsx
type LinkResult (line 19) | interface LinkResult {
type UseFileLinkResult (line 27) | interface UseFileLinkResult {
FILE: src/modules/navigation/hooks/useSharedDriveLink.tsx
type LinkResult (line 12) | interface LinkResult {
type UseFileLinkResult (line 19) | interface UseFileLinkResult {
FILE: src/modules/nextcloud/components/NextcloudTrashFolderBody.tsx
type NextcloudTrashFolderBodyProps (line 14) | interface NextcloudTrashFolderBodyProps {
FILE: src/modules/nextcloud/components/actions/deleteNextcloudFile.tsx
type DeleteNextcloudFileProps (line 12) | interface DeleteNextcloudFileProps {
FILE: src/modules/nextcloud/components/actions/restoreNextcloudFile.tsx
type NextcloudFilesCollection (line 15) | interface NextcloudFilesCollection {
type RestoreNextcloudFileProps (line 19) | interface RestoreNextcloudFileProps {
FILE: src/modules/nextcloud/hooks/useNextcloudEntries.tsx
type useNextcloudEntriesReturn (line 9) | interface useNextcloudEntriesReturn {
FILE: src/modules/nextcloud/hooks/useNextcloudFolder.tsx
type NextcloudFolderProps (line 10) | interface NextcloudFolderProps {
type NextcloudFolderReturn (line 16) | interface NextcloudFolderReturn {
FILE: src/modules/public/PublicProvider.tsx
type PublicContextType (line 3) | interface PublicContextType {
type PublicProviderProps (line 11) | interface PublicProviderProps {
FILE: src/modules/public/helpers.js
function isFilesIsFile (line 1) | function isFilesIsFile(files) {
FILE: src/modules/search/components/helpers.js
constant TYPE_DIRECTORY (line 7) | const TYPE_DIRECTORY = 'directory'
FILE: src/modules/selection/RectangularSelection.jsx
constant INTERACTIVE_ELEMENTS_SELECTOR (line 7) | const INTERACTIVE_ELEMENTS_SELECTOR =
constant SCROLL_STEP_IN_PIXELS (line 9) | const SCROLL_STEP_IN_PIXELS = 10
constant HIT_RATE (line 15) | const HIT_RATE = 1
FILE: src/modules/selection/SelectionBar.tsx
type WrappedDriveAction (line 22) | type WrappedDriveAction = Record<string, DriveAction>
FILE: src/modules/selection/types.ts
type SelectedItems (line 5) | type SelectedItems = Record<string, IOCozyFile>
type SelectionContextType (line 7) | interface SelectionContextType {
type SelectionProviderProps (line 47) | interface SelectionProviderProps {
FILE: src/modules/services/components/Embeder.jsx
class Embeder (line 12) | class Embeder extends React.Component {
method constructor (line 13) | constructor(props) {
method componentDidMount (line 21) | componentDidMount() {
method fetchFileUrl (line 25) | async fetchFileUrl() {
method render (line 36) | render() {
FILE: src/modules/shareddrives/helpers.ts
type SharedDrive (line 5) | interface SharedDrive {
type Rule (line 12) | interface Rule {
FILE: src/modules/shareddrives/hooks/useQueryMultipleSharedDriveFolders.tsx
type UseQueryMultipleSharedDriveFoldersProps (line 8) | interface UseQueryMultipleSharedDriveFoldersProps {
type SharedDriveResult (line 13) | interface SharedDriveResult {
type SharedDriveFolderReturn (line 17) | interface SharedDriveFolderReturn {
FILE: src/modules/shareddrives/hooks/useSharedDriveFolder.tsx
type SharedDriveFolderProps (line 16) | interface SharedDriveFolderProps {
type SharedDriveFolderReturn (line 21) | interface SharedDriveFolderReturn {
FILE: src/modules/shareddrives/hooks/useSharedDriveFolderHelpers.ts
constant PAGE_LIMIT (line 4) | const PAGE_LIMIT = 100
type StatByIdLinks (line 6) | interface StatByIdLinks {
type StatByIdResult (line 10) | interface StatByIdResult {
type TypedFileCollection (line 15) | interface TypedFileCollection {
type PaginatedStatByIdResult (line 22) | interface PaginatedStatByIdResult {
FILE: src/modules/trash/components/DestroyConfirm.tsx
type DestroyConfirmProps (line 19) | interface DestroyConfirmProps {
FILE: src/modules/trash/components/EmptyTrashConfirm.tsx
type EmptyTrashConfirmProps (line 15) | interface EmptyTrashConfirmProps {
FILE: src/modules/trash/components/TrashBreadcrumb.tsx
type TrashBreadcrumbProps (line 10) | interface TrashBreadcrumbProps {
FILE: src/modules/trash/components/actions/destroy.tsx
type destroyProps (line 12) | interface destroyProps {
FILE: src/modules/trash/components/actions/emptyTrash.tsx
type emptyTrashProps (line 10) | interface emptyTrashProps {
FILE: src/modules/upload/DropzoneDnD.jsx
method drop (line 58) | drop(item) {
FILE: src/modules/upload/UploadQueue.jsx
constant IN_PROGRESS (line 37) | const IN_PROGRESS = new Set([PENDING, RESOLVING])
FILE: src/modules/upload/index.js
constant SLUG (line 10) | const SLUG = 'upload'
constant ADD_TO_UPLOAD_QUEUE (line 12) | const ADD_TO_UPLOAD_QUEUE = 'ADD_TO_UPLOAD_QUEUE'
constant UPLOAD_FILE (line 13) | const UPLOAD_FILE = 'UPLOAD_FILE'
constant UPLOAD_PROGRESS (line 14) | const UPLOAD_PROGRESS = 'UPLOAD_PROGRESS'
constant RECEIVE_UPLOAD_SUCCESS (line 15) | const RECEIVE_UPLOAD_SUCCESS = 'RECEIVE_UPLOAD_SUCCESS'
constant RECEIVE_UPLOAD_ERROR (line 16) | const RECEIVE_UPLOAD_ERROR = 'RECEIVE_UPLOAD_ERROR'
constant PURGE_UPLOAD_QUEUE (line 17) | const PURGE_UPLOAD_QUEUE = 'PURGE_UPLOAD_QUEUE'
constant RESOLVE_FOLDER_ITEMS (line 18) | const RESOLVE_FOLDER_ITEMS = 'RESOLVE_FOLDER_ITEMS'
constant CANCEL (line 20) | const CANCEL = 'cancel'
constant PENDING (line 21) | const PENDING = 'pending'
constant LOADING (line 22) | const LOADING = 'loading'
constant CREATED (line 23) | const CREATED = 'created'
constant UPDATED (line 24) | const UPDATED = 'updated'
constant FAILED (line 25) | const FAILED = 'failed'
constant CONFLICT (line 26) | const CONFLICT = 'conflict'
constant QUOTA (line 27) | const QUOTA = 'quota'
constant NETWORK (line 28) | const NETWORK = 'network'
constant UNREADABLE (line 29) | const UNREADABLE = 'unreadable'
constant RESOLVING (line 33) | const RESOLVING = 'resolving'
constant ERR_MAX_FILE_SIZE (line 37) | const ERR_MAX_FILE_SIZE =
constant DONE_STATUSES (line 40) | const DONE_STATUSES = [CREATED, UPDATED]
constant ERROR_STATUSES (line 41) | const ERROR_STATUSES = [CONFLICT, NETWORK, QUOTA, FAILED, UNREADABLE]
constant IN_PROGRESS_STATUSES (line 42) | const IN_PROGRESS_STATUSES = [PENDING, RESOLVING]
constant CONFLICT_ERROR (line 61) | const CONFLICT_ERROR = 409
constant PAYLOAD_TOO_LARGE (line 62) | const PAYLOAD_TOO_LARGE = 413
FILE: src/modules/viewer/CallToAction.jsx
class CallToAction (line 17) | class CallToAction extends Component {
method componentDidMount (line 22) | async componentDidMount() {
method render (line 42) | render() {
FILE: src/modules/views/Folder/ColoredFolder.jsx
function ColoredFolder (line 7) | function ColoredFolder({ color = '#1D7AFF', ...props }) {
FILE: src/modules/views/Modal/MovePublicFilesView.tsx
type LocationState (line 10) | interface LocationState {
FILE: src/modules/views/Nextcloud/NextcloudDestroyView.tsx
type NextcloudFilesCollection (line 13) | interface NextcloudFilesCollection {
FILE: src/modules/views/Nextcloud/NextcloudTrashEmptyView.tsx
type NextcloudFilesCollection (line 11) | interface NextcloudFilesCollection {
FILE: src/modules/views/OnlyOffice/config.js
constant FRAME_EDITOR_NAME (line 1) | const FRAME_EDITOR_NAME = 'frameEditor'
constant DEFAULT_EDITOR_TOOLBAR_HEIGHT_IOS (line 3) | const DEFAULT_EDITOR_TOOLBAR_HEIGHT_IOS = 68
constant DEFAULT_EDITOR_TOOLBAR_HEIGHT (line 4) | const DEFAULT_EDITOR_TOOLBAR_HEIGHT = 32
FILE: src/modules/views/OnlyOffice/helpers.js
function canWriteOfficeDocument (line 27) | function canWriteOfficeDocument() {
function officeDefaultMode (line 39) | function officeDefaultMode(isDesktop, isMobile) {
FILE: src/modules/views/Public/usePublicFileByIdsQuery.tsx
type FetchStatus (line 6) | type FetchStatus = 'pending' | 'loading' | 'loaded' | 'error'
type UsePublicFileByIdsQueryReturn (line 8) | interface UsePublicFileByIdsQueryReturn {
type FileCollection (line 13) | interface FileCollection {
FILE: src/modules/views/Trash/TrashFolderView.spec.jsx
function TestComponent (line 30) | function TestComponent({ onResult }) {
FILE: src/modules/views/Upload/UploadTypes.ts
type FileForQueue (line 1) | interface FileForQueue {
type FileFromNative (line 7) | interface FileFromNative {
type UploadFromFlagship (line 25) | interface UploadFromFlagship {
FILE: src/queries/index.ts
type QueryConfig (line 17) | interface QueryConfig {
type QueryBuilder (line 22) | type QueryBuilder<T = void> = (params: T) => QueryConfig
type buildDriveQueryParams (line 24) | interface buildDriveQueryParams {
constant DEFAULT_CACHE_TIMEOUT_QUERIES (line 34) | const DEFAULT_CACHE_TIMEOUT_QUERIES = 9 * 60 * 1000
type buildRecentWithMetadataAttributeQueryParams (line 110) | interface buildRecentWithMetadataAttributeQueryParams {
type buildSharingsQueryParams (line 153) | interface buildSharingsQueryParams {
type buildSharingsWithMetadataAttributeQueryParams (line 173) | interface buildSharingsWithMetadataAttributeQueryParams {
type buildTrashQueryParams (line 203) | interface buildTrashQueryParams {
type buildSharedDriveQueryParams (line 245) | interface buildSharedDriveQueryParams {
type buildFileWithSpecificMetadataAttributeQueryParams (line 312) | interface buildFileWithSpecificMetadataAttributeQueryParams {
type BuildSharedDriveFileOrFolderByIdQuery (line 355) | interface BuildSharedDriveFileOrFolderByIdQuery {
type buildKonnectorsQueryByIdParams (line 456) | interface buildKonnectorsQueryByIdParams {
type buildNextcloudFolderQueryParams (line 488) | interface buildNextcloudFolderQueryParams {
type buildNextcloudShortcutQueryParams (line 512) | interface buildNextcloudShortcutQueryParams {
type buildFavoritesQueryParams (line 537) | interface buildFavoritesQueryParams {
type buildMagicFolderQueryParams (line 584) | interface buildMagicFolderQueryParams {
type buildNextcloudTrashFolderQueryParams (line 601) | interface buildNextcloudTrashFolderQueryParams {
type buildSharedDriveFolderQueryParams (line 633) | interface buildSharedDriveFolderQueryParams {
type buildSharedDriveIdQueryParams (line 638) | interface buildSharedDriveIdQueryParams {
FILE: src/targets/services/qualificationMigration.js
constant BATCH_FILES_LIMIT (line 16) | const BATCH_FILES_LIMIT = 1000
Condensed preview — 674 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,077K chars).
[
{
"path": ".bundlemonrc",
"chars": 1474,
"preview": "{\n \"baseDir\": \"./build\",\n \"pathLabels\": {\n \"chunkId\": \"[\\\\d-]+\"\n },\n \"files\": [\n {\n \"path\": \"static/js/<c"
},
{
"path": ".editorconfig",
"chars": 247,
"preview": "root = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\ntrim_trailing_whitespace = true\ninsert_final_newline = true\nindent_sty"
},
{
"path": ".github/workflows/ci-cd.yml",
"chars": 1321,
"preview": "name: CI/CD\n\non:\n pull_request:\n push:\n branches:\n - master\n tags:\n - '[0-9]+.[0-9]+.[0-9]+'\n - '"
},
{
"path": ".github/workflows/codeql-analysis.yml",
"chars": 2446,
"preview": "# For most projects, this workflow file will not need changing; you simply need\n# to commit it to your repository.\n#\n# Y"
},
{
"path": ".github/workflows/create-bump-pr.yml",
"chars": 1379,
"preview": "name: 'Create Bump PR'\n\non:\n workflow_dispatch:\n inputs:\n version:\n description: 'New version'\n r"
},
{
"path": ".gitignore",
"chars": 422,
"preview": "# NPM\nnode_modules/\nnpm-debug.log\nyarn-error.log\n\n# Build\nbuild/\n\n# Test\ncoverage/\n.consoleUsageReporter.json\n\n# Stack\n."
},
{
"path": ".nvmrc",
"chars": 3,
"preview": "20\n"
},
{
"path": ".transifexrc.tpl",
"chars": 75,
"preview": "[https://www.transifex.com]\nrest_hostname = https://rest.api.transifex.com\n"
},
{
"path": ".tx/config",
"chars": 214,
"preview": "[main]\nhost = https://www.transifex.com\n\n[o:cozy:p:cozy-drive:r:e8e90edbf54aede8b7b026659d6fe40a]\nfile_filter = src/loca"
},
{
"path": "CHANGELOG.md",
"chars": 6712,
"preview": "# 1.45.0\n\n## ✨ Features\n## 🐛 Bug Fixes\n## 🔧 Tech\n\n\n# 1.44.0\n\n## ✨ Features\n\n* Improvements to DACC service\n\n## 🐛 Bug Fix"
},
{
"path": "CODEOWNERS",
"chars": 92,
"preview": "# General code owners\n* @JF-Cozy @zatteo @rezk2ll @lethemanh @doubleface @lenhanphung\n"
},
{
"path": "CONTRIBUTING.md",
"chars": 4762,
"preview": "How to contribute to Cozy Drive?\n====================================\n\nThank you for your interest in contributing to Co"
},
{
"path": "LICENSE",
"chars": 34520,
"preview": " GNU AFFERO GENERAL PUBLIC LICENSE\n Version 3, 19 November 2007\n\n Copyright (C)"
},
{
"path": "README.md",
"chars": 8377,
"preview": "# Twake Drive\n\n<p align=\"center\">\n <a href=\"https://github.com/linagora/twake-drive\">\n <img src=\"./docs/twake-drive-b"
},
{
"path": "babel.config.js",
"chars": 59,
"preview": "module.exports = {\n presets: ['cozy-app', '@babel/env']\n}\n"
},
{
"path": "docs/nextcloud.md",
"chars": 1069,
"preview": "# Nextcloud\n\nThe integration of Nextcloud within cozy-drive relies heavily on cozy-client and the proxy made by cozy-sta"
},
{
"path": "eslint.config.mjs",
"chars": 1237,
"preview": "import basics from 'eslint-config-cozy-app/basics'\nimport cozyReact from 'eslint-config-cozy-app/react'\n\nconst baseImpor"
},
{
"path": "jest.config.js",
"chars": 2521,
"preview": "module.exports = {\n roots: ['<rootDir>/src'],\n setupFiles: ['<rootDir>/jestHelpers/setup.js'],\n setupFilesAfterEnv: ["
},
{
"path": "jestHelpers/ConsoleUsageReporter.js",
"chars": 4312,
"preview": "/* eslint-disable class-methods-use-this */\nconst fs = require('fs')\nconst path = require('path')\n\nconst { red, reset } "
},
{
"path": "jestHelpers/mocks/fileMock.js",
"chars": 21,
"preview": "module.exports = {};\n"
},
{
"path": "jestHelpers/mocks/iconMock.js",
"chars": 53,
"preview": "let id = 0;\nmodule.exports = { id: `icon-${id++}` };\n"
},
{
"path": "jestHelpers/mocks/pdfjsWorkerMock.js",
"chars": 27,
"preview": "module.exports = () => {};\n"
},
{
"path": "jestHelpers/mocks/svgRawMock.js",
"chars": 88,
"preview": "module.exports = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"></svg>'\n\n\n"
},
{
"path": "jestHelpers/setup.js",
"chars": 1137,
"preview": "import React from 'react'\nimport { TransformStream } from 'stream/web'\n\nglobal.cozy = {}\nglobal.TransformStream = Transf"
},
{
"path": "jestHelpers/setupFilesAfterEnv.js",
"chars": 211,
"preview": "import '@testing-library/jest-dom'\nimport ConsoleUsageReporter from './ConsoleUsageReporter'\n\nConsoleUsageReporter.makeT"
},
{
"path": "manifest.webapp",
"chars": 10756,
"preview": "{\n \"name\": \"Drive\",\n \"name_prefix\": \"Twake\",\n \"slug\": \"drive\",\n \"version\": \"1.99.0\",\n \"type\": \"webapp\",\n \"licence\""
},
{
"path": "package.json",
"chars": 3824,
"preview": "{\n \"name\": \"cozy-drive\",\n \"version\": \"1.99.0\",\n \"main\": \"src/main.jsx\",\n \"scripts\": {\n \"build\": \"rsbuild build\",\n"
},
{
"path": "public/browserconfig.xml",
"chars": 246,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<browserconfig>\n <msapplication>\n <tile>\n <square150x150logo"
},
{
"path": "public/manifest.json",
"chars": 403,
"preview": "{\n \"name\": \"\",\n \"icons\": [\n {\n \"src\": \"/android-chrome-192x192.png\",\n \"sizes\": \"192x1"
},
{
"path": "renovate.json",
"chars": 26,
"preview": "{\n \"extends\": [\"cozy\"]\n}\n"
},
{
"path": "rsbuild.config.mjs",
"chars": 713,
"preview": "import { defineConfig, mergeRsbuildConfig } from '@rsbuild/core'\nimport { getRsbuildConfig } from 'rsbuild-config-cozy-a"
},
{
"path": "src/components/App/App.jsx",
"chars": 2510,
"preview": "import PropTypes from 'prop-types'\nimport React, { Fragment } from 'react'\nimport { DndProvider } from 'react-dnd'\nimpor"
},
{
"path": "src/components/Bar.jsx",
"chars": 319,
"preview": "import React from 'react'\n\nimport { BarRight } from 'cozy-bar'\nimport useBreakpoints from 'cozy-ui/transpiled/react/prov"
},
{
"path": "src/components/Button/BackButton.jsx",
"chars": 497,
"preview": "import React from 'react'\n\nimport Icon from 'cozy-ui/transpiled/react/Icon'\nimport IconButton from 'cozy-ui/transpiled/r"
},
{
"path": "src/components/Button/MoreButton.jsx",
"chars": 631,
"preview": "import React from 'react'\n\nimport Icon from 'cozy-ui/transpiled/react/Icon'\nimport IconButton from 'cozy-ui/transpiled/r"
},
{
"path": "src/components/Button/OpenFolderButton.tsx",
"chars": 960,
"preview": "import React, { FC } from 'react'\nimport { NavigateFunction } from 'react-router-dom'\n\nimport Button from 'cozy-ui/trans"
},
{
"path": "src/components/Button/index.jsx",
"chars": 53,
"preview": "export { default as MoreButton } from './MoreButton'\n"
},
{
"path": "src/components/ColorPicker/ColorPicker.jsx",
"chars": 2821,
"preview": "import PropTypes from 'prop-types'\nimport React from 'react'\n\nimport Avatar from 'cozy-ui/transpiled/react/Avatar'\nimpor"
},
{
"path": "src/components/ColorPicker/constants.js",
"chars": 617,
"preview": "export const COLORS = [\n '#696c6f',\n '#d3bfa4',\n '#e1e3e6',\n '#ff4d5e',\n '#ff7750',\n '#f5ac00',\n '#ffd54c',\n '#f"
},
{
"path": "src/components/ColorPicker/index.jsx",
"chars": 81,
"preview": "export { ColorPicker } from './ColorPicker'\nexport { COLORS } from './constants'\n"
},
{
"path": "src/components/Error/Empty.jsx",
"chars": 3782,
"preview": "import cx from 'classnames'\nimport React from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport flag from '"
},
{
"path": "src/components/Error/ErrorShare.jsx",
"chars": 567,
"preview": "import React from 'react'\n\nimport Empty from 'cozy-ui/transpiled/react/Empty'\nimport CloudBrokenIcon from 'cozy-ui/trans"
},
{
"path": "src/components/Error/NotFound.jsx",
"chars": 396,
"preview": "import React from 'react'\n\nimport Empty from 'cozy-ui/transpiled/react/Empty'\nimport { useI18n } from 'twake-i18n'\n\nimpo"
},
{
"path": "src/components/Error/Oops.jsx",
"chars": 748,
"preview": "import PropTypes from 'prop-types'\nimport React from 'react'\n\nimport Button from 'cozy-ui/transpiled/react/Buttons'\nimpo"
},
{
"path": "src/components/Error/empty.styl",
"chars": 226,
"preview": "@require 'settings/breakpoints'\n\n.empty\n +medium-screen('min')\n border 2px dashed var(--borderMainColor)\n "
},
{
"path": "src/components/Error/oops.styl",
"chars": 107,
"preview": "@require 'settings/breakpoints'\n\n+medium-screen() // @stylint ignore\n .oops\n pointer-events auto\n"
},
{
"path": "src/components/FileHistory/HistoryModal.jsx",
"chars": 3210,
"preview": "import get from 'lodash/get'\nimport PropTypes from 'prop-types'\nimport React from 'react'\nimport { useNavigate } from 'r"
},
{
"path": "src/components/FileHistory/index.jsx",
"chars": 1482,
"preview": "import React from 'react'\nimport { useParams } from 'react-router-dom'\n\nimport { Query, Q } from 'cozy-client'\n\nimport H"
},
{
"path": "src/components/FileHistory/styles.styl",
"chars": 69,
"preview": ".HistoryRowRevisionLoader\n display flex\n justify-content center"
},
{
"path": "src/components/FilesRealTimeQueries.jsx",
"chars": 6640,
"preview": "import debounce from 'lodash/debounce'\nimport { memo, useEffect } from 'react'\n\nimport { useClient, Mutations } from 'co"
},
{
"path": "src/components/FilesViewerLoading.jsx",
"chars": 315,
"preview": "import React from 'react'\n\nimport Backdrop from 'cozy-ui/transpiled/react/Backdrop'\nimport Spinner from 'cozy-ui/transpi"
},
{
"path": "src/components/FolderPicker/FolderPicker.spec.jsx",
"chars": 3891,
"preview": "import { render, fireEvent, screen } from '@testing-library/react'\nimport React from 'react'\n\nimport { createMockClient "
},
{
"path": "src/components/FolderPicker/FolderPicker.tsx",
"chars": 3242,
"preview": "import React, { useState } from 'react'\n\nimport { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs'\nimport { mak"
},
{
"path": "src/components/FolderPicker/FolderPickerAddFolderItem.tsx",
"chars": 2083,
"preview": "import React, { FC } from 'react'\nimport { useDispatch } from 'react-redux'\n\nimport { useClient } from 'cozy-client'\nimp"
},
{
"path": "src/components/FolderPicker/FolderPickerBody.spec.jsx",
"chars": 2898,
"preview": "import { render, screen } from '@testing-library/react'\nimport React from 'react'\n\nimport { FolderPickerBody } from '@/c"
},
{
"path": "src/components/FolderPicker/FolderPickerBody.tsx",
"chars": 2830,
"preview": "import React from 'react'\n\nimport { FolderPickerContentSharedDriveRoot } from './FolderPickerContentSharedDriveRoot'\n\nim"
},
{
"path": "src/components/FolderPicker/FolderPickerContentCozy.tsx",
"chars": 3884,
"preview": "import React, { useMemo } from 'react'\n\nimport { useQuery } from 'cozy-client'\nimport { isDirectory } from 'cozy-client/"
},
{
"path": "src/components/FolderPicker/FolderPickerContentLoadMore.tsx",
"chars": 436,
"preview": "import React from 'react'\n\nimport LoadMoreButton from '@/modules/filelist/LoadMore'\n\ninterface FolderPickerContentLoadMo"
},
{
"path": "src/components/FolderPicker/FolderPickerContentLoader.tsx",
"chars": 1160,
"preview": "import React, { ReactNode } from 'react'\n\nimport ListItemSkeleton from 'cozy-ui/transpiled/react/Skeletons/ListItemSkele"
},
{
"path": "src/components/FolderPicker/FolderPickerContentNextcloud.tsx",
"chars": 1856,
"preview": "import React from 'react'\n\nimport { useQuery } from 'cozy-client'\nimport { isDirectory } from 'cozy-client/dist/models/f"
},
{
"path": "src/components/FolderPicker/FolderPickerContentPublic.tsx",
"chars": 2486,
"preview": "import React, { useMemo } from 'react'\n\nimport { isDirectory } from 'cozy-client/dist/models/file'\nimport { IOCozyFile }"
},
{
"path": "src/components/FolderPicker/FolderPickerContentSharedDrive.tsx",
"chars": 2485,
"preview": "import * as React from 'react'\nimport { useMemo } from 'react'\n\nimport { isDirectory } from 'cozy-client/dist/models/fil"
},
{
"path": "src/components/FolderPicker/FolderPickerContentSharedDriveRoot.tsx",
"chars": 3724,
"preview": "import React, { useMemo } from 'react'\n\nimport { useQuery } from 'cozy-client'\nimport { isDirectory } from 'cozy-client/"
},
{
"path": "src/components/FolderPicker/FolderPickerFooter.tsx",
"chars": 1616,
"preview": "import React from 'react'\n\nimport { IOCozyFile } from 'cozy-client/types/types'\nimport Buttons from 'cozy-ui/transpiled/"
},
{
"path": "src/components/FolderPicker/FolderPickerHeader.spec.js",
"chars": 1868,
"preview": "import { render } from '@testing-library/react'\nimport React from 'react'\n\nimport CozyClient from 'cozy-client'\n\nimport "
},
{
"path": "src/components/FolderPicker/FolderPickerHeader.tsx",
"chars": 1605,
"preview": "import React from 'react'\n\nimport Box from 'cozy-ui/transpiled/react/Box'\nimport Typography from 'cozy-ui/transpiled/rea"
},
{
"path": "src/components/FolderPicker/FolderPickerHeaderIllustration.tsx",
"chars": 1345,
"preview": "import React from 'react'\n\nimport Avatar from 'cozy-ui/transpiled/react/Avatar'\nimport Icon from 'cozy-ui/transpiled/rea"
},
{
"path": "src/components/FolderPicker/FolderPickerListItem.tsx",
"chars": 2166,
"preview": "import { filesize } from 'filesize'\nimport React, { FC } from 'react'\n\nimport { isDirectory } from 'cozy-client/dist/mod"
},
{
"path": "src/components/FolderPicker/FolderPickerTopbar.spec.jsx",
"chars": 6444,
"preview": "import { fireEvent, render, screen, waitFor } from '@testing-library/react'\nimport React from 'react'\n\nimport { createMo"
},
{
"path": "src/components/FolderPicker/FolderPickerTopbar.tsx",
"chars": 2520,
"preview": "import cx from 'classnames'\nimport React, { useCallback, useState } from 'react'\n\nimport { useClient } from 'cozy-client"
},
{
"path": "src/components/FolderPicker/helpers.spec.js",
"chars": 2167,
"preview": "import { areTargetsInCurrentDir } from './helpers'\n\ndescribe('areTargetsInCurrentDir', () => {\n it('should return false"
},
{
"path": "src/components/FolderPicker/helpers.ts",
"chars": 5565,
"preview": "import CozyClient from 'cozy-client/types/CozyClient'\nimport { IOCozyFile, NextcloudFile } from 'cozy-client/types/types"
},
{
"path": "src/components/FolderPicker/types.ts",
"chars": 301,
"preview": "import { IOCozyFile, NextcloudFile } from 'cozy-client/types/types'\n\nexport type File = IOCozyFile | NextcloudFile\n\nexpo"
},
{
"path": "src/components/IconPicker/IconColorPicker.jsx",
"chars": 1924,
"preview": "import PropTypes from 'prop-types'\nimport React from 'react'\n\nimport ClickAwayListener from 'cozy-ui/transpiled/react/Cl"
},
{
"path": "src/components/IconPicker/IconIndex.js",
"chars": 20712,
"preview": "import Album from 'cozy-ui/transpiled/react/Icons/Album'\nimport AlbumAdd from 'cozy-ui/transpiled/react/Icons/AlbumAdd'\n"
},
{
"path": "src/components/IconPicker/IconPicker.jsx",
"chars": 5104,
"preview": "import PropTypes from 'prop-types'\nimport React, { useState, useEffect } from 'react'\n\nimport Backdrop from 'cozy-ui/tra"
},
{
"path": "src/components/IconPicker/NoneIcon.jsx",
"chars": 842,
"preview": "import PropTypes from 'prop-types'\nimport React from 'react'\n\nimport Cross from 'cozy-ui/transpiled/react/Icons/Cross'\n\n"
},
{
"path": "src/components/IconPicker/constants.js",
"chars": 404,
"preview": "export const ICON_COLORS = [\n '#2c2c2c',\n '#9aa0a6',\n '#e0e0e0',\n '#8d5e3c',\n '#ffb300',\n '#66e49a',\n '#00a6ff',\n"
},
{
"path": "src/components/IconPicker/index.jsx",
"chars": 42,
"preview": "export { IconPicker } from './IconPicker'\n"
},
{
"path": "src/components/IconStack/index.jsx",
"chars": 1043,
"preview": "import classNames from 'classnames'\nimport PropTypes from 'prop-types'\nimport React from 'react'\n\nimport styles from './"
},
{
"path": "src/components/IconStack/styles.styl",
"chars": 176,
"preview": ".IconStack-wrapper\n position relative\n display inline-block\n\n.IconStack-foregroundIcon\n position absolute\n l"
},
{
"path": "src/components/Icons/Drive.jsx",
"chars": 2377,
"preview": "// Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/illus/drive.svg` to regenerate;\nimport "
},
{
"path": "src/components/Icons/DriveText.jsx",
"chars": 4342,
"preview": "// Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/illus/drive-text.svg` to regenerate;\nim"
},
{
"path": "src/components/LoaderModal.jsx",
"chars": 427,
"preview": "import React from 'react'\n\nimport { ConfirmDialog } from 'cozy-ui/transpiled/react/CozyDialogs'\nimport Spinner from 'coz"
},
{
"path": "src/components/Migration/MigrationProgressBanner.jsx",
"chars": 4432,
"preview": "import React, { useCallback, useEffect, useState } from 'react'\n\nimport { useClient, useQuery } from 'cozy-client'\nimpor"
},
{
"path": "src/components/Migration/MigrationProgressBanner.spec.jsx",
"chars": 6544,
"preview": "import { render, screen, fireEvent, waitFor, act } from '@testing-library/react'\nimport React from 'react'\n\nimport { cre"
},
{
"path": "src/components/MoreMenu.tsx",
"chars": 1525,
"preview": "import React, { useState, useCallback, useRef, RefObject, FC } from 'react'\n\nimport ActionsMenu from 'cozy-ui/transpiled"
},
{
"path": "src/components/MoveValidationModals/index.tsx",
"chars": 2134,
"preview": "import React from 'react'\n\nimport { useClipboardContext } from '@/contexts/ClipboardProvider'\nimport { MoveInsideSharedF"
},
{
"path": "src/components/PushBanner/PushBanner.spec.jsx",
"chars": 2522,
"preview": "import { render, screen } from '@testing-library/react'\nimport React from 'react'\n\nimport { useInstanceInfo } from 'cozy"
},
{
"path": "src/components/PushBanner/PushBannerProvider.jsx",
"chars": 731,
"preview": "import React, { createContext, useContext, useState } from 'react'\n\nconst PushBannerContext = createContext()\n\n/**\n * Th"
},
{
"path": "src/components/PushBanner/QuotaBanner.jsx",
"chars": 2288,
"preview": "import React, { useEffect, useState } from 'react'\n\nimport { useInstanceInfo } from 'cozy-client'\nimport {\n arePremiumL"
},
{
"path": "src/components/PushBanner/QuotaBanner.spec.jsx",
"chars": 4443,
"preview": "import { fireEvent, render, screen } from '@testing-library/react'\nimport React from 'react'\n\nimport { useInstanceInfo }"
},
{
"path": "src/components/PushBanner/index.jsx",
"chars": 1083,
"preview": "import PropTypes from 'prop-types'\nimport React from 'react'\n\nimport { useInstanceInfo } from 'cozy-client'\nimport { mak"
},
{
"path": "src/components/RightClick/RightClickAddMenu.jsx",
"chars": 2422,
"preview": "import React, { useContext } from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport { useSharingContext } f"
},
{
"path": "src/components/RightClick/RightClickFileMenu.jsx",
"chars": 2269,
"preview": "import React from 'react'\n\nimport ActionsMenu from 'cozy-ui/transpiled/react/ActionsMenu'\nimport { useBreakpoints } from"
},
{
"path": "src/components/RightClick/RightClickProvider.jsx",
"chars": 1188,
"preview": "import React, {\n useContext,\n useState,\n createContext,\n useMemo,\n useCallback\n} from 'react'\n\nconst initialPositio"
},
{
"path": "src/components/SideBarAccordion.jsx",
"chars": 1687,
"preview": "import React, { useState } from 'react'\n\nimport Accordion from 'cozy-ui/transpiled/react/Accordion'\nimport AccordionDeta"
},
{
"path": "src/components/TrashedBanner.jsx",
"chars": 3075,
"preview": "import React, { useState } from 'react'\nimport { useNavigate } from 'react-router-dom'\n\nimport { useClient, useQuery } f"
},
{
"path": "src/components/pushClient/Banner.jsx",
"chars": 3089,
"preview": "// eslint-disable-next-line no-redeclare,no-unused-vars\n/* global localStorage */\n\nimport localforage from 'localforage'"
},
{
"path": "src/components/pushClient/Button.jsx",
"chars": 3063,
"preview": "import localforage from 'localforage'\nimport React, { useState, useEffect } from 'react'\n\nimport { withClient } from 'co"
},
{
"path": "src/components/pushClient/__mocks__/index.js",
"chars": 314,
"preview": "export const track = jest.fn()\n\nexport const isLinux = jest.fn()\nexport const isAndroid = jest.fn()\nexport const isIOS ="
},
{
"path": "src/components/pushClient/index.d.ts",
"chars": 655,
"preview": "export declare const DESKTOP_SOFTWARE_ID: string\nexport declare const DESKTOP_BANNER: string\nexport declare const DESKTO"
},
{
"path": "src/components/pushClient/index.js",
"chars": 1873,
"preview": "import CozyClient, { Q } from 'cozy-client'\nimport flag from 'cozy-flags'\n\nexport const DESKTOP_SOFTWARE_ID = 'github.co"
},
{
"path": "src/components/pushClient/index.spec.js",
"chars": 878,
"preview": "import CozyClient from 'cozy-client'\n\nimport { isClientAlreadyInstalled, DESKTOP_SOFTWARE_ID } from './index'\n\ndescribe("
},
{
"path": "src/components/useDocument.jsx",
"chars": 466,
"preview": "import { useMemo } from 'react'\nimport { useSelector } from 'react-redux'\n\nimport { useClient } from 'cozy-client'\nimpor"
},
{
"path": "src/components/useHead.jsx",
"chars": 918,
"preview": "import { useMemo } from 'react'\nimport { useParams } from 'react-router-dom'\n\nimport { useQuery } from 'cozy-client'\n\nim"
},
{
"path": "src/config/config.json",
"chars": 54,
"preview": "{\n \"promoteDesktop\": {\n \"isActivated\": true\n }\n}\n"
},
{
"path": "src/config/sort.js",
"chars": 468,
"preview": "export const SORTABLE_ATTRIBUTES = [\n { label: 'name', attr: 'name', css: 'file', defaultOrder: 'asc' },\n { label: 'up"
},
{
"path": "src/constants/config.js",
"chars": 1087,
"preview": "/**\n Redux constants\n**/\n\n// global variables\nexport const ROOT_DIR_ID = 'io.cozy.files.root-dir'\nexport const TRASH_DI"
},
{
"path": "src/contexts/ClipboardProvider.spec.tsx",
"chars": 10646,
"preview": "import '@testing-library/jest-dom'\nimport {\n render,\n screen,\n fireEvent,\n renderHook,\n act as actHook\n} from '@tes"
},
{
"path": "src/contexts/ClipboardProvider.tsx",
"chars": 6363,
"preview": "import React, {\n createContext,\n useContext,\n useReducer,\n useCallback,\n ReactNode\n} from 'react'\n\nimport { IOCozyF"
},
{
"path": "src/declarations.d.ts",
"chars": 5978,
"preview": "declare module 'cozy-ui/*'\n\ndeclare module 'cozy-ui/transpiled/react/styles' {\n export function makeStyles<T>(styles: T"
},
{
"path": "src/hooks/helpers.d.ts",
"chars": 420,
"preview": "export declare function changeLocation(url: string): void\n\nexport declare function displayedFolderOrRootFolder(displayed"
},
{
"path": "src/hooks/helpers.js",
"chars": 2058,
"preview": "import { ROOT_DIR_ID, TRASH_DIR_ID } from '@/constants/config'\n\n/**\n * This helper function is used to change the locati"
},
{
"path": "src/hooks/index.js",
"chars": 431,
"preview": "export { default as useCurrentFileId } from './useCurrentFileId'\nexport { default as useCurrentFolderId } from './useCur"
},
{
"path": "src/hooks/useCurrentFileId.jsx",
"chars": 200,
"preview": "import { useParams } from 'react-router-dom'\n\nconst useCurrentFileId = () => {\n const { fileId } = useParams()\n\n if (f"
},
{
"path": "src/hooks/useCurrentFileId.spec.jsx",
"chars": 678,
"preview": "import ReactRouter from 'react-router-dom'\n\nimport useCurrentFileId from './useCurrentFileId'\n\njest.mock('react-router-d"
},
{
"path": "src/hooks/useCurrentFolderId.jsx",
"chars": 577,
"preview": "import { useParams, useLocation } from 'react-router-dom'\n\nimport { ROOT_DIR_ID, TRASH_DIR_ID } from '@/constants/config"
},
{
"path": "src/hooks/useCurrentFolderId.spec.jsx",
"chars": 1972,
"preview": "import ReactRouter from 'react-router-dom'\n\nimport useCurrentFolderId from './useCurrentFolderId'\n\nimport { ROOT_DIR_ID,"
},
{
"path": "src/hooks/useDebounce.jsx",
"chars": 515,
"preview": "import { useEffect, useState } from 'react'\n\nconst useDebounce = (value, { delay, ignore }) => {\n const [debouncedValue"
},
{
"path": "src/hooks/useDisplayedFolder.spec.jsx",
"chars": 1051,
"preview": "import { useQuery } from 'cozy-client'\n\nimport useCurrentFolderId from './useCurrentFolderId'\nimport useDisplayedFolder "
},
{
"path": "src/hooks/useDisplayedFolder.tsx",
"chars": 1199,
"preview": "import { useQuery } from 'cozy-client'\nimport { IOCozyFile } from 'cozy-client/types/types'\n\nimport { ROOT_DIR_ID } from"
},
{
"path": "src/hooks/useFolderSort/index.spec.jsx",
"chars": 9040,
"preview": "import { renderHook, act, waitFor } from '@testing-library/react'\n\nimport { useClient } from 'cozy-client'\nimport flag f"
},
{
"path": "src/hooks/useFolderSort/index.ts",
"chars": 3168,
"preview": "import { useCallback, useEffect, useState } from 'react'\n\nimport { useClient, Q } from 'cozy-client'\nimport flag from 'c"
},
{
"path": "src/hooks/useKeyboardShortcuts.spec.jsx",
"chars": 22099,
"preview": "import '@testing-library/jest-dom'\nimport { renderHook, act } from '@testing-library/react'\nimport React from 'react'\nim"
},
{
"path": "src/hooks/useKeyboardShortcuts.tsx",
"chars": 9436,
"preview": "import React, { useEffect, useCallback } from 'react'\nimport { useDispatch } from 'react-redux'\n\nimport { isFile } from "
},
{
"path": "src/hooks/useMoreMenuActions.jsx",
"chars": 3636,
"preview": "import { useState, useEffect } from 'react'\nimport { useLocation, useNavigate } from 'react-router-dom'\n\nimport { useCli"
},
{
"path": "src/hooks/useOnLongPress/helpers.js",
"chars": 3406,
"preview": "const DOUBLECLICKDELAY = 400\n\nexport const handleClick = ({\n event,\n file,\n disabled,\n isRenaming,\n openLink,\n tog"
},
{
"path": "src/hooks/useOnLongPress/helpers.spec.jsx",
"chars": 7851,
"preview": "import MockDate from 'mockdate'\n\nimport flag from 'cozy-flags'\n\nimport { handlePress, handleClick } from './helpers'\n\nje"
},
{
"path": "src/hooks/useOnLongPress/index.js",
"chars": 1434,
"preview": "import { useRef, useState } from 'react'\n\nimport { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints"
},
{
"path": "src/hooks/useParentFolder.jsx",
"chars": 309,
"preview": "import { useClient } from 'cozy-client'\n\nimport { DOCTYPE_FILES } from '@/lib/doctypes'\n\nconst useParentFolder = parentF"
},
{
"path": "src/hooks/useParentFolder.spec.jsx",
"chars": 734,
"preview": "import useParentFolder from './useParentFolder'\n\nconst mockGetDocumentFromState = jest.fn()\n\njest.mock('cozy-client', ()"
},
{
"path": "src/hooks/useRecentFiles.jsx",
"chars": 1639,
"preview": "import { useEffect, useState, useMemo } from 'react'\n\nimport { useClient } from 'cozy-client'\nimport { useDataProxy } fr"
},
{
"path": "src/hooks/useRecentFiles.spec.jsx",
"chars": 6781,
"preview": "import { renderHook, waitFor } from '@testing-library/react'\n\nimport { useClient } from 'cozy-client'\nimport { useDataPr"
},
{
"path": "src/hooks/useRecentIcons.jsx",
"chars": 1630,
"preview": "import { useState, useEffect } from 'react'\n\nimport logger from '@/lib/logger'\n\nconst STORAGE_KEY = 'iconPicker_recent_i"
},
{
"path": "src/hooks/useRecentIcons.spec.jsx",
"chars": 6622,
"preview": "import { renderHook, act } from '@testing-library/react'\n\nimport { useRecentIcons, addRecentIcon } from './useRecentIcon"
},
{
"path": "src/hooks/useRedirectLink.jsx",
"chars": 3820,
"preview": "import { useState, useEffect } from 'react'\nimport { useSearchParams, useNavigate } from 'react-router-dom'\n\nimport {\n "
},
{
"path": "src/hooks/useRedirectLink.spec.jsx",
"chars": 4898,
"preview": "import { renderHook, act } from '@testing-library/react'\nimport { useSearchParams, useNavigate } from 'react-router-dom'"
},
{
"path": "src/hooks/useShiftSelection/helpers.spec.ts",
"chars": 10099,
"preview": "import { IOCozyFile } from 'cozy-client/types/types'\n\nimport {\n handleShiftArrow,\n handleShiftClick,\n FORWARD_DIRECTI"
},
{
"path": "src/hooks/useShiftSelection/helpers.ts",
"chars": 7907,
"preview": "import cloneDeep from 'lodash/cloneDeep'\n\nimport { IOCozyFile } from 'cozy-client/types/types'\n\nimport type { SelectedIt"
},
{
"path": "src/hooks/useShiftSelection/index.spec.tsx",
"chars": 6465,
"preview": "import { renderHook, act } from '@testing-library/react'\nimport { RefObject } from 'react'\n\nimport { IOCozyFile } from '"
},
{
"path": "src/hooks/useShiftSelection/index.tsx",
"chars": 5997,
"preview": "/* eslint-disable react-hooks/refs */\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n RefObject\n"
},
{
"path": "src/hooks/useTransformFolderListHasSharedDriveShortcuts/index.spec.jsx",
"chars": 7007,
"preview": "import { renderHook } from '@testing-library/react'\n\nimport { useTransformFolderListHasSharedDriveShortcuts } from './in"
},
{
"path": "src/hooks/useTransformFolderListHasSharedDriveShortcuts/index.tsx",
"chars": 3941,
"preview": "import { useMemo } from 'react'\n\nimport { IOCozyFile } from 'cozy-client/types/types'\nimport { useSharingContext } from "
},
{
"path": "src/hooks/useUpdateFavicon/constants.ts",
"chars": 216,
"preview": "export const FAVICON_BY_MIMETYPE: Record<string, string | undefined> = {\n text: '/favicons/icon-onlyoffice-text.ico',\n "
},
{
"path": "src/hooks/useUpdateFavicon/helpers.spec.js",
"chars": 3016,
"preview": "import { updateFavicon } from './helpers'\n\nconst mockQuerySelectorAll = jest.fn()\nconst mockAppendChild = jest.fn()\ncons"
},
{
"path": "src/hooks/useUpdateFavicon/helpers.ts",
"chars": 657,
"preview": "/**\n * Updates all favicon link elements in the document head\n *\n * @param {string}faviconUrl - The URL of the favicon t"
},
{
"path": "src/hooks/useUpdateFavicon/index.spec.jsx",
"chars": 5469,
"preview": "import { renderHook } from '@testing-library/react'\n\nimport flag from 'cozy-flags'\n\nimport useUpdateFavicon from '.'\n\nje"
},
{
"path": "src/hooks/useUpdateFavicon/index.tsx",
"chars": 1189,
"preview": "import { useEffect, useRef } from 'react'\n\nimport { IOCozyFile } from 'cozy-client/types/types'\n\nimport { updateFavicon "
},
{
"path": "src/lib/AcceptingSharingContext.jsx",
"chars": 576,
"preview": "import React, { createContext, useState } from 'react'\n\nconst AcceptingSharingContext = createContext()\n\nconst Accepting"
},
{
"path": "src/lib/DriveProvider.jsx",
"chars": 2633,
"preview": "import PropTypes from 'prop-types'\nimport React from 'react'\n\nimport { CozyProvider } from 'cozy-client'\nimport { DataPr"
},
{
"path": "src/lib/FabProvider.jsx",
"chars": 363,
"preview": "import React, { createContext, useState } from 'react'\n\nexport const FabContext = createContext()\n\nconst FabProvider = ("
},
{
"path": "src/lib/FuzzyPathSearch.js",
"chars": 5364,
"preview": "import { remove as removeDiacritics } from 'diacritics'\n\n// Search for keywords inside a list of files and folders, whil"
},
{
"path": "src/lib/FuzzyPathSearch.spec.js",
"chars": 6547,
"preview": "import FuzzyPathSearch from './FuzzyPathSearch'\n\ndescribe('simple search', () => {\n const guitars = [\n { name: 'fend"
},
{
"path": "src/lib/ModalContext.tsx",
"chars": 1319,
"preview": "import React, { useState, useCallback, useContext, ReactNode } from 'react'\n\ninterface TModalContext {\n modalStack: JSX"
},
{
"path": "src/lib/ThumbnailSizeContext.tsx",
"chars": 939,
"preview": "import React, { useState, useCallback, useContext, createContext } from 'react'\n\ninterface ThumbnailSizeContextProps {\n "
},
{
"path": "src/lib/ViewSwitcherContext.tsx",
"chars": 2398,
"preview": "import React, { useState, useContext, createContext, useEffect } from 'react'\n\nimport { useClient, Q } from 'cozy-client"
},
{
"path": "src/lib/appMetadata.js",
"chars": 204,
"preview": "import manifest from '../../manifest.webapp'\n\nconst appMetadata = {\n slug: manifest.slug,\n version: manifest.version,\n"
},
{
"path": "src/lib/dacc/dacc-run.js",
"chars": 1893,
"preview": "import endOfMonth from 'date-fns/endOfMonth'\nimport format from 'date-fns/format'\nimport startOfMonth from 'date-fns/sta"
},
{
"path": "src/lib/dacc/dacc-run.spec.js",
"chars": 2735,
"preview": "import endOfMonth from 'date-fns/endOfMonth'\nimport subMonths from 'date-fns/subMonths'\n\nimport CozyClient from 'cozy-cl"
},
{
"path": "src/lib/dacc/dacc.js",
"chars": 3850,
"preview": "// @ts-check\nimport log from 'cozy-logger'\n\nimport { queryAllDocsWithFields } from '@/lib/dacc/query'\n\n/**\n * @typedef {"
},
{
"path": "src/lib/dacc/dacc.spec.js",
"chars": 3453,
"preview": "import { aggregateFilesSize, aggregateNonExcludedSlugs } from '@/lib/dacc/dacc'\nimport { queryAllDocsWithFields } from '"
},
{
"path": "src/lib/dacc/query.js",
"chars": 492,
"preview": "import { DOCTYPE_FILES } from '@/lib/doctypes'\n\n/**\n * Query all files by filtering on required fields\n *\n * @param {obj"
},
{
"path": "src/lib/doctypes.js",
"chars": 1287,
"preview": "import extraDoctypes from '@/lib/extraDoctypes'\nimport { Contact, Group } from '@/models'\n\nexport const DOCTYPE_FILES = "
},
{
"path": "src/lib/entries.js",
"chars": 805,
"preview": "/**\n * Get type from the entries\n * @param {IOCozyFile[]} entries - List of files moved\n * @returns {string} - Type from"
},
{
"path": "src/lib/entries.spec.js",
"chars": 983,
"preview": "import { getEntriesType } from '@/lib/entries'\n\ndescribe('getEntriesType', () => {\n it('should return file for entries "
},
{
"path": "src/lib/extraDoctypes.js",
"chars": 18,
"preview": "export default {}\n"
},
{
"path": "src/lib/flags.js",
"chars": 903,
"preview": "import flag from 'cozy-flags'\n\nexport const initFlags = () => {\n let activateFlags = flag('switcher') === true ? true :"
},
{
"path": "src/lib/getFileMimetype.js",
"chars": 894,
"preview": "import mime from 'mime-types'\n\nconst getMimetypeFromFilename = name => {\n return mime.lookup(name) || 'application/octe"
},
{
"path": "src/lib/getMimeTypeIcon.js",
"chars": 1866,
"preview": "import get from 'lodash/get'\n\nimport IconAudio from 'cozy-ui/transpiled/react/Icons/FileTypeAudio'\nimport IconBin from '"
},
{
"path": "src/lib/konnectors.js",
"chars": 1106,
"preview": "import { getReferencedBy } from 'cozy-client'\n\nimport { DOCTYPE_KONNECTORS } from '@/lib/doctypes'\n\n/**\n * Returns the s"
},
{
"path": "src/lib/logger.js",
"chars": 201,
"preview": "import minilog from 'cozy-minilog'\n\nconst logger = minilog(`cozy-drive`)\nminilog.enable()\n\nminilog.suggest.allow(`cozy-d"
},
{
"path": "src/lib/migration/qualification.js",
"chars": 9251,
"preview": "import { get, has, isEmpty, omit, sortBy } from 'lodash'\n\nimport { models, Q } from 'cozy-client'\nimport log from 'cozy-"
},
{
"path": "src/lib/migration/qualification.spec.js",
"chars": 4310,
"preview": "import log from 'cozy-logger'\n\nimport {\n extractFilesToMigrate,\n getFileRequalification,\n getMostRecentUpdatedDate,\n "
},
{
"path": "src/lib/path.js",
"chars": 642,
"preview": "/**\n * Join two paths together ensuring there is only one slash between them\n * @param {string} start\n * @param {string}"
},
{
"path": "src/lib/path.spec.js",
"chars": 399,
"preview": "import { getParentPath } from './path'\n\nit('getParentPath', () => {\n expect(getParentPath('/')).toBeUndefined()\n expec"
},
{
"path": "src/lib/queries.js",
"chars": 1324,
"preview": "import { hasQueryBeenLoaded } from 'cozy-client'\n\n/**\n * Check if the query has been loaded and if it has data\n *\n * @pa"
},
{
"path": "src/lib/react-cozy-helpers/ModalManager.jsx",
"chars": 849,
"preview": "import React from 'react'\nimport { connect } from 'react-redux'\n\nconst SHOW_MODAL = 'SHOW_MODAL'\nconst HIDE_MODAL = 'HID"
},
{
"path": "src/lib/react-cozy-helpers/QueryParameter.js",
"chars": 294,
"preview": "const arrToObj = (obj = {}, [key, val = true]) => {\n obj[key] = decodeURIComponent(val)\n return obj\n}\n\nconst getQueryP"
},
{
"path": "src/lib/react-cozy-helpers/QueryParameter.spec.js",
"chars": 863,
"preview": "import getQueryParameter from './QueryParameter'\n\ndescribe('getQueryParameter', () => {\n afterEach(() => {\n window.h"
},
{
"path": "src/lib/react-cozy-helpers/index.js",
"chars": 263,
"preview": "import { combineReducers } from 'redux'\n\nimport modalReducer from './ModalManager'\n\nexport default combineReducers({ mod"
},
{
"path": "src/lib/registerClientPlugins.js",
"chars": 237,
"preview": "import flag from 'cozy-flags'\nimport { RealtimePlugin } from 'cozy-realtime'\n\nconst registerClientPlugins = client => {\n"
},
{
"path": "src/lib/sentry.js",
"chars": 1047,
"preview": "import * as Sentry from '@sentry/react'\nimport { useEffect } from 'react'\nimport {\n Routes,\n useLocation,\n useNavigat"
},
{
"path": "src/locales/ar.json",
"chars": 4543,
"preview": "{\n \"Nav\": {\n \"item_drive\": \"القرص\",\n \"item_recent\": \"الحديثة\",\n \"item_activity\": \"النشاط\",\n \"item_settings\""
},
{
"path": "src/locales/de.json",
"chars": 21828,
"preview": "{\n \"Nav\": {\n \"item_drive\": \"Laufwerk\",\n \"item_recent\": \"Zuletzt\",\n \"item_sharings\": \"Freigaben\",\n \"item_sha"
},
{
"path": "src/locales/en.json",
"chars": 30903,
"preview": "{\n \"Nav\": {\n \"item_drive\": \"My Drive\",\n \"item_recent\": \"Recents\",\n \"item_sharings\": \"Sharings\",\n \"item_shar"
},
{
"path": "src/locales/es.json",
"chars": 19995,
"preview": "{\n \"Nav\": {\n \"item_drive\": \"Drive\",\n \"item_recent\": \"Recientes\",\n \"item_sharings\": \"Compartidos\",\n \"item_sh"
},
{
"path": "src/locales/fr.json",
"chars": 33509,
"preview": "{\n \"Nav\": {\n \"item_drive\": \"Mon Drive\",\n \"item_recent\": \"Récents\",\n \"item_sharings\": \"Partages\",\n \"item_sha"
},
{
"path": "src/locales/index.js",
"chars": 631,
"preview": "import { getI18n } from 'twake-i18n'\n\nimport ar from './ar.json'\nimport de from './de.json'\nimport en from './en.json'\ni"
},
{
"path": "src/locales/it.json",
"chars": 10731,
"preview": "{\n \"Nav\": {\n \"item_drive\": \"Drive\",\n \"item_recent\": \"Recenti\",\n \"item_sharings\": \"Condivisioni\",\n \"item_sha"
},
{
"path": "src/locales/ja.json",
"chars": 13306,
"preview": "{\n \"Nav\": {\n \"item_drive\": \"ドライブ\",\n \"item_recent\": \"最近使用したファイル\",\n \"item_sharings\": \"共有\",\n \"item_shared\": \"自"
},
{
"path": "src/locales/ko.json",
"chars": 3028,
"preview": "{\n \"Nav\": {\n \"item_drive\": \"드라이브\",\n \"item_recent\": \"최근\",\n \"item_activity\": \"활동\",\n \"item_settings\": \"설정\",\n "
},
{
"path": "src/locales/nl.json",
"chars": 4819,
"preview": "{\n \"breadcrumb\": {\n \"title_drive\": \"Schijf\",\n \"title_recent\": \"Recent\",\n \"title_shared\": \"Gedeeld door mij\",\n "
},
{
"path": "src/locales/nl_NL.json",
"chars": 21994,
"preview": "{\n \"Nav\": {\n \"item_drive\": \"Schijf\",\n \"item_recent\": \"Recent\",\n \"item_sharings\": \"Gedeelde items\",\n \"item_s"
},
{
"path": "src/locales/pl.json",
"chars": 3875,
"preview": "{\n \"Nav\": {\n \"item_drive\": \"Dysk\",\n \"item_recent\": \"Bieżące\",\n \"item_shared\": \"Udostępnione przeze mnie\",\n "
},
{
"path": "src/locales/ru.json",
"chars": 29861,
"preview": "{\n \"Nav\": {\n \"item_drive\": \"Мой диск\",\n \"item_recent\": \"Недавние\",\n \"item_sharings\": \"Общие\",\n \"item_shared"
},
{
"path": "src/locales/vi.json",
"chars": 29122,
"preview": "{\n \"Nav\": {\n \"item_drive\": \"Ổ đĩa của tôi\",\n \"item_recent\": \"Gần đây\",\n \"item_sharings\": \"Chia sẻ\",\n \"item_"
},
{
"path": "src/locales/zh_CN.json",
"chars": 3001,
"preview": "{\n \"Nav\": {\n \"item_drive\": \"硬盘\",\n \"item_recent\": \"最近更改\",\n \"item_sharings\": \"分享\",\n \"item_shared\": \"由我分享\",\n "
},
{
"path": "src/locales/zh_TW.json",
"chars": 4651,
"preview": "{\n \"Nav\": {\n \"item_drive\": \"硬碟\",\n \"item_recent\": \"最近更改\",\n \"item_sharings\": \"分享\",\n \"item_shared\": \"由我分享\",\n "
},
{
"path": "src/models/Contact.js",
"chars": 815,
"preview": "import { getInitials, getDisplayName } from 'cozy-client/dist/models/contact'\nimport { Contact as DoctypeContact } from "
}
]
// ... and 474 more files (download for full content)
About this extraction
This page contains the full source code of the cozy/cozy-drive GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 674 files (1.8 MB), approximately 501.0k tokens, and a symbol index with 314 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.