import React, { useEffect } from 'react'
import CommonLayout from '@proto/app/_layout'
import { BrandProvider } from '@proto/utils/core/brand/context'
import brand from '@/brand'
import { useAppStore } from '@proto/stores'

export default function Layout() {
  useEffect(() => {
    const primary = brand?.theme?.colors?.primary
    if (primary) useAppStore.getState().setPrimary(primary)
  }, [])

  return (
    <BrandProvider value={brand}>
      <CommonLayout />
    </BrandProvider>
  )
}
