Skip to content

Commit 9f649b0

Browse files
committed
feat: Add SiteContentEditor component and ContentContext for managing site content sections.
1 parent 6b21ccf commit 9f649b0

2 files changed

Lines changed: 6 additions & 20 deletions

File tree

src/components/SiteContentEditor/index.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -882,11 +882,11 @@ const SiteContentEditor = () => {
882882
} = useContent()
883883

884884
const sectionOptions = useMemo(() => {
885-
const base = [...CONTENT_SECTIONS]
886-
const extraKeys = content
887-
? Object.keys(content).filter((key) => !base.includes(key))
888-
: []
889-
return [...base, ...extraKeys.sort()]
885+
const keys = Object.keys(content || {})
886+
const defaultKeys = Object.keys(DEFAULT_CONTENT)
887+
const combined = Array.from(new Set([...keys, ...defaultKeys]))
888+
// Only show sections that have a defined label (whitelist approach)
889+
return combined.filter(key => sectionLabels.hasOwnProperty(key)).sort()
890890
}, [content])
891891

892892
const [selectedSection, setSelectedSection] = useState(null)

src/context/ContentContext.jsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,7 @@ export const DEFAULT_CONTENT = {
6565
title: 'IT Wissensportal - Security, Programming & Admin',
6666
description: 'Dein Portal für IT Security, Programmierung und Administration.',
6767
},
68-
tutorial_section: {
69-
title: 'Neueste Beiträge',
70-
description: 'Aktuelle Artikel und Guides aus der IT-Welt',
71-
heading: 'Wissen vertiefen',
72-
ctaDescription: 'Stöbere in unseren Artikeln und erweitere dein Know-how.',
73-
ctaPrimary: {
74-
label: 'Alle Beiträge',
75-
target: { type: 'route', value: '/blog' },
76-
},
77-
ctaSecondary: {
78-
label: 'Mehr erfahren',
79-
target: { type: 'section', value: 'home' },
80-
},
81-
tutorialCardButton: 'Artikel lesen',
82-
},
68+
8369
header: {
8470
brand: {
8571
name: 'IT Portal',

0 commit comments

Comments
 (0)