mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 09:13:08 +00:00
fix: address second round of PR review feedback
- Add fallback for unknown enhancement modes in history button to prevent "Enhanced (undefined)" UI bug - Move DescriptionHistoryEntry interface to top level in add-feature-dialog - Import and use EnhancementMode type in edit-feature-dialog to eliminate hardcoded types - Make FollowUpHistoryEntry extend BaseHistoryEntry for consistency Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -91,6 +91,13 @@ interface AddFeatureDialogProps {
|
|||||||
allFeatures?: Feature[];
|
allFeatures?: Feature[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A single entry in the description history
|
||||||
|
*/
|
||||||
|
interface DescriptionHistoryEntry extends BaseHistoryEntry {
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
export function AddFeatureDialog({
|
export function AddFeatureDialog({
|
||||||
open,
|
open,
|
||||||
onOpenChange,
|
onOpenChange,
|
||||||
@@ -135,9 +142,6 @@ export function AddFeatureDialog({
|
|||||||
const [descriptionError, setDescriptionError] = useState(false);
|
const [descriptionError, setDescriptionError] = useState(false);
|
||||||
|
|
||||||
// Description history state
|
// Description history state
|
||||||
interface DescriptionHistoryEntry extends BaseHistoryEntry {
|
|
||||||
description: string;
|
|
||||||
}
|
|
||||||
const [descriptionHistory, setDescriptionHistory] = useState<DescriptionHistoryEntry[]>([]);
|
const [descriptionHistory, setDescriptionHistory] = useState<DescriptionHistoryEntry[]>([]);
|
||||||
|
|
||||||
// Spawn mode state
|
// Spawn mode state
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import {
|
|||||||
PlanningModeSelect,
|
PlanningModeSelect,
|
||||||
EnhanceWithAI,
|
EnhanceWithAI,
|
||||||
EnhancementHistoryButton,
|
EnhancementHistoryButton,
|
||||||
|
type EnhancementMode,
|
||||||
} from '../shared';
|
} from '../shared';
|
||||||
import type { WorkMode } from '../shared';
|
import type { WorkMode } from '../shared';
|
||||||
import { PhaseModelSelector } from '@/components/views/settings-view/model-defaults/phase-model-selector';
|
import { PhaseModelSelector } from '@/components/views/settings-view/model-defaults/phase-model-selector';
|
||||||
@@ -63,7 +64,7 @@ interface EditFeatureDialogProps {
|
|||||||
requirePlanApproval: boolean;
|
requirePlanApproval: boolean;
|
||||||
},
|
},
|
||||||
descriptionHistorySource?: 'enhance' | 'edit',
|
descriptionHistorySource?: 'enhance' | 'edit',
|
||||||
enhancementMode?: 'improve' | 'technical' | 'simplify' | 'acceptance' | 'ux-reviewer'
|
enhancementMode?: EnhancementMode
|
||||||
) => void;
|
) => void;
|
||||||
categorySuggestions: string[];
|
categorySuggestions: string[];
|
||||||
branchSuggestions: string[];
|
branchSuggestions: string[];
|
||||||
@@ -112,7 +113,7 @@ export function EditFeatureDialog({
|
|||||||
|
|
||||||
// Track the source of description changes for history
|
// Track the source of description changes for history
|
||||||
const [descriptionChangeSource, setDescriptionChangeSource] = useState<
|
const [descriptionChangeSource, setDescriptionChangeSource] = useState<
|
||||||
{ source: 'enhance'; mode: 'improve' | 'technical' | 'simplify' | 'acceptance' } | 'edit' | null
|
{ source: 'enhance'; mode: EnhancementMode } | 'edit' | null
|
||||||
>(null);
|
>(null);
|
||||||
// Track the original description when the dialog opened for comparison
|
// Track the original description when the dialog opened for comparison
|
||||||
const [originalDescription, setOriginalDescription] = useState(feature?.description ?? '');
|
const [originalDescription, setOriginalDescription] = useState(feature?.description ?? '');
|
||||||
|
|||||||
@@ -18,18 +18,20 @@ import {
|
|||||||
} from '@/components/ui/description-image-dropzone';
|
} from '@/components/ui/description-image-dropzone';
|
||||||
import { MessageSquare } from 'lucide-react';
|
import { MessageSquare } from 'lucide-react';
|
||||||
import { Feature } from '@/store/app-store';
|
import { Feature } from '@/store/app-store';
|
||||||
import { EnhanceWithAI, EnhancementHistoryButton, type EnhancementMode } from '../shared';
|
import {
|
||||||
|
EnhanceWithAI,
|
||||||
|
EnhancementHistoryButton,
|
||||||
|
type EnhancementMode,
|
||||||
|
type BaseHistoryEntry,
|
||||||
|
} from '../shared';
|
||||||
|
|
||||||
const logger = createLogger('FollowUpDialog');
|
const logger = createLogger('FollowUpDialog');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A single entry in the follow-up prompt history
|
* A single entry in the follow-up prompt history
|
||||||
*/
|
*/
|
||||||
export interface FollowUpHistoryEntry {
|
export interface FollowUpHistoryEntry extends BaseHistoryEntry {
|
||||||
prompt: string;
|
prompt: string;
|
||||||
timestamp: string; // ISO date string
|
|
||||||
source: 'initial' | 'enhance' | 'edit';
|
|
||||||
enhancementMode?: EnhancementMode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FollowUpDialogProps {
|
interface FollowUpDialogProps {
|
||||||
|
|||||||
@@ -54,7 +54,9 @@ export function EnhancementHistoryButton<T extends BaseHistoryEntry>({
|
|||||||
return 'Original';
|
return 'Original';
|
||||||
}
|
}
|
||||||
if (entry.source === 'enhance') {
|
if (entry.source === 'enhance') {
|
||||||
return `Enhanced (${ENHANCEMENT_MODE_LABELS[entry.enhancementMode ?? 'improve']})`;
|
const mode = entry.enhancementMode ?? 'improve';
|
||||||
|
const label = ENHANCEMENT_MODE_LABELS[mode as EnhancementMode] ?? mode;
|
||||||
|
return `Enhanced (${label})`;
|
||||||
}
|
}
|
||||||
return 'Edited';
|
return 'Edited';
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user