From 946ef76b7aac41621bb9d885b224f1f126d2f41d Mon Sep 17 00:00:00 2001 From: cballevre Date: Fri, 22 Dec 2023 16:11:00 +0100 Subject: [PATCH] feat(DeleteConfirm): Add filename into title --- src/drive/locales/en.json | 2 +- src/drive/locales/fr.json | 2 +- src/drive/web/modules/drive/DeleteConfirm.jsx | 15 +++++++++++---- .../web/modules/drive/DeleteConfirm.spec.jsx | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/drive/locales/en.json b/src/drive/locales/en.json index d7be437196..671131b23f 100644 --- a/src/drive/locales/en.json +++ b/src/drive/locales/en.json @@ -260,7 +260,7 @@ "more": "More" }, "DeleteConfirm": { - "title": "Delete this element? |||| Delete these elements?", + "title": "Delete %{filename}? |||| Delete %{smart_count} %{type}?", "trash": "It will be moved to the Trash. |||| They will be moved to the Trash.", "restore": "You can still restore it whenever you want. |||| You can still restore them whenever you want.", "share_accepted": "Sharing will be stopped. The following contacts will keep a copy, but your changes will no longer be synchronised:", diff --git a/src/drive/locales/fr.json b/src/drive/locales/fr.json index 6c59a86a82..117fafe6eb 100644 --- a/src/drive/locales/fr.json +++ b/src/drive/locales/fr.json @@ -260,7 +260,7 @@ "more": "Afficher plus d'action" }, "DeleteConfirm": { - "title": "Supprimer cet élément ? |||| Supprimer ces éléments ?", + "title": "Supprimer %{filename} ? |||| Supprimer %{smart_count} %{type} ?", "trash": "Cet élément sera déplacé dans la corbeille. |||| Ces éléments seront déplacés dans la corbeille.", "restore": "Vous pouvez toujours le restaurer quand vous voulez.", "share_accepted": "Le partage sera arrêté. Ainsi, les contacts suivant conserveront une copie mais vos changements ne seront plus synchronisés :", diff --git a/src/drive/web/modules/drive/DeleteConfirm.jsx b/src/drive/web/modules/drive/DeleteConfirm.jsx index 7e3c446f43..04294ea725 100644 --- a/src/drive/web/modules/drive/DeleteConfirm.jsx +++ b/src/drive/web/modules/drive/DeleteConfirm.jsx @@ -1,18 +1,19 @@ import React, { useCallback, useEffect, useState } from 'react' + import { useClient } from 'cozy-client' import { ConfirmDialog } from 'cozy-ui/transpiled/react/CozyDialogs' import Button from 'cozy-ui/transpiled/react/deprecated/Button' -import { buildAlbumByIdQuery } from 'drive/web/modules/queries' import { Media, Img, Bd } from 'cozy-ui/transpiled/react/deprecated/Media' import Icon from 'cozy-ui/transpiled/react/Icon' import Stack from 'cozy-ui/transpiled/react/Stack' - import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n' - import { SharedDocument, SharedRecipientsList } from 'cozy-sharing' +import { splitFilename } from 'cozy-client/dist/models/file' +import { buildAlbumByIdQuery } from 'drive/web/modules/queries' import { trashFiles } from 'drive/web/modules/actions/utils' import { DOCTYPE_ALBUMS } from 'drive/lib/doctypes' +import { getEntriesTypeTranslated } from 'drive/lib/entries' const Message = ({ type, fileCount }) => { const ico = @@ -80,11 +81,17 @@ export const DeleteConfirm = ({ onClose() }, [client, files, afterConfirmation, onClose]) + const entriesType = getEntriesTypeTranslated(t, files) + return ( diff --git a/src/drive/web/modules/drive/DeleteConfirm.spec.jsx b/src/drive/web/modules/drive/DeleteConfirm.spec.jsx index 94ababd44f..ac479d9160 100644 --- a/src/drive/web/modules/drive/DeleteConfirm.spec.jsx +++ b/src/drive/web/modules/drive/DeleteConfirm.spec.jsx @@ -29,7 +29,7 @@ describe('DeleteConfirm', () => { ) - expect(getByText('Delete this element?')).toBeTruthy() + expect(getByText('Delete foobar10?')).toBeTruthy() const confirmButton = getByText('Remove') fireEvent.click(confirmButton)