mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
- 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)
22 lines
800 B
TypeScript
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;
|
|
}
|
|
}, []);
|
|
}
|