Skip to content

Minor fixes 1013#1564

Merged
yujonglee merged 14 commits intomainfrom
minor-fixes-1013
Oct 13, 2025
Merged

Minor fixes 1013#1564
yujonglee merged 14 commits intomainfrom
minor-fixes-1013

Conversation

@duckduckhero
Copy link
Contributor

@duckduckhero duckduckhero commented Oct 13, 2025

  • settings initial GUI
  • sidebar context menu

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds a languages dependency, moves ChatFloatingButton into Body, extends timeline context menu with “New Tab”, reworks Settings (General, Notifications, Templates, AI wiring), and updates tinybase AI/general schema defaults and types.

Changes

Cohort / File(s) Summary
Dependencies
apps/desktop2/package.json
Added dependency @huggingface/languages@^1.0.0.
ChatFloatingButton relocation
apps/desktop2/src/components/main/body/index.tsx, apps/desktop2/src/routes/app/main/_layout.index.tsx
Removed ChatFloatingButton from route layout and now render it inside Body; updated imports/usages.
Timeline context menu enhancements
apps/desktop2/src/components/main/sidebar/timeline.tsx
Added “New Tab” context action (ExternalLink icon) wired to open items in a new tab; updated Delete action to use Trash2 icon and red styling; unified behavior for event/session items.
Settings — General overhaul
apps/desktop2/src/components/settings/general.tsx
Added SettingsGeneral component with language selection (ISO_639_1), spoken languages picker, SettingRow + Switch toggles, jargons textarea, Permissions UI, and integration with useUpdateGeneral.
Settings — Notifications refactor
apps/desktop2/src/components/settings/notification.tsx
Replaced ad-hoc inputs with SettingRow + Switch, added nullish guards and structured layout, wired updates via handle.setField.
Settings — Templates editor upgrade
apps/desktop2/src/components/settings/templates.tsx
Introduced TemplateCard list and richer TemplateEditor (title, system instruction, reorderable sections, add/remove/reorder); TemplateEditor signature now accepts onClose.
AI settings / UI wiring
apps/desktop2/src/components/settings/ai.tsx
Added useUpdateGeneral usage to expose generalValue; ProviderCard optionally accepts handleSelectProvider and uses consolidated click handler.
Persistent schema updates (tinybase)
apps/desktop2/src/store/tinybase/internal.ts
Added model_name to aiSchema and storage shapes; changed generalSchema defaults: current_llm_provider"hyprcloud", current_stt_provider"hyprlocal"; updated derived types (AI, AIStorage) and SCHEMA shapes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant SG as SettingsGeneral
  participant LANG as @huggingface/languages
  participant HG as useUpdateGeneral

  U->>SG: Open Settings → General
  SG->>LANG: Load LANGUAGES_ISO_639_1
  SG-->>U: Render language selector, spoken languages, toggles, jargons
  U->>SG: Change field
  SG->>HG: handle.setField(field, value)
  HG-->>SG: Persisted state
  SG-->>U: UI updates
Loading
sequenceDiagram
  autonumber
  participant U as User
  participant TL as TimelineItem
  participant CM as ContextMenu
  participant NAV as Navigation

  U->>TL: Right-click item
  TL->>CM: Show menu (New Tab, Delete)
  U->>CM: Click "New Tab"
  CM->>NAV: handleCmdClick(item) — open in background tab
  NAV-->>U: Item opens in new tab
Loading
sequenceDiagram
  autonumber
  participant U as User
  participant TE as TemplateEditor
  participant HT as useUpdateTemplates

  U->>TE: Open TemplateEditor
  TE-->>U: Render title, system prompt, sections list
  U->>TE: Edit title/section or reorder
  TE->>HT: setField('sections'/'title'/'system', value)
  HT-->>TE: Persisted
  U->>TE: Save / Close
  TE-->>U: Call onClose()
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title “Minor fixes 1013” is too vague and does not clearly summarize the substantive changes such as the new Settings UI, sidebar context menu enhancements, and ChatFloatingButton integration present in this pull request. Please revise the title to concisely reflect the primary changes, for example “Add Settings UI, update sidebar context menu, and integrate ChatFloatingButton.”
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 (1 passed)
Check name Status Explanation
Description Check ✅ Passed The pull request description mentions the initial settings GUI and sidebar context menu, which directly correspond to parts of the changeset, so it is sufficiently related to pass this check.

📜 Recent 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 08d4f9c and 4192e8a.

📒 Files selected for processing (2)
  • apps/desktop2/src/components/main/body/index.tsx (2 hunks)
  • apps/desktop2/src/routes/app/main/_layout.index.tsx (0 hunks)

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

