Skip to content

feat(home): auth-aware landing page navigation#3743

Merged
waleedlatif1 merged 5 commits intostagingfrom
waleedlatif1/home-nav-fix
Mar 24, 2026
Merged

feat(home): auth-aware landing page navigation#3743
waleedlatif1 merged 5 commits intostagingfrom
waleedlatif1/home-nav-fix

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Authenticated users visiting / are redirected to /workspace via middleware (replaces old ?from param with ?home bypass)
  • Landing page navbar shows "Go to App" instead of "Log in / Get started" for authenticated users
  • Logo links to /?home for authenticated users so they stay in marketing context
  • Settings "Home Page" button opens /?home to let users browse landing without redirect
  • Handles isPending session state to prevent CTA button flash
  • Mobile menu nav links also apply auth-aware href transforms

Type of Change

  • New feature (non-breaking change which adds functionality)

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

- Redirect authenticated users from / to /workspace via middleware (?home param bypasses)
- Show "Go to App" instead of "Log in / Get started" in navbar for authenticated users
- Logo links to /?home for authenticated users to stay in marketing context
- Settings "Home Page" button opens /?home
- Handle isPending session state to prevent CTA button flash
@vercel
Copy link

vercel bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 24, 2026 7:55pm

Request Review

@cursor
Copy link

cursor bot commented Mar 24, 2026

PR Summary

Medium Risk
Changes hosted root-path redirect behavior and landing CTAs based on session state, which can affect user routing between marketing pages and /workspace. Risk is moderate due to reliance on query-param bypass (?home) and potential redirect/UX edge cases.

Overview
Makes the hosted homepage navigation auth-aware by introducing a ?home query-parameter bypass for authenticated users.

Authenticated sessions hitting / now redirect to /workspace unless ?home is present (proxy.ts), while both the home and landing navbars update logo/anchor links to preserve the ?home context and swap Log in / Get started for a Go to App CTA (hidden while useSession is pending to avoid button flash). The settings "Home Page" button is updated to open /?home.

Written by Cursor Bugbot for commit a677d8d. Configure here.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 24, 2026

Greptile Summary

This PR introduces auth-aware navigation across the landing and home pages. Authenticated users visiting / are now redirected to /workspace by the middleware unless they carry a ?home query parameter, which replaces the previous ?from convention. Both navbar components ((home) and (landing)) detect session state via useSession and switch the CTA from "Log in / Get started" to "Go to App", rewrite the logo href to /?home, and transform hash-anchor nav links (e.g. /#pricing/?home#pricing) so authenticated users can browse the marketing site without being bounced. The Settings "Home Page" button is also updated to use the new ?home bypass. isSessionPending hides auth buttons during session resolution to prevent a visible flash.

Key changes:

  • proxy.ts: ?home parameter now gates the landing-page bypass (replaces ?from)
  • navbar.tsx / nav.tsx: Both navbars are auth-aware — "Go to App" for authenticated users, with isSessionPending guard to prevent CTA flash
  • general.tsx: Settings "Home Page" button updated to /?home
  • Minor style inconsistency: nav.tsx uses a template literal for the invisible class instead of the cn() utility used elsewhere in the PR

Confidence Score: 4/5

  • Safe to merge — the auth-aware nav logic is correct, the middleware bypass is sound, and prior review concerns have been addressed.
  • All previous comments about ?from=nav dead parameters were resolved in a prior commit. The implementation is consistent across both nav components and the middleware. The only remaining issue is a minor style inconsistency in nav.tsx (template literal instead of cn() for conditional class), which is non-blocking.
  • No files require special attention.

Important Files Changed

Filename Overview
apps/sim/proxy.ts Clean, minimal change: replaces the ?from query-parameter bypass with ?home, aligning middleware logic with the new naming convention. No other middleware behaviour is altered.
apps/sim/app/(home)/components/navbar/navbar.tsx Auth-aware nav: session state drives "Go to App" vs "Log in / Get started", logo and hash links get ?home appended for authenticated users, and isSessionPending hides the CTA area to prevent flash. Desktop and mobile menus are both updated consistently.
apps/sim/app/(landing)/components/nav/nav.tsx Same auth-aware changes as the home navbar (session check, useHomeLinks, logo href, Pricing link). One minor style inconsistency: uses a template literal for the isSessionPending invisible class instead of the project-standard cn() utility.
apps/sim/app/workspace/[workspaceId]/settings/components/general/general.tsx Single-line update: the "Home Page" button now opens /?home instead of the now-dead /?from=settings, keeping settings consistent with the new bypass convention.
bun.lock Adds configVersion: 0 field to the lockfile — an automatic Bun tooling change with no functional impact.

Sequence Diagram

sequenceDiagram
    participant U as User (Browser)
    participant M as Middleware (proxy.ts)
    participant LP as Landing Page (/)
    participant WS as Workspace (/workspace)

    Note over U,WS: Unauthenticated user
    U->>M: GET /
    M->>LP: next() — no session, show landing page
    LP-->>U: Nav shows "Log in / Get started"

    Note over U,WS: Authenticated user — direct visit
    U->>M: GET /
    M->>WS: redirect(/workspace) — has session, no ?home
    WS-->>U: Workspace UI

    Note over U,WS: Authenticated user — intentional landing page browse
    U->>M: GET /?home
    M->>LP: next() — has session BUT ?home present, bypass redirect
    LP-->>U: Nav shows "Go to App", logo → /?home, Pricing → /?home#pricing

    Note over U,WS: Authenticated user via Settings "Home Page" button
    U->>M: GET /?home (new tab)
    M->>LP: next() — ?home bypass
    LP-->>U: Landing page in marketing context
Loading

Reviews (3): Last reviewed commit: "fix(home): preserve ?home param in nav l..." | Re-trigger Greptile

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@greptile

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@waleedlatif1 waleedlatif1 merged commit 34ea99e into staging Mar 24, 2026
6 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/home-nav-fix branch March 24, 2026 19:59
Sg312 pushed a commit that referenced this pull request Mar 24, 2026
* feat(home): auth-aware landing page navigation

- Redirect authenticated users from / to /workspace via middleware (?home param bypasses)
- Show "Go to App" instead of "Log in / Get started" in navbar for authenticated users
- Logo links to /?home for authenticated users to stay in marketing context
- Settings "Home Page" button opens /?home
- Handle isPending session state to prevent CTA button flash

* lint

* fix(home): remove stale ?from=nav params in landing nav

* fix(home): preserve ?home param in nav links during session pending state

* lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant