2026-03-28 12:19:13 +00:00
|
|
|
import React from 'react';
|
2026-03-28 12:19:44 +00:00
|
|
|
import GameRow from './GameRow';
|
2026-03-28 12:19:13 +00:00
|
|
|
|
2026-04-11 10:47:52 +00:00
|
|
|
export default function GameGrid({ grid, width, middle, revealed = false, attemptedLetters = {} }) {
|
2026-03-28 12:19:13 +00:00
|
|
|
return (
|
2026-03-31 17:36:32 +00:00
|
|
|
<div className="game-grid-scroll">
|
|
|
|
|
<table id="actors">
|
|
|
|
|
<tbody>
|
|
|
|
|
{grid.map((row, rowIndex) => {
|
|
|
|
|
if (row.separator !== undefined) {
|
2026-03-31 12:17:22 +00:00
|
|
|
return (
|
2026-03-31 17:36:32 +00:00
|
|
|
<tr key={rowIndex} className="separator-row">
|
|
|
|
|
<td className="hint-cell" />
|
|
|
|
|
{Array.from({ length: middle }, (_, i) => (
|
|
|
|
|
<td key={i} />
|
|
|
|
|
))}
|
|
|
|
|
<td className="letter-static separator-char">
|
|
|
|
|
{row.separator === ' ' ? '' : row.separator}
|
|
|
|
|
</td>
|
|
|
|
|
{Array.from({ length: width - middle }, (_, i) => (
|
|
|
|
|
<td key={middle + 1 + i} />
|
|
|
|
|
))}
|
|
|
|
|
</tr>
|
2026-03-31 12:17:22 +00:00
|
|
|
);
|
2026-03-31 17:36:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<GameRow
|
|
|
|
|
key={rowIndex}
|
|
|
|
|
actorName={row.actorName}
|
|
|
|
|
pos={row.pos}
|
|
|
|
|
colStart={middle - row.pos}
|
|
|
|
|
totalWidth={width}
|
|
|
|
|
hintType={row.hintType}
|
|
|
|
|
hintText={row.hintText}
|
2026-04-11 10:47:52 +00:00
|
|
|
rowIndex={rowIndex}
|
|
|
|
|
attemptedLetters={attemptedLetters[rowIndex] ?? null}
|
2026-04-11 08:58:33 +00:00
|
|
|
revealed={revealed}
|
2026-03-31 17:36:32 +00:00
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
2026-03-31 12:17:22 +00:00
|
|
|
</div>
|
2026-03-28 12:19:13 +00:00
|
|
|
);
|
|
|
|
|
}
|