refactor: simplify calendar nav buttons by removing redundant year/step numbers
This commit is contained in:
@@ -196,9 +196,9 @@ func buildYearPicker(cbPrefix, backData, navSuffix string, centerYear int) model
|
|||||||
blockStart := centerYear - 6
|
blockStart := centerYear - 6
|
||||||
kbRows := [][]models.InlineKeyboardButton{
|
kbRows := [][]models.InlineKeyboardButton{
|
||||||
{
|
{
|
||||||
{Text: "< 12", CallbackData: fmt.Sprintf("%syears_%d%s", cbPrefix, blockStart-12, navSuffix)},
|
{Text: "<", CallbackData: fmt.Sprintf("%syears_%d%s", cbPrefix, blockStart-12, navSuffix)},
|
||||||
{Text: fmt.Sprintf("%d", centerYear), CallbackData: "noop"},
|
{Text: fmt.Sprintf("%d", centerYear), CallbackData: "noop"},
|
||||||
{Text: "12 >", CallbackData: fmt.Sprintf("%syears_%d%s", cbPrefix, blockStart+12, navSuffix)},
|
{Text: ">", CallbackData: fmt.Sprintf("%syears_%d%s", cbPrefix, blockStart+12, navSuffix)},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for i := 0; i < 12; i += 4 {
|
for i := 0; i < 12; i += 4 {
|
||||||
@@ -271,9 +271,9 @@ func (h *Handler) editCalendar(ctx context.Context, chatID int64, msgID int, yea
|
|||||||
|
|
||||||
// Year navigation row
|
// Year navigation row
|
||||||
kbRows = append(kbRows, []models.InlineKeyboardButton{
|
kbRows = append(kbRows, []models.InlineKeyboardButton{
|
||||||
{Text: fmt.Sprintf("< %d", year-1), CallbackData: fmt.Sprintf("cal_prev_year_%d_%d", year-1, month)},
|
{Text: fmt.Sprint("<"), CallbackData: fmt.Sprintf("cal_prev_year_%d_%d", year-1, month)},
|
||||||
{Text: fmt.Sprintf("%d", year), CallbackData: fmt.Sprintf("cal_show_years_%d_%d", year, month)},
|
{Text: fmt.Sprintf("%d", year), CallbackData: fmt.Sprintf("cal_show_years_%d_%d", year, month)},
|
||||||
{Text: fmt.Sprintf("%d >", year+1), CallbackData: fmt.Sprintf("cal_next_year_%d_%d", year+1, month)},
|
{Text: fmt.Sprint(">"), CallbackData: fmt.Sprintf("cal_next_year_%d_%d", year+1, month)},
|
||||||
})
|
})
|
||||||
|
|
||||||
// Weekday header row
|
// Weekday header row
|
||||||
|
|||||||
Reference in New Issue
Block a user