Prettier & slight fix

Streamlined DummyGrid to behave like Grid.

Fixed a bad practice issue with ActiveFragmentSummary that displayed an error message in the webbrowser devtool console.
This commit is contained in:
borisflagell 2022-05-22 01:08:53 +02:00
parent ce5fdb00af
commit 5b4addbb21
3 changed files with 2 additions and 4 deletions

@ -66,7 +66,7 @@ export function ActiveFragmentSummary(props: IProps): React.ReactElement {
</TableRow> </TableRow>
{summary.map((entry) => { {summary.map((entry) => {
return ( return (
<TableRow> <TableRow key={entry.type}>
<TableCell sx={{ borderBottom: "none", p: 0, m: 0 }}> <TableCell sx={{ borderBottom: "none", p: 0, m: 0 }}>
<Typography> <Typography>
{entry.coordinate.map((coord) => { {entry.coordinate.map((coord) => {

@ -13,7 +13,6 @@ interface IProps {
export function DummyGrid(props: IProps): React.ReactElement { export function DummyGrid(props: IProps): React.ReactElement {
const gift = new DummyGift(props.width, props.height, props.fragments); const gift = new DummyGift(props.width, props.height, props.fragments);
const activeGrid = calculateGrid(gift);
const ghostGrid = zeros([props.width, props.height]); const ghostGrid = zeros([props.width, props.height]);
return ( return (
<Box> <Box>
@ -21,7 +20,6 @@ export function DummyGrid(props: IProps): React.ReactElement {
<Grid <Grid
width={props.width} width={props.width}
height={props.height} height={props.height}
activeGrid={activeGrid}
ghostGrid={ghostGrid} ghostGrid={ghostGrid}
gift={gift} gift={gift}
enter={() => undefined} enter={() => undefined}

@ -32,7 +32,7 @@ function randomColor(fragment: ActiveFragment): string {
} }
export function Grid(props: IProps): React.ReactElement { export function Grid(props: IProps): React.ReactElement {
const activeGrid = calculateGrid(props.gift) const activeGrid = calculateGrid(props.gift);
function color(worldX: number, worldY: number): string { function color(worldX: number, worldY: number): string {
if (props.ghostGrid[worldX][worldY] && activeGrid[worldX][worldY]) return "red"; if (props.ghostGrid[worldX][worldY] && activeGrid[worldX][worldY]) return "red";