Skip to content

Commit c694047

Browse files
Merge pull request #9 from aXenDeveloper/section_faq
Page: FAQ
2 parents c2547c4 + 4d93ea3 commit c694047

File tree

75 files changed

+15286
-7281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+15286
-7281
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
graphql/hooks.ts
2+
next.config.js
3+
commitlint.config.js
24

35
# next-pwa
46
/public/precache.*.*.js

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit ${1}

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run lint

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"cSpell.words": [
3+
"axendev",
4+
"clsx",
5+
"commitlint",
36
"datetime",
47
"fluentui",
58
"overscan",

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# (NextJS) aXenDev 2.0 - Portfolio
22

3+
Personal portfolio application.
4+
35
## ⚠️ Requirements for VSCode
46

57
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
@@ -12,6 +14,7 @@ Use commands:
1214

1315
```bash
1416
npm i
17+
npm run prepare
1518
```
1619

1720
## 🛠 Run

__mocks__/RootMock.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { NextIntlProvider } from 'next-intl';
2+
import { ReactNode } from 'react';
3+
import Cookies from 'js-cookie';
4+
5+
import messages from '../messages/en.json';
6+
7+
interface Props {
8+
children: ReactNode;
9+
}
10+
11+
export const RootMock = ({ children }: Props) => {
12+
Cookies.set('NEXT_LOCALE', 'en');
13+
14+
return (
15+
<NextIntlProvider messages={messages} locale="en">
16+
{children}
17+
</NextIntlProvider>
18+
);
19+
};
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { notFound } from 'next/navigation';
2+
import { Suspense, lazy } from 'react';
3+
import { Metadata } from 'next';
4+
import { getTranslator } from 'next-intl/server';
5+
6+
import { LoadingView } from '@/views/global/loading/LoadingView';
7+
8+
interface Props {
9+
params: {
10+
childId: string;
11+
id: string;
12+
locale: string;
13+
};
14+
}
15+
16+
export async function generateMetadata({
17+
params: { childId, id, locale }
18+
}: Props): Promise<Metadata> {
19+
const t = await getTranslator(locale, 'faq');
20+
21+
return {
22+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
23+
// @ts-expect-error
24+
title: t(`pages.${id}_pages.${childId}`)
25+
};
26+
}
27+
28+
export default async function Page({ params: { childId, id, locale } }: Props) {
29+
const MDXComponent = lazy(() =>
30+
import(`@/assets/faq/${id}/${childId}/${childId}-${locale}.mdx`).catch(() => notFound())
31+
);
32+
33+
return (
34+
<Suspense fallback={<LoadingView />}>
35+
<MDXComponent />
36+
</Suspense>
37+
);
38+
}

app/[locale]/(main)/faq/[id]/page.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { notFound } from 'next/navigation';
2+
import { Suspense, lazy } from 'react';
3+
import { Metadata } from 'next';
4+
import { getTranslator } from 'next-intl/server';
5+
6+
import { LoadingView } from '@/views/global/loading/LoadingView';
7+
8+
interface Props {
9+
params: {
10+
id: string;
11+
locale: string;
12+
};
13+
}
14+
15+
export async function generateMetadata({ params: { id, locale } }: Props): Promise<Metadata> {
16+
const t = await getTranslator(locale, 'faq');
17+
18+
return {
19+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
20+
// @ts-expect-error
21+
title: t(`pages.${id}`)
22+
};
23+
}
24+
25+
export default async function Page({ params: { id, locale } }: Props) {
26+
const MDXComponent = lazy(() =>
27+
import(`@/assets/faq/${id}/${id}-${locale}.mdx`).catch(() => notFound())
28+
);
29+
30+
return (
31+
<Suspense fallback={<LoadingView />}>
32+
<MDXComponent />
33+
</Suspense>
34+
);
35+
}

app/[locale]/(main)/faq/layout.tsx

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
1-
import { ErrorView } from '@/views/global/error/ErrorView';
1+
import { ReactNode } from 'react';
2+
import { getTranslator } from 'next-intl/server';
3+
import { Metadata } from 'next';
24

3-
// interface Props {
4-
// children: ReactNode;
5-
// }
5+
import { WrapperFaq } from '@/views/faq/wrapper/WrapperFaq';
66

7-
export default function Layout() {
8-
return <ErrorView code={404} />;
7+
import { CONFIG_TITLE } from '../../../../config';
8+
9+
interface MetadataProps {
10+
params: {
11+
locale: string;
12+
};
13+
}
14+
15+
export async function generateMetadata({ params: { locale } }: MetadataProps): Promise<Metadata> {
16+
const t = await getTranslator(locale, 'nav');
17+
18+
return {
19+
title: {
20+
default: t('faq'),
21+
template: `%s - ${t('faq')} - ${CONFIG_TITLE}`
22+
}
23+
};
24+
}
25+
26+
interface Props {
27+
children: ReactNode;
28+
}
29+
30+
export default function Layout({ children }: Props) {
31+
return <WrapperFaq>{children}</WrapperFaq>;
932
}

app/[locale]/(main)/faq/page.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
11
import { getTranslator } from 'next-intl/server';
2+
import { Suspense, lazy } from 'react';
3+
import { notFound } from 'next/navigation';
24

3-
import { FaqView } from '@/views/faq/FaqView';
5+
import { LoadingView } from '@/views/global/loading/LoadingView';
46

5-
interface MetadataProps {
7+
interface Props {
68
params: {
79
locale: string;
810
};
911
}
1012

11-
export async function generateMetadata({ params: { locale } }: MetadataProps) {
13+
export async function generateMetadata({ params: { locale } }: Props) {
1214
const t = await getTranslator(locale, 'nav');
1315

1416
return {
1517
title: t('faq')
1618
};
1719
}
1820

19-
export default function Page() {
20-
return <FaqView />;
21+
export default function Page({ params: { locale } }: Props) {
22+
const MDXComponent = lazy(() =>
23+
import(`@/assets/faq/welcome/welcome-${locale}.mdx`).catch(() => notFound())
24+
);
25+
26+
return (
27+
<Suspense fallback={<LoadingView />}>
28+
<MDXComponent />
29+
</Suspense>
30+
);
2131
}

0 commit comments

Comments
 (0)