Define TeamRosterInputTeam interface

This commit is contained in:
Kalle (Sendou)
2022-01-17 09:44:27 +02:00
parent 72731fe887
commit e4ffdd1bae
2 changed files with 17 additions and 7 deletions

View File

@@ -1,10 +1,21 @@
import clone from "just-clone";
import { TOURNAMENT_TEAM_ROSTER_MIN_SIZE } from "~/constants";
import { FindTournamentByNameForUrlI } from "~/services/tournament";
import { Unpacked } from "~/utils";
import { Label } from "../Label";
import { TeamRosterInputsCheckboxes } from "./TeamRosterInputsCheckboxes";
/** Fields of a tournament team required to render `<TeamRosterInputs />` */
export interface TeamRosterInputTeam {
name: string;
id: string;
members: {
member: {
id: string;
discordName: string;
};
}[];
}
/** Inputs to select who played for teams in a match as well as the winner. Can also be used in a presentational way. */
export function TeamRosterInputs({
teamOne,
teamTwo,
@@ -13,8 +24,8 @@ export function TeamRosterInputs({
checkedPlayers,
setCheckedPlayers,
}: {
teamOne: Unpacked<FindTournamentByNameForUrlI["teams"]>;
teamTwo: Unpacked<FindTournamentByNameForUrlI["teams"]>;
teamOne: TeamRosterInputTeam;
teamTwo: TeamRosterInputTeam;
winnerId?: string;
setWinnerId: (newId: string) => void;
checkedPlayers: [string[], string[]];

View File

@@ -1,8 +1,7 @@
import clsx from "clsx";
import { TOURNAMENT_TEAM_ROSTER_MIN_SIZE } from "~/constants";
import type { FindTournamentByNameForUrlI } from "~/services/tournament";
import { Unpacked } from "~/utils";
import { Label } from "../Label";
import { TeamRosterInputTeam } from "./TeamRosterInputs";
export function TeamRosterInputsCheckboxes({
team,
@@ -10,7 +9,7 @@ export function TeamRosterInputsCheckboxes({
handlePlayerClick,
disabled,
}: {
team: Unpacked<FindTournamentByNameForUrlI["teams"]>;
team: TeamRosterInputTeam;
checkedPlayers: string[];
handlePlayerClick: (playerId: string) => void;
disabled: boolean;