Skip to content

Conversation

@duckduckhero
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Jul 8, 2025

📝 Walkthrough

Walkthrough

This change refactors the enhancement template selection and invocation flow in the desktop app. It introduces explicit template selection before stopping a recording session, simplifies enhancement mutation signatures to accept trigger types and template IDs, and updates state management and UI accordingly. Localization and store state are updated to support these changes.

Changes

File(s) Change Summary
apps/desktop/src/components/editor-area/index.tsx Refactored enhancement logic: simplified template selection, updated enhance mutation to accept trigger type and template ID, removed config mutation/restoration, adjusted auto-enhance logic, and updated handler signatures.
apps/desktop/src/components/editor-area/floating-button.tsx Removed invalidation of "llm-connection" query on window focus; now only invalidates "templates" query.
apps/desktop/src/components/editor-area/note-header/listen-button.tsx Added UI and logic for selecting an enhancement template before stopping a recording; updated session store and handlers to support template selection.
packages/utils/src/stores/ongoing-session.ts Added autoEnhanceTemplate state and setter method to ongoing session store.
apps/desktop/src/locales/en/messages.po
apps/desktop/src/locales/ko/messages.po
Updated localization references and added entries for new template selection UI; removed obsolete entries.
apps/docs/data/i18n.json Increased translation entry counts to reflect new UI strings.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ListenButton
    participant SessionStore
    participant EditorArea

    User->>ListenButton: Clicks Stop (with selected template)
    ListenButton->>SessionStore: setAutoEnhanceTemplate(templateId)
    ListenButton->>EditorArea: onStop(templateId)
    EditorArea->>EditorArea: enhanceMutation({ triggerType: "auto", templateId })
Loading
sequenceDiagram
    participant User
    participant EditorArea

    User->>EditorArea: Clicks Enhance
    EditorArea->>EditorArea: enhanceMutation({ triggerType: "manual" })
Loading

Possibly related PRs

  • fastrepl/hyprnote#1095: Removes the invalidation of the "llm-connection" query from the handleAddTemplate function in FloatingButton, directly modifying the same function and query invalidation logic.
  • fastrepl/hyprnote#1089: Simplifies and removes template config mutation/restoration logic, directly modifying the enhance mutation signature and calls, closely related to the refactoring in this PR.
  • fastrepl/hyprnote#972: Extends the enhance mutation to include new parameters, modifying the same enhance mutation function signature and usage in EditorArea as this PR.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f91f1dd and dd69a6c.

📒 Files selected for processing (7)
  • apps/desktop/src/components/editor-area/floating-button.tsx (0 hunks)
  • apps/desktop/src/components/editor-area/index.tsx (6 hunks)
  • apps/desktop/src/components/editor-area/note-header/listen-button.tsx (8 hunks)
  • apps/desktop/src/locales/en/messages.po (7 hunks)
  • apps/desktop/src/locales/ko/messages.po (7 hunks)
  • apps/docs/data/i18n.json (1 hunks)
  • packages/utils/src/stores/ongoing-session.ts (3 hunks)
