@@ -14,6 +14,8 @@ const (
1414 monthsPerRow = 3
1515 remindPerRow = 4
1616 daysPerRow = 5
17+
18+ buttonBack = "🔙"
1719)
1820
1921func (h * Handler ) languagesKeyboard () * models.InlineKeyboardMarkup {
@@ -93,39 +95,50 @@ func (h *Handler) daysKeyboard(now time.Time, month int) *models.InlineKeyboardM
9395func (h * Handler ) remindMenuKeyboard (chat * domain.Chat ) * models.InlineKeyboardMarkup {
9496 text := h .lp .GetText (chat .LanguageCode )
9597
96- kb := & models.InlineKeyboardMarkup {InlineKeyboard : make ([][]models.InlineKeyboardButton , 4 )}
98+ // Calculate number of rows based on whether it's a group
99+ numRows := 3
100+ if isChatGroup (chat .ChatID ) {
101+ numRows = 4
102+ }
103+ kb := & models.InlineKeyboardMarkup {InlineKeyboard : make ([][]models.InlineKeyboardButton , numRows )}
104+
105+ rowIndex := 0
97106
98107 if chat .Subscribed {
99- kb .InlineKeyboard [0 ] = []models.InlineKeyboardButton {
108+ kb .InlineKeyboard [rowIndex ] = []models.InlineKeyboardButton {
100109 {Text : text .RemindMenu .Disable , CallbackData : "remind:toggle|" },
101110 }
102111 } else {
103- kb .InlineKeyboard [0 ] = []models.InlineKeyboardButton {
112+ kb .InlineKeyboard [rowIndex ] = []models.InlineKeyboardButton {
104113 {Text : text .RemindMenu .Enable , CallbackData : "remind:toggle|" },
105114 }
106115 }
116+ rowIndex ++
107117
108- todayOffset := domain .FormatDuration (chat .Reminder .Today .Offset )
118+ tomorrowOffset := domain .FormatDuration (chat .Reminder .Tomorrow .Offset )
109119 soonOffset := domain .FormatDuration (chat .Reminder .Soon .Offset )
110- kb .InlineKeyboard [1 ] = []models.InlineKeyboardButton {
111- {Text : fmt .Sprintf ("%s (%s)" , text .RemindMenu .Today , todayOffset ), CallbackData : "remind:edit:today |" },
120+ kb .InlineKeyboard [rowIndex ] = []models.InlineKeyboardButton {
121+ {Text : fmt .Sprintf ("%s (%s)" , text .RemindMenu .Tomorrow , tomorrowOffset ), CallbackData : "remind:edit:tomorrow |" },
112122 {Text : fmt .Sprintf ("%s (%s)" , text .RemindMenu .Soon , soonOffset ), CallbackData : "remind:edit:soon|" },
113123 }
124+ rowIndex ++
114125
115- kb .InlineKeyboard [2 ] = []models.InlineKeyboardButton {
116- {Text : text .RemindMenu .JamaatSettings , CallbackData : "remind:jamaat:menu|" },
126+ // Only show Jamaat Settings for group chats
127+ if isChatGroup (chat .ChatID ) {
128+ kb .InlineKeyboard [rowIndex ] = []models.InlineKeyboardButton {
129+ {Text : text .RemindMenu .JamaatSettings , CallbackData : "remind:jamaat:menu|" },
130+ }
131+ rowIndex ++
117132 }
118133
119- kb .InlineKeyboard [3 ] = []models.InlineKeyboardButton {
134+ kb .InlineKeyboard [rowIndex ] = []models.InlineKeyboardButton {
120135 {Text : text .RemindMenu .Close , CallbackData : "remind:close|" },
121136 }
122137
123138 return kb
124139}
125140
126141func (h * Handler ) remindEditKeyboard (reminderType domain.ReminderType , languageCode string ) * models.InlineKeyboardMarkup {
127- text := h .lp .GetText (languageCode )
128-
129142 kb := & models.InlineKeyboardMarkup {InlineKeyboard : make ([][]models.InlineKeyboardButton , 3 )}
130143
131144 kb .InlineKeyboard [0 ] = []models.InlineKeyboardButton {
@@ -141,8 +154,7 @@ func (h *Handler) remindEditKeyboard(reminderType domain.ReminderType, languageC
141154 }
142155
143156 kb .InlineKeyboard [2 ] = []models.InlineKeyboardButton {
144- {Text : text .Buttons .Save , CallbackData : fmt .Sprintf ("remind:save:%s|" , reminderType )},
145- {Text : text .Buttons .Back , CallbackData : "remind:back:menu|" },
157+ {Text : buttonBack , CallbackData : "remind:back:menu|" },
146158 }
147159
148160 return kb
@@ -185,15 +197,13 @@ func (h *Handler) jammatMenuKeyboard(chat *domain.Chat) *models.InlineKeyboardMa
185197 }
186198
187199 kb .InlineKeyboard [4 ] = []models.InlineKeyboardButton {
188- {Text : text . Buttons . Back , CallbackData : "remind:back:menu|" },
200+ {Text : buttonBack , CallbackData : "remind:back:menu|" },
189201 }
190202
191203 return kb
192204}
193205
194206func (h * Handler ) jammatEditKeyboard (prayerID domain.PrayerID , languageCode string ) * models.InlineKeyboardMarkup {
195- text := h .lp .GetText (languageCode )
196-
197207 kb := & models.InlineKeyboardMarkup {InlineKeyboard : make ([][]models.InlineKeyboardButton , 3 )}
198208
199209 prayerName := prayerID .String ()
@@ -211,8 +221,7 @@ func (h *Handler) jammatEditKeyboard(prayerID domain.PrayerID, languageCode stri
211221 }
212222
213223 kb .InlineKeyboard [2 ] = []models.InlineKeyboardButton {
214- {Text : text .Buttons .Save , CallbackData : fmt .Sprintf ("remind:jamaat:save:%s|" , prayerName )},
215- {Text : text .Buttons .Back , CallbackData : "remind:back:jamaat|" },
224+ {Text : buttonBack , CallbackData : "remind:back:jamaat|" },
216225 }
217226
218227 return kb
0 commit comments