From 6b5a12ba047799267ccd286943decaa3245c8c44 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:49:51 +0300 Subject: [PATCH] Alternating pool code for tournaments --- .../components/ScoreReporter.tsx | 27 ++++++++++++++----- .../tournament-bracket-utils.ts | 13 ++++++--- .../tournament-bracket/tournament-bracket.css | 3 ++- .../tournament/routes/to.$id.register.tsx | 10 ++----- public/locales/en/tournament.json | 6 ++--- public/locales/fr/tournament.json | 6 ++--- public/locales/he/tournament.json | 5 ++-- public/locales/ja/tournament.json | 6 ++--- public/locales/zh/tournament.json | 6 ++--- 9 files changed, 49 insertions(+), 33 deletions(-) diff --git a/app/features/tournament-bracket/components/ScoreReporter.tsx b/app/features/tournament-bracket/components/ScoreReporter.tsx index cffc96e98..328d5310d 100644 --- a/app/features/tournament-bracket/components/ScoreReporter.tsx +++ b/app/features/tournament-bracket/components/ScoreReporter.tsx @@ -79,15 +79,30 @@ export function ScoreReporter({ ) : null, showFullInfos ? ( <> - {t("tournament:match.pass", { pass: resolveRoomPass(data.match.id) })} + {t("tournament:match.pass")}{" "} + + {resolveRoomPass(data.match.id)} + ) : null, showFullInfos ? ( - <> - {t("tournament:match.pool", { - code: HACKY_resolvePoolCode(parentRouteData.event), - })} - + + {t("tournament:match.pool")}{" "} + { + HACKY_resolvePoolCode({ + event: parentRouteData.event, + matchId: data.match.id, + }).prefix + } + + { + HACKY_resolvePoolCode({ + event: parentRouteData.event, + matchId: data.match.id, + }).lastDigit + } + + ) : null, <> {t("tournament:match.score", { diff --git a/app/features/tournament-bracket/tournament-bracket-utils.ts b/app/features/tournament-bracket/tournament-bracket-utils.ts index 22778f615..f9fdfd480 100644 --- a/app/features/tournament-bracket/tournament-bracket-utils.ts +++ b/app/features/tournament-bracket/tournament-bracket-utils.ts @@ -141,10 +141,17 @@ export function checkSourceIsValid({ return false; } -export function HACKY_resolvePoolCode(event: TournamentLoaderData["event"]) { - if (event.name.includes("In The Zone")) return "ITZ"; +export function HACKY_resolvePoolCode({ + event, + matchId, +}: { + event: TournamentLoaderData["event"]; + matchId: number; +}) { + const prefix = event.name.includes("In The Zone") ? "ITZ" : "PN"; + const lastDigit = matchId % 10; - return "PICNIC"; + return { prefix, lastDigit }; } export function bracketSubscriptionKey(tournamentId: number) { diff --git a/app/features/tournament-bracket/tournament-bracket.css b/app/features/tournament-bracket/tournament-bracket.css index 58bf07299..51feaba09 100644 --- a/app/features/tournament-bracket/tournament-bracket.css +++ b/app/features/tournament-bracket/tournament-bracket.css @@ -22,7 +22,8 @@ border-end-start-radius: var(--rounded); color: var(--tournaments-text); column-gap: var(--s-8); - font-size: var(--fonts-xs); + font-size: var(--fonts-xsm); + letter-spacing: 0.3px; } .tournament-bracket__infos__label { diff --git a/app/features/tournament/routes/to.$id.register.tsx b/app/features/tournament/routes/to.$id.register.tsx index 4a4dd0aa2..49a0b9239 100644 --- a/app/features/tournament/routes/to.$id.register.tsx +++ b/app/features/tournament/routes/to.$id.register.tsx @@ -87,10 +87,7 @@ import { import type { TournamentLoaderData } from "./to.$id"; import { FormWithConfirm } from "~/components/FormWithConfirm"; import { deleteTeam } from "../queries/deleteTeam.server"; -import { - HACKY_resolvePoolCode, - findMapPoolByTeamId, -} from "~/features/tournament-bracket"; +import { findMapPoolByTeamId } from "~/features/tournament-bracket"; import { Popover } from "~/components/Popover"; export const handle: SendouRouteHandle = { @@ -471,7 +468,6 @@ function CheckIn({ endDate: Date; checkedIn?: boolean; }) { - const data = useOutletContext(); const { t, i18n } = useTranslation(["tournament"]); const isMounted = useIsMounted(); const fetcher = useFetcher(); @@ -510,9 +506,7 @@ function CheckIn({ if (checkedIn) { return (
- {t("tournament:pre.checkIn.checkedIn", { - pool: HACKY_resolvePoolCode(data.event), - })} + {t("tournament:pre.checkIn.checkedIn")}
); } diff --git a/public/locales/en/tournament.json b/public/locales/en/tournament.json index ef4e18518..5214c455d 100644 --- a/public/locales/en/tournament.json +++ b/public/locales/en/tournament.json @@ -22,7 +22,7 @@ "pre.checkIn.over": "Check-in is over", "pre.checkIn.cant": "Complete the previous steps before checking in", "pre.checkIn.button": "Check in", - "pre.checkIn.checkedIn": "Your team is checked in. Please join the Pool: {{pool}}", + "pre.checkIn.checkedIn": "Your team is checked in", "pre.info.header": "Team info", "pre.info.unregister": "Unregister", @@ -115,8 +115,8 @@ "bracket.standings.showMore": "Show more", "match.hosts": "{{teamName}} hosts", - "match.pass": "Pass {{pass}}", - "match.pool": "Pool {{code}}", + "match.pass": "Pass", + "match.pool": "Pool", "match.score": "{{scoreOne}}-{{scoreTwo}} (Best of {{bestOf}})", "match.action.undoLastScore": "Undo last score", "match.action.reopenMatch": "Reopen match", diff --git a/public/locales/fr/tournament.json b/public/locales/fr/tournament.json index 9dad43088..6ffdf9268 100644 --- a/public/locales/fr/tournament.json +++ b/public/locales/fr/tournament.json @@ -22,7 +22,7 @@ "pre.checkIn.over": "L'enregistrement est fini", "pre.checkIn.cant": "Complétez les étapes précédentes avant de vous enregistrer", "pre.checkIn.button": "S'enregistrer", - "pre.checkIn.checkedIn": "Votre équipe est enregistrée. Veuillez rejoindre le canal: {{pool}}", + "pre.checkIn.checkedIn": "Votre équipe est enregistrée", "pre.info.header": "Info équipe", "pre.info.unregister": "Se désinscrire", @@ -115,8 +115,8 @@ "bracket.standings.showMore": "Montrer plus", "match.hosts": "{{teamName}} héberge", - "match.pass": "MdP {{pass}}", - "match.pool": "Canal {{code}}", + "match.pass": "MdP", + "match.pool": "Canal}", "match.score": "{{scoreOne}}-{{scoreTwo}} (Meilleur de {{bestOf}})", "match.action.undoLastScore": "Annuler le dernier score", "match.action.reopenMatch": "Rouvrir le match", diff --git a/public/locales/he/tournament.json b/public/locales/he/tournament.json index 2d2c92c79..2b6c2d6ab 100644 --- a/public/locales/he/tournament.json +++ b/public/locales/he/tournament.json @@ -22,7 +22,6 @@ "pre.checkIn.over": "צ'ק-אין נגמר", "pre.checkIn.cant": "השלימו את השלבים הקודמים לפני צ'ק-אין", "pre.checkIn.button": "צ'ק אין", - "pre.checkIn.checkedIn": "הצוות שלכם עשה צ'ק-אין. בבקשה הצטרפו לפול: {{pool}}", "pre.info.header": "מידע על הצוות", "pre.info.unregister": "ביטול הרשמה", @@ -115,8 +114,8 @@ "bracket.standings.showMore": "הראו יותר", "match.hosts": "{{teamName}} מארחים", - "match.pass": "סיסמה {{pass}}", - "match.pool": "פול {{code}}", + "match.pass": "סיסמה", + "match.pool": "פול", "match.score": "{{scoreOne}}-{{scoreTwo}} (הטוב מ-{{bestOf}})", "match.action.undoLastScore": "בטלו את התוצאה האחרונה", "match.action.reopenMatch": "פתיחה מחדש של הקרב", diff --git a/public/locales/ja/tournament.json b/public/locales/ja/tournament.json index 40d7e0099..1169fa836 100644 --- a/public/locales/ja/tournament.json +++ b/public/locales/ja/tournament.json @@ -22,7 +22,7 @@ "pre.checkIn.over": "チェックインは終了しました", "pre.checkIn.cant": "チェックインするための入力を完了してください", "pre.checkIn.button": "チェックイン", - "pre.checkIn.checkedIn": "チームのチェックインが完了しました。プールに参加してください: {{pool}}", + "pre.checkIn.checkedIn": "チームのチェックインが完了しました", "pre.info.header": "チーム情報", "pre.info.unregister": "登録解除", @@ -115,8 +115,8 @@ "bracket.standings.showMore": "さらに表示", "match.hosts": "{{teamName}} ホスト", - "match.pass": "通過 {{pass}}", - "match.pool": "プール {{code}}", + "match.pass": "通過", + "match.pool": "プール", "match.score": "{{scoreOne}}-{{scoreTwo}} (Best of {{bestOf}})", "match.action.undoLastScore": "最後のスコアをやりなおす", "match.action.reopenMatch": "対戦を再度開く", diff --git a/public/locales/zh/tournament.json b/public/locales/zh/tournament.json index 3dd8381a8..b262a713f 100644 --- a/public/locales/zh/tournament.json +++ b/public/locales/zh/tournament.json @@ -22,7 +22,7 @@ "pre.checkIn.over": "签到已结束", "pre.checkIn.cant": "请在签到之前完成前面的步骤", "pre.checkIn.button": "签到", - "pre.checkIn.checkedIn": "您的队伍已签到。请加入频道: {{pool}}", + "pre.checkIn.checkedIn": "您的队伍已签到", "pre.info.header": "队伍信息", "pre.info.unregister": "取消报名", @@ -115,8 +115,8 @@ "bracket.standings.showMore": "展开", "match.hosts": "{{teamName}} 为房主", - "match.pass": "密码 {{pass}}", - "match.pool": "频道 {{code}}", + "match.pass": "密码", + "match.pool": "频道", "match.score": "{{scoreOne}}-{{scoreTwo}} (Bo {{bestOf}})", "match.action.undoLastScore": "撤销上次比分", "match.action.reopenMatch": "重新开始对战",