@@ -37,13 +37,28 @@ def _build_main_menu_keyboard(bots_dict: Dict[str, Any]) -> InlineKeyboardMarkup
3737 """
3838 keyboard = []
3939
40- # Add a button for each bot (max 5)
41- for bot_name in list (bots_dict .keys ())[:5 ]:
42- # Truncate name for button
43- display_name = bot_name [:30 ] + "..." if len (bot_name ) > 30 else bot_name
44- keyboard .append ([
45- InlineKeyboardButton (f"π { display_name } " , callback_data = f"bots:bot_detail:{ bot_name } " )
46- ])
40+ # Add a button for each bot (show all bots)
41+ # Group bots in rows of 2 for better layout when there are many bots
42+ bot_names = list (bots_dict .keys ())
43+
44+ # For 1-3 bots: one per row
45+ # For 4+ bots: two per row for better space utilization
46+ if len (bot_names ) <= 3 :
47+ for bot_name in bot_names :
48+ display_name = bot_name [:30 ] + "..." if len (bot_name ) > 30 else bot_name
49+ keyboard .append ([
50+ InlineKeyboardButton (f"π { display_name } " , callback_data = f"bots:bot_detail:{ bot_name } " )
51+ ])
52+ else :
53+ # Two bots per row for better space utilization
54+ for i in range (0 , len (bot_names ), 2 ):
55+ row = []
56+ for j in range (i , min (i + 2 , len (bot_names ))):
57+ bot_name = bot_names [j ]
58+ # Shorter display name when two per row
59+ display_name = bot_name [:25 ] + "..." if len (bot_name ) > 25 else bot_name
60+ row .append (InlineKeyboardButton (f"π { display_name } " , callback_data = f"bots:bot_detail:{ bot_name } " ))
61+ keyboard .append (row )
4762
4863 # Action buttons - historical
4964 keyboard .append ([
0 commit comments