-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
103 lines (99 loc) · 3.14 KB
/
index.tsx
File metadata and controls
103 lines (99 loc) · 3.14 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import * as React from 'react';
import { useSelector } from 'react-redux';
import {
Alert,
Box,
Button,
Container,
CssBaseline,
Typography,
} from '@mui/material';
import CheckIcon from '@mui/icons-material/Check';
import { selectIsAuthenticated } from '../../store/profile-selectors';
import { useTranslations } from 'next-intl';
import { useSearchParams } from 'next/navigation';
import FeedSubmissionForm from './Form';
import { ColoredContainer } from '../../styles/PageLayout.style';
function Component(): React.ReactElement {
const t = useTranslations('feeds');
const searchParams = useSearchParams();
const [showLoginSuccess, setShowLoginSuccess] = React.useState(
searchParams.get('from') === 'registration',
);
const isAuthenticated = useSelector(selectIsAuthenticated);
return (
<Container component='main' sx={{ my: 0, mx: 'auto' }}>
<CssBaseline />
<Box
sx={{
mx: 'auto',
}}
>
{!isAuthenticated && (
<>
<Typography variant='h1'>{t('form.addOrUpdateFeed')}</Typography>
<Typography sx={{ my: 2 }}>{t('form.signUp')}</Typography>
<Button variant='contained' href='/sign-up?add_feed=true'>
{t('form.signUpAction')}
</Button>
</>
)}
{isAuthenticated && (
<>
{showLoginSuccess && (
<Alert
icon={<CheckIcon fontSize='inherit' />}
severity='success'
sx={{ mb: 2 }}
onClose={() => {
setShowLoginSuccess(false);
}}
>
{t('form.loginSuccess')}
</Alert>
)}
<ColoredContainer>
<Typography>
Do you have any questions about how to submit a feed?
<Button
variant='text'
className='inline'
sx={{ fontWeight: 700 }}
href={'/contribute-faq'}
rel='noreferrer'
target='_blank'
>
Read our FAQ
</Button>
<br /> <br />
Want to submit a GBFS feed to the Mobility Database? Contribute
through the{' '}
<Button
variant='text'
className='line-start inline'
sx={{ fontWeight: 700 }}
href={
'https://github.com/MobilityData/gbfs?tab=readme-ov-file#systems-catalog---systems-implementing-gbfs'
}
rel='noreferrer'
target='_blank'
>
GBFS systems catalog
</Button>
</Typography>
</ColoredContainer>
<Container maxWidth='md'>
<Typography variant='h1' sx={{ my: 3 }}>
Add or update a feed
</Typography>
<FeedSubmissionForm />
</Container>
</>
)}
</Box>
</Container>
);
}
export default function Home(): React.ReactElement {
return <Component />;
}