Skip to content

Commit dcddbb3

Browse files
sort called and uncalled into columns
Signed-off-by: Jonathan Irvin <djfoxyslpr@gmail.com>
1 parent 049b6b6 commit dcddbb3

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

main.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ def update_admin_visibility():
135135
"""
136136
for key, chks in admin_checkboxes.items():
137137
val = chks["left"].value # both copies hold the same value
138-
chks["left"].visible = not val # show left box only when unchecked
139-
chks["right"].visible = val # show right box only when checked
138+
chks["left"].set_visibility(not val) # show left box only when unchecked
139+
chks["right"].set_visibility(val) # show right box only when checked
140140
chks["left"].update()
141141
chks["right"].update()
142142

@@ -178,15 +178,20 @@ def admin_checkbox_change(e, key):
178178

179179
@ui.page("/admin")
180180
def admin_page():
181-
with ui.column().classes("w-full max-w-xl mx-auto p-4") as container:
182-
ui.label("Admin Panel (Seed Phrases)").classes("text-h4 text-center")
183-
panel = ui.column() # container for the checkboxes row
184-
181+
def reset_board():
182+
clicked_tiles.clear()
183+
# Re-add FREE MEAT at the center (position (2,2))
184+
clicked_tiles.add((2, 2))
185+
sync_board_state()
186+
build_admin_panel()
187+
with ui.row().classes("zd max-w-xl mx-auto p-4") as container:
188+
ui.label("Admin Panel").classes("text-h4 text-center")
189+
ui.button("Reset Board", on_click=reset_board)
185190
def build_admin_panel():
186191
panel.clear() # clear previous panel content
187-
with panel: # add new content as children of panel
192+
with panel:
188193
with ui.row():
189-
with ui.column().classes("w-1/2"):
194+
with ui.column():
190195
ui.label("Uncalled").classes("text-h5 text-center")
191196
# Create left (uncalled) checkboxes inside this column.
192197
for r in range(5):
@@ -203,7 +208,7 @@ def on_admin_checkbox_change(e, key=key):
203208
build_admin_panel() # re-render admin panel after change
204209
left_chk = ui.checkbox(phrase, value=(key in clicked_tiles), on_change=on_admin_checkbox_change)
205210
admin_checkboxes.setdefault(key, {})["left"] = left_chk
206-
with ui.column().classes("w-1/2"):
211+
with ui.column():
207212
ui.label("Called").classes("text-h5 text-center")
208213
# Create right (called) checkboxes inside this column.
209214
for r in range(5):
@@ -221,6 +226,11 @@ def on_admin_checkbox_change(e, key=key):
221226
right_chk = ui.checkbox(phrase, value=(key in clicked_tiles), on_change=on_admin_checkbox_change)
222227
admin_checkboxes.setdefault(key, {})["right"] = right_chk
223228

229+
panel = ui.row() # container for the checkboxes row
230+
231+
232+
233+
224234
build_admin_panel()
225235
ui.timer(1, update_admin_visibility)
226236

0 commit comments

Comments
 (0)