import "../../style/basket_court.css" import {RefObject} from "react" import CourtPlayer from "./CourtPlayer" import {Player} from "../../tactic/Player" import {CourtObject} from "../../tactic/CourtObjects"; import {CourtBall} from "./CourtBall"; export interface BasketCourtProps { players: Player[] objects: CourtObject[] onPlayerRemove: (p: Player) => void onPlayerChange: (p: Player) => void onBallRemove : () => void onBallMoved: (ball: DOMRect) => void, courtImage: string courtRef: RefObject } export function BasketCourt({ players, objects, onPlayerRemove, onBallRemove, onBallMoved, onPlayerChange, courtImage, courtRef, }: BasketCourtProps) { return (
{"court"} {players.map((player) => { return ( onPlayerRemove(player)} onBallDrop={onBallMoved} parentRef={courtRef} /> ) })} {objects.map(object => { if (object.type == "ball") { return } throw new Error("unknown court object", object.type) })}
) }