Display a warning on mobile devices #42
- Center the cards on home intro when there's only one column
- Display a warning on mobile devices
Summary by CodeRabbit#
New Features
- Mobile device detection automatically routes mobile users to a dedicated mobile-optimized interface.
- Warning notification displays for users accessing the app on mobile devices.
UI/UX Improvements
- Features list is now center-aligned for better visual presentation.
- "Get started" button is disabled on mobile devices.
- 1
🚀 Preview Deployment#
Status: ✅ Ready!
Preview URL: Open Preview
Commit:
327321981e443af40572892894c76fd5fda405bcBuilt and deployed successfully
Actionable comments posted: 1
📜 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 33ca4a2cd35fe646d7aaf0b4b67c2c38035003de and ad1c73ba1bdc7821cc3fd3ce7a1477ea220e660f.
📒 Files selected for processing (4)
src/components/HomeIntro.tsxsrc/routeTree.gen.tssrc/routes/index.tsxsrc/routes/mobile.tsx
🧰 Additional context used
📓 Path-based instructions (3)
src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Always ensure no formatting/linting issues exist in code - use
pnpm check --fixto automatically fix issuesFiles:
src/components/HomeIntro.tsxsrc/routes/mobile.tsxsrc/routeTree.gen.tssrc/routes/index.tsx
**/*.{tsx,ts}
📄 CodeRabbit inference engine (AGENTS.md)
Prefer functions over arrow functions for React components
Files:
src/components/HomeIntro.tsxsrc/routes/mobile.tsxsrc/routeTree.gen.tssrc/routes/index.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Prefer
typeoverinterfacefor type definitionsFiles:
src/components/HomeIntro.tsxsrc/routes/mobile.tsxsrc/routeTree.gen.tssrc/routes/index.tsx
🧠 Learnings (3)
📚 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/components/HomeIntro.tsxsrc/routes/mobile.tsxsrc/routes/index.tsx
📚 Learning: 2025-12-28T23:34:13.416Z
Learnt from: fulopkovacs Repo: fulopkovacs/trytanstackdb.com PR: 32 File: src/components/HomeIntro.tsx:16-25 Timestamp: 2025-12-28T23:34:13.416Z Learning: In Motion (motion/react), when configuring variant transitions, use delayChildren: stagger(x) to create per-child delays (e.g., delayChildren: stagger(0.2)). This is different from the older API that used a separate staggerChildren property. Apply this guidance to TSX files that declare motion variants (e.g., in src/components/**/*.tsx) and verify that stagger is imported from framer-motion. Ensure transitions reflect the intended stagger timing and that no conflicting delay values override the staggered effect.Applied to files:
src/components/HomeIntro.tsxsrc/routes/mobile.tsxsrc/routes/index.tsx
📚 Learning: 2025-12-29T13:20:08.388Z
Learnt from: CR Repo: fulopkovacs/trytanstackdb.com PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-12-29T13:20:08.388Z Learning: Applies to src/route/__root.tsx : The root route is located at `src/route/__root.tsx` in this TanStack Start projectApplied to files:
src/routes/mobile.tsxsrc/routeTree.gen.tssrc/routes/index.tsx
🧬 Code graph analysis (3)
src/components/HomeIntro.tsx (4)
src/components/ui/card.tsx (2)
CardContent(91-91)CardFooter(87-87)
src/components/ui/button.tsx (1)
Button(63-63)
src/components/ui/sidebar.tsx (1)
isMobile(98-100)
src/hooks/use-mobile.ts (1)
setIsMobile(12-14)
src/routes/mobile.tsx (2)
src/routes/index.tsx (1)
Route(12-26)
src/components/HomeIntro.tsx (1)
HomeIntro(63-185)
src/routes/index.tsx (1)
src/routes/mobile.tsx (1)
Route(4-6)
🔇 Additional comments (5)
src/components/HomeIntro.tsx (3)
66-66: LGTM! Clean prop addition.The
isMobileprop with an optional default value is well-structured and integrates cleanly with the existing props.Also applies to: 70-70
127-127: Good centering adjustment.Adding
justify-centerensures the feature cards are centered when they wrap to a single column, improving the mobile layout.
148-153: Clear mobile UX with appropriate guardrails.The warning message clearly communicates the limitation, and disabling the button prevents mobile users from encountering a broken experience.
Also applies to: 159-159
src/routes/index.tsx (1)
5-10: Server function implementation looks correct.The user-agent detection logic is straightforward and covers common mobile devices.
src/routes/mobile.tsx (1)
8-14: LGTM! Clean mobile route implementation.The route correctly renders
HomeIntrowith the mobile configuration, providing a dedicated landing page for mobile users.@@ -1,4 +1,20 @@11 import { createFileRoute, redirect } from "@tanstack/react-router";2+import { createServerFn } from "@tanstack/react-start";3+import { getRequestHeader } from "@tanstack/react-start/server";4+5+const getIsMobile = createServerFn().handler(async () => {6+ const userAgent = getRequestHeader("user-agent") || "";7+ const mobileRegex =8+ /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;9+ return mobileRegex.test(userAgent);10+});211312 export const Route = createFileRoute("/")({413 beforeLoad: async () => {14+ const isMobile = await getIsMobile();15+16+ if (isMobile) {17+ throw redirect({18+ to: "/mobile",19+ });20+ }⚠️ Potential issue | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
# Check route files and their structure find src/routes -type f \( -name "*.tsx" -o -name "*.ts" \) | head -20Repository: fulopkovacs/trytanstackdb.com
Length of output: 364
🏁 Script executed:
# Check all route definitions rg -n "createFileRoute" src/routes/ -A 2 -B 1Repository: fulopkovacs/trytanstackdb.com
Length of output: 4315
🏁 Script executed:
# Look for mobile detection in all route files rg -n "isMobile|mobile" src/routes/ -B 2 -A 2Repository: fulopkovacs/trytanstackdb.com
Length of output: 1433
🏁 Script executed:
cat -n src/routes/__root.tsxRepository: fulopkovacs/trytanstackdb.com
Length of output: 9855
🏁 Script executed:
# Check the tutorial routes to see if they have any auth guards cat -n src/routes/_tutorial.tsxRepository: fulopkovacs/trytanstackdb.com
Length of output: 1526
🏁 Script executed:
# Check if there's any auth or middleware setup rg -n "beforeLoad|loader" src/routes/__root.tsx -A 5Repository: fulopkovacs/trytanstackdb.com
Length of output: 55
🏁 Script executed:
cat -n src/routes/index.tsxRepository: fulopkovacs/trytanstackdb.com
Length of output: 955
Add mobile detection to the root route to apply to all navigations.
Mobile users can bypass the check by accessing routes directly. The mobile detection in the
"/"route'sbeforeLoadhook only runs when users navigate through the home page. Users who directly access/_tutorial/_db/projects(via bookmark, direct link, or browser history) bypass this check entirely and won't see the mobile warning.The recommended solution is to add mobile detection to
__root.tsxso it runs for all routes:Example implementation
Add a
beforeLoadhook to the root route that checks mobile status and redirects appropriately before any route component is loaded.🤖 Prompt for AI Agents
In src/routes/index.tsx around lines 14-20 the mobile detection is only run on the "/" route so direct navigations to other routes bypass it; move this logic into the root route (src/routes/__root.tsx) by adding a beforeLoad hook that calls getIsMobile() on every navigation and performs the same redirect to "/mobile" when true; ensure the hook is async, returns/throws the redirect in the framework's expected way, and avoid duplicating logic by importing or extracting the existing getIsMobile check so all routes are covered.✅ Addressed in commit 3273219
fuko merged this1f9cda5
fuko closed this
Sign in to join this conversation.
Warning
Rate limit exceeded#
@fulopkovacs has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 12 seconds before requesting another review.
⌛ How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the
@coderabbitai reviewcommand as a PR comment. Alternatively, push new commits to this PR.We recommend that you space out your commits to avoid hitting the rate limit.
🚦 How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.
📥 Commits
Reviewing files that changed from the base of the PR and between ad1c73ba1bdc7821cc3fd3ce7a1477ea220e660f and 327321981e443af40572892894c76fd5fda405bc.
📒 Files selected for processing (2)
src/routes/__root.tsxsrc/server/functions/getIsMobile.tsWalkthrough#
This PR adds mobile device detection and routing. A server-side helper inspects the request user-agent in the index route's beforeLoad hook and conditionally redirects mobile clients to a new
/mobileroute. The HomeIntro component accepts anisMobileprop to render mobile-specific UI adjustments, including a warning message and a disabled "Get started" button.Changes#
src/components/HomeIntro.tsxisMobileprop (default: false) to component signature and types. When true, renders a mobile warning paragraph and disables the "Get started" button. Addedjustify-centerto features list for center alignment.src/routes/index.tsxgetIsMobile()helper that inspects the request user-agent header. Updated beforeLoad hook to redirect mobile clients to/mobileand non-mobile clients to/projects.src/routes/mobile.tsx/mobileusing TanStack Router. Renders HomeIntro with mobile-specific props:activeStep={null},showIntro={true},isMobile={true}.src/routeTree.gen.ts/mobileroute metadata.Sequence Diagram#
Estimated code review effort#
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs#
Pre-merge checks and finishing touches#
❌ Failed checks (1 warning)
@coderabbitai generate docstringsto improve docstring coverage.✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share