Skip to content

Note UI refactor#1545

Merged
duckduckhero merged 4 commits intomainfrom
note-ui-refactor
Oct 8, 2025
Merged

Note UI refactor#1545
duckduckhero merged 4 commits intomainfrom
note-ui-refactor

Conversation

@duckduckhero
Copy link
Contributor

  • extracted tab header (memos, summary, transcript) as a pure UI component

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 8, 2025

📝 Walkthrough

Walkthrough

Refactors TabHeader by removing ref-based logic in desktop, introducing a new shared UI TabHeader in packages/ui, and updating call sites to stop passing refs. Also removes the MetadataModal component and its public types.

Changes

Cohort / File(s) Summary of Changes
Editor area integration cleanup
apps/desktop/src/components/editor-area/index.tsx, apps/desktop/src/components/editor-area/note-header/index.tsx
Removed TabHeaderRef import/export and ref usage; adjusted TabHeader invocation to no longer pass a ref.
Note header TabHeader refactor
apps/desktop/src/components/editor-area/note-header/tab-header.tsx
Replaced forwardRef-based TabHeader with a plain function that delegates to the shared UI TabHeader; removed imperative/ref logic; computed and passed visibility/tab props to UI.
Remove MetadataModal
apps/desktop/src/components/editor-area/metadata-modal.tsx
Deleted MetadataModal component and its prop type; removed hover/popover behavior and associated UI elements.
Add shared UI TabHeader
packages/ui/src/components/block/tab-header.tsx
Added new TabHeader component handling tab visibility, defaulting, onTabChange, and onVisibilityChange; renders Summary/Memos/Transcript tabs with recording indicator.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Editor as EditorArea (Desktop)
  participant TH as TabHeader (UI)
  participant Parent as State/Store

  User->>Editor: Open note / interact
  Editor->>TH: Render TabHeader(props: shouldShowTab, shouldShowEnhancedTab, isEnhancing, currentTab, onTabChange, onVisibilityChange, isCurrentlyRecording)
  TH->>Parent: onVisibilityChange(visible) [when shouldShowTab toggles]
  alt isEnhancing true
    TH->>Parent: onTabChange("enhanced")
  else shouldShowTab false
    TH->>Parent: onTabChange("raw")
    TH-->>Editor: Render nothing
  end
  User->>TH: Click tab (Summary/Memos/Transcript)
  TH->>Parent: onTabChange(nextTab)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
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.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Note UI refactor” succinctly captures the primary change of refactoring the note-related user interface by extracting the tab header into a pure component and removing legacy UI elements, providing a focused and concise summary of the main intent of the changeset.
Description Check ✅ Passed The description clearly indicates that the tab header component has been extracted as a pure UI component, which directly aligns with the core modifications in the pull request and confirms that the description is relevant to the implemented changes.
✨ 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 note-ui-refactor

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: 2

🧹 Nitpick comments (1)
packages/ui/src/components/block/tab-header.tsx (1)

37-42: Remove redundant nullish coalescing.

Since shouldShowTab is typed as boolean (not optional), the ?? false is unnecessary.

Apply this diff:

   // notify parent when visibility changes
   useEffect(() => {
     if (onVisibilityChange) {
-      onVisibilityChange(shouldShowTab ?? false);
+      onVisibilityChange(shouldShowTab);
     }
   }, [shouldShowTab, onVisibilityChange]);
📜 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 b8cda04 and 4bf622e.

⛔ Files ignored due to path filters (2)
  • apps/desktop/src/locales/en/messages.po is excluded by !**/*.po
  • apps/desktop/src/locales/ko/messages.po is excluded by !**/*.po
📒 Files selected for processing (5)
  • apps/desktop/src/components/editor-area/index.tsx (1 hunks)
  • apps/desktop/src/components/editor-area/metadata-modal.tsx (0 hunks)
  • apps/desktop/src/components/editor-area/note-header/index.tsx (0 hunks)
  • apps/desktop/src/components/editor-area/note-header/tab-header.tsx (2 hunks)
  • packages/ui/src/components/block/tab-header.tsx (1 hunks)
💤 Files with no reviewable changes (2)
  • apps/desktop/src/components/editor-area/metadata-modal.tsx
  • apps/desktop/src/components/editor-area/note-header/index.tsx
🧰 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/index.tsx
  • packages/ui/src/components/block/tab-header.tsx
  • apps/desktop/src/components/editor-area/note-header/tab-header.tsx
🧬 Code graph analysis (2)
packages/ui/src/components/block/tab-header.tsx (2)
apps/desktop/src/components/editor-area/note-header/tab-header.tsx (1)
  • TabHeader (14-53)
packages/ui/src/lib/utils.ts (1)
  • cn (4-6)
apps/desktop/src/components/editor-area/note-header/tab-header.tsx (4)
packages/ui/src/components/block/tab-header.tsx (1)
  • TabHeader (14-108)
packages/utils/src/contexts/sessions.tsx (1)
  • useSession (49-74)
packages/utils/src/contexts/ongoing-session.tsx (1)
  • useOngoingSession (32-46)
apps/desktop/src/hooks/enhance-pending.ts (1)
  • useEnhancePendingState (4-16)
