diff --git a/desktop_app/main.py b/desktop_app/main.py index 58b033e..de8afe1 100644 --- a/desktop_app/main.py +++ b/desktop_app/main.py @@ -35,6 +35,7 @@ def open_chat(channel: dict, channel_name: str, is_group=False): chat_content.clear() with chat_content: + # back btn with ui.row(): 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() - with ui.column().classes('w-full h-full overflow-auto'): - - current_messages = [] - - for i, msg in enumerate(channel): - current_messages.append(msg.content) + with ui.row().classes('w-full h-full'): + # message history + with ui.column().classes('flex-grow h-full overflow-auto'): - 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 = [] + 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(): chat_content.clear()