Show the intro pages for first-time visitors #26
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.
- 1
🚀 Preview Deployment#
Status: ✅ Ready!
Preview URL: Open Preview
Commit:
31b8a1d31c13a963133e6692f50fbfb33898e82bBuilt and deployed successfully
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 nowintro. 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 beundefinedin the output, making.optional()somewhat redundant for the output type.Additionally, the
HomeIntrocomponent's prop type includesundefined("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 removeundefined:// 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.tsxsrc/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 Useshadcn/uifor UI componentsFiles:
src/routes/_tutorial.tsxsrc/components/HomeIntro.tsx
src/**/*.{tsx,ts,css}
📄 CodeRabbit inference engine (AGENTS.md)
Use
tailwindcss(v4) for stylingFiles:
src/routes/_tutorial.tsxsrc/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 StartApplied 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.tsxsrc/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 forHomeIntro.tsxlines 16-22.Also applies to: 44-44
fuko merged this209e344
fuko closed this
Sign in to join this conversation.
Caution
Review failed#
The pull request is closed.
Walkthrough#
Renamed the search parameter
show_home_introtointroin the tutorial route and HomeIntro component. Updated route validation to includeintrowith default"true". HomeIntro now checksintrofor open state and navigates preserving other query params while settingintro: "false".Changes#
src/routes/_tutorial.tsxshow_home_introwithintroin the route's Zod search schema (addedintro: z.enum(["true","false"]).optional().default("true").catch("true")); updatedRoute.useSearch()destructuring to useintroand pass it intoHomeIntro.src/components/HomeIntro.tsxshow_home_intro→intro; initialization and condition checks switched tointro === "true";startTutorialnavigation now preserves existing query params and setsintro: "false"viasearch: (o) => ({ ...o, intro: "false" }).Estimated code review effort#
🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches#
❌ Failed checks (1 warning)
@coderabbitai generate docstringsto improve docstring coverage.✅ Passed checks (2 passed)
📜 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.tsxComment `@coderabbitai help` to get the list of available commands and usage tips.