From 718ee32165f3dba8575f425866bd8ded7becb69d Mon Sep 17 00:00:00 2001 From: Chris Sexton <3216719+chrissexton@users.noreply.github.com> Date: Wed, 28 Feb 2024 10:25:43 -0500 Subject: [PATCH] emojy: use foundation --- plugins/emojy/list.templ | 43 ++++++++++++------- plugins/emojy/list_templ.go | 30 +++++++------ plugins/emojy/stats.templ | 79 +++++++++++++++++++---------------- plugins/emojy/stats_templ.go | 24 ++++++++--- plugins/emojy/upload.templ | 33 +++++++++++---- plugins/emojy/upload_templ.go | 10 ++++- plugins/meme/meme_templ.go | 4 +- 7 files changed, 141 insertions(+), 82 deletions(-) diff --git a/plugins/emojy/list.templ b/plugins/emojy/list.templ index 0815a64..4d35954 100644 --- a/plugins/emojy/list.templ +++ b/plugins/emojy/list.templ @@ -1,23 +1,34 @@ package emojy templ (p *EmojyPlugin) listTempl(emojy emojyMap) { - @p.emojyNav() - for _, v := range emojy { -
- for _, c := range v { -
-
- - { - -
{ c.Emojy }
+
+
+
+

Emojy

+
+
+
+
+ @p.emojyNav() +
+
+
+ for _, v := range emojy { + for _, c := range v { +
+
+ { +
+ { c.Emojy } +
-
+
+ } }
- } +
} \ No newline at end of file diff --git a/plugins/emojy/list_templ.go b/plugins/emojy/list_templ.go index 82ad7f0..0dbb947 100644 --- a/plugins/emojy/list_templ.go +++ b/plugins/emojy/list_templ.go @@ -23,17 +23,21 @@ func (p *EmojyPlugin) listTempl(emojy emojyMap) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Emojy

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } templ_7745c5c3_Err = p.emojyNav().Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } for _, v := range emojy { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } for _, c := range v { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
\"")
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(c.Emojy) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/emojy/list.templ`, Line: 16, Col: 56} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/emojy/list.templ`, Line: 25, Col: 33} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err } if !templ_7745c5c3_IsBuffer { _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) diff --git a/plugins/emojy/stats.templ b/plugins/emojy/stats.templ index be676ba..68057a3 100644 --- a/plugins/emojy/stats.templ +++ b/plugins/emojy/stats.templ @@ -3,44 +3,51 @@ package emojy import "fmt" templ (p *EmojyPlugin) emojyNav() { - + } templ (p *EmojyPlugin) statsIndex(emojy emojyMap) { - @p.emojyNav() - for categoryName, v := range emojy { -
- +
+
+
+

Emojy

+
- } +
+
+ @p.emojyNav() +
+
+
+ for categoryName, v := range emojy { +
    + for _, c := range v { +
  • + { fmt.Sprintf("%d", c.Count) } - + if categoryName != "emoji" && c.OnServer { + + } else if categoryName != "emoji" { + + } + if c.URL != "" { + { + } else { + { c.Emojy } + } +
  • + } +
+ } +
+
} diff --git a/plugins/emojy/stats_templ.go b/plugins/emojy/stats_templ.go index cf4a812..4e81127 100644 --- a/plugins/emojy/stats_templ.go +++ b/plugins/emojy/stats_templ.go @@ -25,7 +25,7 @@ func (p *EmojyPlugin) emojyNav() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -49,24 +49,32 @@ func (p *EmojyPlugin) statsIndex(emojy emojyMap) templ.Component { templ_7745c5c3_Var2 = templ.NopComponent } ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Emojy

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } templ_7745c5c3_Err = p.emojyNav().Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } for categoryName, v := range emojy { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, c := range v { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    • ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    • ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", c.Count)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/emojy/stats.templ`, Line: 29, Col: 44} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/emojy/stats.templ`, Line: 35, Col: 52} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -112,7 +120,7 @@ func (p *EmojyPlugin) statsIndex(emojy emojyMap) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(c.Emojy) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/emojy/stats.templ`, Line: 38, Col: 29} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/emojy/stats.templ`, Line: 44, Col: 37} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -124,11 +132,15 @@ func (p *EmojyPlugin) statsIndex(emojy emojyMap) templ.Component { return templ_7745c5c3_Err } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } if !templ_7745c5c3_IsBuffer { _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) } diff --git a/plugins/emojy/upload.templ b/plugins/emojy/upload.templ index 0c46849..c386079 100644 --- a/plugins/emojy/upload.templ +++ b/plugins/emojy/upload.templ @@ -1,13 +1,30 @@ package emojy templ (p *EmojyPlugin) uploadIndex() { -
- - - -
- +
+
+
+

Emojy

+
+
+
+
+ @p.emojyNav() +
+
+
+
+ + +
+
+ +
+
+ +
+
} diff --git a/plugins/emojy/upload_templ.go b/plugins/emojy/upload_templ.go index 53b26be..de98377 100644 --- a/plugins/emojy/upload_templ.go +++ b/plugins/emojy/upload_templ.go @@ -23,7 +23,15 @@ func (p *EmojyPlugin) uploadIndex() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Emojy

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = p.emojyNav().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/plugins/meme/meme_templ.go b/plugins/meme/meme_templ.go index 842dd8f..77713f7 100644 --- a/plugins/meme/meme_templ.go +++ b/plugins/meme/meme_templ.go @@ -23,7 +23,7 @@ func (p *MemePlugin) index(all webResps) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Meme

") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Meme

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -147,7 +147,7 @@ func (p *MemePlugin) Edit(meme webResp) templ.Component { templ_7745c5c3_Var5 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("