Add logout confirmation dialog
Add Logout Confirmation Dialog
Current Problem
Currently, logout is handled entirely by Clerk's built-in UserButton component in src/components/Navbar.tsx. When users click sign out, they are logged out instantly without confirmation, which can cause accidental logouts.
What Needs to Be Done
Since the app uses Clerk's UserButton with afterSignOutUrl="/", there are two approaches:
Option A (Recommended): Use Clerk's <UserButton.MenuItems> to add a custom "Sign Out" menu item that triggers a confirmation dialog before calling signOut() from @clerk/nextjs.
Option B: Replace UserButton with a custom dropdown that includes a logout option with a confirmation modal using shadcn/ui AlertDialog.
Implementation Details
- Create a confirmation dialog component using shadcn/ui
AlertDialog - Dialog should show: "Are you sure you want to log out?"
- Two buttons: "Cancel" (closes dialog) and "Confirm" (calls Clerk signOut)
- Match the app's existing dark/light theme styling
Files to Modify
src/components/Navbar.tsx— UserButton section (line ~160)- May need new:
src/components/LogoutDialog.tsx
Acceptance Criteria
- [ ] Clicking logout shows a confirmation dialog
- [ ] "Cancel" keeps user logged in
- [ ] "Confirm" signs the user out and redirects to homepage
- [ ] Dialog supports dark and light mode
- [ ] Works on mobile and desktop
@Suraj-kumar00 kindly assign me this issue under GSSoC '25 and suitable 'level' and other labels.
I don't think this is good. can you check existing issue?