From c75e5052ad85a51891350dccc7196e28daa46497 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 25 Jan 2023 23:22:29 -0800 Subject: [PATCH 1/3] Save current page to use for translations --- pages/about.tsx | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/pages/about.tsx b/pages/about.tsx index ca7ada8e..179e1d53 100644 --- a/pages/about.tsx +++ b/pages/about.tsx @@ -26,6 +26,7 @@ const AboutRoute: React.FC = (props: Props) => { const { t } = useTranslation('common') const [currentTab, setCurrentTab] = useState(AboutTabs.About) + const [currentPage, setCurrentPage] = useState('') useEffect(() => { const parts = router.asPath.split('/') @@ -34,31 +35,38 @@ const AboutRoute: React.FC = (props: Props) => { switch (tab) { case 'about': setCurrentTab(AboutTabs.About) + setCurrentPage(parts[1]) break case 'updates': setCurrentTab(AboutTabs.Updates) + setCurrentPage(parts[1]) break case 'roadmap': setCurrentTab(AboutTabs.Roadmap) + setCurrentPage(parts[1]) break } }, [router.asPath]) function handleTabClicked(event: React.ChangeEvent) { + const parts = router.asPath.split('/') const path = `/${event.target.value}` switch (event.target.value) { case 'about': router.replace(path) setCurrentTab(AboutTabs.About) + setCurrentPage(parts[1]) break case 'updates': router.replace(path) setCurrentTab(AboutTabs.Updates) + setCurrentPage(parts[1]) break case 'roadmap': router.replace(path) setCurrentTab(AboutTabs.Roadmap) + setCurrentPage(parts[1]) break default: break @@ -80,26 +88,32 @@ const AboutRoute: React.FC = (props: Props) => {
{/* HTML */} - {t('page.titles.about')} - + {t(`page.titles.${currentPage}`)} + {/* OpenGraph */} - + - + {/* Twitter */} - + From 0b59f529c78393da6d499283d2e8bd4feb3c3d3c Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 25 Jan 2023 23:25:30 -0800 Subject: [PATCH 2/3] Fix Layout bug --- components/Layout/index.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/components/Layout/index.tsx b/components/Layout/index.tsx index f37d4dac..3716d012 100644 --- a/components/Layout/index.tsx +++ b/components/Layout/index.tsx @@ -26,11 +26,17 @@ const Layout = ({ children }: PropsWithChildren) => { }, []) function getToastCookie() { - const updatedAt = new Date(appState.version.updated_at) - const cookieValues = getCookie(`update-${format(updatedAt, 'yyyy-MM-dd')}`) - return cookieValues - ? (JSON.parse(cookieValues as string) as { seen: true }) - : { seen: false } + if (appState.version.updated_at !== '') { + const updatedAt = new Date(appState.version.updated_at) + const cookieValues = getCookie( + `update-${format(updatedAt, 'yyyy-MM-dd')}` + ) + return cookieValues + ? (JSON.parse(cookieValues as string) as { seen: true }) + : { seen: false } + } else { + return { seen: false } + } } function handleToastActionClicked() { From 8ae51632f2e684daa55db63da9fc8706c5417f06 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 25 Jan 2023 23:52:32 -0800 Subject: [PATCH 3/3] Add translations --- public/locales/en/common.json | 6 ++++++ public/locales/ja/common.json | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 1e21f979..00b17638 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -345,6 +345,9 @@ }, "page": { "titles": { + "about": "About granblue.team", + "updates": "Updates / granblue.team", + "roadmap": "Roadmap / granblue.team", "discover": "Discover teams / granblue.team", "new": "Create a new team / granblue.team", "profile": "@{{username}}'s Teams / granblue.team", @@ -352,6 +355,9 @@ "saved": "Your saved teams / granblue.team" }, "descriptions": { + "about": "More about granblue.team / Save and discover teams to use in Granblue Fantasy", + "updates": "Latest updates to granblue.team", + "roadmap": "Upcoming planned features for granblue.team", "discover": "Save and discover teams to use in Granblue Fantasy and search by raid, element or recency", "new": "Create and theorycraft teams to use in Granblue Fantasy and share with the community", "profile": "Browse @{{username}}'s Teams and filter by raid, element or recency", diff --git a/public/locales/ja/common.json b/public/locales/ja/common.json index 1e09c368..a0cac04a 100644 --- a/public/locales/ja/common.json +++ b/public/locales/ja/common.json @@ -346,6 +346,9 @@ }, "page": { "titles": { + "about": "granblue.teamについて", + "updates": "変更ログ / granblue.team", + "roadmap": "ロードマップ / granblue.team", "discover": "編成を見出す / granblue.team", "new": "新しい編成 / granblue.team", "profile": "@{{username}}さんの作った編成 / granblue.team", @@ -353,6 +356,9 @@ "saved": "保存した編成" }, "descriptions": { + "about": "granblue.teamについて / グランブルーファンタジーの編成を探したり保存したりできる", + "updates": "granblue.teamの最新変更について", + "roadmap": "granblue.teamの開発予定機能", "discover": "グランブルーファンタジーの編成をマルチ、属性、作った時間などで探したり保存したりできる", "new": "グランブルーファンタジーの編成を作成し、騎空士とシェアできるサイトgranblue.team", "profile": "@{{username}}の編成を調査し、マルチ、属性、または作った時間でフィルターする",