import { Link } from "@remix-run/react"; import { humanTimeAgo, snakeCaseToTitleCase, worlds, zones, } from "~/utils/strings"; import * as styles from "./index-world.css"; import vsLogo from "~/images/vs-100.png"; import ncLogo from "~/images/nc-100.png"; import trLogo from "~/images/tr-100.png"; import { FactionBar } from "./faction-bar"; import type { MetagameWorld } from "~/utils/metagame"; import type { PopulationWorld } from "~/utils/population"; import { c } from "~/utils/classes"; import { useEffect, useState } from "react"; import { AlertTimer } from "./alert-timer"; export type IndexWorldProps = { metagame: MetagameWorld; population: PopulationWorld; }; export const IndexWorld = ({ metagame, population }: IndexWorldProps) => { const worldId = metagame.id; const { platform, location, name } = worlds[String(worldId || "default")]; const nextZone = metagame.zones.sort( (a, b) => new Date(a.locked_since ?? Date.now()).getTime() - new Date(b.locked_since ?? Date.now()).getTime() )[0]; const nextZoneStrings = worldId !== 2000 ? zones[nextZone.id] : zones["default"]; return (