Skip to content

Commit 28c29c8

Browse files
authored
Merge pull request #599 from Alt-Org/nikolas/feature/598-implement-new-ethical-ethical-guidelines-page
Nikolas/feature/598 implement new ethical ethical guidelines page
2 parents e1e80f9 + 6e8d642 commit 28c29c8

File tree

23 files changed

+217
-17
lines changed

23 files changed

+217
-17
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { createPage } from '@/app/_helpers';
2+
import { EthicalGuidelinesPageProps } from '@/preparedPages/EthicalGuidelinesPage';
3+
import { makeEthicalGuidelinesSectionsWithI18n } from '@/entities/PresentationPackages';
4+
import { getServerTranslation } from '@/shared/i18n';
5+
import { getRouteEthicalGuidelinesPage } from '@/shared/appLinks/RoutePaths';
6+
import { defaultOpenGraph } from '@/shared/seoConstants';
7+
8+
export async function _getPage(lng: string) {
9+
const { t } = await getServerTranslation(lng, 'ethics');
10+
11+
return createPage<EthicalGuidelinesPageProps>({
12+
buildPage: () => ({
13+
sections: makeEthicalGuidelinesSectionsWithI18n(t),
14+
title: t('main-title'),
15+
}),
16+
buildSeo: () => ({
17+
title: t('main-title'),
18+
description: t('head-description'),
19+
keywords: t('head-keywords'),
20+
openGraph: {
21+
...defaultOpenGraph,
22+
title: t('og-title'),
23+
description: t('og-description'),
24+
url: `/${lng}${getRouteEthicalGuidelinesPage()}`,
25+
},
26+
alternates: {
27+
canonical: `/${lng}${getRouteEthicalGuidelinesPage()}`,
28+
},
29+
}),
30+
});
31+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { PageLoader as default } from '@/widgets/PageLoader';
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { EthicalGuidelinesPage } from '@/preparedPages/EthicalGuidelinesPage';
2+
import { withPageData, withMetadataGenerator } from '@/app/_helpers';
3+
import { _getPage } from './_getPage';
4+
5+
export const generateMetadata = withMetadataGenerator(_getPage);
6+
export default withPageData(EthicalGuidelinesPage, _getPage);

frontend-next-migration/src/entities/PresentationPackages/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ export { makeCookiesSectionsWithI18n } from '@/entities/PresentationPackages/mod
99

1010
export { PrivacySections } from '@/entities/PresentationPackages/model/data/privacySections';
1111
export { makePrivacySectionsWithI18n } from '@/entities/PresentationPackages/model/makeSectionsWithI18n';
12+
13+
export { EthicalGuidelinesSections } from '@/entities/PresentationPackages/model/data/ethicalGuidelinesSections';
14+
export { makeEthicalGuidelinesSectionsWithI18n } from '@/entities/PresentationPackages/model/makeSectionsWithI18n';
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { createSection } from '../createSection';
2+
3+
const i18nKeyPrefixes = ['intro', 'players', 'employees', 'business', 'society', 'law'];
4+
5+
const imageSrcs = [''];
6+
const logoSrc = '';
7+
8+
export const EthicalGuidelinesSections = i18nKeyPrefixes.map((key, index) =>
9+
createSection({
10+
prefix: key,
11+
index,
12+
image: {
13+
src: imageSrcs[index],
14+
alt: `${key}-image`,
15+
},
16+
logo: {
17+
src: logoSrc,
18+
alt: `${key}-logo`,
19+
},
20+
}),
21+
);

frontend-next-migration/src/entities/PresentationPackages/model/makeSectionsWithI18n.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { PresentationSection } from '@/entities/PresentationPackages/types';
22
import { ArtGameSections } from './data/artGameSections';
33
import { CookiesSections } from './data/cookiesSections';
44
import { PrivacySections } from './data/privacySections';
5+
import { EthicalGuidelinesSections } from './data/ethicalGuidelinesSections';
56

67
/**
78
* Takes an array of PresentationSections and returns a higher-order function that takes a translation function
@@ -58,3 +59,12 @@ export const makeCookiesSectionsWithI18n = makeSectionsWithI18n(CookiesSections)
5859
* @returns {Array} - The array of art game sections with internationalization support.
5960
*/
6061
export const makePrivacySectionsWithI18n = makeSectionsWithI18n(PrivacySections);
62+
63+
/**
64+
* Creates ethical guidelines sections with internationalization support.
65+
*
66+
* @param {Array} EthicalGuidelinesSections - The array of art game sections.
67+
* @returns {Array} - The array of art game sections with internationalization support.
68+
*/
69+
export const makeEthicalGuidelinesSectionsWithI18n =
70+
makeSectionsWithI18n(EthicalGuidelinesSections);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { EthicalGuidelinesPageAsync as EthicalGuidelinesPage } from './ui/EthicalGuidelinesPage.async';
2+
3+
export type { Props as EthicalGuidelinesPageProps } from './ui/EthicalGuidelinesPage';
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import dynamic from 'next/dynamic';
2+
import { Props } from './EthicalGuidelinesPage';
3+
4+
export const EthicalGuidelinesPageAsync = dynamic<Props>(() => import('./EthicalGuidelinesPage'));
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
'use client';
2+
import { ScrollTop } from '@/features/ScrollTop';
3+
import { classNames } from '@/shared/lib/classNames/classNames';
4+
import { WikiContentWithSidebar } from '@/shared/ui/v2/WikiContentWithSidebar';
5+
6+
interface Section {
7+
id: string;
8+
navMenuTitle: string;
9+
label: string;
10+
description: string;
11+
image: string;
12+
imageAlt: string;
13+
sidebarLogo: string;
14+
sidebarLogoAlt: string;
15+
}
16+
17+
export type Props = {
18+
sections: Section[];
19+
title: string;
20+
};
21+
22+
const EthicalGuidelinesPage = (props: Props) => {
23+
const { sections = [], title } = props;
24+
25+
return (
26+
<div>
27+
<WikiContentWithSidebar
28+
sections={sections}
29+
title={title}
30+
/>
31+
<ScrollTop />
32+
</div>
33+
);
34+
};
35+
36+
export default EthicalGuidelinesPage;

frontend-next-migration/src/shared/appLinks/RoutePaths.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export enum AppRoutesLinks {
2121
ABOUT = 'ABOUT',
2222
PRIVACY = 'privacy',
2323
COOKIES = 'cookies',
24+
ETHICAL_GUIDELINES = 'ETHICAL_GUIDELINES',
2425
FORUM = 'FORUM',
2526
GAME_ART = 'GAME_ART',
2627

@@ -72,6 +73,7 @@ export const RoutePaths: Record<AppRoutesLinks, string> = {
7273
[AppRoutesLinks.ABOUT]: '/about',
7374
[AppRoutesLinks.PRIVACY]: '/privacy',
7475
[AppRoutesLinks.COOKIES]: '/cookies',
76+
[AppRoutesLinks.ETHICAL_GUIDELINES]: '/ethical-guidelines',
7577
[AppRoutesLinks.GAME_ART]: '/artGame',
7678

7779
[AppRoutesLinks.HEROES]: '/heroes',
@@ -130,6 +132,7 @@ export const getRouteJoinUsPage = () => '/join-us';
130132
export const getRoutePrivacyPage = () => '/privacy';
131133
export const getRouteCookiesPage = () => '/cookies';
132134
export const getRouteDataPolicyPage = () => '/data-policy';
135+
export const getRouteEthicalGuidelinesPage = () => '/ethical-guidelines';
133136
export const getRouteAboutPage = () => '/about';
134137
export const getRouteComingSoonPage = () => '/coming';
135138
export const getRouteForumPage = () => '/forum';

0 commit comments

Comments
 (0)