Skip to content

Commit

Permalink
Add order entry button to menu bar
Browse files Browse the repository at this point in the history
  • Loading branch information
daya0576 committed Dec 1, 2024
1 parent c45659f commit b15906d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion beaverhabits/frontend/icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

MENU = SVG_TEMPLATE.format(height="24", color="rgb(255,255,255)", data="M120-240v-80h720v80H120Zm0-200v-80h720v80H120Zm0-200v-80h720v80H120Z")
ADD = SVG_TEMPLATE.format(height="24", color="rgb(255,255,255)", data="M440-440H240q-17 0-28.5-11.5T200-480q0-17 11.5-28.5T240-520h200v-200q0-17 11.5-28.5T480-760q17 0 28.5 11.5T520-720v200h200q17 0 28.5 11.5T760-480q0 17-11.5 28.5T720-440H520v200q0 17-11.5 28.5T480-200q-17 0-28.5-11.5T440-240v-200Z")
SWAP = SVG_TEMPLATE.format(height="12", color="rgb(255,255,255)", data="M360.21-432q-15.21 0-25.71-10.35T324-468v-258l-80 80q-11 11-25.67 11-14.66 0-25.33-11-11-10.67-11-25.33Q182-686 193-697l142-142q5.4-5 11.7-7.5 6.3-2.5 13.5-2.5t13.5 2.5Q380-844 385-839l142 142q11 11 11 25t-11 25.48Q516-636 501.5-636T476-647l-80-79v258q0 15.3-10.29 25.65Q375.42-432 360.21-432ZM599.8-111q-7.2 0-13.5-2.5T575-121L433-263q-11-10.91-10.5-25.45.5-14.55 11.5-26.03Q445-325 459.5-325t25.5 11l79 80v-258q0-15.3 10.29-25.65Q584.58-528 599.79-528t25.71 10.35Q636-507.3 636-492v258l80-80q11-11 25.67-11 14.66 0 25.33 11 11 10.67 11 25.33Q778-274 767-263L625-121q-5.4 5-11.7 7.5-6.3 2.5-13.5 2.5Z")

DELETE = SVG_TEMPLATE.format(height="24", color="rgb(158,158,158)", data="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z")
DELETE_F = SVG_TEMPLATE.format(height="24", color="rgb(158,158,158)", data="m376-300 104-104 104 104 56-56-104-104 104-104-56-56-104 104-104-104-56 56 104 104-104 104 56 56Zm-96 180q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520Zm-400 0v520-520Z")
Expand Down
6 changes: 5 additions & 1 deletion beaverhabits/frontend/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def menu_component(root_path: str) -> None:
with ui.menu():
compat_menu("Add", lambda: redirect("add"))
ui.separator()
# compat_menu("Sort", lambda: redirect("order"))
# compat_menu("Edit", lambda: redirect("order"))
# ui.separator()

compat_menu("Export", lambda: open_tab("export"))
Expand Down Expand Up @@ -85,6 +85,10 @@ def layout(title: str | None = None, with_menu: bool = True):
menu_header(title, target=root_path)
if with_menu:
ui.space()
if "order" in path:
menu_icon_button(icons.ADD, click=lambda: redirect("add"))
if "add" in path:
menu_icon_button("drag_indicator", click=lambda: redirect("order"))
with menu_icon_button(icons.MENU):
menu_component(root_path)

Expand Down

0 comments on commit b15906d

Please sign in to comment.