mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-19 05:13:54 -07:00
implement gameboard v1
This commit is contained in:
parent
b103db681b
commit
0d7336edc2
177 changed files with 16995 additions and 139 deletions
50
webclient/src/components/Game/ZoneRail/ZoneRail.tsx
Normal file
50
webclient/src/components/Game/ZoneRail/ZoneRail.tsx
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import { App, Data } from '@app/types';
|
||||
|
||||
import ZoneStack from '../ZoneStack/ZoneStack';
|
||||
|
||||
import './ZoneRail.css';
|
||||
|
||||
export interface ZoneRailProps {
|
||||
gameId: number;
|
||||
playerId: number;
|
||||
onCardHover?: (card: Data.ServerInfo_Card) => void;
|
||||
onZoneClick?: (playerId: number, zoneName: string) => void;
|
||||
onZoneContextMenu?: (playerId: number, zoneName: string, event: React.MouseEvent) => void;
|
||||
}
|
||||
|
||||
const ZONES: Array<{ name: string; label: string }> = [
|
||||
{ name: App.ZoneName.DECK, label: 'Deck' },
|
||||
{ name: App.ZoneName.GRAVE, label: 'Graveyard' },
|
||||
{ name: App.ZoneName.EXILE, label: 'Exile' },
|
||||
];
|
||||
|
||||
function ZoneRail({
|
||||
gameId,
|
||||
playerId,
|
||||
onCardHover,
|
||||
onZoneClick,
|
||||
onZoneContextMenu,
|
||||
}: ZoneRailProps) {
|
||||
return (
|
||||
<div className="zone-rail" data-testid="zone-rail">
|
||||
{ZONES.map((z) => (
|
||||
<ZoneStack
|
||||
key={z.name}
|
||||
gameId={gameId}
|
||||
playerId={playerId}
|
||||
zoneName={z.name}
|
||||
label={z.label}
|
||||
onCardHover={onCardHover}
|
||||
onClick={onZoneClick ? (name) => onZoneClick(playerId, name) : undefined}
|
||||
onContextMenu={
|
||||
onZoneContextMenu
|
||||
? (name, e) => onZoneContextMenu(playerId, name, e)
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ZoneRail;
|
||||
Loading…
Add table
Add a link
Reference in a new issue