Skip to content

Commit 67139b7

Browse files
authored
fix: allow blank cells; disable dice roll until it is ready (#29)
1 parent 6d298ed commit 67139b7

7 files changed

Lines changed: 49 additions & 13 deletions

File tree

src/components/Editor/EditorHex.module.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,17 @@
115115
font-weight: bold;
116116
}
117117

118+
/* Blank rendering for editor hexes */
119+
.blank .hexId,
120+
.blank .icon {
121+
display: none !important;
122+
}
123+
124+
/* Hide all direct children (icon/label/etc) when blank — preserves pseudo-elements */
125+
.blank > * {
126+
display: none !important;
127+
}
128+
118129
@media (min-width: 480px) {
119130
.hex {
120131
--hex-size: 60px;

src/components/Editor/EditorHex.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export function EditorHex({ hex, onHexClick, isSelected, isHighlighted, isStart,
3333
]
3434
.filter(Boolean)
3535
.join(" ");
36+
const boxClasses = [hexClasses, hex.blank && classes.blank].filter(Boolean).join(" ");
3637

3738
const tooltipLabel = hex.label || `Hex ${hex.id}`;
3839

@@ -41,19 +42,15 @@ export function EditorHex({ hex, onHexClick, isSelected, isHighlighted, isStart,
4142
<Tooltip label={tooltipLabel} position="top" withArrow>
4243
<UnstyledButton onClick={onHexClick} className={containerClasses} aria-label={tooltipLabel}>
4344
<Box
44-
className={hexClasses}
45+
className={boxClasses}
4546
style={
4647
{
4748
backgroundColor,
4849
"--hex-bg": backgroundColor,
4950
} as React.CSSProperties
5051
}
5152
>
52-
{hex.style?.icon ? (
53-
<HexIcon icon={hex.style.icon} label={tooltipLabel} />
54-
) : (
55-
<span className={classes.hexId}>{hex.id}</span>
56-
)}
53+
{!hex.blank && (hex.style?.icon ? <HexIcon icon={hex.style.icon} label={tooltipLabel} /> : <span className={classes.hexId}>{hex.id}</span>)}
5754
</Box>
5855
</UnstyledButton>
5956
</Tooltip>

src/components/Editor/EngineSettingsPanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,11 @@ export function EngineSettingsPanel() {
143143

144144
<Select
145145
label="Dice Roll"
146-
description="The dice rolled to determine movement"
146+
description="(Coming Soon) The dice rolled to determine movement"
147147
value={draft.roll}
148148
onChange={handleRollChange}
149149
data={DICE_OPTIONS}
150+
disabled
150151
/>
151152

152153
<Text size="sm" fw={500}>

src/components/Editor/HexPropertyPanel.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useCallback, useState } from "react";
22
import {
33
Stack,
44
Text,
5+
Switch,
56
TextInput,
67
Textarea,
78
ColorInput,
@@ -199,6 +200,15 @@ export function HexPropertyPanel() {
199200
swatchesPerRow={8}
200201
/>
201202

203+
<Group justify="space-between" align="center">
204+
<Text size="sm">Render blank</Text>
205+
<Switch
206+
checked={!!selectedHex.blank}
207+
onChange={(e) => actions.updateHex(selectedHex.id, { blank: e.currentTarget.checked })}
208+
aria-label="Render hex blank"
209+
/>
210+
</Group>
211+
202212
<Box>
203213
<Text size="sm" fw={500} mb={4}>
204214
Icon

src/components/Hex/Hex.module.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@
7676
font-weight: bold;
7777
}
7878

79+
/* When a hex is marked blank, hide overlays (icon/label/number) */
80+
.blank .hexId,
81+
.blank .icon {
82+
display: none !important;
83+
}
84+
85+
.blank {
86+
/* make sure blank hexes still show shape but without content */
87+
}
88+
/* Hide all direct children (icon/label/etc) when blank — preserves pseudo-elements */
89+
.blank > * {
90+
display: none !important;
91+
}
92+
7993
@media (min-width: 480px) {
8094
.hex {
8195
--hex-size: 80px;

src/components/Hex/Hex.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export function Hex({ hex, onHexClick, isActive, isHighlighted }: HexProps) {
2020
const hexClasses = [classes.hex, isActive && classes.activeHex, isHighlighted && classes.highlightedHex]
2121
.filter(Boolean)
2222
.join(" ");
23+
// add blank class when hex should render empty
24+
const boxClasses = [hexClasses, hex.blank && classes.blank].filter(Boolean).join(" ");
2325

2426
const tooltipLabel = hex.label || `Hex ${hex.id}`;
2527

@@ -28,19 +30,15 @@ export function Hex({ hex, onHexClick, isActive, isHighlighted }: HexProps) {
2830
<Tooltip label={tooltipLabel} position="top" withArrow>
2931
<UnstyledButton onClick={onHexClick} className={containerClasses} disabled={isActive} aria-label={tooltipLabel}>
3032
<Box
31-
className={hexClasses}
33+
className={boxClasses}
3234
style={
3335
{
3436
backgroundColor,
3537
"--hex-bg": backgroundColor,
3638
} as React.CSSProperties
3739
}
3840
>
39-
{hex.style?.icon ? (
40-
<HexIcon icon={hex.style.icon} label={tooltipLabel} />
41-
) : (
42-
<span className={classes.hexId}>{hex.id}</span>
43-
)}
41+
{!hex.blank && (hex.style?.icon ? <HexIcon icon={hex.style.icon} label={tooltipLabel} /> : <span className={classes.hexId}>{hex.id}</span>)}
4442
</Box>
4543
</UnstyledButton>
4644
</Tooltip>

src/types/engine.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ export interface HexNode {
5454
modifiers?: Modifier[];
5555
/** Visual styling */
5656
style?: NodeStyle;
57+
/**
58+
* When true, this hex renders as a blank cell on the grid:
59+
* no icon, no number/label — only the base hex shape (still selectable).
60+
*/
61+
blank?: boolean;
5762
/**
5863
* Navigation map: direction -> target node ID
5964
* A node can reference itself to indicate "stay in place"

0 commit comments

Comments
 (0)