export const setClientTitleAndDescription = (title: string, desc: string) => {
  document.title = title

  const description = document.querySelector('meta[name=description]') as HTMLMetaElement
  description.content = desc
}

export const setClientIcons = (clientName: string) => {
  const faviconLink = document.createElement('link')
  faviconLink.rel = 'icon'
  faviconLink.href = `/clients/${clientName}/favicon/favicon.ico`

  const faviconAppleLink = document.createElement('link')
  faviconLink.rel = 'apple-touch-icon'
  faviconLink.type = 'image/png'
  faviconLink.href = `/clients/${clientName}/favicon/apple-touch-icon.png`

  const favicon32Link = document.createElement('link')
  favicon32Link.rel = 'icon'
  favicon32Link.type = 'image/png'
  favicon32Link.href = `/clients/${clientName}/favicon/favicon-32x32.png`

  const favicon16Link = document.createElement('link')
  favicon16Link.rel = 'icon'
  favicon16Link.type = 'image/png'
  favicon16Link.href = `/clients/${clientName}/favicon/favicon-16x16.png`

  const manifest = document.createElement('link')
  manifest.rel = 'icon'
  manifest.href = `/clients/${clientName}/favicon/manifest.json`

  const { head } = window.document
  head.appendChild(faviconLink)
  head.appendChild(faviconAppleLink)
  head.appendChild(favicon32Link)
  head.appendChild(favicon16Link)
  head.appendChild(manifest)
}
