2023-02-23 22:03:06 +00:00
|
|
|
import React from "react";
|
|
|
|
import ReactDOM from "react-dom/client";
|
|
|
|
import { App } from "./App";
|
2023-02-25 21:38:26 +00:00
|
|
|
import { ViewMode } from "./routes/ViewMode";
|
2023-01-29 20:27:02 +00:00
|
|
|
|
2023-05-13 21:06:58 +00:00
|
|
|
const renderResistants = (defaultViewMode: ViewMode, isHome: boolean) => {
|
2023-02-25 21:02:50 +00:00
|
|
|
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
|
|
|
|
<React.StrictMode>
|
2023-05-13 21:06:58 +00:00
|
|
|
<App defaultViewMode={defaultViewMode} home={isHome} />
|
2023-02-25 21:02:50 +00:00
|
|
|
</React.StrictMode>
|
|
|
|
);
|
2023-02-25 21:12:59 +00:00
|
|
|
};
|
2023-02-25 21:02:50 +00:00
|
|
|
|
2023-05-08 17:45:44 +00:00
|
|
|
const render = () => {
|
2023-05-13 21:06:58 +00:00
|
|
|
const isOnPageResistants = location.href.includes("resistants");
|
|
|
|
const defaultViewMode: ViewMode = isOnPageResistants ? "photos" : "map";
|
|
|
|
const isHome = !isOnPageResistants;
|
2023-02-25 21:02:50 +00:00
|
|
|
|
2023-05-13 21:06:58 +00:00
|
|
|
renderResistants(defaultViewMode, isHome);
|
2023-05-08 17:45:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if ("Squarespace" in window) {
|
|
|
|
// @ts-ignore
|
|
|
|
window.Squarespace.onInitialize(Y, render);
|
|
|
|
} else {
|
|
|
|
render();
|
|
|
|
}
|