Skip to content

Commit cf3b0ee

Browse files
Merge pull request #194 from blockful/dev
Dev
2 parents a3861db + 46712ef commit cf3b0ee

1 file changed

Lines changed: 21 additions & 11 deletions

File tree

apps/consumers/src/services/dao/telegram-dao.service.ts

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,29 @@ export class TelegramDAOService extends BaseDAOService {
148148
* Build Telegram inline keyboard for DAO selection
149149
*/
150150
private buildInlineKeyboard(daos: any[], selections: Set<string>): any {
151+
// Create all DAO buttons
152+
const daoButtons = daos.map(dao => {
153+
const normalizedDao = dao.id.toUpperCase();
154+
const daoWithEmoji = getDaoWithEmoji(dao.id);
155+
const isSelected = selections.has(normalizedDao);
156+
157+
return {
158+
text: isSelected ? `${uiMessages.status.success} ${daoWithEmoji}` : daoWithEmoji,
159+
callback_data: `dao_toggle_${normalizedDao}`
160+
};
161+
});
162+
163+
// Group buttons into rows of 4
164+
const BUTTONS_PER_ROW = 3;
165+
const daoButtonRows: any[][] = [];
166+
167+
for (let i = 0; i < daoButtons.length; i += BUTTONS_PER_ROW) {
168+
daoButtonRows.push(daoButtons.slice(i, i + BUTTONS_PER_ROW));
169+
}
170+
151171
return {
152172
inline_keyboard: [
153-
// DAO buttons row
154-
daos.map(dao => {
155-
const normalizedDao = dao.id.toUpperCase();
156-
const daoWithEmoji = getDaoWithEmoji(dao.id);
157-
const isSelected = selections.has(normalizedDao);
158-
159-
return {
160-
text: isSelected ? `${uiMessages.status.success} ${daoWithEmoji}` : daoWithEmoji,
161-
callback_data: `dao_toggle_${normalizedDao}`
162-
};
163-
}),
173+
...daoButtonRows,
164174
// Confirm button row
165175
[
166176
{ text: uiMessages.confirmSelection, callback_data: 'dao_confirm' }

0 commit comments

Comments
 (0)