# adapter/telegram/keyboards/chat.py from __future__ import annotations from aiogram.types import InlineKeyboardButton, InlineKeyboardMarkup def chats_list_keyboard(chats: list[dict], active_chat_id: str | None) -> InlineKeyboardMarkup: buttons = [] for chat in chats: mark = "● " if chat["chat_id"] == active_chat_id else "" buttons.append([InlineKeyboardButton( text=f"{mark}{chat['name']}", callback_data=f"switch:{chat['chat_id']}:{chat['name']}", )]) buttons.append([InlineKeyboardButton(text="➕ Новый чат", callback_data="new_chat")]) return InlineKeyboardMarkup(inline_keyboard=buttons)