fix: apply designer agent improvements to src/store/settingsStore.ts
This commit is contained in:
parent
747b68366f
commit
283a71dc8e
|
|
@ -0,0 +1,144 @@
|
||||||
|
import { create } from 'zustand'
|
||||||
|
import { persist } from 'zustand/middleware'
|
||||||
|
|
||||||
|
export interface SiteSettings {
|
||||||
|
// Identity
|
||||||
|
siteName: string
|
||||||
|
siteTagline: string
|
||||||
|
logoUrl: string
|
||||||
|
faviconUrl: string
|
||||||
|
|
||||||
|
// Colors
|
||||||
|
primaryColor: string
|
||||||
|
secondaryColor: string
|
||||||
|
accentColor: string
|
||||||
|
bgColor: string
|
||||||
|
textColor: string
|
||||||
|
headerBgColor: string
|
||||||
|
headerTextColor: string
|
||||||
|
footerBgColor: string
|
||||||
|
footerTextColor: string
|
||||||
|
|
||||||
|
// Layout
|
||||||
|
headerPosition: 'static' | 'sticky' | 'fixed'
|
||||||
|
headerLayout: 'left' | 'center' | 'right'
|
||||||
|
footerColumns: 1 | 2 | 3 | 4
|
||||||
|
|
||||||
|
// Header content
|
||||||
|
showTopBar: boolean
|
||||||
|
topBarText: string
|
||||||
|
topBarBgColor: string
|
||||||
|
|
||||||
|
// Footer content
|
||||||
|
footerDescription: string
|
||||||
|
footerAddress: string
|
||||||
|
footerPhone: string
|
||||||
|
footerEmail: string
|
||||||
|
footerCopyright: string
|
||||||
|
showFooterMap: boolean
|
||||||
|
|
||||||
|
// Social links
|
||||||
|
socialFacebook: string
|
||||||
|
socialTwitter: string
|
||||||
|
socialYoutube: string
|
||||||
|
|
||||||
|
// Hero section
|
||||||
|
heroTitle: string
|
||||||
|
heroSubtitle: string
|
||||||
|
heroBgImage: string
|
||||||
|
heroBgColor: string
|
||||||
|
heroTextColor: string
|
||||||
|
heroButtonText: string
|
||||||
|
heroButtonLink: string
|
||||||
|
heroButtonSecondaryText: string
|
||||||
|
heroButtonSecondaryLink: string
|
||||||
|
heroOverlayOpacity: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultSettings: SiteSettings = {
|
||||||
|
siteName: 'Association des Anciens Combattants',
|
||||||
|
siteTagline: 'Mémoire, Honneur, Fraternité',
|
||||||
|
logoUrl: '',
|
||||||
|
faviconUrl: '',
|
||||||
|
|
||||||
|
primaryColor: '#002395',
|
||||||
|
secondaryColor: '#ED2939',
|
||||||
|
accentColor: '#C9A84C',
|
||||||
|
bgColor: '#F8F5F0',
|
||||||
|
textColor: '#1a1a2e',
|
||||||
|
headerBgColor: '#002395',
|
||||||
|
headerTextColor: '#FFFFFF',
|
||||||
|
footerBgColor: '#001a6e',
|
||||||
|
footerTextColor: '#FFFFFF',
|
||||||
|
|
||||||
|
headerPosition: 'sticky',
|
||||||
|
headerLayout: 'left',
|
||||||
|
footerColumns: 3,
|
||||||
|
|
||||||
|
showTopBar: true,
|
||||||
|
topBarText: '🇫🇷 Gardons la mémoire de ceux qui ont servi la France',
|
||||||
|
topBarBgColor: '#C9A84C',
|
||||||
|
|
||||||
|
footerDescription: 'Notre association œuvre pour préserver la mémoire des anciens combattants et maintenir les liens de fraternité entre ses membres.',
|
||||||
|
footerAddress: '1 Rue de la République, 75001 Paris',
|
||||||
|
footerPhone: '+33 1 23 45 67 89',
|
||||||
|
footerEmail: 'contact@anciens-combattants.fr',
|
||||||
|
footerCopyright: '© 2024 Association des Anciens Combattants. Tous droits réservés.',
|
||||||
|
showFooterMap: false,
|
||||||
|
|
||||||
|
socialFacebook: '',
|
||||||
|
socialTwitter: '',
|
||||||
|
socialYoutube: '',
|
||||||
|
|
||||||
|
heroTitle: 'Mémoire, Honneur, Fraternité',
|
||||||
|
heroSubtitle: 'Association dédiée à la préservation de la mémoire des anciens combattants français et au soutien de leurs familles.',
|
||||||
|
heroBgImage: '',
|
||||||
|
heroBgColor: '#001a6e',
|
||||||
|
heroTextColor: '#FFFFFF',
|
||||||
|
heroButtonText: 'Découvrir l\'association',
|
||||||
|
heroButtonLink: '/about',
|
||||||
|
heroButtonSecondaryText: 'Nous rejoindre',
|
||||||
|
heroButtonSecondaryLink: '/contact',
|
||||||
|
heroOverlayOpacity: 60,
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SettingsStore {
|
||||||
|
settings: SiteSettings
|
||||||
|
updateSettings: (partial: Partial<SiteSettings>) => void
|
||||||
|
resetSettings: () => void
|
||||||
|
applyThemeVars: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useSettingsStore = create<SettingsStore>()(
|
||||||
|
persist(
|
||||||
|
(set, get) => ({
|
||||||
|
settings: defaultSettings,
|
||||||
|
updateSettings: (partial) => {
|
||||||
|
set((state) => ({
|
||||||
|
settings: { ...state.settings, ...partial },
|
||||||
|
}))
|
||||||
|
get().applyThemeVars()
|
||||||
|
},
|
||||||
|
resetSettings: () => {
|
||||||
|
set({ settings: defaultSettings })
|
||||||
|
get().applyThemeVars()
|
||||||
|
},
|
||||||
|
applyThemeVars: () => {
|
||||||
|
const s = get().settings
|
||||||
|
const root = document.documentElement
|
||||||
|
root.style.setProperty('--color-primary', s.primaryColor)
|
||||||
|
root.style.setProperty('--color-secondary', s.secondaryColor)
|
||||||
|
root.style.setProperty('--color-accent', s.accentColor)
|
||||||
|
root.style.setProperty('--color-bg', s.bgColor)
|
||||||
|
root.style.setProperty('--color-text', s.textColor)
|
||||||
|
root.style.setProperty('--color-header-bg', s.headerBgColor)
|
||||||
|
root.style.setProperty('--color-header-text', s.headerTextColor)
|
||||||
|
root.style.setProperty('--color-footer-bg', s.footerBgColor)
|
||||||
|
root.style.setProperty('--color-footer-text', s.footerTextColor)
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
name: 'cms-settings',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
Loading…
Reference in New Issue