From 65a9ee90e3fa81826d84d4da171962cd9f34cb09 Mon Sep 17 00:00:00 2001 From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com> Date: Wed, 19 Jan 2022 08:58:07 +0200 Subject: [PATCH] FancyStageBanners in Match modal --- app/components/Modal.tsx | 2 +- .../tournament/DuringMatchActions.tsx | 29 ++++-------- .../tournament/FancyStageBanner.tsx | 46 +++++++++++++++++++ .../queries/findMatchModalInfoByNumber.ts | 4 +- .../bracket.$bid/match.$num.tsx | 30 +++++++----- app/styles/global.css | 5 +- app/styles/tournament-match.css | 14 +++++- 7 files changed, 93 insertions(+), 37 deletions(-) create mode 100644 app/components/tournament/FancyStageBanner.tsx diff --git a/app/components/Modal.tsx b/app/components/Modal.tsx index eaa82d72a..a9232a8b0 100644 --- a/app/components/Modal.tsx +++ b/app/components/Modal.tsx @@ -16,7 +16,7 @@ export default function Modal({ Close -

{title}

+

{title}

{children}
diff --git a/app/components/tournament/DuringMatchActions.tsx b/app/components/tournament/DuringMatchActions.tsx index af4ccdb82..945551e6e 100644 --- a/app/components/tournament/DuringMatchActions.tsx +++ b/app/components/tournament/DuringMatchActions.tsx @@ -1,13 +1,13 @@ import { Form, useMatches } from "remix"; import invariant from "tiny-invariant"; -import { modesShortToLong } from "~/constants"; import { resolveHostInfo } from "~/core/tournament/utils"; -import type { FindTournamentByNameForUrlI } from "~/services/tournament"; import type { BracketModified } from "~/services/bracket"; -import { modeToImageUrl, Unpacked } from "~/utils"; +import type { FindTournamentByNameForUrlI } from "~/services/tournament"; +import { Unpacked } from "~/utils"; import { SubmitButton } from "../SubmitButton"; import { ActionSectionWrapper } from "./ActionSectionWrapper"; import { DuringMatchActionsRosters } from "./DuringMatchActionsRosters"; +import { FancyStageBanner } from "./FancyStageBanner"; export function DuringMatchActions({ ownTeam, @@ -58,17 +58,11 @@ export function DuringMatchActions({ return (
-
-
-

- - {modesShortToLong[stage.mode]} on {stage.name} -

-

Stage {currentPosition}

-
+ {currentPosition > 1 && (
@@ -85,12 +79,7 @@ export function DuringMatchActions({
)} -
-
- {roundInfos.map((info, i) => ( -
{info}
- ))} -
+ +
+
+

+ + {modesShortToLong[stage.mode]} on {stage.name} +

+

Stage {roundNumber}

+
+ {children} +
+ {infos && ( +
+ {infos.map((info, i) => ( +
{info}
+ ))} +
+ )} + + ); +} diff --git a/app/db/tournament/queries/findMatchModalInfoByNumber.ts b/app/db/tournament/queries/findMatchModalInfoByNumber.ts index 5b78479ce..d7a6c18cb 100644 --- a/app/db/tournament/queries/findMatchModalInfoByNumber.ts +++ b/app/db/tournament/queries/findMatchModalInfoByNumber.ts @@ -15,7 +15,7 @@ export type FindMatchModalInfoByNumber = title: string; roundName: string; matchInfos: { - idForReact: string; + idForFrontend: string; teamUpper: TeamRosterInputTeam; teamLower: TeamRosterInputTeam; winnerId?: string; @@ -80,7 +80,7 @@ export async function findMatchModalInfoByNumber({ }); return { - idForReact: uuidv4(), + idForFrontend: uuidv4(), teamUpper: { name: upperTeam.team.name, id: upperTeam.teamId, diff --git a/app/routes/to/$organization.$tournament/bracket.$bid/match.$num.tsx b/app/routes/to/$organization.$tournament/bracket.$bid/match.$num.tsx index 7d003a2fc..16670c710 100644 --- a/app/routes/to/$organization.$tournament/bracket.$bid/match.$num.tsx +++ b/app/routes/to/$organization.$tournament/bracket.$bid/match.$num.tsx @@ -14,6 +14,7 @@ import { } from "~/db/tournament/queries/findMatchModalInfoByNumber"; import { Unpacked } from "~/utils"; import styles from "~/styles/tournament-match.css"; +import { FancyStageBanner } from "~/components/tournament/FancyStageBanner"; export const links: LinksFunction = () => { return [{ rel: "stylesheet", href: styles }]; @@ -38,22 +39,27 @@ export default function MatchModal() { return ( -

{data.roundName}

+

{data.roundName}

{data.matchInfos .filter((matchInfo) => matchInfo.winnerId) - .map((matchInfo) => { + .map((matchInfo, i) => { return ( - null} - setWinnerId={() => null} - winnerId={matchInfo.winnerId} - presentational - /> +
+ + null} + setWinnerId={() => null} + winnerId={matchInfo.winnerId} + presentational + /> +
); })}
diff --git a/app/styles/global.css b/app/styles/global.css index acc5e21e9..bf222a05f 100644 --- a/app/styles/global.css +++ b/app/styles/global.css @@ -290,7 +290,6 @@ select::selection { padding: 2em; background-color: var(--bg-lighter); border-radius: var(--rounded); - overscroll-behavior: contain; transform: translate(-50%, -50%); } @@ -426,3 +425,7 @@ select::selection { .items-center { align-items: center; } + +.rounded { + border-radius: var(--rounded); +} diff --git a/app/styles/tournament-match.css b/app/styles/tournament-match.css index 1c40878ab..b65838b63 100644 --- a/app/styles/tournament-match.css +++ b/app/styles/tournament-match.css @@ -1,6 +1,18 @@ +.tournament-match-modal__round-name { + color: var(--theme); + font-size: var(--fonts-sm); +} + .tournament-match-modal__rounds { display: flex; flex-direction: column; gap: var(--s-8); - margin-block-start: var(--s-4); + padding-block-start: var(--s-4); +} + +.tournament-match-modal__round { + display: flex; + flex-direction: column; + gap: var(--s-4); + padding-block-start: var(--s-4); }