MCPcopy Create free account
hub / github.com/code100x/chess / PlayerDisplay

Function PlayerDisplay

apps/frontend/src/components/GameEndModal.tsx:23–54  ·  view source on GitHub ↗
({
    player,
    gameResult,
    isWhite,
  }: {
    player?: { id: string; name: string };
    gameResult: Result;
    isWhite: boolean;
  })

Source from the content-addressed store, hash-verified

21 };
22
23 const PlayerDisplay = ({
24 player,
25 gameResult,
26 isWhite,
27 }: {
28 player?: { id: string; name: string };
29 gameResult: Result;
30 isWhite: boolean;
31 }) => {
32 const imageSrc = isWhite ? WhiteKing : BlackKing;
33 const borderColor =
34 gameResult === (isWhite ? Result.WHITE_WINS : Result.BLACK_WINS)
35 ? 'border-green-400'
36 : 'border-red-400';
37
38 return (
39 <div className="flex flex-col items-center">
40 <div className={`border-4 rounded-full p-2 ${borderColor}`}>
41 <img
42 src={imageSrc}
43 alt={`${isWhite ? 'White' : 'Black'} King`}
44 className="w-10 h-10"
45 />
46 </div>
47 <div className="text-center text-xm p-2">
48 <p className="text-white truncate w-24" title={getPlayerName(player)}>
49 {getPlayerName(player)}
50 </p>
51 </div>
52 </div>
53 );
54 };
55
56 const getWinnerMessage = (result: Result) => {
57 switch (result) {

Callers

nothing calls this directly

Calls 1

getPlayerNameFunction · 0.85

Tested by

no test coverage detected