From d9342f184e9569cebfc73d561c0574c34ed37e6e Mon Sep 17 00:00:00 2001 From: Chris Sexton <3216719+chrissexton@users.noreply.github.com> Date: Tue, 21 May 2024 12:28:25 -0400 Subject: [PATCH] web: make cards display in grid --- bot/web/index.templ | 1 + bot/web/index_templ.go | 20 +++---- plugins/emojy/emojy.go | 12 +++++ plugins/emojy/list.templ | 40 +++++++------- plugins/emojy/list_templ.go | 104 +++++++++++++++++++++++------------- plugins/emojy/web.go | 2 +- plugins/meme/meme.templ | 17 +++--- plugins/meme/meme_templ.go | 20 +++---- 8 files changed, 132 insertions(+), 84 deletions(-) diff --git a/bot/web/index.templ b/bot/web/index.templ index a648fa8..2988811 100644 --- a/bot/web/index.templ +++ b/bot/web/index.templ @@ -9,6 +9,7 @@ templ (w *Web) Header(title string) { rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css" /> + ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -37,7 +37,7 @@ func (w *Web) Header(title string) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(w.botName()) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 25, Col: 32} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 26, Col: 32} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -50,7 +50,7 @@ func (w *Web) Header(title string) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 25, Col: 44} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 26, Col: 44} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -68,7 +68,7 @@ func (w *Web) Header(title string) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(w.botName()) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 27, Col: 32} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 28, Col: 32} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -192,7 +192,7 @@ func (w *Web) Nav(currentPage string) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(w.botName()) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 61, Col: 62} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 62, Col: 62} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -224,7 +224,7 @@ func (w *Web) Nav(currentPage string) templ.Component { var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(item.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 67, Col: 101} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 68, Col: 101} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { @@ -251,7 +251,7 @@ func (w *Web) Nav(currentPage string) templ.Component { var templ_7745c5c3_Var12 string templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(item.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 69, Col: 63} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 70, Col: 63} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) if templ_7745c5c3_Err != nil { @@ -298,7 +298,7 @@ func (w *Web) showStats() templ.Component { var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", w.stats.MessagesRcv)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 84, Col: 56} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 85, Col: 56} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { @@ -311,7 +311,7 @@ func (w *Web) showStats() templ.Component { var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", w.stats.MessagesSent)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 88, Col: 57} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 89, Col: 57} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { @@ -324,7 +324,7 @@ func (w *Web) showStats() templ.Component { var templ_7745c5c3_Var16 string templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(w.stats.Uptime()) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 92, Col: 34} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 93, Col: 34} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) if templ_7745c5c3_Err != nil { diff --git a/plugins/emojy/emojy.go b/plugins/emojy/emojy.go index 4222518..9d6eda4 100644 --- a/plugins/emojy/emojy.go +++ b/plugins/emojy/emojy.go @@ -207,6 +207,18 @@ func InvertEmojyList(emojy map[string]string) map[string]string { return out } +func (p *EmojyPlugin) allCountsFlat(threshold int) ([]EmojyCount, error) { + emoji, err := p.allCounts(threshold) + if err != nil { + return nil, err + } + output := []EmojyCount{} + for _, v := range emoji { + output = append(output, v...) + } + return output, nil +} + func (p *EmojyPlugin) allCounts(threshold int) (map[string][]EmojyCount, error) { out := map[string][]EmojyCount{} onServerList := InvertEmojyList(p.b.GetEmojiList(true)) diff --git a/plugins/emojy/list.templ b/plugins/emojy/list.templ index eacc423..f201df0 100644 --- a/plugins/emojy/list.templ +++ b/plugins/emojy/list.templ @@ -1,25 +1,29 @@ package emojy -templ (p *EmojyPlugin) listTempl(emojy emojyMap) { +templ (p *EmojyPlugin) listTempl(emojy []EmojyCount) {{ meme.Name }
+{ meme.Config }