not working shit
This commit is contained in:
@ -2,7 +2,7 @@ from telebot.types import (
|
||||
InlineKeyboardButton as button,
|
||||
InlineKeyboardMarkup as keyboard,
|
||||
)
|
||||
from db.models import Queue
|
||||
from db.models import Queue, QueueUser
|
||||
|
||||
|
||||
def menu() -> keyboard:
|
||||
@ -117,3 +117,28 @@ def to_menu_keyboard() -> keyboard:
|
||||
[button(text="⬅️ В меню", callback_data="to_menu")],
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def pagination_footer(current_page: int, total_pages: int) -> list:
|
||||
return [
|
||||
button(text="◀️", callback_data="page_down"),
|
||||
button(text=f"{current_page}/{total_pages}", callback_data="dummy"),
|
||||
button(text="▶️", callback_data="page_up"),
|
||||
]
|
||||
|
||||
|
||||
def swap_users_list(
|
||||
queue_users: list[QueueUser], current_page: int, total_pages: int
|
||||
) -> keyboard:
|
||||
kb = [
|
||||
[
|
||||
button(
|
||||
text=f"{qu.position}. {qu.user.name}",
|
||||
callback_data=f"action:{qu.id}",
|
||||
)
|
||||
]
|
||||
for qu in queue_users
|
||||
]
|
||||
kb.append(pagination_footer(current_page, total_pages))
|
||||
kb.append([button(text="⬅️ Назад", callback_data="get_queue_users")])
|
||||
return keyboard(kb)
|
||||
|
||||
Reference in New Issue
Block a user