added members sidebar

This commit is contained in:
2026-05-15 15:29:17 +10:00
parent 1f3b570bd1
commit 00ac34431d

View File

@@ -35,6 +35,7 @@ def open_chat(channel: dict, channel_name: str, is_group=False):
chat_content.clear() chat_content.clear()
with chat_content: with chat_content:
# back btn
with ui.row(): with ui.row():
ui.button("Back", icon="arrow_back", on_click=show_contacts).props("flat") ui.button("Back", icon="arrow_back", on_click=show_contacts).props("flat")
@@ -43,16 +44,30 @@ def open_chat(channel: dict, channel_name: str, is_group=False):
ui.separator() ui.separator()
with ui.column().classes('w-full h-full overflow-auto'): with ui.row().classes('w-full h-full'):
# message history
current_messages = [] with ui.column().classes('flex-grow h-full overflow-auto'):
for i, msg in enumerate(channel):
current_messages.append(msg.content)
if i == len(channel)-1 or channel[i + 1].sender != msg.sender: current_messages = []
ui.chat_message(current_messages, name=msg.sender.name, stamp=msg.timestamp, sent=msg.sender != me)
current_messages = [] for i, msg in enumerate(channel):
current_messages.append(msg.content)
if i == len(channel)-1 or channel[i + 1].sender != msg.sender:
ui.chat_message(current_messages, name=msg.sender.name, stamp=msg.timestamp, sent=msg.sender != me)
current_messages = []
# users column on the right
with ui.column().classes('w-50 border-l h-full'):
ui.label("Users").classes('pl-4 text-h5')
ui.separator()
for user in set(msg.sender.name for msg in channel):
with ui.item():
with ui.item_section().props("avatar"):
ui.icon("person")
with ui.item_section():
ui.item_label(user)
def show_contacts(): def show_contacts():
chat_content.clear() chat_content.clear()