|
3 | 3 | import { useEffect, useState } from 'react' |
4 | 4 | import { GithubIcon, GoogleIcon } from '@/components/icons' |
5 | 5 | import { Button } from '@/components/ui/button' |
6 | | -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip' |
7 | 6 | import { client } from '@/lib/auth-client' |
8 | 7 |
|
9 | 8 | interface SocialLoginButtonsProps { |
@@ -114,58 +113,16 @@ export function SocialLoginButtons({ |
114 | 113 | </Button> |
115 | 114 | ) |
116 | 115 |
|
117 | | - const renderGithubButton = () => { |
118 | | - if (githubAvailable) return githubButton |
119 | | - |
120 | | - return ( |
121 | | - <TooltipProvider> |
122 | | - <Tooltip> |
123 | | - <TooltipTrigger asChild> |
124 | | - <div>{githubButton}</div> |
125 | | - </TooltipTrigger> |
126 | | - <TooltipContent className='border-neutral-700 bg-neutral-800 text-white'> |
127 | | - <p> |
128 | | - GitHub login requires OAuth credentials to be configured. Add the following |
129 | | - environment variables: |
130 | | - </p> |
131 | | - <ul className='mt-2 space-y-1 text-neutral-300 text-xs'> |
132 | | - <li>• GITHUB_CLIENT_ID</li> |
133 | | - <li>• GITHUB_CLIENT_SECRET</li> |
134 | | - </ul> |
135 | | - </TooltipContent> |
136 | | - </Tooltip> |
137 | | - </TooltipProvider> |
138 | | - ) |
139 | | - } |
| 116 | + const hasAnyOAuthProvider = githubAvailable || googleAvailable |
140 | 117 |
|
141 | | - const renderGoogleButton = () => { |
142 | | - if (googleAvailable) return googleButton |
143 | | - |
144 | | - return ( |
145 | | - <TooltipProvider> |
146 | | - <Tooltip> |
147 | | - <TooltipTrigger asChild> |
148 | | - <div>{googleButton}</div> |
149 | | - </TooltipTrigger> |
150 | | - <TooltipContent className='border-neutral-700 bg-neutral-800 text-white'> |
151 | | - <p> |
152 | | - Google login requires OAuth credentials to be configured. Add the following |
153 | | - environment variables: |
154 | | - </p> |
155 | | - <ul className='mt-2 space-y-1 text-neutral-300 text-xs'> |
156 | | - <li>• GOOGLE_CLIENT_ID</li> |
157 | | - <li>• GOOGLE_CLIENT_SECRET</li> |
158 | | - </ul> |
159 | | - </TooltipContent> |
160 | | - </Tooltip> |
161 | | - </TooltipProvider> |
162 | | - ) |
| 118 | + if (!hasAnyOAuthProvider) { |
| 119 | + return null |
163 | 120 | } |
164 | 121 |
|
165 | 122 | return ( |
166 | 123 | <div className='grid gap-3'> |
167 | | - {renderGithubButton()} |
168 | | - {renderGoogleButton()} |
| 124 | + {githubAvailable && githubButton} |
| 125 | + {googleAvailable && googleButton} |
169 | 126 | </div> |
170 | 127 | ) |
171 | 128 | } |
0 commit comments