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() {
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() {

View file

@ -26,6 +26,7 @@ const AboutRoute: React.FC<Props> = (props: Props) => {
const { t } = useTranslation('common')
const [currentTab, setCurrentTab] = useState<AboutTabs>(AboutTabs.About)
const [currentPage, setCurrentPage] = useState('')
useEffect(() => {
const parts = router.asPath.split('/')
@ -34,31 +35,38 @@ const AboutRoute: React.FC<Props> = (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<HTMLInputElement>) {
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: Props) => {
<div id="About">
<Head>
{/* HTML */}
<title>{t('page.titles.about')}</title>
<meta name="description" content={t('page.descriptions.about')} />
<title>{t(`page.titles.${currentPage}`)}</title>
<meta
name="description"
content={t(`page.descriptions.${currentPage}`)}
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{/* OpenGraph */}
<meta property="og:title" content={t('page.titles.about')} />
<meta property="og:title" content={t(`page.titles.${currentPage}`)} />
<meta
property="og:description"
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" />
{/* Twitter */}
<meta name="twitter:card" content="summary_large_image" />
<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
name="twitter:description"
content={t('page.descriptions.about')}
content={t(`page.descriptions.${currentPage}`)}
/>
</Head>

View file

@ -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",

View file

@ -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}}の編成を調査し、マルチ、属性、または作った時間でフィルターする",