-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathhome.tsx
79 lines (73 loc) · 2.85 KB
/
home.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { useTranslation } from 'react-i18next';
import editorImg from 'assets/pictures/home/editor.svg';
import mapImg from 'assets/pictures/home/map.svg';
import operationalStudiesImg from 'assets/pictures/home/operationalStudies.svg';
import rollingStockEditorImg from 'assets/pictures/home/rollingstockeditor.svg';
import stdcmImg from 'assets/pictures/home/stdcm.svg';
import useAllowedUserRoles from 'common/authorization/hooks/useAllowedUserRoles';
import Card from 'common/BootstrapSNCF/CardSNCF/CardSNCF';
import { ModalProvider } from 'common/BootstrapSNCF/ModalSNCF/ModalProvider';
import NavBarSNCF from 'common/BootstrapSNCF/NavBarSNCF';
export default function Home() {
const { t } = useTranslation('home/home');
const {
operationalStudiesAllowed,
stdcmAllowed,
infraEditorAllowed,
rollingStockEditorAllowed,
mapAllowed,
} = useAllowedUserRoles();
return (
<ModalProvider>
<NavBarSNCF showLogoWithName />
<main className="mastcontainer mastcontainer-no-mastnav">
<div className="cardscontainer">
<div className="row justify-content-center mb-2">
<div
className="col-6 col-md-5 col-lg-4 col-xl-3"
{...(!operationalStudiesAllowed && { 'aria-disabled': true })}
>
<Card
img={operationalStudiesImg}
title={t('operationalStudies')}
link="/operational-studies/projects"
data-testid="operationalStudies"
/>
</div>
<div
className="col-6 col-md-5 col-lg-4 col-xl-3"
{...(!stdcmAllowed && { 'aria-disabled': true })}
>
<Card img={stdcmImg} title={t('stdcm')} link="/stdcm" openInNewTab />
</div>
</div>
<div className="row justify-content-center">
<div className="col-12 col-md-10 col-lg-8 col-xl-6">
<div className="row">
<div
className="col-6 col-sm-4 "
{...(!infraEditorAllowed && { 'aria-disabled': true })}
>
<Card img={editorImg} title={t('editor')} link="/editor" />
</div>
<div
className="col-6 col-sm-4 "
{...(!rollingStockEditorAllowed && { 'aria-disabled': true })}
>
<Card
img={rollingStockEditorImg}
title={t('rollingStockEditor')}
link="/rolling-stock-editor"
/>
</div>
<div className="col-6 col-sm-4 " {...(!mapAllowed && { 'aria-disabled': true })}>
<Card img={mapImg} title={t('map')} link="/map" />
</div>
</div>
</div>
</div>
</div>
</main>
</ModalProvider>
);
}