From 2d845ee8e33010cf5b735ef3bc3d36189e5fe8ea Mon Sep 17 00:00:00 2001 From: Patrick Browne Date: Fri, 4 Feb 2022 14:59:51 +0100 Subject: [PATCH 1/3] feat: Add page titles in browsing pages --- .../components/select-dataset-step.tsx | 20 ++++++++++++++++++- app/locales/en/messages.po | 2 +- app/pages/_app.tsx | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/configurator/components/select-dataset-step.tsx b/app/configurator/components/select-dataset-step.tsx index 16696caef..6898b6aa6 100644 --- a/app/configurator/components/select-dataset-step.tsx +++ b/app/configurator/components/select-dataset-step.tsx @@ -1,4 +1,5 @@ -import { Trans } from "@lingui/macro"; +import { t, Trans } from "@lingui/macro"; +import Head from "next/head"; import NextLink from "next/link"; import { Router, useRouter } from "next/router"; import React, { useMemo } from "react"; @@ -171,9 +172,26 @@ export const SelectDatasetStepContent = () => { ); }; +const PageTitle = () => { + const { search, filters } = useBrowseContext(); + return ( + + + {search + ? `"${search}"` + : filters?.length > 0 && filters[0].__typename !== "DataCubeAbout" + ? filters[0].label + : t({ id: "browse.datasets.all-datasets" })}{" "} + - visualize.admin.ch + + + ); +}; + export const SelectDatasetStep = () => { return ( + ); diff --git a/app/locales/en/messages.po b/app/locales/en/messages.po index ba0ee096e..ea56e39c0 100644 --- a/app/locales/en/messages.po +++ b/app/locales/en/messages.po @@ -63,7 +63,7 @@ msgstr "Create visualization" #: app/configurator/components/select-dataset-step.tsx:133 msgid "browse.datasets.all-datasets" -msgstr "All Datasets" +msgstr "All datasets" #: app/configurator/components/select-dataset-step.tsx:145 msgid "browse.datasets.description" diff --git a/app/pages/_app.tsx b/app/pages/_app.tsx index 22c9c3176..cb119bb2d 100644 --- a/app/pages/_app.tsx +++ b/app/pages/_app.tsx @@ -77,7 +77,7 @@ export default function App({ Component, pageProps }: AppProps) { return ( <> - visualize.admin.ch + visualize.admin.ch From 6b0f04ccb1bd17e1177746bedecb64e037c8c3dc Mon Sep 17 00:00:00 2001 From: Patrick Browne Date: Fri, 4 Feb 2022 15:00:10 +0100 Subject: [PATCH 2/3] feat: Add browsing title in dataset preview page --- app/configurator/components/dataset-preview.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/configurator/components/dataset-preview.tsx b/app/configurator/components/dataset-preview.tsx index afa22cd85..5dc6fbffa 100644 --- a/app/configurator/components/dataset-preview.tsx +++ b/app/configurator/components/dataset-preview.tsx @@ -8,6 +8,7 @@ import { useLocale } from "../../locales/use-locale"; import { DataCubePublicationStatus } from "../../graphql/resolver-types"; import DebugPanel from "../../components/debug-panel"; import LinkButton from "./link-button"; +import Head from "next/head"; export interface Preview { iri: string; @@ -44,6 +45,11 @@ export const DataSetPreview = ({ dataSetIri }: { dataSetIri: string }) => { + + + {dataCubeByIri.title} - visualize.admin.ch + + {dataCubeByIri.title} From 700f9529407f5d76ccfd2fbf94e238c98e172ec1 Mon Sep 17 00:00:00 2001 From: Patrick Browne Date: Fri, 4 Feb 2022 15:00:21 +0100 Subject: [PATCH 3/3] feat: Add page title when creating chart --- app/components/chart-preview.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/components/chart-preview.tsx b/app/components/chart-preview.tsx index 01d31e6fe..3b9cb96db 100644 --- a/app/components/chart-preview.tsx +++ b/app/components/chart-preview.tsx @@ -1,4 +1,5 @@ import { Trans } from "@lingui/macro"; +import Head from "next/head"; import * as React from "react"; import { Box, Flex, Text } from "theme-ui"; import { ChartDataFilters } from "../charts/shared/chart-data-filters"; @@ -65,6 +66,14 @@ export const ChartPreview = ({ dataSetIri }: { dataSetIri: string }) => { state.meta.title[locale] )} + + + {state.meta.title[locale] === "" + ? metaData?.dataCubeByIri?.title + : state.meta.title[locale]}{" "} + - visualize.admin.ch + +