💤 Files with no reviewable changes (1)
  • apps/desktop/src/components/editor-area/floating-button.tsx
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{js,ts,tsx,rs}`: 1. No error handling. 2. No unused imports, variables, or functions. 3. For comments, keep it minimal. It should be about "Why", not "What".

**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • apps/desktop/src/components/editor-area/note-header/listen-button.tsx
  • packages/utils/src/stores/ongoing-session.ts
  • apps/desktop/src/components/editor-area/index.tsx
🧬 Code Graph Analysis (1)
apps/desktop/src/components/editor-area/note-header/listen-button.tsx (3)
packages/ui/src/components/ui/popover.tsx (1)
  • Popover (85-85)
packages/utils/src/contexts/ongoing-session.tsx (1)
  • useOngoingSession (32-46)
packages/ui/src/components/ui/select.tsx (5)
  • Select (174-174)
  • SelectTrigger (174-174)
  • SelectValue (174-174)
  • SelectContent (174-174)
  • SelectItem (174-174)
🪛 GitHub Actions: .github/workflows/i18n.yaml
apps/docs/data/i18n.json

[error] 1-1: i18n data is not up-to-date. Please run 'task i18n' locally and commit the changes.

⏰ 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 (windows, windows-latest)
  • GitHub Check: ci (macos, macos-latest)
🔇 Additional comments (19)
packages/utils/src/stores/ongoing-session.ts (1)

16-16: LGTM! Clean state management implementation.

The autoEnhanceTemplate state property and setter are well-implemented, following the existing patterns in the store with proper typing and mutative state updates.

Also applies to: 23-23, 38-38, 67-73

apps/docs/data/i18n.json (1)

4-5: Address the pipeline failure by running the i18n task.

The translation count updates look correct, but the pipeline failure indicates that the i18n data is not up-to-date. Please run task i18n locally and commit the changes as instructed by the pipeline.

Also applies to: 9-9

apps/desktop/src/locales/en/messages.po (1)

259-260: LGTM! Localization updates are properly maintained.

The line number updates and new translation entries correctly reflect the UI changes. The obsolete entries are properly marked and the new "No Template (Default)" entry supports the template selection feature.

Also applies to: 374-376, 835-841

apps/desktop/src/locales/ko/messages.po (1)

259-260: LGTM! Korean localization structure is properly maintained.

The localization updates mirror the English version correctly. The empty translations are expected and will be filled by translators as needed.

Also applies to: 374-376, 835-841

apps/desktop/src/components/editor-area/note-header/listen-button.tsx (5)

9-9: LGTM! Imports are properly used.

The new imports for database commands and Select components are correctly utilized in the template selection feature.

Also applies to: 14-14


227-227: LGTM! Clean integration with the ongoing session store.

The store integration is well-implemented with proper conditional logic to set the auto-enhance template only when provided.

Also applies to: 237-240


251-251: LGTM! Improved popover state management.

Making the popover controlled with explicit open and onOpenChange props provides better control over its behavior.


278-278: LGTM! Well-implemented template selection feature.

The template selection implementation is comprehensive and follows React best practices:

  • Proper state management and data fetching
  • Correct default template handling from config
  • Clean UI with Select components
  • Proper conversion of "auto" to null for the store
  • Event handlers are correctly wired up

The feature integrates seamlessly with the existing recording controls.

Also applies to: 284-284, 294-312, 314-317, 334-350, 363-363


321-321: LGTM! Appropriate spacing adjustments.

The margin adjustments properly accommodate the new template selection dropdown while maintaining visual consistency.

Also applies to: 334-334

apps/desktop/src/components/editor-area/index.tsx (10)

92-92: LGTM: Proper placement of generateTitle mutation.

Moving the generateTitle mutation declaration after the enhance mutation makes logical sense since it depends on the enhance mutation's onSuccess callback.


116-119: LGTM: Simplified template enhancement logic.

The refactoring correctly simplifies the template enhancement by directly passing the templateId and triggerType to the mutation, eliminating the need for complex config state management.


122-122: LGTM: Consistent parameter passing.

The manual enhance trigger now correctly passes the triggerType parameter, maintaining consistency with the new mutation signature.


249-255: LGTM: Well-structured mutation parameter interface.

The updated mutation function signature with object parameters and proper TypeScript typing improves maintainability and makes the API more explicit.


285-291: LGTM: Proper template selection fallback logic.

The effective template ID logic correctly handles both explicit template selection and fallback to config default, with proper null handling.


296-298: LGTM: Consistent use of effective template ID.

The template lookup logic correctly uses the effectiveTemplateId variable, maintaining consistency with the refactored approach.


503-503: LGTM: Proper typing for auto-enhance mutation.

The enhanceMutate function signature correctly specifies the triggerType as "auto" and includes the optional templateId parameter.


506-507: LGTM: Proper integration with ongoing session store.

The addition of autoEnhanceTemplate state management from the ongoing session store correctly supports the one-time template usage pattern.


520-526: LGTM: Proper one-time template usage implementation.

The auto-enhancement logic correctly uses the stored template and clears it immediately after use, preventing unintended reuse. The implementation properly handles the templateId parameter.


534-536: LGTM: Complete dependency array for useEffect.

The useEffect dependencies correctly include all the new state variables (autoEnhanceTemplate, setAutoEnhanceTemplate) to ensure proper reactivity.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@duckduckhero duckduckhero merged commit 4a40096 into main Jul 8, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants