Skip to content

Commit

Permalink
✨ enter submits message details modal
Browse files Browse the repository at this point in the history
  • Loading branch information
haliphax committed Mar 28, 2024
1 parent 4cdbf66 commit 08082ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions userland/scripts/messages/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class MessagesApp(BannerApp):
Binding("f", "filter", "Filter"),
Binding("n", "compose", "Compose"),
Binding("r", "reply", "Reply"),
Binding("escape", "", "Exit"),
]

CSS = """
Expand Down
16 changes: 11 additions & 5 deletions userland/scripts/messages/details_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@ async def on_mount(self) -> None:
inp: Input = self.get_widget_by_id("tags") # type: ignore
inp.value = tags

async def on_button_pressed(self, event: Button.Pressed) -> None:
if event.button.name == "cancel":
self.app.pop_screen() # pop this modal
return

async def submit(self) -> None:
app: XthuluApp = self.app # type: ignore
title: Input = self.get_widget_by_id("title") # type: ignore
title_validator = title.validate(title.value)
Expand Down Expand Up @@ -153,5 +149,15 @@ async def on_button_pressed(self, event: Button.Pressed) -> None:
self.app.pop_screen() # pop this modal
self.app.pop_screen() # pop the editor

async def on_input_submitted(self, event: Input.Submitted) -> None:
await self.submit()

async def on_button_pressed(self, event: Button.Pressed) -> None:
if event.button.name == "cancel":
self.app.pop_screen() # pop this modal
return

await self.submit()

async def key_escape(self, _):
self.app.pop_screen() # pop this modal

0 comments on commit 08082ce

Please sign in to comment.