Skip to content

Commit

Permalink
Merge pull request #1026 from visualize-admin/feat/update-minimal-emb…
Browse files Browse the repository at this point in the history
…ed-mode-footnotes

feat: Update minimal embed mode chart footnotes
  • Loading branch information
bprusinowski authored May 8, 2023
2 parents e804d90 + 55e3b20 commit 12366c9
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 27 deletions.
46 changes: 28 additions & 18 deletions app/components/chart-footnotes.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Trans } from "@lingui/macro";
import { Box, Button, Link, Theme, Typography } from "@mui/material";
import { makeStyles } from "@mui/styles";
import { useEffect, useMemo, useState } from "react";
import { PropsWithChildren, useEffect, useMemo, useState } from "react";

import { useChartTablePreview } from "@/components/chart-table-preview";
import { DataDownloadMenu, RunSparqlQuery } from "@/components/data-download";
Expand Down Expand Up @@ -174,6 +174,12 @@ export const ChartFootnotes = ({
dangerouslySetInnerHTML={{ __html: dataCubeByIri.publisher }}
></Box>
)}
{configKey && shareUrl && visualizeLinkText && (
<>
{" "}
/ <LinkButton href={shareUrl}> {visualizeLinkText}</LinkButton>
</>
)}
</Typography>
) : null}