🧹 Nitpick comments (8)
apps/desktop2/src/components/main/sidebar/timeline.tsx (1)

134-134: Remove redundant color styling.

The text-red-500 class is applied both to the parent ContextMenuItem (line 133) and to the Trash2 icon. The icon will inherit the color from its parent, making the duplicate styling unnecessary.

Apply this diff to remove the redundant styling:

-        <Trash2 className="w-4 h-4 mr-2 text-red-500" />
+        <Trash2 className="w-4 h-4 mr-2" />
apps/desktop2/src/components/settings/templates.tsx (1)

96-99: Replace direct crypto.randomUUID() calls with a cross‑runtime id generator (feature‑detect or use nanoid)

Search found many direct uses of crypto.randomUUID() (notably apps/desktop2/src/components/settings/templates.tsx and apps/desktop2/src/utils.ts) and no polyfill/fallback; apps/desktop/package.json lists nanoid. Action: centralize id generation (or update apps/desktop2/src/utils.ts) to feature‑detect crypto.randomUUID and fall back to nanoid/uuid, then replace all direct crypto.randomUUID() usages with that util.

apps/desktop2/package.json (1)

18-18: Consider pinning @huggingface/languages for reproducibility

Use an exact version (e.g., 1.0.0) to avoid future drift in metadata that might subtly change names/fields.

apps/desktop2/src/components/settings/general.tsx (4)

108-123: Persist language codes, not display names

You currently store/display language names (e.g., "English"). Names can change or collide; ISO-639-1 codes are stable. Store codes in settings and map to names in the UI.

Minimal guidance:

  • ai_language: store code (e.g., "en"), show HF_LANGUAGES[code].name.
  • spoken_languages: store array of codes, show chips via HF_LANGUAGES[code].name.
  • Filters should compare codes, not names.

This avoids duplicate name issues and simplifies future i18n.

Also applies to: 169-181, 131-151


197-205: Remove no‑op onBlur handler

The onBlur callback does nothing and adds noise.

-            <Textarea
-              value={(value.jargons ?? []).join(", ")}
-              onChange={(e) => handle.setField("jargons", e.target.value.split(",").map(s => s.trim()).filter(Boolean))}
-              onBlur={() => {
-                // Auto-save on blur
-              }}
-              placeholder="smart notepad, offline, X, Discord"
-              className="w-full resize-none"
-              rows={3}
-            />
+            <Textarea
+              value={(value.jargons ?? []).join(", ")}
+              onChange={(e) =>
+                handle.setField(
+                  "jargons",
+                  e.target.value.split(",").map(s => s.trim()).filter(Boolean),
+                )
+              }
+              placeholder="smart notepad, offline, X, Discord"
+              className="w-full resize-none"
+              rows={3}
+            />

235-238: “Grant Permission” button has no action

Add an onClick to request/guide permissions, or disable the button until wiring exists. Otherwise it’s confusing.

I can help wire this to your permissions flow or add a disabled state with a tooltip.


246-266: Duplicate SettingRow across settings screens — extract shared component

This component is duplicated here and in notifications.tsx. Move it to a shared module (e.g., settings/SettingRow.tsx) and reuse.

apps/desktop2/src/components/settings/notification.tsx (1)

31-51: Deduplicate SettingRow (same as in general.tsx)

Extract to a shared component and import in both files to avoid drift.

📜 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 64b0dd6 and efc0a78.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • apps/desktop2/package.json (1 hunks)
  • apps/desktop2/src/components/main/body/index.tsx (2 hunks)
  • apps/desktop2/src/components/main/sidebar/timeline.tsx (2 hunks)
  • apps/desktop2/src/components/settings/general.tsx (1 hunks)
  • apps/desktop2/src/components/settings/notification.tsx (1 hunks)
  • apps/desktop2/src/components/settings/templates.tsx (2 hunks)
  • apps/desktop2/src/routes/app/main/_layout.index.tsx (0 hunks)
💤 Files with no reviewable changes (1)
  • apps/desktop2/src/routes/app/main/_layout.index.tsx
🧰 Additional context used
📓 Path-based instructions (2)
apps/desktop2/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (apps/desktop2/.cursor/rules/style.mdc)

apps/desktop2/**/*.{tsx,jsx}: When there are many Tailwind classNames with conditional logic, use the cn utility imported as import { cn } from "@hypr/ui/lib/utils"
Always pass an array to cn when composing Tailwind classNames
Split cn array entries by logical grouping when composing Tailwind classNames

Files:

  • apps/desktop2/src/components/main/sidebar/timeline.tsx
  • apps/desktop2/src/components/settings/notification.tsx
  • apps/desktop2/src/components/settings/general.tsx
  • apps/desktop2/src/components/main/body/index.tsx
  • apps/desktop2/src/components/settings/templates.tsx
