Skip to content

Commit 2c7ca10

Browse files
committed
feat: add overriddenBy property to ModeWithSource and display in ModeEnableDisableDialog
1 parent c789545 commit 2c7ca10

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/services/ModeManager.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ export interface ModeState {
1414
// Internal type used when returning modes to callers (webview/handlers).
1515
// Extends the canonical ModeConfig with source information and an optional
1616
// UI-only `overridesBuiltin` flag used by the webview.
17-
export type ModeWithSource = ModeConfig & { source: ModeSource; overridesBuiltin?: boolean }
17+
export type ModeWithSource = ModeConfig & {
18+
source: ModeSource
19+
overridesBuiltin?: boolean
20+
overriddenBy?: ModeSource
21+
}
1822

1923
/**
2024
* ModeManager handles mode operations including enable/disable functionality,
@@ -42,6 +46,14 @@ export class ModeManager {
4246
const customOverride = customModes.find((m) => m.slug === mode.slug)
4347
if (!customOverride) {
4448
allModes.push({ ...mode, source: "builtin" })
49+
} else {
50+
// Add overridden built-in mode with override information
51+
allModes.push({
52+
...mode,
53+
source: "builtin",
54+
disabled: customOverride.disabled,
55+
overriddenBy: customOverride.source as ModeSource,
56+
})
4557
}
4658
}
4759

webview-ui/src/components/modes/ModeEnableDisableDialog.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export type ModeSource = "builtin" | "global" | "project"
4343
export interface ModeWithSource extends ModeConfig {
4444
source: ModeSource
4545
disabled?: boolean
46+
overriddenBy?: ModeSource
4647
}
4748

4849
interface ModeEnableDisableDialogProps {
@@ -222,6 +223,11 @@ export const ModeEnableDisableDialog: React.FC<ModeEnableDisableDialogProps> = (
222223
<Badge variant="outline" className={cn("source-badge text-xs px-1.5 py-0.5", mode.source)}>
223224
{SOURCE_INFO[mode.source].icon} {mode.source}
224225
</Badge>
226+
{mode.overriddenBy && (
227+
<Badge variant="secondary" className="text-xs px-1.5 py-0.5">
228+
Overridden by {mode.overriddenBy}
229+
</Badge>
230+
)}
225231
</div>
226232
{mode.description && (
227233
<p className={cn("mode-description text-xs mt-1 truncate", mode.disabled && "disabled")}>

0 commit comments

Comments
 (0)