2023-05-15 00:51:32 +00:00
|
|
|
'use client'
|
2025-12-23 08:58:55 +00:00
|
|
|
import type { Locale } from '@/i18n-config'
|
2025-05-14 01:06:14 +00:00
|
|
|
import Divider from '@/app/components/base/divider'
|
2025-12-23 08:58:55 +00:00
|
|
|
import LocaleSigninSelect from '@/app/components/base/select/locale-signin'
|
2025-05-28 12:06:58 +00:00
|
|
|
import { useGlobalPublicStore } from '@/context/global-public-context'
|
2025-12-30 06:38:23 +00:00
|
|
|
import { useLocale } from '@/context/i18n'
|
|
|
|
|
import { setLocaleOnClient } from '@/i18n-config'
|
2025-12-23 08:58:55 +00:00
|
|
|
import { languages } from '@/i18n-config/language'
|
2026-03-18 02:37:29 +00:00
|
|
|
import dynamic from '@/next/dynamic'
|
2025-05-15 04:38:20 +00:00
|
|
|
|
|
|
|
|
// Avoid rendering the logo and theme selector on the server
|
|
|
|
|
const DifyLogo = dynamic(() => import('@/app/components/base/logo/dify-logo'), {
|
|
|
|
|
ssr: false,
|
2025-12-23 08:58:55 +00:00
|
|
|
loading: () => <div className="h-7 w-16 bg-transparent" />,
|
2025-05-15 04:38:20 +00:00
|
|
|
})
|
|
|
|
|
const ThemeSelector = dynamic(() => import('@/app/components/base/theme-selector'), {
|
|
|
|
|
ssr: false,
|
2025-12-23 08:58:55 +00:00
|
|
|
loading: () => <div className="size-8 bg-transparent" />,
|
2025-05-15 04:38:20 +00:00
|
|
|
})
|
2023-05-15 00:51:32 +00:00
|
|
|
|
|
|
|
|
const Header = () => {
|
2025-12-30 06:38:23 +00:00
|
|
|
const locale = useLocale()
|
2025-05-28 12:06:58 +00:00
|
|
|
const systemFeatures = useGlobalPublicStore(s => s.systemFeatures)
|
2023-09-25 04:49:16 +00:00
|
|
|
|
2025-05-14 01:06:14 +00:00
|
|
|
return (
|
2025-12-23 08:58:55 +00:00
|
|
|
<div className="flex w-full items-center justify-between p-6">
|
2025-05-28 12:06:58 +00:00
|
|
|
{systemFeatures.branding.enabled && systemFeatures.branding.login_page_logo
|
2025-12-23 08:58:55 +00:00
|
|
|
? (
|
|
|
|
|
<img
|
|
|
|
|
src={systemFeatures.branding.login_page_logo}
|
|
|
|
|
className="block h-7 w-auto object-contain"
|
|
|
|
|
alt="logo"
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
: <DifyLogo size="large" />}
|
|
|
|
|
<div className="flex items-center gap-1">
|
2025-08-10 09:21:05 +00:00
|
|
|
<LocaleSigninSelect
|
2025-05-14 01:06:14 +00:00
|
|
|
value={locale}
|
|
|
|
|
items={languages.filter(item => item.supported)}
|
|
|
|
|
onChange={(value) => {
|
|
|
|
|
setLocaleOnClient(value as Locale)
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2025-12-23 08:58:55 +00:00
|
|
|
<Divider type="vertical" className="mx-0 ml-2 h-4" />
|
2025-05-14 01:06:14 +00:00
|
|
|
<ThemeSelector />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
2023-05-15 00:51:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Header
|