fix: update social login button to use enableGoogleLogin and enableGithubLogin configuration options
This commit is contained in:
parent
48270b17ee
commit
9046645006
@ -23,7 +23,10 @@ interface SocialLoginButtonProps {
|
||||
export const SocialLoginButton = ({
|
||||
callbackUrl: propCallbackUrl,
|
||||
}: SocialLoginButtonProps) => {
|
||||
if (websiteConfig.auth.disableGoogleLogin && websiteConfig.auth.disableGithubLogin) {
|
||||
if (
|
||||
!websiteConfig.auth.enableGoogleLogin &&
|
||||
!websiteConfig.auth.enableGithubLogin
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -91,35 +94,35 @@ export const SocialLoginButton = ({
|
||||
return (
|
||||
<div className="w-full flex flex-col gap-4">
|
||||
<DividerWithText text={t('or')} />
|
||||
{!websiteConfig.auth.disableGoogleLogin && (
|
||||
{websiteConfig.auth.enableGoogleLogin && (
|
||||
<Button
|
||||
size="lg"
|
||||
className="w-full cursor-pointer"
|
||||
variant="outline"
|
||||
onClick={() => onClick('google')}
|
||||
disabled={isLoading === 'google'}
|
||||
>
|
||||
{isLoading === 'google' ? (
|
||||
<Loader2Icon className="mr-2 size-4 animate-spin" />
|
||||
) : (
|
||||
<GoogleIcon className="size-4 mr-2" />
|
||||
)}
|
||||
>
|
||||
{isLoading === 'google' ? (
|
||||
<Loader2Icon className="mr-2 size-4 animate-spin" />
|
||||
) : (
|
||||
<GoogleIcon className="size-4 mr-2" />
|
||||
)}
|
||||
<span>{t('signInWithGoogle')}</span>
|
||||
</Button>
|
||||
)}
|
||||
{!websiteConfig.auth.disableGithubLogin && (
|
||||
{websiteConfig.auth.enableGithubLogin && (
|
||||
<Button
|
||||
size="lg"
|
||||
className="w-full cursor-pointer"
|
||||
variant="outline"
|
||||
onClick={() => onClick('github')}
|
||||
disabled={isLoading === 'github'}
|
||||
>
|
||||
{isLoading === 'github' ? (
|
||||
<Loader2Icon className="mr-2 size-4 animate-spin" />
|
||||
) : (
|
||||
<GitHubIcon className="size-4 mr-2" />
|
||||
)}
|
||||
>
|
||||
{isLoading === 'github' ? (
|
||||
<Loader2Icon className="mr-2 size-4 animate-spin" />
|
||||
) : (
|
||||
<GitHubIcon className="size-4 mr-2" />
|
||||
)}
|
||||
<span>{t('signInWithGitHub')}</span>
|
||||
</Button>
|
||||
)}
|
||||
|
@ -34,8 +34,8 @@ export const websiteConfig: WebsiteConfig = {
|
||||
enableSpeedInsights: false,
|
||||
},
|
||||
auth: {
|
||||
disableGoogleLogin: false,
|
||||
disableGithubLogin: false,
|
||||
enableGoogleLogin: true,
|
||||
enableGithubLogin: true,
|
||||
},
|
||||
i18n: {
|
||||
defaultLocale: 'en',
|
||||
|
4
src/types/index.d.ts
vendored
4
src/types/index.d.ts
vendored
@ -66,8 +66,8 @@ export interface AnalyticsConfig {
|
||||
}
|
||||
|
||||
export interface AuthConfig {
|
||||
disableGoogleLogin?: boolean; // Whether to disable google login
|
||||
disableGithubLogin?: boolean; // Whether to disable github login
|
||||
enableGoogleLogin?: boolean; // Whether to enable google login
|
||||
enableGithubLogin?: boolean; // Whether to enable github login
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user