Apply tenant theme on business login and polish login branding.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
56f6b23074
commit
a48a24e6f2
@@ -16,6 +16,7 @@ import { resolveTenantByDomain } from '../services/tenantService'
|
||||
|
||||
interface TenantBrandingContextValue {
|
||||
businessName: string
|
||||
businessNameEn: string
|
||||
logoUrl: string | null
|
||||
faviconUrl: string | null
|
||||
}
|
||||
@@ -35,6 +36,7 @@ function pickBusinessName(
|
||||
export function TenantBrandingProvider({ children }: { children: ReactNode }) {
|
||||
const { setLocale } = useLocale()
|
||||
const [businessName, setBusinessName] = useState('')
|
||||
const [businessNameEn, setBusinessNameEn] = useState('')
|
||||
const [logoUrl, setLogoUrl] = useState<string | null>(null)
|
||||
const [faviconUrl, setFaviconUrl] = useState<string | null>(null)
|
||||
const defaultLocaleAppliedRef = useRef(false)
|
||||
@@ -59,6 +61,7 @@ export function TenantBrandingProvider({ children }: { children: ReactNode }) {
|
||||
tenant.name,
|
||||
domain,
|
||||
)
|
||||
const nameEn = pickBusinessName(info?.name, tenant.name, domain)
|
||||
|
||||
const nextLogo =
|
||||
info?.logoUrl?.trim() || tenant.logoUrl?.trim() || null
|
||||
@@ -69,6 +72,7 @@ export function TenantBrandingProvider({ children }: { children: ReactNode }) {
|
||||
null
|
||||
|
||||
setBusinessName(name || domain)
|
||||
setBusinessNameEn(nameEn || domain)
|
||||
setLogoUrl(nextLogo)
|
||||
setFaviconUrl(nextFavicon)
|
||||
applyDocumentFavicon(nextFavicon)
|
||||
@@ -84,6 +88,7 @@ export function TenantBrandingProvider({ children }: { children: ReactNode }) {
|
||||
} catch (err) {
|
||||
if (isAbortError(err) || controller.signal.aborted) return
|
||||
setBusinessName(domain)
|
||||
setBusinessNameEn(domain)
|
||||
setLogoUrl(null)
|
||||
setFaviconUrl(null)
|
||||
applyDocumentFavicon(null)
|
||||
@@ -98,8 +103,8 @@ export function TenantBrandingProvider({ children }: { children: ReactNode }) {
|
||||
}, [domain, setLocale])
|
||||
|
||||
const value = useMemo(
|
||||
() => ({ businessName, logoUrl, faviconUrl }),
|
||||
[businessName, logoUrl, faviconUrl],
|
||||
() => ({ businessName, businessNameEn, logoUrl, faviconUrl }),
|
||||
[businessName, businessNameEn, logoUrl, faviconUrl],
|
||||
)
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user