import { useMemo } from "react"; import type { Population } from "~/utils/saerro"; import { totalPopulation } from "~/utils/saerro"; import * as styles from "./faction-bar.css"; export const FactionBar = ({ population: { vs, nc, tr }, }: { population: Population; }) => { const { vsPercent, ncPercent, trPercent } = useMemo(() => { const total = totalPopulation({ vs, nc, tr, total: 0 }); return { vsPercent: Math.floor((vs / total) * 100) || 0, ncPercent: Math.floor((nc / total) * 100) || 0, trPercent: Math.floor((tr / total) * 100) || 0, }; }, [vs, nc, tr]); return (