Skip to content

Commit

Permalink
Merge pull request #552 from psarando/CORE-1968-page-titles
Browse files Browse the repository at this point in the history
CORE-1968 Add page titles in each DE page
  • Loading branch information
psarando authored Oct 27, 2023
2 parents c52d672 + 9b70981 commit ceda13e
Show file tree
Hide file tree
Showing 44 changed files with 203 additions and 42 deletions.
1 change: 1 addition & 0 deletions public/static/locales/en/apps.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"appListingError": "Unable to get Apps. Please try again.",
"appPubRequestsFetchError": "Unable to fetch publication requests. Please try again.",
"appPublicationError": "Unable to publish {{appName}}. Please check the details.",
"appsAdmin": "Apps Admin",
"appType": "Type",
"appVersion": "Version",
"apps_under_development": "Apps Under Development",
Expand Down
1 change: 1 addition & 0 deletions public/static/locales/en/collections.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"noCollections": "No $t(featureName_plural)",
"noExternalApps": "Adding Agave/HPC apps is not currently supported",
"noExternalAppsNote": "NOTE: $t(noExternalApps).",
"pageTitle": "Collection - {{name}}",
"remove": "Remove",
"retagApps": "Re-tag Apps",
"retagAppsMessage": "{{name}} currently has apps associated with it. Renaming the $t(featureName) will cause all the currently tagged apps to be re-tagged with the new $t(featureName) name. Do you wish to continue?",
Expand Down
1 change: 1 addition & 0 deletions public/static/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"dataNavUsageTitle": "{{percentage}}% usage",
"description": "Description",
"deTitle": "Discovery Environment",
"dePageTitle": "{{title}} - Discovery Environment",
"delete": "Delete",
"disable": "Disable",
"discard": "Discard",
Expand Down
1 change: 1 addition & 0 deletions public/static/locales/en/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"noContent": "No content to display.",
"ok": "OK",
"own": "Own",
"pageTitle": "Data - {{path}}",
"path": "Path",
"pathCopied": "Path copied.",
"pathCopyError": "Unable to copy path.",
Expand Down
1 change: 1 addition & 0 deletions public/static/locales/en/referenceGenomes.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"createdOn": "Created On",
"lastModifiedBy": "Last Modified By",
"lastModifiedOn": "Last Modified On",
"referenceGenomes": "Reference Genomes",
"search": "Search",
"updateSuccess": "Reference Genome updated successfully.",
"updateFailed": "Unable to update the Reference Genome"
Expand Down
1 change: 1 addition & 0 deletions public/static/locales/en/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"noResults": "No results to display.",
"own": "Own",
"owner": "Owner",
"pageTitle": "Search - {{searchTerm}}",
"path": "Path",
"pathPlaceholder": "/iplant/home/me",
"permissions": "Permissions",
Expand Down
1 change: 1 addition & 0 deletions public/static/locales/en/subscriptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"noSubscriptions": "No subscriptions",
"noUsages": "No usages",
"paid": "Paid",
"pageTitle": "Subscriptions - {{searchTerm}}",
"planName": "Plan Name",
"quota": "Quota",
"quotas": "Quotas",
Expand Down
2 changes: 2 additions & 0 deletions public/static/locales/en/teams.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"admin": "Admin",
"allTeams": "All Teams",
"ariaTeamFilter": "Team Filter",
"createTeam": "Create Team",
"createTeamFail": "Failed to create team name or description. Please try again.",
"creator": "Creator Name",
"deleteTeamFail": "Failed to delete team. Please try again.",
Expand All @@ -26,6 +27,7 @@
"myTeams": "My Teams",
"name": "Name",
"noTeams": "No teams",
"pageTitle": "Team - {{name}}",
"privilege": "Privilege",
"publicTeam": "Public Team",
"publicTeamHelp": "Making your team public allows your team to be discoverable to other CyVerse users who are not members of your team. Allowing users to discover your team will enable them to view the team and request to join. A team can be updated from public to private and vice versa any time.",
Expand Down
1 change: 1 addition & 0 deletions public/static/locales/en/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
"toolRequests": "Tool Requests",
"toolRequestSuccess": "Request submitted successfully. You will receive notifications about the progress.",
"tools": "Tools",
"toolsAdmin": "Tools Admin",
"toolSrcLinkLabel": "Provide a link for your tool's source (GitHub, BitBucket, DockerHub etc...)",
"toolsUsed": "Tools used by {{appName}}",
"toolTestDataLabel": "Provide a link for your tool's test data",
Expand Down
3 changes: 2 additions & 1 deletion public/static/locales/en/vice-admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,6 @@
"userIDColumn": "User ID",
"username": "Username",
"usernameColumn": "Username",
"value": "Value"
"value": "Value",
"viceAdmin": "VICE Admin"
}
10 changes: 9 additions & 1 deletion src/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ function MyApp({ Component, pageProps }) {
})
);

