Initial commit
This commit is contained in:
25
frontend/app/ui/BrandingFavicon.tsx
Normal file
25
frontend/app/ui/BrandingFavicon.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect } from 'react'
|
||||
import { getApiBase } from '../lib/auth'
|
||||
|
||||
const STORAGE_KEY = 'branding_version'
|
||||
|
||||
export default function BrandingFavicon() {
|
||||
useEffect(() => {
|
||||
const baseUrl = getApiBase()
|
||||
const version =
|
||||
(typeof window !== 'undefined' && window.localStorage.getItem(STORAGE_KEY)) || ''
|
||||
const versionSuffix = version ? `?v=${encodeURIComponent(version)}` : ''
|
||||
const href = `${baseUrl}/branding/favicon.ico${versionSuffix}`
|
||||
let link = document.querySelector("link[rel='icon']") as HTMLLinkElement | null
|
||||
if (!link) {
|
||||
link = document.createElement('link')
|
||||
link.rel = 'icon'
|
||||
document.head.appendChild(link)
|
||||
}
|
||||
link.href = href
|
||||
}, [])
|
||||
|
||||
return null
|
||||
}
|
||||
Reference in New Issue
Block a user