Files
explore/lib/hooks/useChainFavicon.ts
zeekay cbe3f2adb2 fix: use real brand logos from each project's logo repo
- Lux: triangle from ~/work/lux/logo/
- Zoo: three overlapping circles from ~/work/zoo/logo/
- Hanzo: geometric H from ~/work/hanzo/logo/
- SPC: unicorn emoji per user request
- Pars: 8-pointed star from ~/work/pars/logo/
- Changed branding to multi-path SVGs (logoViewBox + logoContent)
2026-02-27 13:13:13 -08:00

22 lines
800 B
TypeScript

import React from 'react';
import { getCurrentChain } from 'configs/app/chainRegistry';
/**
* Dynamically sets the favicon SVG based on the current chain's branding.
* Generates an inline data: URI SVG favicon so each chain gets its own icon.
*/
export default function useChainFavicon(): void {
React.useEffect(() => {
const chain = getCurrentChain();
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">${ chain.branding.faviconContent }</svg>`;
const dataUri = `data:image/svg+xml,${ encodeURIComponent(svg) }`;
// Update the SVG favicon link (browsers prefer SVG when available)
const svgLink = document.querySelector<HTMLLinkElement>('link[rel="icon"][type="image/svg+xml"]');
if (svgLink) {
svgLink.href = dataUri;
}
}, []);
}