diff --git a/tg_bot/screens/purchase_optional_details.go b/tg_bot/screens/purchase_optional_details.go index cf1f030..7bc54ee 100644 --- a/tg_bot/screens/purchase_optional_details.go +++ b/tg_bot/screens/purchase_optional_details.go @@ -402,16 +402,6 @@ func (s *PurchaseOptionalDetails) HandleCallback(b *bot.Bot, u *echotron.Update) s.Enter(b, bot.EditMessage) return } - if u.CallbackQuery.Data == "format_custom_top_input_mode" { - s.InputMode = "format_custom_top_input" - s.Enter(b, bot.EditMessage) - return - } - if u.CallbackQuery.Data == "format_custom_feed_input_mode" { - s.InputMode = "format_custom_feed_input" - s.Enter(b, bot.EditMessage) - return - } if u.CallbackQuery.Data == "format_custom_back_to_select" { s.InputMode = "format_select" s.Enter(b, bot.EditMessage) @@ -464,10 +454,9 @@ func (s *PurchaseOptionalDetails) HandleMessage(b *bot.Bot, u *echotron.Update) } switch s.InputMode { - case "format_custom_top_input": + case "format_custom": value, err := strconv.Atoi(text) if err != nil || value <= 0 { - s.renderInputPrompt(b, bot.EditMessage) return } // Конвертируем в минуты по текущей единице @@ -478,10 +467,9 @@ func (s *PurchaseOptionalDetails) HandleMessage(b *bot.Bot, u *echotron.Update) s.InputMode = "format_custom_feed" s.Enter(b, bot.NewMessage) return - case "format_custom_feed_input": + case "format_custom_feed": value, err := strconv.Atoi(text) if err != nil || value <= 0 { - s.renderInputPrompt(b, bot.EditMessage) return } // Конвертируем в минуты по текущей единице @@ -861,23 +849,9 @@ func (s *PurchaseOptionalDetails) renderInputPrompt(b *bot.Bot, mode bot.RenderM case "format_custom": s.renderCustomFormatTop(b, mode) return - case "format_custom_top_input": - text += "Введите число для времени в топе\n\n" - unit := "часах" - if s.CustomFormatTopUnit == "minutes" { - unit = "минутах" - } - text += fmt.Sprintf("Единица: %s", unit) case "format_custom_feed": s.renderCustomFormatFeed(b, mode) return - case "format_custom_feed_input": - text += "Введите число для времени в ленте\n\n" - unit := "часах" - if s.CustomFormatFeedUnit == "days" { - unit = "днях" - } - text += fmt.Sprintf("Единица: %s", unit) case "invite_link_type": text = "Страница выбора типа ссылки\n\n" if s.CurrentChannel != "" { @@ -938,8 +912,7 @@ func (s *PurchaseOptionalDetails) renderCustomFormatTop(b *bot.Bot, mode bot.Ren var rows [][]echotron.InlineKeyboardButton if s.CustomFormatTopUnit == "minutes" { - text += "⏱ Единица: минуты\n\n" - text += "Выберите время в топе" + text += "Выберите или введите число (в минутах):" rows = append(rows, Row( Button("10", "format_custom_top:10"), @@ -953,14 +926,10 @@ func (s *PurchaseOptionalDetails) renderCustomFormatTop(b *bot.Bot, mode bot.Ren Button("90", "format_custom_top:90"), Button("120", "format_custom_top:120"), ), - Row( - Button("↔ Часы", "format_custom_top_toggle_unit"), - Button("Ввести число", "format_custom_top_input_mode"), - ), + Row(Button("⏱ В часах", "format_custom_top_toggle_unit")), ) } else { - text += "⏱ Единица: часы\n\n" - text += "Выберите время в топе" + text += "Выберите или введите число (в часах):" rows = append(rows, Row( Button("1", "format_custom_top:60"), @@ -974,10 +943,7 @@ func (s *PurchaseOptionalDetails) renderCustomFormatTop(b *bot.Bot, mode bot.Ren Button("8", "format_custom_top:480"), Button("12", "format_custom_top:720"), ), - Row( - Button("↔ Минуты", "format_custom_top_toggle_unit"), - Button("Ввести число", "format_custom_top_input_mode"), - ), + Row(Button("⏱ В минутах", "format_custom_top_toggle_unit")), ) } @@ -999,8 +965,7 @@ func (s *PurchaseOptionalDetails) renderCustomFormatFeed(b *bot.Bot, mode bot.Re var rows [][]echotron.InlineKeyboardButton if s.CustomFormatFeedUnit == "days" { - text += "⏱ Единица: дни\n\n" - text += "Выберите время в ленте" + text += "Выберите или введите число (в днях):" rows = append(rows, Row( Button("7", "format_custom_feed:10080"), @@ -1015,13 +980,12 @@ func (s *PurchaseOptionalDetails) renderCustomFormatFeed(b *bot.Bot, mode bot.Re Button("365", "format_custom_feed:525600"), ), Row( - Button("↔ Часы", "format_custom_feed_toggle_unit"), + Button("⏱ В часах", "format_custom_feed_toggle_unit"), Button("Без удаления", "format_custom_feed:0"), ), ) } else { - text += "⏱ Единица: часы\n\n" - text += "Выберите время в ленте" + text += "Выберите или введите число (в часах):" rows = append(rows, Row( Button("24", "format_custom_feed:1440"), @@ -1036,16 +1000,13 @@ func (s *PurchaseOptionalDetails) renderCustomFormatFeed(b *bot.Bot, mode bot.Re Button("168", "format_custom_feed:10080"), ), Row( - Button("↔ Дни", "format_custom_feed_toggle_unit"), + Button("⏱ В днях", "format_custom_feed_toggle_unit"), Button("Без удаления", "format_custom_feed:0"), ), ) } - rows = append(rows, - Row(Button("Ввести число", "format_custom_feed_input_mode")), - Row(Button("← Назад", "format_custom_back_to_top")), - ) + rows = append(rows, Row(Button("← Назад", "format_custom_back_to_top"))) b.Render(text, Keyboard(rows...), mode) }