Skip to content

Commit 84dac26

Browse files
committed
feat: improve AI enhancement settings discoverability
- Show enhancement settings always with 50% opacity when AI is off - Remove vocabulary section from UI to simplify interface - Move setup guide below settings for better visual flow - Users can preview available modes before enabling This improves UX by showing what features are available without requiring AI to be enabled first.
1 parent b2db125 commit 84dac26

File tree

2 files changed

+17
-77
lines changed

2 files changed

+17
-77
lines changed
Lines changed: 7 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
import { Label } from "@/components/ui/label";
22
import { Button } from "@/components/ui/button";
3-
import { Input } from "@/components/ui/input";
4-
import { Badge } from "@/components/ui/badge";
5-
import { useState } from "react";
6-
import { FileText, Mail, GitCommit, Sparkles, X } from "lucide-react";
3+
import { FileText, Mail, GitCommit, Sparkles } from "lucide-react";
74

85
interface EnhancementSettingsProps {
96
settings: {
107
preset: "Default" | "Prompts" | "Email" | "Commit";
118
customVocabulary: string[];
129
};
1310
onSettingsChange: (settings: any) => void;
11+
disabled?: boolean;
1412
}
1513

16-
export function EnhancementSettings({ settings, onSettingsChange }: EnhancementSettingsProps) {
17-
const [vocabularyInput, setVocabularyInput] = useState("");
18-
14+
export function EnhancementSettings({ settings, onSettingsChange, disabled = false }: EnhancementSettingsProps) {
1915
const presets = [
2016
{
2117
id: "Default",
@@ -52,32 +48,9 @@ export function EnhancementSettings({ settings, onSettingsChange }: EnhancementS
5248
}
5349
};
5450

55-
const handleAddVocabulary = () => {
56-
const terms = vocabularyInput.split(",").map(t => t.trim()).filter(t => t);
57-
if (terms.length > 0) {
58-
onSettingsChange({
59-
...settings,
60-
customVocabulary: [...settings.customVocabulary, ...terms]
61-
});
62-
setVocabularyInput("");
63-
}
64-
};
65-
66-
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
67-
if (e.key === 'Enter' && vocabularyInput.trim()) {
68-
handleAddVocabulary();
69-
}
70-
};
71-
72-
const handleRemoveTerm = (term: string) => {
73-
onSettingsChange({
74-
...settings,
75-
customVocabulary: settings.customVocabulary.filter(t => t !== term)
76-
});
77-
};
7851

7952
return (
80-
<div className="space-y-6">
53+
<div className={`space-y-6 ${disabled ? 'opacity-50' : ''}`}>
8154
{/* Enhancement Mode */}
8255
<div className="space-y-3">
8356
<Label className="text-sm font-medium">Enhancement Mode</Label>
@@ -91,8 +64,9 @@ export function EnhancementSettings({ settings, onSettingsChange }: EnhancementS
9164
key={preset.id}
9265
variant={isSelected ? "default" : "outline"}
9366
size="sm"
94-
className="gap-2"
95-
onClick={() => handlePresetChange(preset.id)}
67+
className={`gap-2 ${disabled ? 'cursor-not-allowed' : ''}`}
68+
onClick={() => !disabled && handlePresetChange(preset.id)}
69+
disabled={disabled}
9670
>
9771
<Icon className="h-4 w-4" />
9872
{preset.label}
@@ -109,40 +83,6 @@ export function EnhancementSettings({ settings, onSettingsChange }: EnhancementS
10983
{settings.preset === "Commit" && "Creates conventional commit messages with type and scope"}
11084
</p>
11185
</div>
112-
113-
{/* Custom Vocabulary */}
114-
<div className="space-y-3">
115-
<Label className="text-sm font-medium">Custom Vocabulary</Label>
116-
<Input
117-
placeholder="Add terms (comma separated)"
118-
value={vocabularyInput}
119-
onChange={(e) => setVocabularyInput(e.target.value)}
120-
onKeyDown={handleKeyDown}
121-
className="text-sm"
122-
/>
123-
124-
{settings.customVocabulary.length > 0 && (
125-
<div className="flex flex-wrap gap-1.5">
126-
{settings.customVocabulary.map((term) => (
127-
<Badge
128-
key={term}
129-
variant="secondary"
130-
className="gap-1 pr-1"
131-
>
132-
{term}
133-
<Button
134-
variant="ghost"
135-
size="sm"
136-
className="h-4 w-4 p-0 hover:bg-transparent"
137-
onClick={() => handleRemoveTerm(term)}
138-
>
139-
<X className="h-3 w-3" />
140-
</Button>
141-
</Badge>
142-
))}
143-
</div>
144-
)}
145-
</div>
14686
</div>
14787
);
14888
}

src/components/sections/EnhancementsSection.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,16 @@ export function EnhancementsSection() {
363363
))}
364364
</div>
365365

366+
{/* Enhancement Settings - Always visible, disabled when AI is off */}
367+
<div className="mt-4 pt-4">
368+
<div className={!aiSettings.enabled ? "opacity-50 pointer-events-none" : ""}>
369+
<EnhancementSettings
370+
settings={enhancementOptions}
371+
onSettingsChange={handleEnhancementOptionsChange}
372+
/>
373+
</div>
374+
</div>
375+
366376
{/* Simple setup guide when AI is disabled */}
367377
{!aiSettings.enabled && (
368378
<div className="bg-muted/50 rounded-lg p-4 space-y-3 mt-4">
@@ -376,16 +386,6 @@ export function EnhancementsSection() {
376386
</ol>
377387
</div>
378388
)}
379-
380-
{/* Enhancement Settings - Always visible when enabled */}
381-
{aiSettings.enabled && (
382-
<div className="mt-4 pt-4">
383-
<EnhancementSettings
384-
settings={enhancementOptions}
385-
onSettingsChange={handleEnhancementOptionsChange}
386-
/>
387-
</div>
388-
)}
389389
</div>
390390
</ScrollArea>
391391

0 commit comments

Comments
 (0)