Skip to content

Commit 2309f4a

Browse files
committed
feat: add providerId handling and last connection indicator in AuthModal
1 parent cd2c390 commit 2309f4a

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/features/auth/components/AuthModal.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const githubAuthProvider = new GithubAuthProvider()
2020

2121
type AuthProvider = GoogleAuthProvider | GithubAuthProvider
2222
export const AuthModal = ({ showAuth }: AuthModalProps) => {
23-
const { closeAuthModal, authError, setAuthError } = useAuth()
23+
const { closeAuthModal, authError, setAuthError, providerId } = useAuth()
2424
const [selectedProvider, setSelectedProvider] = useState<AuthProvider>(googleAuthProvider)
2525
const getOauthLink = useGetOauthLink()
2626

@@ -96,14 +96,18 @@ export const AuthModal = ({ showAuth }: AuthModalProps) => {
9696
onClick={() => {
9797
signIn(githubAuthProvider)
9898
}}
99+
className="relative"
99100
size="medium">
101+
{providerId === 'github.com' && <span className="lastFlag">Last</span>}
100102
Connect with Github
101103
</Button>
102104
<Button
103105
isLoading={getOauthLink.isLoading && getOauthLink.data?.['provider'] === 'google.com'}
104106
startIcon={<FcGoogle style={{ fontSize: '1.5em' }} />}
105107
onClick={() => signIn(googleAuthProvider)}
108+
className="relative"
106109
size="medium">
110+
{providerId === 'google.com' && <span className="lastFlag">Last</span>}
107111
Connect with Google
108112
</Button>
109113
</div>

src/features/auth/components/authModal.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,19 @@
1616
width: 100%;
1717
margin: 0 0 20px 0;
1818
}
19-
19+
.authModal .relative {
20+
position: relative;
21+
}
22+
.authModal .lastFlag {
23+
position: absolute;
24+
right: -6px;
25+
top: -6px;
26+
background: var(--tooltip-accent-color);
27+
font-size: 0.7em;
28+
color: white;
29+
border-radius: 12px;
30+
padding: 0 4px;
31+
}
2032
.authModal .description {
2133
padding: 20px;
2234
text-align: center;

0 commit comments

Comments
 (0)