Skip to content

Minor fixes 1003#1529

Merged
duckduckhero merged 3 commits intomainfrom
minor-fixes-1003
Oct 3, 2025
Merged

Minor fixes 1003#1529
duckduckhero merged 3 commits intomainfrom
minor-fixes-1003

Conversation

@duckduckhero
Copy link
Contributor

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

📝 Walkthrough

Walkthrough

Refactors template dropdown handling in enhanced note header: introduces a centralized open/close handler that triggers template refetch on open, updates regeneration flow to use it, simplifies dropdown content labels, and removes commented UI. Separately, adjusts ChatInput model button layout to truncate long model names without shrinking the icon.

Changes

Cohort / File(s) Summary of changes
Enhanced note template dropdown and regenerate flow
apps/desktop/src/components/editor-area/note-header/sub-headers/enhanced-note-sub-header.tsx
Introduced handleTemplateDropdownChange(open) to manage dropdown state and refetch on open; reworked regenerate button to use the handler; replaced direct state mutations with handler in Popover; refactored template mapping with sorted list and consistent title/fullTitle; updated Add Template flow to close via handler; renamed “Custom templates” to “Templates”; removed commented Share UI; minor text/structure tweaks.
ChatInput model button layout
apps/desktop/src/components/right-panel/components/chat/chat-input.tsx
Wrapped model name in truncating span with constrained width; ensured BrainIcon doesn’t shrink; added min-w-0 behavior to support ellipsis; improves robustness for long model names.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant RegenerateBtn as Regenerate Button
  participant Dropdown as Template Dropdown (Popover)
  participant Handler as handleTemplateDropdownChange
  participant Templates as Templates Store/Fetcher

  User->>RegenerateBtn: Click
  RegenerateBtn->>Handler: open=true
  Handler->>Dropdown: Set isOpen=true
  alt opening dropdown
    Handler->>Templates: refetch()
    Templates-->>Dropdown: updated templates (sorted: custom then built-in)
  end

  Note over Dropdown: User selects template or adds new one

  User->>Dropdown: Close (UI interaction)
  Dropdown->>Handler: onOpenChange(false)
  Handler->>Dropdown: Set isOpen=false
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Chat abort #1381 — Also modifies ChatInput’s send/stop button UI/behavior in the same component file.
  • Minor fixes 0820 #1377 — Related ChatInput UI/layout adjustments focusing on icon shrinkage and truncation behavior.
  • Template Selector Merge  #1089 — Related to editor template selection UI/state handling, including dropdown/templating logic.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning There is no pull request description provided, so reviewers lack any context or summary of the changes. Without a description, it is impossible to quickly understand the purpose of the template refactor or the chat input UI adjustment, making the description effectively off-topic. This omission hinders efficient code review and onboarding. Please add a concise description that outlines the main objectives of the pull request, such as the introduction of a handleTemplateDropdownChange handler, the reordering of templates, removal of commented UI, and the chat input model button truncation enhancements.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title “Minor fixes 1003” is too generic and does not convey any specific information about the main changes in the pull request. It fails to reflect significant updates such as refactoring the template dropdown behavior or adjusting the chat input model button UI. This lack of specificity means a teammate scanning the history cannot understand the primary change at a glance. Please revise the title to clearly and concisely summarize the main change, for example by mentioning the template dropdown refactoring and the chat input model button truncation update.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch minor-fixes-1003

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/desktop/src/components/editor-area/note-header/sub-headers/enhanced-note-sub-header.tsx (1)

42-62: Template sorting logic is correct but could be refactored.

The inline sorting works correctly (custom templates first, then built-in). However, since TemplateService already has getTemplatesByCategory() that understands custom vs. builtin distinction, consider moving the sorting logic into the service layer for better separation of concerns.

This could be done by adding a getSortedTemplates() method to TemplateService:

static async getSortedTemplates(): Promise<Template[]> {
  const allTemplates = await this.getAllTemplates();
  return allTemplates.sort((a, b) => {
    const aIsBuiltin = a.tags?.includes("builtin") || false;
    const bIsBuiltin = b.tags?.includes("builtin") || false;
    if (aIsBuiltin === bIsBuiltin) return 0;
    return aIsBuiltin ? 1 : -1;
  });
}

Then simplify the query to:

queryFn: () =>
  TemplateService.getSortedTemplates().then((templates) =>
    templates.map((template) => {
      const title = template.title || "Untitled";
      const truncatedTitle = title.length > 30 ? title.substring(0, 30) + "..." : title;
      return {
        id: template.id,
        title: truncatedTitle,
        fullTitle: template.title || "",
      };
    })
  ),
📜 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 6668c51 and 3d5b473.

📒 Files selected for processing (2)
  • apps/desktop/src/components/editor-area/note-header/sub-headers/enhanced-note-sub-header.tsx (5 hunks)
  • apps/desktop/src/components/right-panel/components/chat/chat-input.tsx (1 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/note-header/sub-headers/enhanced-note-sub-header.tsx
  • apps/desktop/src/components/right-panel/components/chat/chat-input.tsx
🧬 Code graph analysis (1)
apps/desktop/src/components/editor-area/note-header/sub-headers/enhanced-note-sub-header.tsx (1)
apps/desktop/src/utils/template-service.ts (1)
  • TemplateService (5-66)
⏰ 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-14)
🔇 Additional comments (4)
apps/desktop/src/components/right-panel/components/chat/chat-input.tsx (1)

508-513: LGTM! Model button truncation implemented correctly.

The layout changes properly handle long model names by:

  • Using min-w-0 to allow the button to shrink
  • Keeping the icon fixed with flex-shrink-0
  • Truncating the text with a max width constraint

This matches the pattern used for the entity badge at line 418.

apps/desktop/src/components/editor-area/note-header/sub-headers/enhanced-note-sub-header.tsx (3)

74-79: LGTM! Centralized dropdown handler improves consistency.

The new handleTemplateDropdownChange handler centralizes dropdown state management and intelligently refetches templates only when opening. This ensures fresh template data and simplifies the state management flow throughout the component.


103-103: LGTM! Handler usage is consistent and correct.

All callsites properly use handleTemplateDropdownChange:

  • Lines 103, 107: Close dropdown before actions
  • Line 169: Wire to Popover's onOpenChange
  • Line 174: Correctly branches based on isEnhancing state (cancel vs. open dropdown)

Also applies to: 107-107, 169-169, 174-174


269-269: LGTM! Label simplification aligns with unified template display.

The change from "Custom templates" to "Templates" reflects the unified dropdown that now shows both custom and built-in templates in a single sorted list.

@duckduckhero duckduckhero merged commit ecf4d42 into main Oct 3, 2025
9 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Oct 4, 2025
@ComputelessComputer ComputelessComputer deleted the minor-fixes-1003 branch December 14, 2025 15:20
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.

1 participant

Comments