'use client'

import { useEffect } from 'react'
import { useThemeStore, ACCENT_PRESETS } from '@/store/themeStore'

export default function ThemeApplier() {
  const { accentIdx } = useThemeStore()

  useEffect(() => {
    const preset = ACCENT_PRESETS[accentIdx] ?? ACCENT_PRESETS[0]
    document.documentElement.style.setProperty('--accent', preset.accent)
    document.documentElement.style.setProperty('--accent-rgb', preset.rgb)
  }, [accentIdx])

  return null
}
