Skip to content

fix (desktop): preset fix an add two defaults#312

Merged
AviPeltz merged 2 commits intomainfrom
coherent-seahorse-889fcc
Dec 10, 2025
Merged

fix (desktop): preset fix an add two defaults#312
AviPeltz merged 2 commits intomainfrom
coherent-seahorse-889fcc

Conversation

@AviPeltz
Copy link
Copy Markdown
Collaborator

@AviPeltz AviPeltz commented Dec 10, 2025

Description

Related Issues

Type of Change

  • [x ] Bug fix
  • New feature
  • Documentation
  • Refactor
  • [ x] enhancement
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes

Summary by CodeRabbit

  • New Features

    • Introduced quick-add preset templates feature with predefined configurations for common setups, enabling one-click template additions.
  • Bug Fixes

    • Resolved input field layout issues to ensure proper text display and truncation within flexible containers.
  • Style

    • Updated placeholder text throughout preset settings for clearer, more concise guidance.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
website Ready Ready Preview Comment Dec 10, 2025 9:13pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 10, 2025

Walkthrough

The pull request adds preset template functionality to the settings view, introduces two predefined templates (Codex Danger and Claude Danger), and applies minor CSS layout fixes to ensure input fields shrink properly within flex containers. Placeholder text descriptions are updated for clarity.

Changes

Cohort / File(s) Summary
Preset layout refinements
apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/CommandsEditor/CommandsEditor.tsx, apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx
Added min-w-0 and/or truncate CSS classes to input fields to enable proper shrinking behavior within flex containers
Preset template system
apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
Introduced PresetTemplate interface and PRESET_TEMPLATES array with two predefined templates; added useMemo hook to track existing preset names; implemented isTemplateAdded helper and handleAddTemplate function; added "Quick add" UI section displaying template buttons with conditional state (check icon if already added, sparkles icon if available to add)
Configuration updates
apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts
Updated placeholder strings in PRESET_COLUMNS entries for name, cwd, and commands fields to use shorter, example-focused text

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • PresetsSettings.tsx deserves extra attention: verify that the template feature logic correctly prevents duplicate presets, that the useMemo dependency array is appropriate, and that the UI button state transitions (enabled/disabled/pending) work as intended

Poem

🐰 A rabbit's delight!
Templates spring forth like clover,
Quick add buttons bloom,
Presets now with sparkle shine—
No more typing thrice! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete with only the template checkboxes filled in; no actual description content, related issues, testing steps, screenshots, or notes are provided. Add a clear description of changes, link related issues, document testing steps, and provide additional context explaining the preset fixes and template additions.
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
Title check ✅ Passed The title mentions 'preset fix' and 'add two defaults', which aligns with the changes introducing preset templates and UI improvements, though the phrasing is somewhat awkward.
✨ 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 coherent-seahorse-889fcc

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 10, 2025

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

@AviPeltz AviPeltz marked this pull request as ready for review December 10, 2025 21:16
Copy link
Copy Markdown
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 (2)
apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx (1)

45-53: Improved handling of long preset values

Adding min-w-0 and truncate on the input complements the flex container and prevents long names/paths from breaking the row layout, while preserving readability. The small redundancy with the parent’s min-w-0 is acceptable.

apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx (1)

13-44: Template + quick‑add flow is solid; consider a small robustness guard

The new PresetTemplate/PRESET_TEMPLATES setup and quick‑add UI integrate cleanly with the existing presets logic: template payloads match what createPreset.mutate expects, existingPresetNames/isTemplateAdded give a clear “Already added” state, and the explanatory copy around presets/quick‑add reads well.

One edge case to consider: very fast repeated clicks on a template button could slip in multiple createPreset.mutate calls before createPreset.isPending or serverPresets update, potentially creating duplicates if the backend doesn’t enforce uniqueness on name. If you care about that case, you could add an internal guard:

-const handleAddTemplate = (template: PresetTemplate) => {
-  if (isTemplateAdded(template)) return;
-  createPreset.mutate(template.preset);
-};
+const handleAddTemplate = (template: PresetTemplate) => {
+  if (createPreset.isPending || isTemplateAdded(template)) return;
+  createPreset.mutate(template.preset);
+};

Not critical, but it makes the duplicate‑prevention behavior more robust without changing the UX.

Also applies to: 61-68, 120-123, 158-189

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3870a61 and 4b49189.

📒 Files selected for processing (4)
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/CommandsEditor/CommandsEditor.tsx (1 hunks)
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx (1 hunks)
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx (5 hunks)
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
apps/desktop/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

For Electron interprocess communication, ALWAYS use tRPC as defined in src/lib/trpc

Files:

  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/CommandsEditor/CommandsEditor.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts
apps/desktop/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

apps/desktop/**/*.{ts,tsx}: Please use alias as defined in tsconfig.json when possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary

Files:

  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/CommandsEditor/CommandsEditor.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Maintain type safety and avoid using any unless absolutely necessary in TypeScript code

Files:

  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/CommandsEditor/CommandsEditor.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts
**/components/**/[A-Z]*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Use one folder per component with structure ComponentName/ComponentName.tsx + index.ts barrel export

Files:

  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/CommandsEditor/CommandsEditor.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx
apps/desktop/src/renderer/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never import Node.js modules in renderer process or shared code - only in src/main/

Files:

  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/CommandsEditor/CommandsEditor.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts
🧠 Learnings (2)
📚 Learning: 2025-12-08T23:32:32.232Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T23:32:32.232Z
Learning: Applies to src/components/{ui,ai-elements,react-flow}/**/*.tsx : Use kebab-case single files for shadcn/ui components in src/components/ui/, src/components/ai-elements, and src/components/react-flow/

Applied to files:

  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/CommandsEditor/CommandsEditor.tsx
  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetRow/PresetRow.tsx
📚 Learning: 2025-12-08T23:32:32.232Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T23:32:32.232Z
Learning: Use React + TailwindCSS v4 + shadcn/ui for UI components

Applied to files:

  • apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/PresetsSettings.tsx
🔇 Additional comments (2)
apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/types.ts (1)

15-27: Placeholder copy changes look good

The shorter “e.g.” placeholders are clear and better aligned with the new quick‑add UX, with no impact on types or behavior.

apps/desktop/src/renderer/screens/main/components/SettingsView/PresetsSettings/CommandsEditor/CommandsEditor.tsx (1)

71-85: Flex layout tweak is appropriate

Adding min-w-0 to the flexed input ensures it can shrink without overflowing alongside the delete button; the rest of the behavior is unchanged and looks correct.

@AviPeltz AviPeltz merged commit c5da22d into main Dec 10, 2025
8 checks passed
@Kitenite Kitenite deleted the coherent-seahorse-889fcc branch December 11, 2025 03:06
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