-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: redirect user to login when registering an existing account. (#263
- Loading branch information
Showing
9 changed files
with
2,325 additions
and
2,017 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
import { useRouter } from 'next/navigation'; | ||
|
||
import { LOGIN_URL } from '@/common'; | ||
import { useLanguage } from '../provider'; | ||
|
||
export function Counter() { | ||
const [count, setCount] = React.useState(5); | ||
const { intl } = useLanguage(); | ||
const router = useRouter(); | ||
|
||
React.useEffect(() => { | ||
if (count === 0) { | ||
router.push(LOGIN_URL); | ||
} else { | ||
const timer = setTimeout(() => setCount(count - 1), 1_000); | ||
|
||
return () => clearTimeout(timer); | ||
} | ||
}, [count, router]); | ||
|
||
return ( | ||
<span | ||
dangerouslySetInnerHTML={{ | ||
__html: intl.redirection.counter.replace('{count}', String(count)), | ||
}} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.center { | ||
display: flex; | ||
justify-content: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { Typography } from '@mui/material'; | ||
import { redirect } from 'next/navigation'; | ||
import Image from 'next/image'; | ||
|
||
import { GridContainer, GridItem } from '@/components/elements/grid'; | ||
import { TextBody } from '@/components/elements/typography'; | ||
import { getDictionary } from '@/dictionaries'; | ||
import { Locale } from '@/i18n-config'; | ||
import { Counter } from './counter'; | ||
|
||
import AccountCreated from '@public/assets/account-created.svg'; | ||
import styles from './page.module.css'; | ||
|
||
type Props = { searchParams: { cedula: string }; params: { lang: Locale } }; | ||
|
||
export default async function RedirectionPage({ searchParams, params }: Props) { | ||
const intl = await getDictionary(params.lang); | ||
const cedula = searchParams.cedula; | ||
|
||
if (!cedula) redirect('identification'); | ||
|
||
return ( | ||
<GridContainer> | ||
<GridItem md={12} lg={12}> | ||
<div className={styles.center}> | ||
<Image | ||
src={AccountCreated?.src} | ||
alt="imagen de cuenta creada" | ||
width={259} | ||
height={225} | ||
/> | ||
</div> | ||
<br /> | ||
<Typography | ||
color="primary" | ||
sx={{ | ||
fontSize: '24px', | ||
fontWeight: '700', | ||
textAlign: 'center', | ||
}} | ||
gutterBottom | ||
> | ||
{intl.redirection.title} | ||
</Typography> | ||
<TextBody textCenter gutterBottom> | ||
<span | ||
dangerouslySetInnerHTML={{ | ||
__html: intl.redirection.body.replace('{id}', cedula), | ||
}} | ||
/> | ||
</TextBody> | ||
</GridItem> | ||
|
||
<GridItem md={12} lg={12}> | ||
<div className={styles.center}> | ||
<Typography | ||
color="primary" | ||
fontWeight={500} | ||
fontSize="medium" | ||
bgcolor="#0091ff20" | ||
sx={{ px: 2, py: 1 }} | ||
borderRadius={2} | ||
> | ||
<Counter /> | ||
</Typography> | ||
</div> | ||
</GridItem> | ||
</GridContainer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters