mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
feat: remove login page (temp)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { route } from '@izzyjs/route/client';
|
||||
import { Avatar, Group, Menu, Text, UnstyledButton } from '@mantine/core';
|
||||
import { forwardRef } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { TbChevronRight } from 'react-icons/tb';
|
||||
import useUser from '~/hooks/use_user';
|
||||
|
||||
@@ -44,6 +46,7 @@ const UserButton = forwardRef<HTMLButtonElement, UserButtonProps>(
|
||||
);
|
||||
|
||||
export function MantineUserCard() {
|
||||
const { t } = useTranslation('common');
|
||||
const { user, isAuthenticated } = useUser();
|
||||
return (
|
||||
isAuthenticated && (
|
||||
@@ -56,7 +59,9 @@ export function MantineUserCard() {
|
||||
/>
|
||||
</Menu.Target>
|
||||
<Menu.Dropdown>
|
||||
<Menu.Item>Logout</Menu.Item>
|
||||
<Menu.Item component="a" href={route('auth.logout').path}>
|
||||
{t('logout')}
|
||||
</Menu.Item>
|
||||
</Menu.Dropdown>
|
||||
</Menu>
|
||||
)
|
||||
|
||||
@@ -50,8 +50,8 @@ export default function MantineNavbar() {
|
||||
<MantineLanguageSwitcher />
|
||||
{!isAuthenticated ? (
|
||||
<Button
|
||||
component={Link}
|
||||
href={route('auth.login').url}
|
||||
component="a"
|
||||
href={route('auth').path}
|
||||
visibleFrom="sm"
|
||||
w={110}
|
||||
>
|
||||
@@ -60,7 +60,7 @@ export default function MantineNavbar() {
|
||||
) : (
|
||||
<Button
|
||||
component={Link}
|
||||
href={route('dashboard').url}
|
||||
href={route('dashboard').path}
|
||||
visibleFrom="sm"
|
||||
w={110}
|
||||
>
|
||||
@@ -102,7 +102,7 @@ export default function MantineNavbar() {
|
||||
|
||||
<Group justify="center" grow pb="xl" px="md">
|
||||
{!isAuthenticated ? (
|
||||
<Button component={Link} href={route('auth.login').url}>
|
||||
<Button component="a" href={route('auth').path}>
|
||||
{t('login')}
|
||||
</Button>
|
||||
) : (
|
||||
|
||||
@@ -97,7 +97,7 @@ export default function Navbar() {
|
||||
<ModalSettings openItem={DropdownItemButtonWithPadding} />
|
||||
</li>
|
||||
<li>
|
||||
<Link href={route('auth.login').url}>{t('login')}</Link>
|
||||
<Link href={route('auth').path}>{t('login')}</Link>
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -8,29 +8,26 @@ import frResourceAbout from './locales/fr/about.json';
|
||||
import frResourceAdmin from './locales/fr/admin.json';
|
||||
import frResourceCommon from './locales/fr/common.json';
|
||||
import frResourceHome from './locales/fr/home.json';
|
||||
import frResourceLogin from './locales/fr/login.json';
|
||||
|
||||
import frResourceLegal from './locales/fr/legal.json';
|
||||
import frResourcePrivacy from './locales/fr/privacy.json';
|
||||
import frResourceTerms from './locales/fr/terms.json';
|
||||
import frResourceLegal from './locales/fr/legal.json';
|
||||
|
||||
import { LS_LANG_KEY } from '~/constants';
|
||||
import enResourceAbout from './locales/en/about.json';
|
||||
import enResourceAdmin from './locales/en/admin.json';
|
||||
import enResourceCommon from './locales/en/common.json';
|
||||
import enResourceHome from './locales/en/home.json';
|
||||
import enResourceLogin from './locales/en/login.json';
|
||||
|
||||
import enResourceLegal from './locales/en/legal.json';
|
||||
import enResourcePrivacy from './locales/en/privacy.json';
|
||||
import enResourceTerms from './locales/en/terms.json';
|
||||
import enResourceLegal from './locales/en/legal.json';
|
||||
|
||||
type I18nFR =
|
||||
| RemoveSuffix<Leaves<typeof frResourceAbout>>
|
||||
| RemoveSuffix<Leaves<typeof frResourceAdmin>>
|
||||
| RemoveSuffix<Leaves<typeof frResourceCommon>>
|
||||
| RemoveSuffix<Leaves<typeof frResourceHome>>
|
||||
| RemoveSuffix<Leaves<typeof frResourceLogin>>
|
||||
| RemoveSuffix<Leaves<typeof frResourcePrivacy>>
|
||||
| RemoveSuffix<Leaves<typeof frResourceTerms>>
|
||||
| RemoveSuffix<Leaves<typeof frResourceLegal>>;
|
||||
@@ -42,7 +39,6 @@ export const resources = {
|
||||
admin: enResourceAdmin,
|
||||
common: enResourceCommon,
|
||||
home: enResourceHome,
|
||||
login: enResourceLogin,
|
||||
privacy: enResourcePrivacy,
|
||||
terms: enResourceTerms,
|
||||
legal: enResourceLegal,
|
||||
@@ -52,7 +48,6 @@ export const resources = {
|
||||
admin: frResourceAdmin,
|
||||
common: frResourceCommon,
|
||||
home: frResourceHome,
|
||||
login: frResourceLogin,
|
||||
privacy: frResourcePrivacy,
|
||||
terms: frResourceTerms,
|
||||
legal: frResourceLegal,
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"title": "Authentication",
|
||||
"informative-text": "Authentication required to use MyLinks",
|
||||
"continue-with": "Continue with {{provider}}",
|
||||
"accept-terms": "By continuing, you accept the"
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"title": "Authentification",
|
||||
"informative-text": "Authentification requise pour utiliser MyLinks",
|
||||
"continue-with": "Continuer avec {{provider}}",
|
||||
"accept-terms": "En poursuivant, vous acceptez les"
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
import styled from '@emotion/styled';
|
||||
import { Head, Link } from '@inertiajs/react';
|
||||
import { route } from '@izzyjs/route/client';
|
||||
import { ReactNode } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { FcGoogle } from 'react-icons/fc';
|
||||
import Button from '~/components/common/form/_button';
|
||||
import ContentLayout from '~/components/layouts/content_layout';
|
||||
import Quotes from '~/components/quotes';
|
||||
|
||||
const LoginContainer = styled.div({
|
||||
width: '100%',
|
||||
maxWidth: '100%',
|
||||
whiteSpace: 'nowrap',
|
||||
marginTop: '50px',
|
||||
paddingInline: '1rem',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '1.5em',
|
||||
flexDirection: 'column',
|
||||
});
|
||||
|
||||
const FormWrapper = styled.div(({ theme }) => ({
|
||||
width: '500px',
|
||||
maxWidth: '100%',
|
||||
backgroundColor: theme.colors.secondary,
|
||||
padding: '2em',
|
||||
borderRadius: theme.border.radius,
|
||||
border: `1px solid ${theme.colors.lightGrey}`,
|
||||
display: 'flex',
|
||||
gap: '1em',
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
flexDirection: 'column',
|
||||
}));
|
||||
|
||||
const InformativeText = styled.p(({ theme }) => ({
|
||||
width: '100%',
|
||||
padding: '10px',
|
||||
textAlign: 'center',
|
||||
color: theme.colors.darkBlue,
|
||||
backgroundColor: theme.colors.lightestBlue,
|
||||
borderRadius: theme.border.radius,
|
||||
}));
|
||||
|
||||
const AgreementText = styled.p(({ theme }) => ({
|
||||
color: theme.colors.grey,
|
||||
}));
|
||||
|
||||
const ButtonLink = styled(Button.withComponent('a'))({
|
||||
display: 'flex',
|
||||
gap: '0.35em',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
});
|
||||
|
||||
function LoginPage() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<LoginContainer>
|
||||
<Head title={t('login:title')} />
|
||||
<img
|
||||
src={'/logo-light.png'}
|
||||
width={300}
|
||||
height={100}
|
||||
alt="MyLinks's logo"
|
||||
/>
|
||||
<Quotes css={{ marginBottom: '3em' }}>{t('common:slogan')}</Quotes>
|
||||
<FormWrapper>
|
||||
<h1>{t('login:title')}</h1>
|
||||
<InformativeText>{t('login:informative-text')}</InformativeText>
|
||||
<ButtonLink href={route('auth.google').url}>
|
||||
<FcGoogle size="1.5em" />{' '}
|
||||
{t('login:continue-with', { provider: 'Google' })}
|
||||
</ButtonLink>
|
||||
</FormWrapper>
|
||||
<AgreementText>
|
||||
{t('login:accept-terms')}{' '}
|
||||
<Link href={route('terms').url}>{t('common:terms')}</Link>
|
||||
</AgreementText>
|
||||
</LoginContainer>
|
||||
);
|
||||
}
|
||||
|
||||
LoginPage.layout = (page: ReactNode) => (
|
||||
<ContentLayout
|
||||
children={page}
|
||||
css={{ display: 'flex', alignItems: 'center' }}
|
||||
/>
|
||||
);
|
||||
export default LoginPage;
|
||||
Reference in New Issue
Block a user