import { createRoot } from "react-dom/client";
import App from "./App.jsx";
import "./index.css";
import { registerLicense } from '@syncfusion/ej2-base'

registerLicense('Ngo9BigBOggjHTQxAR8/V1JHaF5cWWdCf1FpRmJGdld5fUVHYVZUTXxaS00DNHVRdkdlWXxcdHRWRmFfU01+WkBWYEo=');

const host = window.location.hostname;

// favicon
function setFavicon(icon) {
  let link = document.querySelector("link[rel~='icon']");

  if (!link) {
    link = document.createElement("link");
    link.rel = "icon";
    document.head.appendChild(link);
  }

  link.href = icon + "?v=" + Date.now(); // cache fix
}

// theme color
function setTheme(color) {
  let meta = document.querySelector('meta[name="theme-color"]');

  if (!meta) {
    meta = document.createElement("meta");
    meta.name = "theme-color";
    document.head.appendChild(meta);
  }

  meta.content = color;
}

// DOMAIN LOGIC
if (host === "hf.herofashion.com") {
  setFavicon("/icons/production.png");
  setTheme("#42b883");
} else {
  setFavicon("/icons/development.png");
  setTheme("#000000");
}

createRoot(document.getElementById("root")).render(<App />);