@@ -4,24 +4,16 @@ import Button from '../Button';
44import { useGame } from '../../providers/GameProvider' ;
55import { useLocation } from 'wouter' ;
66import DarkContainer from '../DarkContainer' ;
7- import type { Player } from '../../utils/Player' ;
8- import { useWallet } from '@solana/wallet-adapter-react' ;
7+ import PlayerTagContainer from '../PlayerTag' ;
98
109const getColor = ( time : number ) => {
1110 if ( time > 5000 ) return 'lightgreen' ;
1211 if ( time > 2000 ) return 'orange' ;
1312 return 'red' ;
1413} ;
1514
16- const getTextDecoration = ( p : Player , walletId : string | undefined ) => {
17- if ( p . isDead ) return 'line-through' ;
18- if ( p . walletId === walletId ) return 'underline' ;
19- return 'none' ;
20- } ;
21-
2215export const GameStatus = ( ) => {
2316 const queryClient = useQueryClient ( ) ;
24- const { publicKey : walletId } = useWallet ( ) ;
2517
2618 const {
2719 gameState,
@@ -93,20 +85,7 @@ export const GameStatus = () => {
9385 </ Button >
9486 }
9587 </ DarkContainer >
96- < DarkContainer className = { c . rightFixed } >
97- { gameState ?. players . map ( ( p ) => (
98- < div
99- key = { p . walletId }
100- style = { {
101- textDecoration : getTextDecoration ( p , walletId ?. toString ( ) ) ,
102- fontSize : p . won ? '20px' : '16px' ,
103- } } >
104- { p . playerType } { p . walletId === walletId ? ' (you)' : '' } | { p . cards } { ' ' }
105- / 3{ p . won && ' WON!' }
106- </ div >
107- ) ) }
108- </ DarkContainer >
109- { /* </div> */ }
88+ < PlayerTagContainer gameState = { gameState } />
11089 </ div >
11190 ) ;
11291} ;
0 commit comments