ultisuite-client/components/agenda/agenda-org-policy-sync.tsx
R3D347HR4Y ad1370ea7e
Some checks are pending
E2E / Playwright e2e (push) Waiting to run
feat: enhance configuration and add new demo layouts
- Introduced turbopack alias for canvas in next.config.mjs.
- Updated package.json scripts for development and branding tasks.
- Added new dependencies for Tiptap extensions.
- Implemented new demo layouts for agenda, contacts, drive, and mail applications.
- Enhanced globals.css for improved theming and splash screen animations.
- Added OAuth callback handling for drive mounts.
- Updated layout components to integrate new demo shells and improve structure.
2026-06-12 19:10:24 +02:00

29 lines
992 B
TypeScript

"use client"
import { useEffect, useRef } from "react"
import { useCurrentUser } from "@/lib/api/hooks/use-current-user"
import { useMailSettingsStore } from "@/lib/stores/mail-settings-store"
import type { MailThemeMode } from "@/lib/mail-settings/types"
/** Applique le thème organisationnel imposé sur le store mail partagé. */
export function AgendaOrgPolicySync() {
const { data: user } = useCurrentUser()
const appliedRef = useRef<MailThemeMode | null>(null)
const enforceOrgTheme = user?.org_agenda?.enforce_org_theme ?? false
const orgThemeMode = user?.org_agenda?.default_theme_mode
useEffect(() => {
if (!enforceOrgTheme || !orgThemeMode) return
if (appliedRef.current === orgThemeMode) return
const current = useMailSettingsStore.getState().themeMode
if (current !== orgThemeMode) {
useMailSettingsStore.getState().setThemeMode(orgThemeMode)
}
appliedRef.current = orgThemeMode
}, [enforceOrgTheme, orgThemeMode])
return null
}