Conversation
📝 WalkthroughWalkthroughAdds analytics events across editor interactions: template selection in FloatingButton (requires new userId prop), Ask AI click in TextSelectionPopover, and selecting Custom STT provider in settings. EditorArea passes userId to FloatingButton. Functional flows remain the same after emitting analytics. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant FB as FloatingButton
participant ANA as analyticsCommands
participant APP as Editor logic
U->>FB: Select template (templateId)
alt templateId is built-in (not "auto")
FB->>ANA: event({event: "template_<id>_selected", distinct_id: userId, template_id})
ANA-->>FB: resolve/reject (errors caught)
else default/auto
Note over FB: No analytics emitted
end
FB->>APP: handleEnhanceWithTemplate(templateId)
APP-->>U: Enhancement proceeds
sequenceDiagram
participant U as User
participant P as TextSelectionPopover
participant ANA as analyticsCommands
participant TT as TipTap/Editor
U->>P: Click "Ask AI"
P->>ANA: event({event: "ask_ai_clicked", distinct_id: userId})
ANA-->>P: resolve/reject (ignored)
P->>TT: Compute positions and proceed with Ask AI flow
sequenceDiagram
participant U as User
participant STT as STT Settings View
participant ANA as analyticsCommands
participant CFG as Settings Store
U->>STT: Select provider "Custom"
STT->>ANA: event({event: "custom_stt_selected", distinct_id: userId})
ANA-->>STT: resolve/reject (ignored)
STT->>CFG: Set provider = "Custom"
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
apps/desktop/src/components/editor-area/text-selection-popover.tsx (1)
178-181: Include session_id in analytics for consistency with other events.Keeps your analytics schema aligned with index.tsx events that send session_id.
analyticsCommands.event({ event: "ask_ai_clicked", distinct_id: userId, + session_id: sessionId, });apps/desktop/src/components/settings/views/ai-stt.tsx (1)
49-55: Track provider in the analytics payload for clarity.Small payload enrichment; no behavior change.
const setProviderToCustom = () => { setProviderMutation.mutate("Custom"); analyticsCommands.event({ event: "custom_stt_selected", distinct_id: userId, + provider: "Custom", }); };apps/desktop/src/components/editor-area/floating-button.tsx (1)
151-168: Close popover and trigger enhance before awaiting analytics to keep UI snappy.Avoid blocking UI on the analytics call; fire it after UI actions. Behavior remains the same.
-const handleTemplateSelect = async (templateId: string) => { - if (templateId !== "auto" && isDefaultTemplate(templateId)) { - try { - const templateName = templateId.replace("default-", "").replace(/-/g, "_"); - const eventName = `${templateName}_builtin_selected`; - - await analyticsCommands.event({ - event: eventName, - distinct_id: userId, - template_id: templateId, - }); - } catch (error) { - console.error("Failed to track template selection:", error); - } - } - setShowTemplatePopover(false); - handleEnhanceWithTemplate(templateId); -}; +const handleTemplateSelect = async (templateId: string) => { + // Update UI immediately + setShowTemplatePopover(false); + handleEnhanceWithTemplate(templateId); + + if (templateId !== "auto" && isDefaultTemplate(templateId)) { + try { + const templateName = templateId.replace("default-", "").replace(/-/g, "_"); + const eventName = `${templateName}_builtin_selected`; + await analyticsCommands.event({ + event: eventName, + distinct_id: userId, + template_id: templateId, + }); + } catch (error) { + console.error("Failed to track template selection:", error); + } + } +};Optional: consider a stable event name (e.g., "builtin_template_selected") with template_id as a property to simplify downstream analytics.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (2)
apps/desktop/src/locales/en/messages.pois excluded by!**/*.poapps/desktop/src/locales/ko/messages.pois excluded by!**/*.po
📒 Files selected for processing (4)
apps/desktop/src/components/editor-area/floating-button.tsx(4 hunks)apps/desktop/src/components/editor-area/index.tsx(1 hunks)apps/desktop/src/components/editor-area/text-selection-popover.tsx(1 hunks)apps/desktop/src/components/settings/views/ai-stt.tsx(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}
⚙️ CodeRabbit configuration file
**/*.{js,ts,tsx,rs}: 1. Do not add any error handling. Keep the existing one.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".
Files:
apps/desktop/src/components/editor-area/text-selection-popover.tsxapps/desktop/src/components/editor-area/floating-button.tsxapps/desktop/src/components/editor-area/index.tsxapps/desktop/src/components/settings/views/ai-stt.tsx
🧬 Code graph analysis (2)
apps/desktop/src/components/editor-area/floating-button.tsx (1)
apps/desktop/src/utils/default-templates.ts (1)
isDefaultTemplate(211-213)
apps/desktop/src/components/settings/views/ai-stt.tsx (1)
apps/desktop/src/contexts/hypr.tsx (1)
useHypr(63-69)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: ci (macos, macos-latest)
- GitHub Check: ci (windows, windows-latest)
🔇 Additional comments (1)
apps/desktop/src/components/editor-area/floating-button.tsx (1)
54-55: New required prop userId: looks good; confirm all invocations updated.Props/type changes are correct here. Please double-check other call sites (if any) to avoid TS errors at build time.
Use the same search as suggested in EditorArea to catch any missing userId props.
Also applies to: 65-66
| isError={enhance.status === "error" && !isCancelled} | ||
| progress={progress} | ||
| showProgress={llmConnectionQuery.data?.type === "HyprLocal" && sessionId !== onboardingSessionId} | ||
| userId={userId} |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Passing userId to FloatingButton: LGTM; please verify all call sites.
Prop plumb is correct. Ensure no other usages of FloatingButton are missing the new required prop.
Run to find any usages without userId:
🏁 Script executed:
#!/bin/bash
rg -nP --type tsx '<FloatingButton(?![^>]*\buserId=)' -C2Length of output: 87
🏁 Script executed:
#!/bin/bash
# Search all .tsx files for FloatingButton usages missing the userId prop
rg -n --glob '*.tsx' -P '<FloatingButton(?![^>]*\buserId=)' -C2Length of output: 521
Add missing userId prop to FloatingButton in editor-area
apps/desktop/src/components/editor-area/index.tsx (line 327): the <FloatingButton …> invocation there lacks userId={userId}—please add it.
🤖 Prompt for AI Agents
In apps/desktop/src/components/editor-area/index.tsx around line 336, the
FloatingButton JSX is missing the userId prop; add userId={userId} to the
FloatingButton invocation so the component receives the current userId prop
(ensure userId is in scope or passed into the parent component).
No description provided.