diff --git a/src/content/components/config-panel.ts b/src/content/components/config-panel.ts index e7b3cfb..a692ab0 100644 --- a/src/content/components/config-panel.ts +++ b/src/content/components/config-panel.ts @@ -11,6 +11,7 @@ import { type RulePresetRecord, } from '../../types/rule-preset'; import { I18nService } from '../../utils/i18n'; +import { buildRulePresetSummary, isRulePresetConfigValid } from '../../utils/rule-presets'; /** * Config Panel Component @@ -225,6 +226,10 @@ export class ConfigPanel extends LitElement { } private handleApplyPreset(record: RulePresetRecord): void { + if (!isRulePresetConfigValid(record.config)) { + return; + } + this.dispatchEvent( new CustomEvent('apply-rule-preset', { detail: { presetId: record.id, source: record.source }, @@ -818,16 +823,26 @@ export class ConfigPanel extends LitElement { private renderPresetItem(record: RulePresetRecord, deletable: boolean) { const summary = this.buildPresetSummary(record); + const isValid = isRulePresetConfigValid(record.config); return html` -
+
-
${record.name || summary}
+
+ ${record.name || summary} + ${isValid + ? '' + : html`${I18nService.t('rule_preset_invalid_badge')}`} +
${summary}
+ ${isValid + ? '' + : html`
${I18nService.t('rule_preset_invalid_hint')}
`}