Repository navigation
fix(auth): enhance route protection, fix header button state, and embed email logo - #54
Merged
Merged
Conversation
remove the mounted state check and implemented tailwind-css based theme toggle remove /register from NAV_LINKS to keep it exclusively as a CTA button remove the logic waiting for isPending? and add optional session prop to header
… toast message spam
banuka20431
approved these changes
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Summary of Changes
This PR resolves several UI/UX glitches, enhances route protection and authorization handling, refactors verification email delivery, and cleans up code quality across authentication workflows.
1. 🎨 Header & Navigation Fixes
mounted-state check with zero-layout-shift Tailwind CSS dark mode variants (hidden dark:blockandblock dark:hidden)./registerfromNAV_LINKSso it acts exclusively as the primary CTA button without duplication or hydration pop-in.2. 🛡️ Route Protection & Session Validation
guard.ts): Added reusable layout-level server-side access control for protected role routes (/donor/*,/hospital/*,/admin/*)./loginwith an informative toast: "Please login first to access this page."/unauthorized) mirroring the app's error design system.Why
guard.tsoverproxy.ts/middleware.ts:In line with Next.js security guidelines, validating auth at the layout and Data-Access Layer ensures that sensitive Server Component payloads are never leaked during prefetching and avoids Edge runtime constraints when validating user roles against the database.
3. 📧 Email Verification & Workflow Improvements
4. 🚪 Logout & Login Button State Fix
router.refresh()) and flag-based navigation on logout.✨ Code Quality & Best Practices
eslintcleanly (0 errors, 0 warnings).tsc --noEmittype checking.headers()access and Server Component layout boundaries.