**/*.{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/desktop2/src/components/main/sidebar/timeline.tsx
  • apps/desktop2/src/components/settings/notification.tsx
  • apps/desktop2/src/components/settings/general.tsx
  • apps/desktop2/src/components/main/body/index.tsx
  • apps/desktop2/src/components/settings/templates.tsx
🧬 Code graph analysis (5)
apps/desktop2/src/components/main/sidebar/timeline.tsx (1)
packages/ui/src/components/ui/context-menu.tsx (1)
  • ContextMenuItem (186-186)
apps/desktop2/src/components/settings/notification.tsx (2)
apps/desktop2/src/components/settings/shared.ts (1)
  • useUpdateGeneral (6-24)
packages/ui/src/components/ui/switch.tsx (1)
  • Switch (57-57)
apps/desktop2/src/components/settings/general.tsx (1)
apps/desktop2/src/components/settings/shared.ts (1)
  • useUpdateGeneral (6-24)
apps/desktop2/src/components/main/body/index.tsx (1)
apps/desktop2/src/components/chat/index.tsx (1)
  • ChatFloatingButton (11-56)
apps/desktop2/src/components/settings/templates.tsx (4)
apps/desktop/src/components/settings/views/template.tsx (1)
  • TemplateEditor (68-424)
packages/db/src/schema.ts (1)
  • templates (83-88)
packages/ui/src/components/ui/button.tsx (1)
  • Button (37-89)
apps/desktop2/src/components/settings/shared.ts (1)
  • useUpdateTemplate (38-55)
⏰ 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 (8)
apps/desktop2/src/components/main/body/index.tsx (2)

8-8: LGTM!

The import is correctly placed and used within the component.


31-31: No duplicate ChatFloatingButton instances Body is only rendered once in apps/desktop2/src/routes/app/main/_layout.index.tsx, so global hotkey registration and window state conflicts cannot occur.

apps/desktop2/src/components/main/sidebar/timeline.tsx (2)

3-3: LGTM!

The lucide-react imports are correctly used in the context menu items below.


129-132: LGTM!

The "New Tab" context menu item correctly reuses the existing handleCmdClick function, maintaining consistency with the existing Cmd+Click behavior.

apps/desktop2/src/components/settings/templates.tsx (3)

1-11: LGTM!

The imports are well-organized and all are utilized in the component. The lucide-react icons, motion/react Reorder component, and UI components are appropriately imported for the new drag-reorder template editor functionality.


101-123: LGTM!

The section management handlers (reorder, update, remove, add) are well-structured and maintain consistency between local state and the persisted store. The pattern of stripping IDs before syncing to the store (updatedSections.map(({ id, ...rest }) => rest)) correctly maintains the separation between UI state and data model.


174-206: Verify drag-and-drop functionality with keyboard accessibility.

The Reorder implementation uses motion/react's Reorder components for drag-and-drop. Ensure that keyboard users can also reorder sections, as drag-and-drop interfaces can be inaccessible without keyboard alternatives.

Test the following:

  1. Can keyboard users (using Tab, Enter, and arrow keys) reorder sections?
  2. Are appropriate ARIA attributes present for screen reader users?
  3. Is there visual feedback during keyboard-based reordering?

If keyboard accessibility is not built into the motion/react Reorder component, you may need to add keyboard handlers or provide alternative reordering controls (e.g., up/down buttons).

apps/desktop2/src/components/settings/notification.tsx (1)

13-25: LGTM on Switch wiring and state updates

The toggles read null-safe values and update via handle.setField. Looks good.

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

♻️ Duplicate comments (5)
apps/desktop2/src/components/settings/templates.tsx (5)

47-55: Stop using any for template titles/descriptions.

Line [51] still relies on (template as any), defeating the persisted schema and risking runtime undefined if the row shape shifts. Please type the query result once and drop the cast. For example:

   const templates = persisted.UI.useResultTable(USER_TEMPLATE_QUERY, quries);
+  type TemplateRow = persisted.Template;
+  const typedTemplates = templates as Record<string, TemplateRow>;-        {Object.entries(templates).map(([id, template]) => (
+        {Object.entries(typedTemplates).map(([id, template]) => (
           <TemplateCard
             key={id}
             id={id}
-            title={(template as any).title || "Untitled"}
-            description={(template as any).description || ""}
+            title={template.title ?? "Untitled"}
+            description={template.description ?? ""}
             onEdit={() => setCurrentTemplate(id)}
           />

81-89: Finish the “Set as default” action.

Line [85] still just logs, so users can’t actually set a default template. Wire this button into the real mutation (or disable it with a tracked TODO) instead of console.log.


97-105: Give sections a real type instead of (s: any).

Line [99] repeats the unsafe (s: any) map. Please reuse the persisted schema so the editor stays type-safe:

-  const [sections, setSections] = useState(() =>
-    (value.sections || []).map((s: any) => ({ ...s, id: crypto.randomUUID() }))
-  );
+  type SectionWithId = persisted.Template["sections"][number] & { id: string };
+  const [sections, setSections] = useState<SectionWithId[]>(() =>
+    (value.sections ?? []).map((section) => ({ ...section, id: crypto.randomUUID() }))
+  );

138-144: Implement the Delete flow before shipping.

Line [141] still only logs, so “Delete” never happens. Hook this button into the actual delete mutation (with loading/cleanup) or remove it until the backend call exists—leaving it as a no-op is a broken UX.


150-202: Restore visible focus styling for keyboard users.

Lines [152], [195], and [201] all include focus-visible:ring-0, which removes any focus indicator and violates WCAG 2.4.7. Swap in an accessible focus style instead, e.g.:

-          className="text-lg font-semibold border-none p-0 focus-visible:ring-0"
+          className="text-lg font-semibold border-none p-0 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2"-                    className="border-0 bg-transparent p-0 text-base font-medium focus-visible:ring-0 focus-visible:ring-offset-0 placeholder:text-muted-foreground/60"
+                    className="border-0 bg-transparent p-0 text-base font-medium focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 placeholder:text-muted-foreground/60"-                    className="min-h-[30px] resize-none border-0 bg-transparent p-0 text-sm text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0 placeholder:text-muted-foreground/50"
+                    className="min-h-[30px] resize-none border-0 bg-transparent p-0 text-sm text-muted-foreground focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 placeholder:text-muted-foreground/50"

Apply a similar treatment wherever you removed the default ring.

📜 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 efc0a78 and 768c35d.

📒 Files selected for processing (3)
  • apps/desktop2/src/components/settings/ai.tsx (3 hunks)
  • apps/desktop2/src/components/settings/templates.tsx (3 hunks)
  • apps/desktop2/src/store/tinybase/internal.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
apps/desktop2/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (apps/desktop2/.cursor/rules/style.mdc)

apps/desktop2/**/*.{tsx,jsx}: When there are many Tailwind classNames with conditional logic, use the cn utility imported as import { cn } from "@hypr/ui/lib/utils"
Always pass an array to cn when composing Tailwind classNames
Split cn array entries by logical grouping when composing Tailwind classNames

