feat: pagination hints

This commit is contained in:
2026-08-19 21:33:22 +07:00
parent 981db23b6f
commit 04be991865
5 changed files with 57 additions and 1 deletions

View File

@@ -51,6 +51,9 @@ async def searching(
await redis_client.set_search_query(query_hash, msg.text)
next_cb = f"search:{query_hash}:1"
total = await products_repo.count_search(session, msg.text, include_hidden=is_admin)
total_pages = (total + PAGE_SIZE - 1) // PAGE_SIZE if total else None
await orig_msg.edit_text(
"<b>🗒 Результаты поиска:</b>",
reply_markup=render_products(
@@ -59,6 +62,8 @@ async def searching(
back_cb="menu:main",
next_cb=next_cb,
is_admin=is_admin,
page=0,
total_pages=total_pages,
),
)
@@ -89,6 +94,9 @@ async def search_pagination(
include_hidden=is_admin,
)
total = await products_repo.count_search(session, query, include_hidden=is_admin)
total_pages = (total + PAGE_SIZE - 1) // PAGE_SIZE if total else None
await cb.message.edit_reply_markup(
reply_markup=render_products(
results[:PAGE_SIZE],
@@ -97,5 +105,7 @@ async def search_pagination(
next_cb=f"search:{q_hash}:{page + 1}" if len(results) > PAGE_SIZE else None,
prev_cb=f"search:{q_hash}:{page - 1}" if page > 0 else None,
is_admin=is_admin,
page=page,
total_pages=total_pages,
)
)