Skip to content

Commit

Permalink
Scroll down after loading messages from history(#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
douglascdev committed Mar 21, 2024
1 parent a6822db commit 8b7155b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions hasherino/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ async def join_chat_click(_):
return

await self.tabs.add_tab(channel.value, self.message_received)
await self.chat_container.chat.scroll_to_async(offset=-1, duration=10)
await self.persistent_storage.set("channel", channel.value)
self.page.dialog.open = False

Expand Down Expand Up @@ -266,6 +267,7 @@ async def run(self):
self.tabs = Tabs(self.memory_storage, self.persistent_storage)

self.chat_container_on_msg = chat_container.on_message
self.chat_container = chat_container

# Add everything to the page
await self.page.add_async(
Expand Down Expand Up @@ -311,6 +313,7 @@ async def run(self):

if channel:
await self.tabs.add_tab(channel, self.message_received)
await self.chat_container.chat.scroll_to_async(offset=-1, duration=10)

await self.memory_storage.set(
"ttv_badges",
Expand Down
2 changes: 1 addition & 1 deletion hasherino/components/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ async def add_tab(self, channel: str, message_received: Awaitable[ParsedMessage]
channel, self.persistent_storage, self.memory_storage, message_received
)
await tab.load_emotes()
asyncio.ensure_future(tab.load_history())
await tab.load_history()
close_button = ft.IconButton(icon=ft.icons.CLOSE, on_click=self.close)
close_button.parent_tab = tab
tab.tab_content.controls.append(close_button)
Expand Down

0 comments on commit 8b7155b

Please sign in to comment.