Skip to content

Commit

Permalink
fix: move "Back" button to the bottom and update its text to use an a…
Browse files Browse the repository at this point in the history
…rrow
  • Loading branch information
dantetemplar committed Aug 17, 2024
1 parent 3354aa1 commit 4c7cf59
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 28 deletions.
6 changes: 3 additions & 3 deletions src/bot/dialogs/invitation/incoming_invitations.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ async def invitations_getter(dialog_manager: DialogManager, **kwargs):
},
selector=lambda data, widget, manager: len(data["invitations"]) == 0,
),
Row(
Cancel(Const("Back")),
),
ListGroup(
Row(
Button(
Expand All @@ -142,6 +139,9 @@ async def invitations_getter(dialog_manager: DialogManager, **kwargs):
item_id_getter=lambda invitation: invitation.id,
items=lambda data: data["invitations"],
),
Row(
Cancel(Const("◀️ Back")),
),
state=IncomingInvitationsSG.list,
getter=invitations_getter,
),
Expand Down
2 changes: 1 addition & 1 deletion src/bot/dialogs/invitation/outgoing_invitations.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async def invitations_getter(dialog_manager: DialogManager, **kwargs):
selector=lambda data, widget, manager: len(data["invitations"]) == 0,
),
Row(
Cancel(Const("Back")),
Cancel(Const("◀️ Back")),
),
Row(
SwitchTo(
Expand Down
5 changes: 4 additions & 1 deletion src/bot/dialogs/manual_task/manual_task_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ async def getter(dialog_manager: DialogManager, **kwargs):
on_click=Events.on_do_task,
when=lambda data, w, m: data["executors"],
),
Cancel(Const("Back"), MainWindowConsts.BACK_BUTTON_ID),
Cancel(
Const("◀️ Back"),
MainWindowConsts.BACK_BUTTON_ID,
),
parse_mode="HTML",
state=ManualTaskViewSG.main,
getter=getter,
Expand Down
8 changes: 4 additions & 4 deletions src/bot/dialogs/manual_task/manual_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ async def list_getter(dialog_manager: DialogManager, **kwargs):
# Task list
Window(
Const(TasksWindowConsts.HEADER_TEXT),
Cancel(
Const("Back"),
TasksWindowConsts.BACK_BUTTON_ID,
),
Button(
Const(TasksWindowConsts.NEW_TASK_BUTTON_TEXT),
id=TasksWindowConsts.NEW_TASK_BUTTON_ID,
Expand All @@ -114,6 +110,10 @@ async def list_getter(dialog_manager: DialogManager, **kwargs):
),
width=2,
),
Cancel(
Const("◀️ Back"),
TasksWindowConsts.BACK_BUTTON_ID,
),
state=ManualTasksSG.list,
getter=list_getter,
),
Expand Down
2 changes: 1 addition & 1 deletion src/bot/dialogs/periodic_task/periodic_task_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ async def getter(dialog_manager: DialogManager, **kwargs):
on_click=Events.on_edit_order,
),
),
Cancel(Const("Back"), MainWindowConsts.BACK_BUTTON_ID),
Cancel(Const("◀️ Back"), MainWindowConsts.BACK_BUTTON_ID),
state=PeriodicTaskViewSG.main,
getter=getter,
),
Expand Down
2 changes: 1 addition & 1 deletion src/bot/dialogs/periodic_task/periodic_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async def list_getter(dialog_manager: DialogManager, **kwargs):
Window(
Const(TasksWindowConsts.HEADER_TEXT),
Cancel(
Const("Back"),
Const("◀️ Back"),
TasksWindowConsts.BACK_BUTTON_ID,
),
Button(
Expand Down
15 changes: 8 additions & 7 deletions src/bot/dialogs/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ async def getter(dialog_manager: DialogManager, **kwargs):
items="roommates",
),
SwitchTo(
Const("Back"),
Const("◀️ Back"),
RoommatesWindowConsts.BACK_BUTTON_ID,
RoomSG.main,
on_click=Loader.load_callback(Loader.load_daily_info),
Expand All @@ -206,12 +206,6 @@ async def getter(dialog_manager: DialogManager, **kwargs):
# Task category selection
Window(
Const("Choose a category:"),
SwitchTo(
Const("Back"),
TaskCategoriesWindowConsts.BACK_BUTTON_ID,
state=RoomSG.main,
on_click=Loader.load_callback(Loader.load_daily_info),
),
Start(
Const("Periodic"),
TaskCategoriesWindowConsts.PERIODIC_TASKS_BUTTON_ID,
Expand All @@ -222,6 +216,13 @@ async def getter(dialog_manager: DialogManager, **kwargs):
TaskCategoriesWindowConsts.MANUAL_TASKS_BUTTON_ID,
state=ManualTasksSG.list,
),
SwitchTo(
Const("◀️ Back"),
TaskCategoriesWindowConsts.BACK_BUTTON_ID,
state=RoomSG.main,
on_click=Loader.load_callback(Loader.load_daily_info),
),

state=RoomSG.tasks,
),
on_start=Events.on_start,
Expand Down
20 changes: 10 additions & 10 deletions src/bot/dialogs/rule/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,6 @@ async def view_getter(dialog_manager: DialogManager, **kwargs):
# Rules list
Window(
Const(RulesWindowConsts.HEADER_TEXT),
Cancel(
Const("Back"),
RulesWindowConsts.BACK_BUTTON_ID,
),
Button(
Const(RulesWindowConsts.NEW_RULE_BUTTON_TEXT),
id=RulesWindowConsts.NEW_RULE_BUTTON_ID,
on_click=Events.on_create_rule,
),
Group(
Select(
Format("{item.name}"),
Expand All @@ -103,14 +94,23 @@ async def view_getter(dialog_manager: DialogManager, **kwargs):
),
width=2,
),
Button(
Const(RulesWindowConsts.NEW_RULE_BUTTON_TEXT),
id=RulesWindowConsts.NEW_RULE_BUTTON_ID,
on_click=Events.on_create_rule,
),
Cancel(
Const("◀️ Back"),
RulesWindowConsts.BACK_BUTTON_ID,
),
state=RulesSG.list,
getter=list_getter,
),
# View rule
Window(
Jinja(RulesWindowConsts.RULE_FORMAT),
SwitchTo(
Const("Back"),
Const("◀️ Back"),
id=RulesWindowConsts.BACK_BUTTON_ID,
state=RulesSG.list,
),
Expand Down

0 comments on commit 4c7cf59

Please sign in to comment.