Skip to content

Commit 827b755

Browse files
committed
feat: Add success toast notification for user login with dynamic welcome message
1 parent 0d596f2 commit 827b755

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/assets/App.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,12 @@ Producthunt item
13331333
padding: 10px 20px;
13341334
border-radius: 10px;
13351335
}
1336-
1336+
.successToast {
1337+
background-color: #52c41a;
1338+
color: white;
1339+
padding: 10px 20px;
1340+
border-radius: 10px;
1341+
}
13371342
.capitalize {
13381343
text-transform: capitalize;
13391344
}

src/providers/AuthProvider.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
2323

2424
return signInWithCredential(firebaseAuth, authProvider).then((userCredential) => {
2525
const user = userCredential.user
26+
2627
initState({
2728
user: {
2829
name: user.displayName || 'Anonymous',
2930
imageURL: user.photoURL || '',
3031
},
3132
providerId: authProvider.providerId,
3233
})
34+
if (user.displayName) {
35+
toast(`Welcome, ${user.displayName}`, { theme: 'successToast' })
36+
}
3337
closeAuthModal()
3438
navigate(window.location.pathname, { replace: true })
3539
})

0 commit comments

Comments
 (0)