From 30461c0c68231c776ecdab069cc85a2e3cda0ad0 Mon Sep 17 00:00:00 2001 From: hugo Date: Tue, 10 Feb 2026 17:56:54 +0100 Subject: [PATCH] fix: delete for standard categories forbidden --- .../components/SettingsView/SettingsView.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/SettingsView/SettingsView.tsx b/src/renderer/components/SettingsView/SettingsView.tsx index f3ce90b..047a7a5 100644 --- a/src/renderer/components/SettingsView/SettingsView.tsx +++ b/src/renderer/components/SettingsView/SettingsView.tsx @@ -58,6 +58,9 @@ const SearchIcon = () => ( // Default post categories based on VISION.md const DEFAULT_POST_CATEGORIES = ['article', 'picture', 'aside', 'page']; +// Standard categories that cannot be deleted +const PROTECTED_CATEGORIES = ['article', 'aside', 'page', 'picture']; + // Individual setting row component (VS Code style) const SettingRow: React.FC<{ id: string; @@ -328,6 +331,10 @@ export const SettingsView: React.FC = () => { }; const handleRemoveCategory = (categoryToRemove: string) => { + if (PROTECTED_CATEGORIES.includes(categoryToRemove)) { + showToast.error(`Cannot delete standard category "${categoryToRemove}"`); + return; + } if (postCategories.length <= 1) { showToast.error('Must have at least one category'); return; @@ -352,9 +359,12 @@ export const SettingsView: React.FC = () => { hidden={!sectionHasMatches(contentKeywords)} >
- {postCategories.map((cat) => ( + {postCategories.map((cat) => { + const isProtected = PROTECTED_CATEGORIES.includes(cat); + return (
- {cat} + {cat}{isProtected && ' (standard)'} + {!isProtected && ( + )}
- ))} + ); + })}