Files:

  • apps/desktop2/src/components/settings/ai.tsx
  • apps/desktop2/src/components/settings/templates.tsx
**/*.{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/desktop2/src/components/settings/ai.tsx
  • apps/desktop2/src/store/tinybase/internal.ts
  • apps/desktop2/src/components/settings/templates.tsx
🔇 Additional comments (5)
apps/desktop2/src/store/tinybase/internal.ts (3)

54-54: Schema definition correctly mirrors Zod schema.

The TinyBase schema definition for model_name is consistent with the Zod schema change on line 26.


19-20: LGTM! Consider verifying provider identifiers.

The new LLM and STT provider fields are correctly defined with sensible defaults. The schema definitions are consistent between the Zod schema and TinyBase schema.

Consider running the following script to verify that "hyprcloud" and "hyprlocal" are valid provider identifiers used elsewhere in the codebase:


26-26: Verify impact of required field on existing AI records.

The model_name field is added as a required field without a default value. This could break existing code or data if:

  1. There are existing AI records in storage that don't have this field
  2. Code that creates/updates AI records hasn't been updated to include this field

Consider either:

  1. Adding a default value: model_name: z.string().default("") or similar
  2. Making it optional: model_name: z.string().optional()
  3. Or verifying that all existing usage points and data have been updated

Run the following script to find where AI records are created or the AI type is used:

apps/desktop2/src/components/settings/ai.tsx (2)

139-153: LGTM!

The refactor to extract handleClick improves code organization and allows for combining the toggle logic with the optional provider selection callback.


130-142: Verify the usage of handleSelectProvider prop.

The handleSelectProvider callback prop is defined but doesn't appear to be passed by any parent component (TranscriptionSettings or IntelligenceSettings). Ensure this prop is being used or consider removing it if it's not yet needed.

Run the following script to check if this prop is being passed anywhere:

@yujonglee yujonglee merged commit f40d239 into main Oct 13, 2025
4 checks passed
@yujonglee yujonglee deleted the minor-fixes-1013 branch October 13, 2025 09:10
This was referenced Oct 19, 2025
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