import clsx from "clsx"; import { QRCodeSVG } from "qrcode.react"; import { useTranslation } from "react-i18next"; import { Alert } from "~/components/Alert"; import { useFormatDistanceToNow } from "~/hooks/intl/useFormatDistanceToNow"; import { SendouButton } from "../elements/Button"; import { SendouTabPanel } from "../elements/Tabs"; import styles from "./MatchJoinTab.module.css"; import { TAB_KEYS } from "./MatchTabs"; interface MatchJoinTabProps { joinLink?: string; hostedBy?: string; pool: string; pass: string; showNoSplatnetAlert: boolean; isStale?: boolean; staleMinutesAgo?: number; refreshedAt?: Date; onConfirmRoom?: () => void; isConfirming?: boolean; } export function MatchJoinTab({ joinLink, hostedBy, pool, pass, showNoSplatnetAlert, isStale, staleMinutesAgo, refreshedAt, onConfirmRoom, isConfirming, }: MatchJoinTabProps) { const { t } = useTranslation(["q"]); const formatDistanceToNow = useFormatDistanceToNow(); return (
{showNoSplatnetAlert ? ( {t("q:match.noSplatnetWarning")} ) : null}
{joinLink ? ( isStale ? ( ) : ( <> {refreshedAt ? (
{formatDistanceToNow(refreshedAt, { addSuffix: true })}
) : null}
{joinLink}
) ) : (
{t("q:match.room.noRoomHint")}
)}
{hostedBy ? ( ) : null}
); } function StaleRoomPrompt({ minutesAgo, onConfirm, isConfirming, }: { minutesAgo: number; onConfirm?: () => void; isConfirming?: boolean; }) { const { t } = useTranslation(["q"]); return (
{t("q:match.room.stalePrompt", { minutes: minutesAgo })}
{t("q:match.room.confirm")}
); } function InfoWithHeader({ header, value, testId, }: { header: string; value: string; testId?: string; }) { return (
{header}
{value}
); }