Expand Down Expand Up @@ -238,23 +244,12 @@ export const ChartFootnotes = ({
{sparqlEditorUrl && showSparqlQuery !== false && (
<RunSparqlQuery url={sparqlEditorUrl as string} />
)}
{configKey && shareUrl && (
<Button
component="a"
variant="text"
color="primary"
size="small"
sx={{ p: 0, typography: "caption" }}
href={shareUrl}
target="_blank"
rel="noopener noreferrer"
>
{visualizeLinkText ?? (
<Trans id="metadata.link.created.with.visualize">
Created with visualize.admin.ch
</Trans>
)}
</Button>
{configKey && shareUrl && !visualizeLinkText && (
<LinkButton href={shareUrl}>
<Trans id="metadata.link.created.with.visualize">
Created with visualize.admin.ch
</Trans>
</LinkButton>
)}
</Box>
</Box>
Expand All @@ -263,3 +258,18 @@ export const ChartFootnotes = ({
return null;
}
};

const LinkButton = (props: PropsWithChildren<{ href: string }>) => {
return (
<Button
component="a"
variant="text"
color="primary"
size="small"
sx={{ p: 0, typography: "caption", verticalAlign: "unset" }}
target="_blank"
rel="noopener noreferrer"
{...props}
/>
);
};
2 changes: 1 addition & 1 deletion app/components/chart-published.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export const ChartPublishedInner = ({
visualizeLinkText={
showDownload === false ? (
<Trans id="metadata.link.created.with.visualize.alternate">
More information
visualize.admin.ch
</Trans>
) : undefined
}
Expand Down
6 changes: 4 additions & 2 deletions app/locales/de/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ msgstr "Kategorien"
msgid "columnStyle.heatmap"
msgstr "Heatmap"

#: app/configurator/table/table-chart-options.tsx
#: app/configurator/table/table-chart-options.tsx
#: app/configurator/table/table-chart-options.tsx
msgid "columnStyle.text"
Expand Down Expand Up @@ -874,6 +875,8 @@ msgstr "Koordinaten-Ladefehler"
msgid "hint.create.your.own.chart"
msgstr "Kopieren Sie diese Visualisierung oder erstellen Sie eine neue Visualisierung mit Swiss Open Government Data."

#: app/components/data-download.tsx
#: app/components/data-download.tsx
#: app/components/hint.tsx
msgid "hint.dataloadingerror.message"
msgstr "Die Daten konnten nicht geladen werden."
Expand All @@ -892,7 +895,6 @@ msgstr "Sie können diese Visualisierung teilen oder sie einbetten. Zudem könne

#: app/components/form.tsx
#: app/components/hint.tsx
#: app/components/hint.tsx
msgid "hint.loading.data"
msgstr "Lade Daten …"

Expand Down Expand Up @@ -943,7 +945,7 @@ msgstr "Erstellt mit visualize.admin.ch"

#: app/components/chart-published.tsx
msgid "metadata.link.created.with.visualize.alternate"
msgstr "Mehr Informationen"
msgstr "visualize.admin.ch"

#: app/components/chart-footnotes.tsx
msgid "metadata.source"
Expand Down
6 changes: 4 additions & 2 deletions app/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ msgstr "Categories"
msgid "columnStyle.heatmap"
msgstr "Heat Map"

#: app/configurator/table/table-chart-options.tsx
#: app/configurator/table/table-chart-options.tsx
#: app/configurator/table/table-chart-options.tsx
msgid "columnStyle.text"
Expand Down Expand Up @@ -874,6 +875,8 @@ msgstr "Coordinates loading error"
msgid "hint.create.your.own.chart"
msgstr "Copy this visualization or make a new visualization using Swiss Open Government Data."

#: app/components/data-download.tsx
#: app/components/data-download.tsx
#: app/components/hint.tsx
msgid "hint.dataloadingerror.message"
msgstr "The data could not be loaded."
Expand All @@ -892,7 +895,6 @@ msgstr "You can share this visualization by copying the URL or by embedding it o

#: app/components/form.tsx
#: app/components/hint.tsx
#: app/components/hint.tsx
msgid "hint.loading.data"
msgstr "Loading data..."

Expand Down Expand Up @@ -943,7 +945,7 @@ msgstr "Created with visualize.admin.ch"

#: app/components/chart-published.tsx
msgid "metadata.link.created.with.visualize.alternate"
msgstr "More information"
msgstr "visualize.admin.ch"

#: app/components/chart-footnotes.tsx
msgid "metadata.source"
Expand Down
6 changes: 4 additions & 2 deletions app/locales/fr/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ msgstr "Catégories"
msgid "columnStyle.heatmap"
msgstr "Heatmap"

#: app/configurator/table/table-chart-options.tsx
#: app/configurator/table/table-chart-options.tsx
#: app/configurator/table/table-chart-options.tsx
msgid "columnStyle.text"
Expand Down Expand Up @@ -874,6 +875,8 @@ msgstr "Erreur de chargement des coordonnées"
msgid "hint.create.your.own.chart"
msgstr "Copiez cette visualisation ou créez une nouvelle visualisation à partir des données ouvertes de l’administration publique suisse."

#: app/components/data-download.tsx
#: app/components/data-download.tsx
#: app/components/hint.tsx
msgid "hint.dataloadingerror.message"
msgstr "Les données n'ont pas pu être téléchargées."
Expand All @@ -892,7 +895,6 @@ msgstr "Vous pouvez partager cette visualisation en copiant l'URL ou en l'intég

#: app/components/form.tsx
#: app/components/hint.tsx
#: app/components/hint.tsx
msgid "hint.loading.data"
msgstr "Chargement des données..."

Expand Down Expand Up @@ -943,7 +945,7 @@ msgstr "Créé avec visualize.admin.ch"

#: app/components/chart-published.tsx
msgid "metadata.link.created.with.visualize.alternate"
msgstr "Plus d'informations"
msgstr "visualize.admin.ch"

#: app/components/chart-footnotes.tsx
msgid "metadata.source"
Expand Down
6 changes: 4 additions & 2 deletions app/locales/it/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ msgstr "Categorie"
msgid "columnStyle.heatmap"
msgstr "Mappa di calore"

#: app/configurator/table/table-chart-options.tsx
#: app/configurator/table/table-chart-options.tsx
#: app/configurator/table/table-chart-options.tsx
msgid "columnStyle.text"
Expand Down Expand Up @@ -874,6 +875,8 @@ msgstr "Errore di caricamento delle coordinate"
msgid "hint.create.your.own.chart"
msgstr "Copia questa visualizzazione o crea una nuova visualizzazione usando «dati aperti» dell’amministrazione pubblica svizzera"

#: app/components/data-download.tsx
#: app/components/data-download.tsx
#: app/components/hint.tsx
msgid "hint.dataloadingerror.message"
msgstr "I dati non possono essere caricati."
Expand All @@ -892,7 +895,6 @@ msgstr "È possibile condividere questa visualizzazione copiando l'URL o incorpo

#: app/components/form.tsx
#: app/components/hint.tsx
#: app/components/hint.tsx
msgid "hint.loading.data"
msgstr "Caricamento dei dati..."

Expand Down Expand Up @@ -943,7 +945,7 @@ msgstr "Creato con visualize.admin.ch"

#: app/components/chart-published.tsx
msgid "metadata.link.created.with.visualize.alternate"
msgstr "Più informazioni"
msgstr "visualize.admin.ch"

#: app/components/chart-footnotes.tsx
msgid "metadata.source"
Expand Down

1 comment on commit 12366c9

@vercel
Copy link

@vercel vercel bot commented on 12366c9 May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visualization-tool – ./

visualization-tool-alpha.vercel.app
visualization-tool-git-main-ixt1.vercel.app
visualization-tool-ixt1.vercel.app

Please sign in to comment.