Rebrand to kaboot
This commit is contained in:
parent
156c210dea
commit
8a8ec9bc0e
8 changed files with 59 additions and 27 deletions
|
|
@ -8,10 +8,15 @@ interface ScoreboardProps {
|
|||
players: Player[];
|
||||
onNext: () => void;
|
||||
isHost: boolean;
|
||||
currentPlayerId: string | null;
|
||||
}
|
||||
|
||||
export const Scoreboard: React.FC<ScoreboardProps> = ({ players, onNext, isHost }) => {
|
||||
const sortedPlayers = [...players].sort((a, b) => b.score - a.score).slice(0, 5);
|
||||
export const Scoreboard: React.FC<ScoreboardProps> = ({ players, onNext, isHost, currentPlayerId }) => {
|
||||
const playersWithDisplayName = players.map(p => ({
|
||||
...p,
|
||||
displayName: p.id === currentPlayerId ? `${p.name} (You)` : p.name
|
||||
}));
|
||||
const sortedPlayers = [...playersWithDisplayName].sort((a, b) => b.score - a.score).slice(0, 5);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col h-screen p-8">
|
||||
|
|
@ -29,7 +34,7 @@ export const Scoreboard: React.FC<ScoreboardProps> = ({ players, onNext, isHost
|
|||
<XAxis type="number" hide />
|
||||
<YAxis
|
||||
type="category"
|
||||
dataKey="name"
|
||||
dataKey="displayName"
|
||||
tick={{ fontSize: 24, fontWeight: 800, fill: '#333', fontFamily: 'Fredoka' }}
|
||||
width={200}
|
||||
tickLine={false}
|
||||
|
|
@ -39,7 +44,7 @@ export const Scoreboard: React.FC<ScoreboardProps> = ({ players, onNext, isHost
|
|||
{sortedPlayers.map((entry, index) => (
|
||||
<Cell
|
||||
key={`cell-${index}`}
|
||||
fill={entry.id.startsWith('host') ? '#46178f' : '#8884d8'}
|
||||
fill={entry.color}
|
||||
className="filter drop-shadow-md"
|
||||
/>
|
||||
))}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue