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"; 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")]; return (
{name}
[{location}] [{platform}]{" "}
DETAILS ⇨
{population.factions.vs + population.factions.nc + population.factions.tr}
VS{" "} {population.factions.vs}
NC{" "} {population.factions.nc}
TR{" "} {population.factions.tr}
{metagame.zones .filter((zone) => !zone.locked) .sort((a, b) => { return a.alert && !b.alert ? -1 : b.alert && !a.alert ? 1 : 0; }) .map((zone) => { let { name, colors: [upper, lower], } = zones[zone.id]; return worldId !== 19 ? (
{name}
TERRITORY CONTROL
{zone.alert && (
{snakeCaseToTitleCase( zone.alert.alert_type ).toUpperCase()}{" "} ALERT PROGRESS | STARTED{" "} {humanTimeAgo( Date.now() - new Date(zone.alert.start_time).getTime(), true ).toUpperCase()}{" "} AGO
)}
) : (
{name}
); })}
); };