feat: chat docked as the homepage command bar + suggested prompts (Catalog HQ 3/3, chat#1850)#1854
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds a new ChangesHome Suggested Prompts Feature
Estimated code review effort: 2 (Simple) | ~15 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant HomeSuggestedPrompts
participant getHomeSuggestedPrompts
participant VercelChatContext
HomeSuggestedPrompts->>getHomeSuggestedPrompts: compute prompts from valuation/tasks/artist state
getHomeSuggestedPrompts-->>HomeSuggestedPrompts: prompt chip list
User->>HomeSuggestedPrompts: click chip
HomeSuggestedPrompts->>VercelChatContext: setInput(prompt text)
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
Preview verification (sha 4dfc77e, https://chat-git-feat-home-command-bar-recoup.vercel.app/):
|
There was a problem hiding this comment.
1 issue found across 8 files
Confidence score: 4/5
- In
lib/home/getHomeSuggestedPrompts.ts,artistNameis checked/interpolated before trimming, so whitespace-only input can slip through and generate visibly broken suggested prompt text for users; trim (or normalize)artistNamebefore the truthiness check and interpolation before merging.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="lib/home/getHomeSuggestedPrompts.ts">
<violation number="1" location="lib/home/getHomeSuggestedPrompts.ts:50">
P2: `artistName` should be trimmed before truthiness checks and interpolation. A whitespace-only string (e.g. `" "`) is truthy in JavaScript, so it passes the `if (artistName)` gate and produces broken prompt copy like `"What should do this week?"`. Consider normalizing with `const trimmedArtistName = artistName.trim();` and using `trimmedArtistName` throughout the function for both the conditional and the interpolations.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| }); | ||
| } | ||
|
|
||
| if (artistName) { |
There was a problem hiding this comment.
P2: artistName should be trimmed before truthiness checks and interpolation. A whitespace-only string (e.g. " ") is truthy in JavaScript, so it passes the if (artistName) gate and produces broken prompt copy like "What should do this week?". Consider normalizing with const trimmedArtistName = artistName.trim(); and using trimmedArtistName throughout the function for both the conditional and the interpolations.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At lib/home/getHomeSuggestedPrompts.ts, line 50:
<comment>`artistName` should be trimmed before truthiness checks and interpolation. A whitespace-only string (e.g. `" "`) is truthy in JavaScript, so it passes the `if (artistName)` gate and produces broken prompt copy like `"What should do this week?"`. Consider normalizing with `const trimmedArtistName = artistName.trim();` and using `trimmedArtistName` throughout the function for both the conditional and the interpolations.</comment>
<file context>
@@ -0,0 +1,60 @@
+ });
+ }
+
+ if (artistName) {
+ prompts.push({
+ label: `What should ${artistName} do this week?`,
</file context>
5eb9fc8 to
c2d0e25
Compare
4dfc77e to
29ad23f
Compare
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
c2d0e25 to
2874fed
Compare
29ad23f to
efd97b8
Compare
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
2874fed to
3a596cc
Compare
efd97b8 to
a151df6
Compare
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
3a596cc to
21c7a77
Compare
a151df6 to
8d8f576
Compare
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
21c7a77 to
eb7e063
Compare
8d8f576 to
19d3b25
Compare
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
eb7e063 to
1aec69d
Compare
19d3b25 to
94d4a48
Compare
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
1aec69d to
e2af7d4
Compare
94d4a48 to
962e621
Compare
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
e2af7d4 to
befcadd
Compare
962e621 to
c97e92f
Compare
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Re-targeted to
|
Live preview verification —
|
| Check | Result |
|---|---|
| Page order | ✅ hero ($8.1M · 154 tracks, Ana Bárbara scope) → YOUR LABEL AT WORK (5 runs) → prompt chips → docked input |
| Chips render + wiring | ✅ all three, module-aware and artist-personalized: "Why did my valuation change?" (valuation has data), "What did my last task run do?" (runs exist), "What should Ana Bárbara do this week?" |
| Chip click → prefill, no auto-send | ✅ clicking the valuation chip set the input to the full prompt ("Why did my catalog valuation change? Walk through the latest measurements…") via the existing setInput path; nothing sent |
| Unified empty-state layout | ✅ scroll container present around header+input (engages when content exceeds the viewport; at 617px the full stack fits with scrollHeight 583), input fully visible, no clipping |
| No regressions | ✅ hero + tasks module render identically to the merged 1853 behavior beneath them |
Not exercised live: the short-content centering on the session-chat route (same component geometry, spacer-based — the centered case is the degenerate no-scroll case verified above) and narrow-viewport scrolling (mechanism structurally confirmed via the armed overflow-y-auto container).
The stack is complete with this PR — ready to merge.
🤖 Generated with Claude Code
…at changes (chat#1850) Slimmed twice at review: the modules prop died when the hero/tasks moved into ChatGreeting, and per the KISS review the chips now need no props either — HomeSuggestedPrompts is fully self-contained (module relevance from the same provider-backed hooks the header uses; prefill via the VercelChatProvider's setInput the same way ?q= already works) and renders inside ChatGreeting beneath the tasks module, self-hiding when no module has data. chat.tsx, NewChatBootstrap and HomePage are byte-identical to main; the empty-state layout hardening was dropped as YAGNI (nothing clips at real viewports — if it ever does, that is its own PR). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
c97e92f to
ba7b344
Compare
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Reworked per review: zero core chat changes (
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
lib/home/getHomeSuggestedPrompts.ts (1)
19-60: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider adding unit tests for this pure function.
getHomeSuggestedPromptsis a small, pure, easily-testable function driving user-facing chip content across multiple gating combinations (valuation/no-valuation × runs × artist). No test file was included for it.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/home/getHomeSuggestedPrompts.ts` around lines 19 - 60, Add unit tests for getHomeSuggestedPrompts to cover the different gating combinations it supports, since it is a pure function that determines user-facing prompt chips. Create tests for hasValuation vs no valuation, hasRuns present/absent, and artistName present/absent, and verify the returned labels/prompts and MAX_PROMPTS limiting behavior. Use getHomeSuggestedPrompts and its parameter cases to locate the function and keep the tests focused on its output shape.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@lib/home/getHomeSuggestedPrompts.ts`:
- Around line 19-60: Add unit tests for getHomeSuggestedPrompts to cover the
different gating combinations it supports, since it is a pure function that
determines user-facing prompt chips. Create tests for hasValuation vs no
valuation, hasRuns present/absent, and artistName present/absent, and verify the
returned labels/prompts and MAX_PROMPTS limiting behavior. Use
getHomeSuggestedPrompts and its parameter cases to locate the function and keep
the tests focused on its output shape.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e7ac0e8c-a6c6-4c6e-bb0c-7ed17789e397
⛔ Files ignored due to path filters (1)
lib/home/__tests__/getHomeSuggestedPrompts.test.tsis excluded by!**/*.test.*and included bylib/**
📒 Files selected for processing (5)
components/Chat/ChatGreeting.tsxcomponents/Home/HomeSuggestedPrompts.tsxcomponents/Home/TasksModule.tsxhooks/useHomeTasksModuleState.tslib/home/getHomeSuggestedPrompts.ts


What this does
Third and final PR of the Catalog HQ homepage stack (#1850). Chat becomes the command bar:
setInput(same mechanism as the?q=prefill from feat: prefill the input with the ?q= prompt while provisioning (chat#1848 follow-up) #1849); the send itself goes through the untouched send path.handleSendMessage+history.replaceStateto the canonical chat URL); once messages exist the modules give way to the normal message view, and returning to/renders the modules as the landing state again (the Done-when).modulesis an optional prop, absent on every otherChatmount.hideGreetingprop is subsumed by the docked-modules mechanism and removed (no dead props).Tests (TDD — confirmed RED before implementing)
5 new unit tests, full suite 114 passed (32 files):
lib/home/__tests__/getHomeSuggestedPrompts.test.ts— chips wired to visible modules, capped at 3, catalog-worth fallback, artist chip omitted without an artist, every chip carries a sendable prompt.pnpm exec tsc --noEmit: no new errors (same two pre-existing failures asmain).eslint+prettierclean on changed files.Screenshots
N/A in the body — preview verification results go in a PR comment.
Stack
Part of a 3-PR stack for chat#1850 (merge in order, each PR only after its base):
feat/home-valuation-hero→ basemainfeat/home-tasks-module→ basefeat/home-valuation-herofeat/home-command-bar→ basefeat/home-tasks-moduleWhen #1853 merges, this PR gets re-targeted accordingly.
Tracked in #1850.
🤖 Generated with Claude Code
Summary by cubic
Chat is now the homepage command bar: the valuation hero and tasks module render in the empty state above the input, with suggested prompt chips that prefill the input. Final step of the Catalog HQ homepage work (chat#1850).
New Features
Refactors
modulesprop; modules now live insideChatGreeting.HomeSuggestedPromptsinsideChatGreeting(self-contained, no new props), plususeHomeTasksModuleStateandgetHomeSuggestedPrompts; other chat mounts andNewChatBootstrapare unchanged.Written for commit ba7b344. Summary will update on new commits.
Summary by CodeRabbit
New Features
Bug Fixes