Skip to content
Source
Sign inSign up
fuko/trytanstackdb.com

Show the intro pages for first-time visitors #26

Mergedfukomerged 2 commits intomain fromrefs/pull/26/headmerged by fuko View on GitHub

fukocommented

Previously, the intro pages were hidden by default, even for first-time visitors.

Summary by CodeRabbit

  • Refactor

    • Renamed tutorial query parameter to "intro" and updated component prop to match.
    • The intro now defaults to showing by default.
  • Bug Fix

    • Starting the tutorial now preserves existing URL parameters and explicitly disables the intro flag without dropping other query params.
✏️ Tip: You can customize this high-level summary in your review settings.
    1. Caution

      Review failed

      The pull request is closed.

      Walkthrough

      Renamed the search parameter show_home_intro to intro in the tutorial route and HomeIntro component. Updated route validation to include intro with default "true". HomeIntro now checks intro for open state and navigates preserving other query params while setting intro: "false".

      Changes

      Cohort / File(s)Summary
      Route params & validation
      src/routes/_tutorial.tsx
      Replaced show_home_intro with intro in the route's Zod search schema (added intro: z.enum(["true","false"]).optional().default("true").catch("true")); updated Route.useSearch() destructuring to use intro and pass it into HomeIntro.
      Component prop & navigation
      src/components/HomeIntro.tsx
      Renamed prop show_home_intro → intro; initialization and condition checks switched to intro === "true"; startTutorial navigation now preserves existing query params and sets intro: "false" via search: (o) => ({ ...o, intro: "false" }).

      Estimated code review effort

      🎯 3 (Moderate) | ⏱️ ~20 minutes

      Pre-merge checks and finishing touches

      ❌ Failed checks (1 warning)
      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.You can run @coderabbitai generate docstrings to improve docstring coverage.
      ✅ Passed checks (2 passed)
      Check nameStatusExplanation
      Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title check✅ PassedThe title clearly describes the main objective of the changeset: showing intro pages for first-time visitors by changing the default behavior of the intro parameter.

      📜 Recent review details

      Configuration used: Path: .coderabbit.yaml

      Review profile: CHILL

      Plan: Pro

      📥 Commits

      Reviewing files that changed from the base of the PR and between 31b8a1d31c13a963133e6692f50fbfb33898e82b and d65e748f70055b5d8648332d84d8d3838d27c8a0.

      📒 Files selected for processing (1)
      • src/components/HomeIntro.tsx

      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. 🚀 Preview Deployment

      Status: ✅ Ready!

      Preview URL: Open Preview

      Commit: 31b8a1d31c13a963133e6692f50fbfb33898e82b

      Built and deployed successfully

    3. Actionable comments posted: 0

      🧹 Nitpick comments (2)
      src/components/HomeIntro.tsx (1)

      16-22: Consider renaming the prop to match the query parameter.

      The component prop is named show_home_intro, but the actual query parameter in the URL is now intro. This naming inconsistency could cause confusion when debugging or maintaining the code.

      🔎 Proposed refactor to align prop name with query parameter
       export function HomeIntro({
         activeStep,
      -  show_home_intro,
      +  intro,
       }: {
         activeStep: string | null;
      -  show_home_intro: "true" | "false" | undefined;
      +  intro: "true" | "false" | undefined;
       }) {
         const [open, setOpen] = useState(
           activeStep === null ||
             // used for debugging
      -      show_home_intro === "true",
      +      intro === "true",
         );

      And update the route file accordingly:

      // src/routes/_tutorial.tsx
      <HomeIntro
        activeStep={tutorialData.tutorialStep}
        intro={intro}
      />
      src/routes/_tutorial.tsx (1)

      18-18: Consider simplifying the Zod schema.

      The combination of .optional().default("true").catch("true") is functionally correct but contains some redundancy. In Zod 4, .default() ensures the field will never be undefined in the output, making .optional() somewhat redundant for the output type.

      Additionally, the HomeIntro component's prop type includes undefined ("true" | "false" | undefined), but with .default("true") in place, the value will always be defined.

      🔎 Proposed simplification

      Option 1 - Remove .optional() since .default() handles undefined inputs:

      -intro: z.enum(["true", "false"]).optional().default("true").catch("true"),
      +intro: z.enum(["true", "false"]).default("true").catch("true"),

      Option 2 - If you want to keep .optional() for clarity at the input level, update the component type to remove undefined:

      // src/components/HomeIntro.tsx
      export function HomeIntro({
        activeStep,
        show_home_intro,
      }: {
        activeStep: string | null;
        show_home_intro: "true" | "false"; // Remove | undefined
      })
      📜 Review details

      Configuration used: Path: .coderabbit.yaml

      Review profile: CHILL

      Plan: Pro

      📥 Commits

      Reviewing files that changed from the base of the PR and between 879ef86ecc77ab32e5fd106446d030af8828a951 and 31b8a1d31c13a963133e6692f50fbfb33898e82b.

      📒 Files selected for processing (2)
      • src/components/HomeIntro.tsx
      • src/routes/_tutorial.tsx
      🧰 Additional context used
      📓 Path-based instructions (2)
      src/**/*.{tsx,ts}

      📄 CodeRabbit inference engine (AGENTS.md)

      src/**/*.{tsx,ts}: The project uses TanStack Start framework (@tanstack/start) with React for the frontend Use shadcn/ui for UI components

      Files:

      • src/routes/_tutorial.tsx
      • src/components/HomeIntro.tsx
      src/**/*.{tsx,ts,css}

      📄 CodeRabbit inference engine (AGENTS.md)

      Use tailwindcss (v4) for styling

      Files:

      • src/routes/_tutorial.tsx
      • src/components/HomeIntro.tsx
      🧠 Learnings (2)
      📚 Learning: 2025-12-24T15:55:57.531Z
      Learnt from: CR
      Repo: fulopkovacs/trytanstackdb.com PR: 0
      File: AGENTS.md:0-0
      Timestamp: 2025-12-24T15:55:57.531Z
      Learning: Applies to src/route/__root.tsx : The root route is located at `src/route/__root.tsx` in TanStack Start

      Applied to files:

      • src/routes/_tutorial.tsx
      📚 Learning: 2025-12-24T15:25:07.106Z
      Learnt from: fulopkovacs
      Repo: fulopkovacs/trytanstackdb.com PR: 22
      File: src/components/TodoBoards.tsx:63-81
      Timestamp: 2025-12-24T15:25:07.106Z
      Learning: In Tailwind CSS v4, prefer canonical classes using bg-linear-to-* (e.g., bg-linear-to-b, bg-linear-to-t, bg-linear-to-r) over the older bg-gradient-to-* syntax. This aligns with Tailwind LSP's suggestCanonicalClasses rule. Apply across TSX files (e.g., src/components/*.tsx); replace occurrences of bg-gradient-to-* with the corresponding bg-linear-to-* equivalents and verify gradients visually.

      Applied to files:

      • src/routes/_tutorial.tsx
      • src/components/HomeIntro.tsx
      🧬 Code graph analysis (1)
      src/routes/_tutorial.tsx (1)
      src/components/HomeIntro.tsx (1)
      • HomeIntro (16-144)
      🔇 Additional comments (2)
      src/components/HomeIntro.tsx (1)

      33-39: Navigation logic correctly updated.

      The search updater function properly preserves other query parameters while setting intro: "false", which aligns with the renamed query parameter in the route.

      src/routes/_tutorial.tsx (1)

      37-37: Query parameter handling is functionally correct.

      The destructuring and prop passing work correctly. However, note the naming inconsistency between the query parameter (intro) and the component prop (show_home_intro) mentioned in the review comment for HomeIntro.tsx lines 16-22.

      Also applies to: 44-44

    4. fuko merged this209e344

    5. fuko closed this

Sign in to join this conversation.