forked from httpcats/http.cat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ca): expand catalan version to status pages
- Loading branch information
1 parent
ae3e7f2
commit 5929df6
Showing
11 changed files
with
134 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { Metadata } from 'next'; | ||
import Image from 'next/image'; | ||
import Link from 'next/link'; | ||
|
||
import Header from '@/components/Header'; | ||
import Footer from '@/components/Footer'; | ||
import StatusDescription from '@/components/StatusDescription'; | ||
|
||
import statuses from '@/lib/statuses'; | ||
import { getStatusInfo } from '@/lib/status-info'; | ||
import { getTranslations } from '@/lib/translation'; | ||
|
||
export default async function Info({ params }: { params: { status: string } }) { | ||
const statusObj = statuses[params.status as unknown as keyof typeof statuses]; | ||
const statusInfoHTML = await getStatusInfo(params.status); | ||
|
||
const t = await getTranslations('ca'); | ||
|
||
return ( | ||
<> | ||
<Header t={t} /> | ||
<main> | ||
<nav> | ||
<Link href="/ca" className="text-white">{`< ${t.BACK_TO_HOME}`}</Link> | ||
</nav> | ||
|
||
<h1 className="text-center my-12"> | ||
{statusObj.code} {statusObj.message} | ||
</h1> | ||
|
||
<div className="text-center"> | ||
<Image | ||
src={`/images/${statusObj.code.toString()}.jpg`} | ||
alt={statusObj.message} | ||
width={750} | ||
height={600} | ||
className="w-full h-full max-w-3xl" | ||
/> | ||
</div> | ||
<section className="flex justify-center tracking-wider"> | ||
<StatusDescription> | ||
<div dangerouslySetInnerHTML={{ __html: statusInfoHTML }} /> | ||
</StatusDescription> | ||
</section> | ||
</main> | ||
<Footer t={t} /> | ||
</> | ||
); | ||
} | ||
|
||
export function generateStaticParams() { | ||
return Object.keys(statuses).map((status) => ({ status })); | ||
} | ||
|
||
export function generateMetadata({ | ||
params, | ||
}: { | ||
params: { status: string }; | ||
}): Metadata { | ||
const statusObj = statuses[params.status as unknown as keyof typeof statuses]; | ||
|
||
return { | ||
title: `${statusObj.code} ${statusObj.message} | HTTP Cats`, | ||
description: `HTTP Cat for status ${statusObj.code} ${statusObj.message}`, | ||
openGraph: { | ||
title: `${statusObj.code} ${statusObj.message} | HTTP Cats`, | ||
images: [ | ||
{ | ||
url: `https://http.cat/${statusObj.code}.jpg`, | ||
alt: statusObj.message, | ||
}, | ||
], | ||
}, | ||
twitter: { | ||
card: 'summary_large_image', | ||
site: `https://http.cat/status/${statusObj.code}`, | ||
title: `${statusObj.code} ${statusObj.message} | HTTP Cats`, | ||
images: [`https://http.cat/${statusObj.code}`], | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
{ | ||
"LOCALE": "ca", | ||
"APP_TITLE": "HTTP Gats", | ||
"USAGE_TITLE": "Instruccions", | ||
"USAGE_PARAM": "codi_d_estat", | ||
"USAGE_NOTE_LABEL": "Nota", | ||
"USAGE_NOTE_TEXT": "Si necessiteu una extensió al final de l’URL només heu d’afegir", | ||
"LANGUAGE_LINK_TEXT": "Versió Català", | ||
"LANGUAGE_LINK_TEXT": "English Version", | ||
"DEVELOPED_BY": "Desenvolupat per", | ||
"IMAGES_BY": "Imatges de", | ||
"COPIED": "Copiat!", | ||
"COPY_ICON_ALT_TEXT": "Icona que representa l'acció del porta-retalls" | ||
"COPY_TO_CLIPBOARD": "Copiar al porta-retalls", | ||
"BACK_TO_HOME": "Tornar a l'inici" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters