diff --git a/src/locales/en.json b/src/locales/en.json index 8a885108b2..f4782f9f9d 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -781,6 +781,7 @@ "error": "An error occurred, please try again." }, "actions": { + "infos": "Details and qualification", "duplicateTo": { "label": "Duplicate to…" } diff --git a/src/locales/fr.json b/src/locales/fr.json index 0a24c789f7..80efbac8d9 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -782,6 +782,7 @@ "error": "Une erreur est survenue, merci de réessayer." }, "actions": { + "infos": "Détails et qualification", "duplicateTo": { "label": "Dupliquer vers…" } diff --git a/src/modules/actions/index.js b/src/modules/actions/index.js index 22cbc050a4..88acab403b 100644 --- a/src/modules/actions/index.js +++ b/src/modules/actions/index.js @@ -7,4 +7,5 @@ export { qualify } from './qualify' export { versions } from './versions' export { restore } from './restore' export { select } from './select' +export { infos } from './infos' export { addItems } from './addItems' diff --git a/src/modules/actions/infos.jsx b/src/modules/actions/infos.jsx new file mode 100644 index 0000000000..3ba4993091 --- /dev/null +++ b/src/modules/actions/infos.jsx @@ -0,0 +1,41 @@ +import React, { forwardRef } from 'react' + +import { isFile } from 'cozy-client/dist/models/file' +import ActionsMenuItem from 'cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem' +import Icon from 'cozy-ui/transpiled/react/Icon' +import InfoIcon from 'cozy-ui/transpiled/react/Icons/Info' +import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon' +import ListItemText from 'cozy-ui/transpiled/react/ListItemText' + +const makeComponent = (label, icon) => { + const Component = forwardRef((props, ref) => { + return ( + + + + + + + ) + }) + + Component.displayName = 'infos' + + return Component +} + +export const infos = ({ t, navigate }) => { + const icon = InfoIcon + const label = t('actions.infos') + + return { + name: 'infos', + icon, + label, + displayCondition: docs => isFile(docs[0]), + Component: makeComponent(label, icon), + action: docs => { + navigate(`file/${docs[0]._id}`) + } + } +} diff --git a/src/modules/views/Drive/DriveFolderView.jsx b/src/modules/views/Drive/DriveFolderView.jsx index df67d40ad3..c275c351ab 100644 --- a/src/modules/views/Drive/DriveFolderView.jsx +++ b/src/modules/views/Drive/DriveFolderView.jsx @@ -22,7 +22,7 @@ import { download, trash, rename, - qualify, + infos, versions, hr } from 'modules/actions' @@ -166,12 +166,12 @@ const DriveFolderView = () => { share, download, hr, - qualify, rename, moveTo, duplicateTo, addToFavorites, removeFromFavorites, + infos, hr, versions, hr, diff --git a/src/modules/views/Favorites/FavoritesView.tsx b/src/modules/views/Favorites/FavoritesView.tsx index e49b936682..35045334e8 100644 --- a/src/modules/views/Favorites/FavoritesView.tsx +++ b/src/modules/views/Favorites/FavoritesView.tsx @@ -14,7 +14,7 @@ import { useModalContext } from 'lib/ModalContext' import { download, rename, - qualify, + infos, versions, share, hr, @@ -99,15 +99,16 @@ const FavoritesView: FC = () => { } const actions = makeActions( + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument [ share, download, hr, - qualify, rename, moveTo, addToFavorites, removeFromFavorites, + infos, hr, versions, hr, diff --git a/src/modules/views/Recent/index.jsx b/src/modules/views/Recent/index.jsx index ef1a7eab39..389fdf90b3 100644 --- a/src/modules/views/Recent/index.jsx +++ b/src/modules/views/Recent/index.jsx @@ -18,7 +18,7 @@ import { download, trash, rename, - qualify, + infos, versions, hr, share @@ -89,11 +89,11 @@ export const RecentView = () => { share, download, hr, - qualify, rename, moveTo, addToFavorites, removeFromFavorites, + infos, hr, versions, hr, diff --git a/src/modules/views/Sharings/index.jsx b/src/modules/views/Sharings/index.jsx index 70fb4ee316..deb4d5f9a3 100644 --- a/src/modules/views/Sharings/index.jsx +++ b/src/modules/views/Sharings/index.jsx @@ -15,7 +15,7 @@ import FolderViewBody from '../Folder/FolderViewBody' import FolderViewHeader from '../Folder/FolderViewHeader' import useHead from 'components/useHead' import { useModalContext } from 'lib/ModalContext' -import { download, rename, qualify, versions, share, hr } from 'modules/actions' +import { download, rename, infos, versions, share, hr } from 'modules/actions' import { addToFavorites } from 'modules/actions/components/addToFavorites' import { moveTo } from 'modules/actions/components/moveTo' import { removeFromFavorites } from 'modules/actions/components/removeFromFavorites' @@ -85,11 +85,11 @@ export const SharingsView = ({ sharedDocumentIds = [] }) => { share, download, hr, - qualify, rename, moveTo, addToFavorites, removeFromFavorites, + infos, hr, versions ],