2024-10-05 14:35:26 +00:00
|
|
|
|
from aiogram.filters.callback_data import CallbackData
|
|
|
|
|
from aiogram.types import InlineKeyboardButton
|
|
|
|
|
from aiogram.utils.keyboard import InlineKeyboardBuilder
|
|
|
|
|
|
2024-10-09 20:50:46 +00:00
|
|
|
|
from bot.handlers.user.model_processing import get_model_page, ChooseCallBack
|
2024-10-05 14:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PageCallBack(CallbackData, prefix="page"):
|
|
|
|
|
page: int
|
|
|
|
|
page_name: str
|
|
|
|
|
|
|
|
|
|
def get_user_main_btns(*, page: int): # page 0
|
|
|
|
|
btns = [
|
2024-10-06 13:29:07 +00:00
|
|
|
|
InlineKeyboardButton(text="Бесплатные уроки", callback_data=PageCallBack(page=1, page_name="lessons").pack()),#1
|
|
|
|
|
InlineKeyboardButton(text="Выбрать тариф", callback_data=PageCallBack(page=2, page_name="tarif").pack()),#2
|
|
|
|
|
InlineKeyboardButton(text="Больше о моделях", callback_data=PageCallBack(page=3, page_name="more_about_models").pack()),#3
|
2024-10-05 14:35:26 +00:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
return get_kb_buttons(btns=btns)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_user_lessons_page(*, page): # page 1
|
|
|
|
|
btns = [
|
2024-10-06 13:29:07 +00:00
|
|
|
|
InlineKeyboardButton(text="Выбрать модель", callback_data=PageCallBack(page=2, page_name="tarif").pack()), # 2
|
|
|
|
|
InlineKeyboardButton(text="⬅️Назад", callback_data=PageCallBack(page=0, page_name="main").pack()), # 2
|
2024-10-05 14:35:26 +00:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
return get_kb_buttons(btns=btns)
|
|
|
|
|
|
|
|
|
|
def get_user_tarif_page(*, page): # page 2
|
|
|
|
|
btns = [
|
2024-10-06 13:29:07 +00:00
|
|
|
|
InlineKeyboardButton(text="1o", callback_data=PageCallBack(page=4, page_name='1o').pack()), # 4
|
|
|
|
|
InlineKeyboardButton(text="1o mini", callback_data=PageCallBack(page=5, page_name='1o mini').pack()), # 5
|
|
|
|
|
InlineKeyboardButton(text="4o", callback_data=PageCallBack(page=6, page_name='4o').pack()), # 6
|
|
|
|
|
InlineKeyboardButton(text="4o mini", callback_data=PageCallBack(page=7, page_name='4o mini').pack()), # 7
|
|
|
|
|
InlineKeyboardButton(text="⬅️Назад", callback_data=PageCallBack(page=0, page_name="main").pack()), # 1
|
2024-10-05 14:35:26 +00:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
return get_kb_buttons(btns=btns)
|
|
|
|
|
|
2024-10-09 20:50:46 +00:00
|
|
|
|
async def get_user_model_description_page(*, page: int, name: str, user_id):
|
|
|
|
|
text, kbd = await get_model_page(page=page, name=name, user_id=user_id)
|
2024-10-06 13:29:07 +00:00
|
|
|
|
|
|
|
|
|
kbd.add(InlineKeyboardButton(text="⬅️Назад", callback_data=PageCallBack(page=2, page_name="tarif").pack()),)
|
|
|
|
|
|
|
|
|
|
return text, kbd.adjust(*(1,)).as_markup()
|
|
|
|
|
|
|
|
|
|
def get_more_about_modules_page(*, page: int): # page 3
|
|
|
|
|
btns = [
|
2024-10-09 20:50:46 +00:00
|
|
|
|
# InlineKeyboardButton(text="Какая модель мне подходит", callback_data=PageCallBack(page=8, page_name='match_model').pack()),
|
|
|
|
|
InlineKeyboardButton(text="Как узнать, какая модель мне подходит", callback_data='choose'),
|
2024-10-06 13:29:07 +00:00
|
|
|
|
InlineKeyboardButton(text="Узнать стоимость моделей", callback_data=PageCallBack(page=9, page_name='price_list').pack()),
|
|
|
|
|
InlineKeyboardButton(text="Выбрать модель", callback_data=PageCallBack(page=2, page_name="tarif").pack()), # 2
|
|
|
|
|
InlineKeyboardButton(text="⬅️Назад", callback_data=PageCallBack(page=0, page_name="main").pack()),
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
return get_kb_buttons(btns=btns)
|
|
|
|
|
|
|
|
|
|
def get_price_list_page(*, page: int):
|
|
|
|
|
btns = [
|
|
|
|
|
InlineKeyboardButton(text="⬅️Назад", callback_data=PageCallBack(page=3, page_name="more_about_models").pack()),
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
return get_kb_buttons(btns=btns)
|
2024-10-05 14:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_kb_buttons(*, btns: list[InlineKeyboardButton], sizes: tuple[int] = (1,)):
|
|
|
|
|
kb_temp = InlineKeyboardBuilder()
|
|
|
|
|
|
|
|
|
|
for btn in btns:
|
|
|
|
|
kb_temp = kb_temp.add(btn)
|
|
|
|
|
|
|
|
|
|
return kb_temp.adjust(*sizes).as_markup()
|
|
|
|
|
|