Skip to content

Commit 43e97eb

Browse files
committed
test
1 parent 3f646e1 commit 43e97eb

35 files changed

+556
-230
lines changed

.eslintrc.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
2-
"extends": [
3-
"next",
4-
"next/core-web-vitals",
5-
"next/typescript",
6-
"prettier"
7-
],
2+
"extends": ["next", "next/core-web-vitals", "next/typescript", "prettier"],
83
"plugins": ["@typescript-eslint"],
94
"rules": {
105
// Todo: investigate, for each of these rules, whether we want them.
@@ -60,4 +55,4 @@
6055
"@typescript-eslint/no-useless-constructor": "error",
6156
"@typescript-eslint/prefer-literal-enum-member": "error"
6257
}
63-
}
58+
}

README.md

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
[![CI_Build](https://github.com/bobis33/Portfolio/actions/workflows/build.yml/badge.svg)](https://github.com/bobis33/Portfolio/actions/workflows/build.yml)
2-
[![CI_Deploy](https://github.com/bobis33/Portfolio/actions/workflows/deploy.yml/badge.svg)](https://github.com/bobis33/Portfolio/actions/workflows/deploy.yml)
3-
![GitHub repo size](https://img.shields.io/github/repo-size/PossibleGames/PossibleGames.github.io)
4-
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/PossibleGames/PossibleGames.github.io/blob/main/LICENSE)
5-
6-
# PossibleGames Website
1+
[![client-web-build](https://github.com/bobis33/end-year-project/actions/workflows/client-web-build.yml/badge.svg)](https://github.com/bobis33/end-year-project/actions/workflows/client-web-build.yml)
2+
[![client-web-test](https://github.com/bobis33/end-year-project/actions/workflows/client-web-test.yml/badge.svg)](https://github.com/bobis33/end-year-project/actions/workflows/client-web-test.yml)
73

84

95
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
@@ -35,23 +31,3 @@ To learn more about Next.js, take a look at the following resources:
3531
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
3632

3733
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
38-
39-
40-
# Commit Norms
41-
42-
| Commit Type | Description |
43-
|:------------|:--------------------------------------------------------------------------------------------------------------------------|
44-
| build | Changes that affect the build system or external dependencies (npm, make, etc.) |
45-
| ci | Changes related to integration files and scripts or configuration (Travis, Ansible, BrowserStack, etc.) |
46-
| feat | Addition of a new feature |
47-
| fix | Bug fix |
48-
| perf | Performance improvements |
49-
| refactor | Modification that neither adds a new feature nor improves performance |
50-
| style | Change that does not affect functionality or semantics (indentation, formatting, adding space, renaming a variable, etc.) |
51-
| docs | Writing or updating documentation |
52-
| test | Addition or modification of tests |
53-
54-
55-
# License
56-
57-
This project is licensed under the MIT License - see the [LICENSE](https://github.com/PossibleGames/PossibleGames.github.io/blob/main/LICENSE.md) file for details.

app/[lang]/[...]/page.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import NotFound from '@/[lang]/not-found'
2+
import { Locale } from '@/internationalization/i18n-config'
3+
4+
interface CatchAllProps {
5+
params: {
6+
lang: Locale
7+
}
8+
}
9+
10+
export default function CatchAll({ params }: CatchAllProps) {
11+
const { lang } = params
12+
13+
return <NotFound lang={lang} />
14+
}

app/[lang]/about/page.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react'
2+
3+
import { getDictionary } from '@/internationalization/dictionary'
4+
import { Locale } from '@/internationalization/i18n-config'
5+
6+
export default async function Page({
7+
params: { lang },
8+
}: {
9+
params: { lang: Locale }
10+
}) {
11+
const t = await getDictionary(lang)
12+
13+
return (
14+
<>
15+
<p>{t.about}</p>
16+
</>
17+
)
18+
}

app/[lang]/contact/page.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react'
2+
3+
import { getDictionary } from '@/internationalization/dictionary'
4+
import { Locale } from '@/internationalization/i18n-config'
5+
6+
export default async function Page({
7+
params: { lang },
8+
}: {
9+
params: { lang: Locale }
10+
}) {
11+
const t = await getDictionary(lang)
12+
13+
return (
14+
<>
15+
<p>{t.contact}</p>
16+
</>
17+
)
18+
}

app/[lang]/documentation/page.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react'
2+
3+
import { getDictionary } from '@/internationalization/dictionary'
4+
import { Locale } from '@/internationalization/i18n-config'
5+
6+
export default async function Page({
7+
params: { lang },
8+
}: {
9+
params: { lang: Locale }
10+
}) {
11+
const t = await getDictionary(lang)
12+
13+
return (
14+
<>
15+
<p>{t.documentation}</p>
16+
</>
17+
)
18+
}

app/[lang]/global-error.tsx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
'use client'
2+
3+
import { useEffect, useState } from 'react'
4+
import { Locale } from '@/internationalization/i18n-config'
5+
import { getDictionary } from 'internationalization/dictionary'
6+
7+
export default function GlobalError({
8+
error,
9+
reset,
10+
params,
11+
}: {
12+
error: Error & { digest?: string }
13+
reset: () => void
14+
params: { lang: Locale }
15+
}) {
16+
const [translations, setTranslations] = useState<Record<
17+
string,
18+
string
19+
> | null>(null)
20+
21+
useEffect(() => {
22+
console.error(error)
23+
const fetchDictionary = async () => {
24+
try {
25+
const data = await getDictionary(params.lang)
26+
setTranslations(data)
27+
} catch (err) {
28+
console.error('Error fetching translations:', err)
29+
}
30+
}
31+
32+
fetchDictionary().then((r) => r)
33+
}, [error, params.lang])
34+
35+
if (!translations) {
36+
return (
37+
<html lang={'en'}>
38+
<body>Loading...</body>
39+
</html>
40+
)
41+
}
42+
43+
return (
44+
<html lang={params.lang}>
45+
<body>
46+
<h2>{translations.error === null ? 'Error' : translations.error}</h2>
47+
<p>
48+
{translations.notFoundMessage === null
49+
? 'Something went wrong'
50+
: translations.notFoundMessage}
51+
</p>
52+
<button onClick={() => reset()}>
53+
{translations.tryAgain === null ? 'Try again' : translations.tryAgain}
54+
</button>
55+
</body>
56+
</html>
57+
)
58+
}

app/[lang]/layout.tsx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import type { Metadata } from 'next'
2+
import React from 'react'
3+
import { GeistSans } from 'geist/font/sans'
4+
import { GeistMono } from 'geist/font/mono'
5+
6+
import '@/styles/globals.scss'
7+
import { i18n } from '@/internationalization/i18n-config'
8+
import { Locale } from '@/internationalization/i18n-config'
9+
import { getDictionary } from '@/internationalization/dictionary'
10+
import Header from '@/components/Header'
11+
12+
export async function generateStaticParams() {
13+
return i18n.locales.map((locale) => ({ lang: locale }))
14+
}
15+
16+
export const metadata: Metadata = {
17+
title: 'Web',
18+
description: 'Web Client',
19+
}
20+
21+
function Footer() {
22+
return (
23+
<footer className="flex flex-row justify-center p-4">
24+
<p className="text-xs font-bold">&copy; 2024 Web</p>
25+
</footer>
26+
)
27+
}
28+
29+
export default async function rootLayout({
30+
children,
31+
params: { lang },
32+
}: {
33+
children: React.ReactNode
34+
params: { lang: Locale }
35+
}) {
36+
const t = await getDictionary(lang)
37+
38+
const navLinks = [
39+
{ href: '/about', label: t.about },
40+
{ href: '/contact', label: t.contact },
41+
{ href: '/documentation', label: t.documentation },
42+
]
43+
44+
return (
45+
<html lang={lang}>
46+
<body
47+
className={`${GeistSans.variable} ${GeistMono.variable} antialiased`}
48+
>
49+
<Header navLinks={navLinks} langSwitcherStr={t.language} />
50+
<div className="flex flex-col h-screen">
51+
<main className="flex flex-col items-center justify-center flex-1">
52+
{children}
53+
</main>
54+
</div>
55+
<Footer />
56+
</body>
57+
</html>
58+
)
59+
}

app/[lang]/manifest.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "Web",
3+
"short_name": "web",
4+
"description": "Web Client",
5+
"start_url": "/",
6+
"display": "standalone"
7+
}

app/[lang]/not-found.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react'
2+
3+
import { getDictionary } from '@/internationalization/dictionary'
4+
import { Locale } from '@/internationalization/i18n-config'
5+
6+
export default async function NotFound({ lang }: { lang: Locale }) {
7+
const t = await getDictionary(lang)
8+
9+
return (
10+
<div>
11+
<p>404 - {t.notFound}</p>
12+
<p>{t.notFoundMessage}</p>
13+
</div>
14+
)
15+
}

0 commit comments

Comments
 (0)