From 3fac77956bd44dac56bedf15447299e283ab18aa Mon Sep 17 00:00:00 2001 From: Paul Sarando Date: Wed, 14 Feb 2024 19:44:47 -0700 Subject: [PATCH] CORE-1967 Update LocalContexts details dialog and icon display Improved the LocalContexts label/notice icon sizing. Added a link to the LocalContextsHub project in the details dialog. --- public/static/locales/en/localcontexts.json | 3 + .../metadata/LocalContextsLabelDisplay.js | 60 ++++++++++++++----- src/pages/data/ds/[...pathItems].js | 1 + 3 files changed, 50 insertions(+), 14 deletions(-) create mode 100644 public/static/locales/en/localcontexts.json diff --git a/public/static/locales/en/localcontexts.json b/public/static/locales/en/localcontexts.json new file mode 100644 index 000000000..bca3b5533 --- /dev/null +++ b/public/static/locales/en/localcontexts.json @@ -0,0 +1,3 @@ +{ + "projectMoreInfoWithLink": "For more information on the Local Contexts project for this data, please visit the project's page: {{projectTitle}}" +} diff --git a/src/components/metadata/LocalContextsLabelDisplay.js b/src/components/metadata/LocalContextsLabelDisplay.js index 4cac48e6c..5976b30c3 100644 --- a/src/components/metadata/LocalContextsLabelDisplay.js +++ b/src/components/metadata/LocalContextsLabelDisplay.js @@ -12,7 +12,10 @@ import { useTheme, } from "@mui/material"; +import { Trans, useTranslation } from "i18n"; + import DEDialog from "components/utils/DEDialog"; +import ExternalLink from "components/utils/ExternalLink"; import { LOCAL_CONTEXTS_QUERY_KEY, @@ -26,7 +29,9 @@ const sizeToSpacing = (size, theme) => ? theme.spacing(3) : theme.spacing(5); -const LocalContextsLabel = ({ baseId, label, size = "medium" }) => { +const LocalContextsLabel = ({ baseId, label, project, size = "medium" }) => { + const { t } = useTranslation("localcontexts"); + const [dialogOpen, setDialogOpen] = React.useState(false); const theme = useTheme(); const labelURI = label.svg_url || label.img_url; @@ -38,7 +43,8 @@ const LocalContextsLabel = ({ baseId, label, size = "medium" }) => { {label.name} @@ -48,19 +54,44 @@ const LocalContextsLabel = ({ baseId, label, size = "medium" }) => { title={label.name} onClose={() => setDialogOpen(false)} > - - + + + + + + {label.label_text || label.default_text} + + + + - - {label.default_text} + + , + ProjectLink: ( + + ), + }} + /> @@ -113,6 +144,7 @@ const LocalContextsLabelDisplay = ({ rightsURI, size = "medium" }) => { baseId={label.unique_id || label.img_url} size={size} label={label} + project={project} /> ))} diff --git a/src/pages/data/ds/[...pathItems].js b/src/pages/data/ds/[...pathItems].js index 3c220d55a..7f02db92a 100644 --- a/src/pages/data/ds/[...pathItems].js +++ b/src/pages/data/ds/[...pathItems].js @@ -205,6 +205,7 @@ export async function getServerSideProps(context) { title, ...(await serverSideTranslations(locale, [ "data", + "localcontexts", "metadata", "upload", "urlImport",