mirror of https://github.com/openclaw/openclaw.git
30 lines
732 B
TypeScript
30 lines
732 B
TypeScript
export function buildCommandsPaginationKeyboard(
|
|
currentPage: number,
|
|
totalPages: number,
|
|
agentId?: string,
|
|
): Array<Array<{ text: string; callback_data: string }>> {
|
|
const buttons: Array<{ text: string; callback_data: string }> = [];
|
|
const suffix = agentId ? `:${agentId}` : "";
|
|
|
|
if (currentPage > 1) {
|
|
buttons.push({
|
|
text: "◀ Prev",
|
|
callback_data: `commands_page_${currentPage - 1}${suffix}`,
|
|
});
|
|
}
|
|
|
|
buttons.push({
|
|
text: `${currentPage}/${totalPages}`,
|
|
callback_data: `commands_page_noop${suffix}`,
|
|
});
|
|
|
|
if (currentPage < totalPages) {
|
|
buttons.push({
|
|
text: "Next ▶",
|
|
callback_data: `commands_page_${currentPage + 1}${suffix}`,
|
|
});
|
|
}
|
|
|
|
return [buttons];
|
|
}
|