улучшение ui
This commit is contained in:
@@ -26,7 +26,7 @@ func (s *Creatives) Enter(b *bot.Bot, mode bot.RenderMode) {
|
||||
jwt := b.Session.JWT
|
||||
if jwt == "" {
|
||||
log.Error().Msg("JWT is empty in session")
|
||||
b.SendNew("❌ Ошибка авторизации. Попробуйте /start login", bot.Keyboard())
|
||||
b.SendNew("❌ Ошибка авторизации. Попробуйте /start login", Keyboard())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func (s *Creatives) renderCreatives(b *bot.Bot, mode bot.RenderMode, jwt string)
|
||||
)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("Failed to get creatives")
|
||||
b.SendNew("❌ Не удалось загрузить креативы", bot.Keyboard())
|
||||
b.SendNew("❌ Не удалось загрузить креативы", Keyboard())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -87,13 +87,13 @@ func (s *Creatives) renderCreatives(b *bot.Bot, mode bot.RenderMode, jwt string)
|
||||
// Создаем слоты для креативов
|
||||
var slots []echotron.InlineKeyboardButton
|
||||
for _, creative := range page.Items {
|
||||
slots = append(slots, bot.Button(creative.Name, fmt.Sprintf("creative:%s", creative.ID)))
|
||||
slots = append(slots, Button(creative.Name, fmt.Sprintf("creative:%s", creative.ID)))
|
||||
}
|
||||
|
||||
// Если страниц >= 2, заполняем до 6 слотов пустыми кнопками
|
||||
if page.Pages >= 2 {
|
||||
for len(slots) < creativesPerPage {
|
||||
slots = append(slots, bot.Button(" ", "empty"))
|
||||
slots = append(slots, Button(" ", "empty"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ func (s *Creatives) renderCreatives(b *bot.Bot, mode bot.RenderMode, jwt string)
|
||||
row = append(row, slots[i+1])
|
||||
} else {
|
||||
// Если нечетное количество, добавляем пустую кнопку
|
||||
row = append(row, bot.Button(" ", "empty"))
|
||||
row = append(row, Button(" ", "empty"))
|
||||
}
|
||||
|
||||
buttons = append(buttons, row)
|
||||
@@ -117,18 +117,18 @@ func (s *Creatives) renderCreatives(b *bot.Bot, mode bot.RenderMode, jwt string)
|
||||
if navRow := ui.BuildNavigationRow(ui.PaginationConfig{
|
||||
CurrentPage: s.CurrentPage,
|
||||
TotalPages: page.Pages,
|
||||
MiddleButtons: []echotron.InlineKeyboardButton{bot.Button("+ Добавить", "add_creative")},
|
||||
MiddleButtons: []echotron.InlineKeyboardButton{Button("+ Добавить", "add_creative")},
|
||||
}); navRow != nil {
|
||||
buttons = append(buttons, navRow)
|
||||
}
|
||||
|
||||
// Нижний ряд: Назад + Архив
|
||||
buttons = append(buttons, bot.Row(
|
||||
bot.Button("← Назад", "back"),
|
||||
bot.Button("≡ Архив", "archive"),
|
||||
buttons = append(buttons, Row(
|
||||
Button("← Назад", "back"),
|
||||
Button("≡ Архив", "archive"),
|
||||
))
|
||||
|
||||
keyboard := bot.Keyboard(buttons...)
|
||||
keyboard := Keyboard(buttons...)
|
||||
b.Render(text, keyboard, mode)
|
||||
}
|
||||
|
||||
@@ -157,8 +157,8 @@ func (s *Creatives) HandleCallback(b *bot.Bot, u *echotron.Update) {
|
||||
|
||||
case data == "archive":
|
||||
// TODO: реализовать экран архива креативов
|
||||
b.Edit("📦 Архив креативов\n\nЭта функция в разработке", bot.Keyboard(
|
||||
bot.Row(bot.Button("← Назад", "back")),
|
||||
b.Edit("📦 Архив креативов\n\nЭта функция в разработке", Keyboard(
|
||||
Row(Button("← Назад", "back")),
|
||||
))
|
||||
|
||||
case data == "add_creative":
|
||||
|
||||
Reference in New Issue
Block a user