const { title } = pageProps;

useEffect(() => {
const analytics_id = publicRuntimeConfig.ANALYTICS_ID;
const handleRouteChange = (url) => {
Expand Down Expand Up @@ -271,7 +273,13 @@ function MyApp({ Component, pageProps }) {
clientConfig={config}
>
<Head>
<title>{t("deTitle")}</title>
<title>
{title
? t("dePageTitle", {
title,
})
: t("deTitle")}
</title>
</Head>
<ReactQueryDevtools
initialIsOpen={false}
Expand Down
5 changes: 4 additions & 1 deletion src/pages/admin/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React, { useCallback } from "react";
import { useRouter } from "next/router";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";

import { RequiredNamespaces, useTranslation } from "i18n";
import { i18n, RequiredNamespaces, useTranslation } from "i18n";

import { getLocalStorage } from "components/utils/localStorage";

Expand Down Expand Up @@ -145,8 +145,11 @@ export default function Apps() {
}

export async function getServerSideProps({ locale }) {
const title = i18n.t("apps:appsAdmin");

return {
props: {
title,
...(await serverSideTranslations(locale, [
"collections",
"tools",
Expand Down
5 changes: 4 additions & 1 deletion src/pages/admin/doi.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import React, { useCallback } from "react";
import { useRouter } from "next/router";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { RequiredNamespaces } from "i18n";
import { i18n, RequiredNamespaces } from "i18n";
import Listing from "components/doi/Listing";
import NotAuthorized from "components/error/NotAuthorized";
import { useUserProfile } from "contexts/userProfile";
Expand Down Expand Up @@ -73,8 +73,11 @@ export default function Doi() {
}

export async function getServerSideProps({ locale }) {
const title = i18n.t("doiRequests");

return {
props: {
title,
...(await serverSideTranslations(locale, [
"doi",
"data",
Expand Down
5 changes: 4 additions & 1 deletion src/pages/admin/refgenomes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";

import { serverSideTranslations } from "next-i18next/serverSideTranslations";

import { RequiredNamespaces } from "i18n";
import { i18n, RequiredNamespaces } from "i18n";
import ReferenceGenomes from "../../components/apps/admin/referenceGenomes/ReferenceGenomes";
import { useUserProfile } from "contexts/userProfile";
import NotAuthorized from "components/error/NotAuthorized";
Expand All @@ -17,8 +17,11 @@ export default function RefGenome() {
}

export async function getServerSideProps({ locale }) {
const title = i18n.t("referenceGenomes:referenceGenomes");

return {
props: {
title,
...(await serverSideTranslations(locale, [
"referenceGenomes",
...RequiredNamespaces,
Expand Down
15 changes: 13 additions & 2 deletions src/pages/admin/subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useQuery, useQueryClient } from "react-query";
import { useRouter } from "next/router";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";

import { RequiredNamespaces, useTranslation } from "i18n";
import { i18n, RequiredNamespaces, useTranslation } from "i18n";

import Listing from "components/subscriptions/listing/Listing";
import AddOnsListing from "components/subscriptions/addons/listing/Listing";
Expand Down Expand Up @@ -157,9 +157,20 @@ export default function Subscriptions() {
}
}

export async function getServerSideProps({ locale }) {
export async function getServerSideProps(context) {
const {
locale,
query: { searchTerm },
} = context;

let title = i18n.t("subscriptions");
if (searchTerm) {
title = i18n.t("subscriptions:pageTitle", { searchTerm });
}

return {
props: {
title,
...(await serverSideTranslations(locale, [
"subscriptions",
...RequiredNamespaces,
Expand Down
5 changes: 4 additions & 1 deletion src/pages/admin/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React, { useCallback } from "react";
import { useRouter } from "next/router";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";

import { RequiredNamespaces, useTranslation } from "i18n";
import { i18n, RequiredNamespaces, useTranslation } from "i18n";

import constants from "../../constants";
import { getLocalStorage } from "components/utils/localStorage";
Expand Down Expand Up @@ -139,8 +139,11 @@ export default function Tools() {
}

export async function getServerSideProps({ locale }) {
const title = i18n.t("tools:toolsAdmin");

return {
props: {
title,
...(await serverSideTranslations(locale, [
"tools",
...RequiredNamespaces,
Expand Down
5 changes: 4 additions & 1 deletion src/pages/admin/vice.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useState } from "react";
import { useUserProfile } from "contexts/userProfile";
import NotAuthorized from "components/error/NotAuthorized";

import { RequiredNamespaces, useTranslation } from "i18n";
import { i18n, RequiredNamespaces, useTranslation } from "i18n";

import { serverSideTranslations } from "next-i18next/serverSideTranslations";

Expand Down Expand Up @@ -221,8 +221,11 @@ export default function VICEAdminPage() {
}

export async function getServerSideProps({ locale }) {
const title = i18n.t("vice-admin:viceAdmin");

return {
props: {
title,
...(await serverSideTranslations(locale, [
"vice-admin",
...RequiredNamespaces,
Expand Down
5 changes: 4 additions & 1 deletion src/pages/analyses.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React, { useCallback } from "react";
import { useRouter } from "next/router";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";

import { RequiredNamespaces, useTranslation } from "i18n";
import { i18n, RequiredNamespaces, useTranslation } from "i18n";

import constants from "../constants";

Expand Down Expand Up @@ -86,8 +86,11 @@ export default function Analyses() {
}

export async function getServerSideProps({ locale }) {
const title = i18n.t("analyses");

return {
props: {
title,
...(await serverSideTranslations(locale, [
"data",
// "analyses" already included by RequiredNamespaces
Expand Down
5 changes: 4 additions & 1 deletion src/pages/analyses/[analysisId]/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React from "react";
import { useRouter } from "next/router";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";

import { RequiredNamespaces } from "i18n";
import { i18n, RequiredNamespaces } from "i18n";
import AnalysisSubmissionLanding from "components/analyses/landing/AnalysisSubmissionLanding";

/**
Expand All @@ -32,8 +32,11 @@ export default function Analysis() {
}

export async function getServerSideProps({ locale }) {
const title = i18n.t("analyses:analysis");

return {
props: {
title,
...(await serverSideTranslations(locale, [
// "analyses" already included by RequiredNamespaces
"dashboard",
Expand Down
7 changes: 5 additions & 2 deletions src/pages/analyses/[analysisId]/relaunch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useRouter } from "next/router";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { useQuery } from "react-query";

import { RequiredNamespaces, useTranslation } from "i18n";
import { i18n, RequiredNamespaces, useTranslation } from "i18n";

import constants from "../../../constants";
import {
Expand Down Expand Up @@ -122,14 +122,17 @@ const Relaunch = ({ showErrorAnnouncer }) => {
};

export async function getServerSideProps({ locale }) {
const title = i18n.t("analyses:relaunch");

return {
props: {
title,
...(await serverSideTranslations(locale, [
"data",
"launch",
"upload",
"urlImport",
// "apps" already included by RequiredNamespaces
// "apps" and "analyses" already included by RequiredNamespaces
...RequiredNamespaces,
])),
},
Expand Down
13 changes: 11 additions & 2 deletions src/pages/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React, { useCallback } from "react";
import { useRouter } from "next/router";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";

import { RequiredNamespaces, useTranslation } from "i18n";
import { i18n, RequiredNamespaces, useTranslation } from "i18n";

import { getLocalStorage } from "components/utils/localStorage";

Expand Down Expand Up @@ -79,9 +79,18 @@ export default function Apps() {
}

export async function getServerSideProps(context) {
const { locale } = context;
const { locale, query } = context;

let selectedCategory;
if (query.selectedCategory) {
selectedCategory = JSON.parse(query.selectedCategory).name;
}

const title = selectedCategory || i18n.t("apps");

return {
props: {
title,
...(await serverSideTranslations(locale, [
"collections",
// "apps" already included by RequiredNamespaces
Expand Down
5 changes: 4 additions & 1 deletion src/pages/apps/[systemId]/[appId]/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, { useCallback } from "react";
import { useRouter } from "next/router";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";

import { RequiredNamespaces, useTranslation } from "i18n";
import { i18n, RequiredNamespaces, useTranslation } from "i18n";

import { getLocalStorage } from "components/utils/localStorage";

Expand Down Expand Up @@ -76,8 +76,11 @@ export default function App() {
}

export async function getServerSideProps({ locale }) {
const title = i18n.t("apps");

return {
props: {
title,
...(await serverSideTranslations(locale, [
"collections",
// "apps" already included by RequiredNamespaces
Expand Down
5 changes: 4 additions & 1 deletion src/pages/apps/[systemId]/[appId]/launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useRouter } from "next/router";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { useQuery } from "react-query";

import { RequiredNamespaces, useTranslation } from "i18n";
import { i18n, RequiredNamespaces, useTranslation } from "i18n";

import {
getAppDescription,
Expand Down Expand Up @@ -120,8 +120,11 @@ function Launch({ showErrorAnnouncer }) {
}

export async function getServerSideProps({ locale }) {
const title = i18n.t("launch:launchAnalysis");

return {
props: {
title,
...(await serverSideTranslations(locale, [
"data",
"upload",
Expand Down
Loading

0 comments on commit ceda13e

Please sign in to comment.