Skip to content

Conversation

@TBau23
Copy link

@TBau23 TBau23 commented Nov 27, 2025

What does this PR do?

Adds a user preference setting to choose their default home view (landing page). When users visit the root URL (/), they are automatically redirected to either Event Types or Bookings based on their saved preference.

Key Changes:

  • Added defaultHomeView field to user metadata schema with values "event-types" | "bookings"

  • Modified root redirect logic to respect user preference (defaults to "event-types" for backward compatibility)

  • Added dropdown control in Settings → My Account → General for users to set their preference

  • Preference is stored in existing metadata JSONB column (no migration required)

  • Fixes 13778 (GitHub issue number)

  • Fixes CAL-3176 (Linear issue number - should be visible at the bottom of the GitHub issue description)

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A - this is a user-facing feature change with no developer API impact.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

Environment Setup:

  • No special environment variables required
  • Requires a working database connection (standard Cal.com setup)

Test Scenarios:

  1. New User (No Preference Set)

    • Login as a user who hasn't set a preference
    • Visit / → should redirect to /event-types
  2. Set Preference to Bookings

    • Navigate to Settings → My Account → General
    • Find "Default Home View" dropdown
    • Select "Bookings"
    • Click "Update"
    • Verify success toast appears
    • Visit / → should redirect to /bookings/upcoming
  3. Set Preference to Event Types

    • Navigate to Settings → My Account → General
    • Change "Default Home View" to "Event Types"
    • Click "Update"
    • Visit / → should redirect to /event-types
  4. Persistence Test

    • Set preference to "Bookings"
    • Logout and login again
    • Visit / → should still redirect to /bookings/upcoming
  5. Onboarding Flow (Should Not Be Affected)

    • Create a new user who needs onboarding
    • Verify onboarding redirect still takes precedence over home view preference

Expected Behavior:

  • Dropdown appears in Settings → General after "Start of Week"
  • Form's "Update" button enables when selection changes
  • Success toast on save
  • Root URL redirects to chosen view
  • Preference persists across sessions
  • Defaults to "event-types" for backward compatibility

Checklist

  • I have read the contributing guide
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked if my changes generate no new warnings

Files Changed:

  • packages/prisma/zod-utils.ts - Added schema field
  • packages/trpc/server/routers/viewer/me/updateProfile.schema.ts - Whitelisted field for updates
  • apps/web/app/page.tsx - Added redirect logic
  • apps/web/modules/settings/my-account/general-view.tsx - Added UI control
  • apps/web/public/static/locales/en/common.json - Added translation keys

Technical Notes:

  • Uses existing metadata JSONB column (no database migration needed)
  • Type-safe with Zod validation
  • Backward compatible (defaults to existing behavior)
  • Integrates seamlessly with existing auth/onboarding flows

Summary by cubic

Adds a user setting to choose the default home view. Users are redirected to Bookings or Event Types on sign-in based on this preference.

  • New Features
    • Added "Default Home View" selector in My Account → General.
    • Saved preference in user metadata and allowed via updateProfile schema.
    • Updated app/page.tsx to redirect to /bookings/upcoming or /event-types based on the saved preference (defaults to Event Types).
    • Added i18n strings for the new setting.
      Written for commit 477e8e4. Summary will update automatically on new commits.

@vercel
Copy link

vercel bot commented Nov 27, 2025

@TBau23 is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 27, 2025

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "add a setting to change default home view". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@TBau23 TBau23 changed the title add a setting to change default home view feat: add a setting to change default home view Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants