Skip to content

Commit

Permalink
chore: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gustaveWPM committed Apr 21, 2024
1 parent 2f4682f commit 6efa9cc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/components/layouts/navbar/NavbarLoginButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import UserImage from '@/components/ui/hoc/UserImage';
import { useSession, signIn } from 'next-auth/react';
import handleSignOut from '@/lib/misc/handleSignOut';
import { Button } from '@/components/ui/Button';
import { signInProvider } from '@/config/auth';
import { useScopedI18n } from '@/i18n/client';
import { usePathname } from 'next/navigation';
import ROUTES_ROOTS from '##/config/routes';
Expand All @@ -23,6 +24,7 @@ interface NavbarLoginButtonMobileProps extends WithSession {
interface NavbarLoginButtonProps extends WithIsMobile {}

const { SIZE_PX_VALUE: SIZE } = NAVBAR_ICON_STYLE;
const provider = signInProvider;

const NavbarLoginButtonMobile: FunctionComponent<NavbarLoginButtonMobileProps> = ({ currentPathname, session }) => {
const scopedT = useScopedI18n(i18ns.auth);
Expand All @@ -39,7 +41,7 @@ const NavbarLoginButtonMobile: FunctionComponent<NavbarLoginButtonMobileProps> =
}

return (
<Button onClick={() => signIn('discord', { callbackUrl: ROUTES_ROOTS.DASHBOARD })} withTransparentBackground className={className}>
<Button onClick={() => signIn(provider, { callbackUrl: ROUTES_ROOTS.DASHBOARD })} withTransparentBackground className={className}>
<KeyIcon height={SIZE} width={SIZE} />
<span className="sr-only">{scopedT('login')}</span>
</Button>
Expand All @@ -62,7 +64,7 @@ const NavbarLoginButton: FunctionComponent<NavbarLoginButtonProps> = ({ isMobile
/>
);

return <NavbarButton onClick={() => signIn('discord', { callbackUrl: ROUTES_ROOTS.DASHBOARD })} i18nTitle={`${auth}.login`} />;
return <NavbarButton onClick={() => signIn(provider, { callbackUrl: ROUTES_ROOTS.DASHBOARD })} i18nTitle={`${auth}.login`} />;
};

export default NavbarLoginButton;
3 changes: 2 additions & 1 deletion src/components/ui/cta/SignupButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { FunctionComponent } from 'react';

import BUTTON_CONFIG from '@/components/config/styles/buttons';
import { Button } from '@/components/ui/Button';
import { signInProvider } from '@/config/auth';
import { useScopedI18n } from '@/i18n/client';
import ROUTES_ROOTS from '##/config/routes';
import { signIn } from 'next-auth/react';
Expand All @@ -20,7 +21,7 @@ const SignupButton: FunctionComponent<SignUpButtonProps> = () => {
const className = BUTTON_CONFIG.CLASSNAME;

return (
<Button onClick={() => signIn('discord', { callbackUrl: ROUTES_ROOTS.DASHBOARD })} className={className} size="lg">
<Button onClick={() => signIn(signInProvider, { callbackUrl: ROUTES_ROOTS.DASHBOARD })} className={className} size="lg">
{capitalize(scopedT('signup'))}
</Button>
);
Expand Down
2 changes: 2 additions & 0 deletions src/config/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const AUTH_SECRETS_SEP = ';;;;;;';
// See also: https://github.com/nextauthjs/next-auth/issues/10633
const secret = 'huuuummmmm';

export const signInProvider = 'discord';

const config = {
providers: [
Discord({
Expand Down

0 comments on commit 6efa9cc

Please sign in to comment.