diff --git a/src/app/drive/types/index.ts b/src/app/drive/types/index.ts index 3d50fea367..d95f9032b3 100644 --- a/src/app/drive/types/index.ts +++ b/src/app/drive/types/index.ts @@ -1,5 +1,6 @@ import { RenewalPeriod } from '@internxt/sdk/dist/drive/payments/types/types'; import { ShareLink } from '@internxt/sdk/dist/drive/share/types'; +import { FileStatus } from '@internxt/sdk/dist/drive/storage/types'; import { UserResumeData } from '@internxt/sdk/dist/drive/users/types'; import { AppSumoDetails } from '@internxt/sdk/dist/shared/types/appsumo'; import { AdvancedSharedItem } from 'app/share/types'; @@ -91,7 +92,13 @@ export interface DriveFileMetadataPayload { itemName: string; } -export type DriveItemData = DriveFileData & DriveFolderData; +export type DriveItemData = DriveFileData & + DriveFolderData & { + parent?: { + plainName: string; + status: FileStatus; + }; + }; export interface DriveItemPatch { name?: string; @@ -152,6 +159,8 @@ export enum FileViewMode { Grid = 'grid', } +export type SortField = 'type' | 'name' | 'updatedAt' | 'size' | 'expiresAt'; + export enum DownloadFolderMethod { FileSystemAccessAPI = 'file-system-access-api', StreamSaver = 'stream-saver', diff --git a/src/app/i18n/locales/de.json b/src/app/i18n/locales/de.json index 97c2578964..25d3d64608 100644 --- a/src/app/i18n/locales/de.json +++ b/src/app/i18n/locales/de.json @@ -1537,7 +1537,8 @@ "modified": "Modifiziert", "size": "Größe", "actions": "Aktionen", - "autoDelete": "Automatisches Löschen" + "autoDelete": "Automatisches Löschen", + "originalLocation": "Ursprünglicher Speicherort" } }, "viewMode": { diff --git a/src/app/i18n/locales/en.json b/src/app/i18n/locales/en.json index eb41fab548..bf7d01a967 100644 --- a/src/app/i18n/locales/en.json +++ b/src/app/i18n/locales/en.json @@ -1619,7 +1619,8 @@ "modified": "Modified", "size": "Size", "actions": "Actions", - "autoDelete": "Auto-delete" + "autoDelete": "Auto-delete", + "originalLocation": "Original location" } }, "viewMode": { diff --git a/src/app/i18n/locales/es.json b/src/app/i18n/locales/es.json index 2a5ba9fe98..416587f897 100644 --- a/src/app/i18n/locales/es.json +++ b/src/app/i18n/locales/es.json @@ -1597,7 +1597,8 @@ "modified": "Modificado", "size": "Tamaño", "actions": "Acciones", - "autoDelete": "Eliminación automática" + "autoDelete": "Eliminación automática", + "originalLocation": "Ubicación original" } }, "viewMode": { diff --git a/src/app/i18n/locales/fr.json b/src/app/i18n/locales/fr.json index 50a151cbf6..83cb82d56d 100644 --- a/src/app/i18n/locales/fr.json +++ b/src/app/i18n/locales/fr.json @@ -1543,7 +1543,8 @@ "modified": "Modifié", "size": "Taille", "actions": "Actions", - "autoDelete": "Suppression automatique" + "autoDelete": "Suppression automatique", + "originalLocation": "Emplacement d'origine" } }, "viewMode": { diff --git a/src/app/i18n/locales/it.json b/src/app/i18n/locales/it.json index efbbe80091..4309e7787c 100644 --- a/src/app/i18n/locales/it.json +++ b/src/app/i18n/locales/it.json @@ -1650,7 +1650,8 @@ "modified": "Ultima modifica", "size": "Dimensione", "actions": "Azioni", - "autoDelete": "Eliminazione automatica" + "autoDelete": "Eliminazione automatica", + "originalLocation": "Posizione originale" } }, "viewMode": { diff --git a/src/app/i18n/locales/ru.json b/src/app/i18n/locales/ru.json index 290628e21c..b8ab173d0e 100644 --- a/src/app/i18n/locales/ru.json +++ b/src/app/i18n/locales/ru.json @@ -1558,7 +1558,8 @@ "modified": "Изменено", "size": "Размер", "actions": "Действия", - "autoDelete": "Автоматическое удаление" + "autoDelete": "Автоматическое удаление", + "originalLocation": "Исходное расположение" } }, "viewMode": { diff --git a/src/app/i18n/locales/tw.json b/src/app/i18n/locales/tw.json index 30652a9b86..feb7fd34ed 100644 --- a/src/app/i18n/locales/tw.json +++ b/src/app/i18n/locales/tw.json @@ -1549,7 +1549,8 @@ "modified": "修改日期", "size": "大小", "actions": "操作", - "autoDelete": "自動刪除" + "autoDelete": "自動刪除", + "originalLocation": "原始位置" } }, "viewMode": { diff --git a/src/app/i18n/locales/zh.json b/src/app/i18n/locales/zh.json index 0cb77135de..72ee6cb405 100644 --- a/src/app/i18n/locales/zh.json +++ b/src/app/i18n/locales/zh.json @@ -1584,7 +1584,8 @@ "modified": "修改日期", "size": "大小", "actions": "操作", - "autoDelete": "自动删除" + "autoDelete": "自动删除", + "originalLocation": "原始位置" } }, "viewMode": { diff --git a/src/views/Drive/components/DriveExplorer/components/DriveExplorerList/DriveExplorerList.tsx b/src/views/Drive/components/DriveExplorer/components/DriveExplorerList/DriveExplorerList.tsx index 51fa6b6a04..780c3a3767 100644 --- a/src/views/Drive/components/DriveExplorer/components/DriveExplorerList/DriveExplorerList.tsx +++ b/src/views/Drive/components/DriveExplorer/components/DriveExplorerList/DriveExplorerList.tsx @@ -17,7 +17,7 @@ import { sharedThunks } from 'app/store/slices/sharedLinks'; import { storageActions } from 'app/store/slices/storage'; import { uiActions } from 'app/store/slices/ui'; import workspacesSelectors from 'app/store/slices/workspaces/workspaces.selectors'; -import { DriveItemData, DriveItemDetails } from 'app/drive/types'; +import { DriveItemData, DriveItemDetails, SortField } from 'app/drive/types'; import EditItemNameDialog from 'app/drive/components/EditItemNameDialog/EditItemNameDialog'; import ShareWithTeamDialog from 'app/drive/components/ShareWithTeamDialog/ShareWithTeamDialog'; import DriveExplorerListItem from './DriveExplorerListItem'; @@ -59,8 +59,6 @@ interface DriveExplorerListProps { type ObjectWithId = { id: string | number }; -type SortField = 'type' | 'name' | 'updatedAt' | 'size' | 'expiresAt'; - type ContextMenuDriveItem = DriveItemData | Pick | (ListShareLinksItem & { code: string }); function findUniqueItems(array1: T[], array2: T[]): T[] { @@ -476,7 +474,7 @@ const DriveExplorerList: React.FC = memo((props) => { /> )} - + header={getListHeaders(translate, isRecents, isTrash)} checkboxDataCy="driveListHeaderCheckbox" disableKeyboardShortcuts={props.disableKeyboardShortcuts || props.showStopSharingConfirmation} diff --git a/src/views/Drive/components/DriveExplorer/components/DriveExplorerList/DriveExplorerListItem.tsx b/src/views/Drive/components/DriveExplorer/components/DriveExplorerList/DriveExplorerListItem.tsx index dc2edcbe9a..73e646a41a 100644 --- a/src/views/Drive/components/DriveExplorer/components/DriveExplorerList/DriveExplorerListItem.tsx +++ b/src/views/Drive/components/DriveExplorer/components/DriveExplorerList/DriveExplorerListItem.tsx @@ -10,6 +10,7 @@ import { useDriveItemActions, useDriveItemDrag, useDriveItemDrop, useDriveItemSt import './DriveExplorerListItem.scss'; import { useTranslationContext } from 'app/i18n/provider/TranslationProvider'; import { WarningCircle } from '@phosphor-icons/react'; +import { FileStatus } from '@internxt/sdk/dist/drive/storage/types'; const getItemClassNames = (isSelected: boolean, isDraggingOver: boolean, isDragging: boolean): string => { const selectedClass = isSelected ? 'selected' : ''; @@ -86,6 +87,7 @@ const DriveExplorerListItem = ({ item, isTrash }: DriveExplorerItemProps): JSX.E const isItemShared = (item.sharings?.length ?? 0) > 0; const isInteractive = isItemInteractive(item); const itemClassNames = getItemClassNames(isItemSelected(item), isDraggingOverThisItem, isDraggingThisItem); + const parentFolderName = item.parent?.status === FileStatus.EXISTS ? (item.parent?.plainName ?? 'Drive') : '-'; const template = (
)} + {isTrash && ( +
+

{parentFolderName}

+
+ )} + {/* DATE */} -
- {dateService.formatDefaultDate(item.updatedAt, translate)} -
+ {!isTrash && ( +
+ {dateService.formatDefaultDate(item.updatedAt, translate)} +
+ )} {/* SIZE */}
diff --git a/src/views/Drive/components/DriveExplorer/components/DriveExplorerList/getListHeaders.ts b/src/views/Drive/components/DriveExplorer/components/DriveExplorerList/getListHeaders.ts index cbada6c410..f5bb46c812 100644 --- a/src/views/Drive/components/DriveExplorer/components/DriveExplorerList/getListHeaders.ts +++ b/src/views/Drive/components/DriveExplorer/components/DriveExplorerList/getListHeaders.ts @@ -1,19 +1,12 @@ -interface ListHeaderItem { - label: string; - width: string; - name: 'type' | 'name' | 'updatedAt' | 'size' | 'expiresAt'; - orderable: boolean; - defaultDirection: 'ASC' | 'DESC'; - buttonDataCy?: string; - textDataCy?: string; -} +import { DriveItemData, SortField } from 'app/drive/types'; +import { HeaderProps } from '@internxt/ui/dist/components/data-display/list/ListHeader'; export const getListHeaders = ( translate: (key: string) => string, isRecents: boolean, isTrash: boolean, -): ListHeaderItem[] => { - const headers: ListHeaderItem[] = [ +): HeaderProps[] => { + const headers: HeaderProps[] = [ { label: translate('drive.list.columns.name'), width: 'flex grow items-center min-w-driveNameHeader', @@ -26,31 +19,39 @@ export const getListHeaders = ( ]; if (isTrash) { - headers.push({ - label: translate('drive.list.columns.autoDelete'), - width: 'w-date', - name: 'expiresAt', - orderable: true, - defaultDirection: 'ASC', - }); + headers.push( + { + label: translate('drive.list.columns.autoDelete'), + width: 'w-date', + name: 'expiresAt', + orderable: true, + defaultDirection: 'ASC', + }, + { + label: translate('drive.list.columns.originalLocation'), + width: 'w-date', + name: 'parent', + orderable: false, + }, + ); } - headers.push( - { + if (!isTrash) { + headers.push({ label: translate('drive.list.columns.modified'), width: 'w-date', name: 'updatedAt', orderable: !isRecents, defaultDirection: 'ASC', - }, - { - label: translate('drive.list.columns.size'), - orderable: false, - defaultDirection: 'ASC', - width: 'w-size', - name: 'size', - }, - ); + }); + } + + headers.push({ + label: translate('drive.list.columns.size'), + orderable: false, + width: 'w-size', + name: 'size', + }); return headers; };