⏰ 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-14)
  • GitHub Check: ci (windows, windows-latest)
🔇 Additional comments (2)
apps/desktop/src/components/editor-area/index.tsx (1)

29-29: LGTM!

The removal of TabHeaderRef aligns with the refactor to use a pure UI component without ref exposure. The TabHeader usage at lines 336-343 remains unchanged and correctly passes props without refs.

apps/desktop/src/components/editor-area/note-header/tab-header.tsx (1)

14-53: LGTM!

The refactored component successfully separates concerns by:

  • Acting as a smart container that computes visibility flags and recording state
  • Delegating rendering to the pure UI component (TabHeaderUI)
  • Maintaining clean prop drilling without ref exposure

The state derivations (lines 27-40) are logical, and the props mapping to TabHeaderUI (lines 43-50) is complete and accurate.

Comment on lines +23 to +28
useEffect(() => {
// when enhancement starts (immediately after recording ends) -> switch to enhanced note
if (isEnhancing) {
onTabChange("enhanced");
}
}, [isEnhancing]);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add onTabChange to the dependency array.

The onTabChange callback is used inside the effect but missing from the dependency array, which could cause stale closures.

Apply this diff:

   useEffect(() => {
     // when enhancement starts (immediately after recording ends) -> switch to enhanced note
     if (isEnhancing) {
       onTabChange("enhanced");
     }
-  }, [isEnhancing]);
+  }, [isEnhancing, onTabChange]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect(() => {
// when enhancement starts (immediately after recording ends) -> switch to enhanced note
if (isEnhancing) {
onTabChange("enhanced");
}
}, [isEnhancing]);
useEffect(() => {
// when enhancement starts (immediately after recording ends) -> switch to enhanced note
if (isEnhancing) {
onTabChange("enhanced");
}
}, [isEnhancing, onTabChange]);
🤖 Prompt for AI Agents
In packages/ui/src/components/block/tab-header.tsx around lines 23 to 28, the
useEffect references the onTabChange callback but does not include it in the
dependency array, which can lead to stale closures; update the effect's
dependency array to include onTabChange (i.e., [isEnhancing, onTabChange]) so
the effect sees the latest callback, or if onTabChange is intentionally stable,
ensure it is memoized (useCallback) or document why it's safe to omit before
keeping it out of the deps.

Comment on lines +72 to +83
<button
onClick={() => onTabChange("raw")}
className={cn(
"relative py-2 text-xs font-medium transition-all duration-200 border-b-2 -mb-px flex items-center gap-1.5",
shouldShowEnhancedTab ? "pl-3 px-4" : "pl-1 px-2",
currentTab === "raw"
? "text-neutral-900 border-neutral-900"
: "text-neutral-600 border-transparent hover:text-neutral-800",
)}
>
Memos
</button>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider consistent padding to prevent layout shift.

The dynamic padding on the "Memos" button based on shouldShowEnhancedTab causes the button to shift position when the Enhanced tab appears or disappears, creating a jarring visual experience.

If this is intentional for design reasons, consider adding a CSS transition to smooth the shift. Otherwise, use consistent padding:

             <button
               onClick={() => onTabChange("raw")}
               className={cn(
                 "relative py-2 text-xs font-medium transition-all duration-200 border-b-2 -mb-px flex items-center gap-1.5",
-                shouldShowEnhancedTab ? "pl-3 px-4" : "pl-1 px-2",
+                "pl-3 px-4",
                 currentTab === "raw"
                   ? "text-neutral-900 border-neutral-900"
                   : "text-neutral-600 border-transparent hover:text-neutral-800",
               )}
             >
               Memos
             </button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button
onClick={() => onTabChange("raw")}
className={cn(
"relative py-2 text-xs font-medium transition-all duration-200 border-b-2 -mb-px flex items-center gap-1.5",
shouldShowEnhancedTab ? "pl-3 px-4" : "pl-1 px-2",
currentTab === "raw"
? "text-neutral-900 border-neutral-900"
: "text-neutral-600 border-transparent hover:text-neutral-800",
)}
>
Memos
</button>
<button
onClick={() => onTabChange("raw")}
className={cn(
"relative py-2 text-xs font-medium transition-all duration-200 border-b-2 -mb-px flex items-center gap-1.5",
"pl-3 px-4",
currentTab === "raw"
? "text-neutral-900 border-neutral-900"
: "text-neutral-600 border-transparent hover:text-neutral-800",
)}
>
Memos
</button>
🤖 Prompt for AI Agents
In packages/ui/src/components/block/tab-header.tsx around lines 72 to 83, the
"Memos" button uses conditional padding based on shouldShowEnhancedTab which
causes layout shift when the Enhanced tab appears or disappears; make the
padding consistent (choose one padding set for both states) to prevent shifting,
or if the design requires the change, add a CSS transition on padding or
transform to smooth the shift (apply a stable padding value and optionally
animate the change) so the button position does not jump when tabs toggle.

@duckduckhero duckduckhero merged commit bb5a8b0 into main Oct 8, 2025
12 checks passed
This was referenced Oct 8, 2025
@coderabbitai coderabbitai bot mentioned this pull request Oct 17, 2025
@ComputelessComputer ComputelessComputer deleted the note-ui-refactor 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