Merge pull request #169 from jedmund/fix-static-pages

Final fixes for static pages
This commit is contained in:
Justin Edmund 2023-01-25 23:53:02 -08:00 committed by GitHub
commit 46b050224b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 11 deletions

View file

@ -26,11 +26,17 @@ const Layout = ({ children }: PropsWithChildren<Props>) => {
}, []) }, [])
function getToastCookie() { function getToastCookie() {
const updatedAt = new Date(appState.version.updated_at) if (appState.version.updated_at !== '') {
const cookieValues = getCookie(`update-${format(updatedAt, 'yyyy-MM-dd')}`) const updatedAt = new Date(appState.version.updated_at)
return cookieValues const cookieValues = getCookie(
? (JSON.parse(cookieValues as string) as { seen: true }) `update-${format(updatedAt, 'yyyy-MM-dd')}`
: { seen: false } )
return cookieValues
? (JSON.parse(cookieValues as string) as { seen: true })
: { seen: false }
} else {
return { seen: false }
}
} }
function handleToastActionClicked() { function handleToastActionClicked() {

View file

@ -26,6 +26,7 @@ const AboutRoute: React.FC<Props> = (props: Props) => {
const { t } = useTranslation('common') const { t } = useTranslation('common')
const [currentTab, setCurrentTab] = useState<AboutTabs>(AboutTabs.About) const [currentTab, setCurrentTab] = useState<AboutTabs>(AboutTabs.About)
const [currentPage, setCurrentPage] = useState('')
useEffect(() => { useEffect(() => {
const parts = router.asPath.split('/') const parts = router.asPath.split('/')
@ -34,31 +35,38 @@ const AboutRoute: React.FC<Props> = (props: Props) => {
switch (tab) { switch (tab) {
case 'about': case 'about':
setCurrentTab(AboutTabs.About) setCurrentTab(AboutTabs.About)
setCurrentPage(parts[1])
break break
case 'updates': case 'updates':
setCurrentTab(AboutTabs.Updates) setCurrentTab(AboutTabs.Updates)
setCurrentPage(parts[1])
break break
case 'roadmap': case 'roadmap':
setCurrentTab(AboutTabs.Roadmap) setCurrentTab(AboutTabs.Roadmap)
setCurrentPage(parts[1])
break break
} }
}, [router.asPath]) }, [router.asPath])
function handleTabClicked(event: React.ChangeEvent<HTMLInputElement>) { function handleTabClicked(event: React.ChangeEvent<HTMLInputElement>) {
const parts = router.asPath.split('/')
const path = `/${event.target.value}` const path = `/${event.target.value}`
switch (event.target.value) { switch (event.target.value) {
case 'about': case 'about':
router.replace(path) router.replace(path)
setCurrentTab(AboutTabs.About) setCurrentTab(AboutTabs.About)
setCurrentPage(parts[1])
break break
case 'updates': case 'updates':
router.replace(path) router.replace(path)
setCurrentTab(AboutTabs.Updates) setCurrentTab(AboutTabs.Updates)
setCurrentPage(parts[1])
break break
case 'roadmap': case 'roadmap':
router.replace(path) router.replace(path)
setCurrentTab(AboutTabs.Roadmap) setCurrentTab(AboutTabs.Roadmap)
setCurrentPage(parts[1])
break break
default: default:
break break
@ -80,26 +88,32 @@ const AboutRoute: React.FC<Props> = (props: Props) => {
<div id="About"> <div id="About">
<Head> <Head>
{/* HTML */} {/* HTML */}
<title>{t('page.titles.about')}</title> <title>{t(`page.titles.${currentPage}`)}</title>
<meta name="description" content={t('page.descriptions.about')} /> <meta
name="description"
content={t(`page.descriptions.${currentPage}`)}
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
{/* OpenGraph */} {/* OpenGraph */}
<meta property="og:title" content={t('page.titles.about')} /> <meta property="og:title" content={t(`page.titles.${currentPage}`)} />
<meta <meta
property="og:description" property="og:description"
content={t('page.descriptions.about')} content={t('page.descriptions.about')}
/> />
<meta property="og:url" content="https://app.granblue.team/about" /> <meta
property="og:url"
content={`https://app.granblue.team/${currentPage}`}
/>
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
{/* Twitter */} {/* Twitter */}
<meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:card" content="summary_large_image" />
<meta property="twitter:domain" content="app.granblue.team" /> <meta property="twitter:domain" content="app.granblue.team" />
<meta name="twitter:title" content={t('page.titles.about')} /> <meta name="twitter:title" content={t(`page.titles.${currentPage}`)} />
<meta <meta
name="twitter:description" name="twitter:description"
content={t('page.descriptions.about')} content={t(`page.descriptions.${currentPage}`)}
/> />
</Head> </Head>

View file

@ -345,6 +345,9 @@
}, },
"page": { "page": {
"titles": { "titles": {
"about": "About granblue.team",
"updates": "Updates / granblue.team",
"roadmap": "Roadmap / granblue.team",
"discover": "Discover teams / granblue.team", "discover": "Discover teams / granblue.team",
"new": "Create a new team / granblue.team", "new": "Create a new team / granblue.team",
"profile": "@{{username}}'s Teams / granblue.team", "profile": "@{{username}}'s Teams / granblue.team",
@ -352,6 +355,9 @@
"saved": "Your saved teams / granblue.team" "saved": "Your saved teams / granblue.team"
}, },
"descriptions": { "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", "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", "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", "profile": "Browse @{{username}}'s Teams and filter by raid, element or recency",

View file

@ -346,6 +346,9 @@
}, },
"page": { "page": {
"titles": { "titles": {
"about": "granblue.teamについて",
"updates": "変更ログ / granblue.team",
"roadmap": "ロードマップ / granblue.team",
"discover": "編成を見出す / granblue.team", "discover": "編成を見出す / granblue.team",
"new": "新しい編成 / granblue.team", "new": "新しい編成 / granblue.team",
"profile": "@{{username}}さんの作った編成 / granblue.team", "profile": "@{{username}}さんの作った編成 / granblue.team",
@ -353,6 +356,9 @@
"saved": "保存した編成" "saved": "保存した編成"
}, },
"descriptions": { "descriptions": {
"about": "granblue.teamについて / グランブルーファンタジーの編成を探したり保存したりできる",
"updates": "granblue.teamの最新変更について",
"roadmap": "granblue.teamの開発予定機能",
"discover": "グランブルーファンタジーの編成をマルチ、属性、作った時間などで探したり保存したりできる", "discover": "グランブルーファンタジーの編成をマルチ、属性、作った時間などで探したり保存したりできる",
"new": "グランブルーファンタジーの編成を作成し、騎空士とシェアできるサイトgranblue.team", "new": "グランブルーファンタジーの編成を作成し、騎空士とシェアできるサイトgranblue.team",
"profile": "@{{username}}の編成を調査し、マルチ、属性、または作った時間でフィルターする", "profile": "@{{username}}の編成を調査し、マルチ、属性、または作った時間でフィルターする",