fix(auth): resolve mobile layout collision and implement defensive runtime safeguards #175
fix(auth): resolve mobile layout collision and implement defensive runtime safeguards #175Soura149 wants to merge 1 commit into
Conversation
|
@Soura149 is attempting to deploy a commit to the Arsh Chauhan's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @arshchouhan , I have submitted a comprehensive PR to fix this layout issue (#163), which I originally opened and documented. While I noticed another contributor submitted an unassigned PR earlier, my PR provides a robust structural fix using clean layout flows that perfectly preserves the UI across all mobile breakpoints along with visual symmetry . Additionally, while working on the codebase, I implemented critical defensive safeguards to handle missing environment variables ( The fix and stability improvements are ready for review here: #175 Please let me know if any adjustments are needed! |
Closes: #163
This PR fixes a critical mobile layout collision bug on the Login page (
/loginand/register) where the top navigation elements ("Back to Home" and "Back" buttons) overlapped with the main heading text. Additionally, it addresses runtime client-side crashes that left the authentication pages completely blank/black when environment variables were missing or when local storage was corrupted.Contribution Context
This Pull Request directly addresses Issue #163, which was opened and documented by me. Due to temporary maintainer/mentor inactivity in assigning the issue, development was carried out independently to resolve the bug. This PR provides a comprehensive structural fix alongside vital defensive stability updates.
Root Causes Resolved
VITE_GOOGLE_CLIENT_IDenvironment variable was missing, the@react-oauth/googleprovider threw an unhandled runtime error on initialization, causing the entire React tree to crash.localStorageuser object was stored as an invalid JSON string (e.g. "undefined"), it threw a parsing exception and crashed the view.Changes Made
1. Dedicated Global Navigation Header
Frontend/src/pages/Login.jsxabsolute top-0 left-0 right-0 z-50 p-6 md:p-8).flex items-center justify-center min-h-screen relative z-10).2. Spacing Refactoring in Authentication Forms
Frontend/src/components/auth/LoginForm.jsx,Frontend/src/components/auth/RegisterForm.jsx,Frontend/src/components/auth/PhoneLoginForm.jsx<br/>) with fluid inline text elements in the subtitle.flex flex-col gap-y-6).pt-12) to the form wrappers. This pushes the main heading down dynamically, leaving a safe area below the top navigation header on all viewports.3. Client ID and Defensive Parsing Safeguards
Frontend/src/main.jsx"dummy-client-id") for theclientIdprop ofGoogleOAuthProviderto prevent load-time crashes if the environment variable is not set.Frontend/src/pages/Login.jsxJSON.parse(user)inside theuseEffectredirection hook in atry/catchblock. If parsing fails, it clears the local storage defensively instead of crashing the page.How to Verify and Test
/loginor/registerin your browser.###Screenshot:
