package main import ( "surdeus.su/core/tg" ) var DynamicPanelWidget = tg.RenderFunc(func(c tg.Context) tg.UI { return tg.UI{ tg.Messagef("Paged panel").PanelPager( c, 0, 5, tg.PanelPagerFunc(func( panel *tg.PanelPagerCompo, c tg.Context, page, size int, ) tg.PanelPage { rows := []tg.ButtonRow{} for i := 0; i < size; i++ { num := 1 + page*size + i rows = append(rows, tg.ButtonRow{ tg.Buttonf("%d", num).Rand().WithAction(tg.Func(func(c tg.Context) { _, err := c.Sendf("%d", num*num) if err != nil { } })), tg.Buttonf("%d", num*num), }) } return tg.PanelPage{ Rows: rows, Next: page < 3, Prev: page != 0, } }), ), tg.Messagef("").Reply( BackKeyboard.Reply(), ), } })