diff options
author | MetroWind <chris.corsair@gmail.com> | 2025-08-31 09:45:36 -0700 |
---|---|---|
committer | MetroWind <chris.corsair@gmail.com> | 2025-08-31 09:45:36 -0700 |
commit | 58446021aaef002422c52c7d6c4b1a860d116de5 (patch) | |
tree | 77fa5048e416d6b5d03079b29c8259d328131f84 | |
parent | 3204043e5cd855855b045d8f410b320dcb772d25 (diff) |
UI layout
-rw-r--r-- | scripts/main.js | 20 | ||||
-rw-r--r-- | styles.css | 91 |
2 files changed, 60 insertions, 51 deletions
diff --git a/scripts/main.js b/scripts/main.js index b8de9e4..5483adf 100644 --- a/scripts/main.js +++ b/scripts/main.js | |||
@@ -108,8 +108,8 @@ ${cell_y * (CELL_SIZE + 1) + 1})`}, ASSET_WHITE_BG, TILES[idx].inner_svg); | |||
108 | 108 | ||
109 | function PlanView({plan, mouse_state}) | 109 | function PlanView({plan, mouse_state}) |
110 | { | 110 | { |
111 | console.debug("Looking at plan ", plan); | 111 | return h("div", {"id": "PlanView"}, |
112 | return h("div", {}, | 112 | h("div", {"id": "EntryIndicator"}, "⬇️"), |
113 | h(PlanGridView, {content: plan, mouse_state: mouse_state})); | 113 | h(PlanGridView, {content: plan, mouse_state: mouse_state})); |
114 | } | 114 | } |
115 | 115 | ||
@@ -190,13 +190,17 @@ function App({initial_state}) | |||
190 | } | 190 | } |
191 | 191 | ||
192 | return h("div", {}, | 192 | return h("div", {}, |
193 | h(FloorSelector, {floor: state.floor + 1, | 193 | h("div", {"class": "MainWrapper"}, |
194 | on_floor_change: onFloorChange}), | 194 | h("aside", {}, |
195 | h(AssetsView, {on_drag_begin: onDragAssetBegin, | 195 | h(FloorSelector, {floor: state.floor + 1, |
196 | on_drag_end: onDragAssetEnd}), | 196 | on_floor_change: onFloorChange}), |
197 | h("div", {"class": "LabeledPanel"}, | ||
198 | h("h2", {}, "Rooms"), | ||
199 | h(AssetsView, {on_drag_begin: onDragAssetBegin, | ||
200 | on_drag_end: onDragAssetEnd}))), | ||
201 | h(PlanView, {plan: state.plan[state.floor], | ||
202 | mouse_state: state.mouse_state})), | ||
197 | h("hr", {}), | 203 | h("hr", {}), |
198 | h(PlanView, {plan: state.plan[state.floor], | ||
199 | mouse_state: state.mouse_state}), | ||
200 | h("div", {}, | 204 | h("div", {}, |
201 | h("textarea", {readonly: true}, state.plan_code)), | 205 | h("textarea", {readonly: true}, state.plan_code)), |
202 | h("div", {"class": "ButtonRow"}, | 206 | h("div", {"class": "ButtonRow"}, |
@@ -95,10 +95,36 @@ html | |||
95 | 95 | ||
96 | .Dialog | 96 | .Dialog |
97 | { | 97 | { |
98 | max-width: 800px; | 98 | max-width: 910px; |
99 | margin: 0px auto; | 99 | margin: 0px auto; |
100 | } | 100 | } |
101 | 101 | ||
102 | .LabeledPanel | ||
103 | { | ||
104 | border-top: solid var(--color-border-light-1) 1px; | ||
105 | border-right: solid var(--color-border-dark-1) 1px; | ||
106 | border-bottom: solid var(--color-border-dark-1) 1px; | ||
107 | border-left: solid var(--color-border-light-1) 1px; | ||
108 | |||
109 | box-shadow: 1px 1px var(--color-border-light-1), | ||
110 | -1px -1px var(--color-border-dark-1); | ||
111 | padding: 1ex; | ||
112 | padding-top: 0px; | ||
113 | margin: 2ex 0px; | ||
114 | } | ||
115 | |||
116 | .LabeledPanel > h3, .LabeledPanel > h2 | ||
117 | { | ||
118 | font-weight: normal; | ||
119 | display: inline-block; | ||
120 | position: relative; | ||
121 | top: calc(-0.5em); | ||
122 | left: 1ex; | ||
123 | background-color: var(--color-bg); | ||
124 | padding: 0px 1ex 0px 1ex; | ||
125 | margin: 0px; | ||
126 | } | ||
127 | |||
102 | input[type="number"] | 128 | input[type="number"] |
103 | { | 129 | { |
104 | appearance: none; | 130 | appearance: none; |
@@ -248,28 +274,6 @@ table.InputFields | |||
248 | flex-grow: 1; | 274 | flex-grow: 1; |
249 | } | 275 | } |
250 | 276 | ||
251 | .Asset | ||
252 | { | ||
253 | display: inline-block; | ||
254 | border: solid black 1px; | ||
255 | width: 34px; | ||
256 | height: 34px; | ||
257 | } | ||
258 | |||
259 | |||
260 | |||
261 | /* Prevent SVG elements from interferring with drag n drop. */ | ||
262 | #Grid * | ||
263 | { | ||
264 | pointer-events: none; | ||
265 | } | ||
266 | |||
267 | nav | ||
268 | { | ||
269 | display: flex; | ||
270 | justify-content: space-between; | ||
271 | } | ||
272 | |||
273 | #Links | 277 | #Links |
274 | { | 278 | { |
275 | box-shadow: inset -1px -1px var(--color-border-light-2), | 279 | box-shadow: inset -1px -1px var(--color-border-light-2), |
@@ -302,28 +306,29 @@ table.TableView | |||
302 | } | 306 | } |
303 | } | 307 | } |
304 | 308 | ||
305 | #Links table | 309 | .MainWrapper |
306 | { | 310 | { |
307 | table-layout: fixed; | 311 | display: flex; |
308 | 312 | gap: 10px; | |
309 | th:nth-child(1) | 313 | } |
310 | { | ||
311 | width: 10em; | ||
312 | } | ||
313 | 314 | ||
314 | td:nth-child(2) | 315 | .Asset |
315 | { | 316 | { |
316 | overflow: hidden; | 317 | display: inline-block; |
317 | white-space: nowrap; | 318 | border: solid black 1px; |
318 | } | 319 | width: 34px; |
320 | height: 34px; | ||
321 | } | ||
319 | 322 | ||
320 | th:nth-child(3), th:nth-child(4) | 323 | #EntryIndicator |
321 | { | 324 | { |
322 | width: 55px; | 325 | font-size: 150%; |
323 | } | 326 | text-align: center; |
327 | margin-bottom: 10px; | ||
328 | } | ||
324 | 329 | ||
325 | td:nth-child(3), td:nth-child(4) | 330 | /* Prevent SVG elements from interferring with drag n drop. */ |
326 | { | 331 | #Grid * |
327 | text-align: center; | 332 | { |
328 | } | 333 | pointer-events: none; |
329 | } | 334 | } |