From 87bf26e039d9150abb4dd6dc2daaf44824b97db5 Mon Sep 17 00:00:00 2001 From: Chris Sexton <3216719+chrissexton@users.noreply.github.com> Date: Fri, 17 May 2024 11:27:46 -0400 Subject: [PATCH] web: refactor site into picocss from foundation --- bot/web/index.templ | 70 +++++++++------- bot/web/index_templ.go | 42 ++++++---- plugins/admin/admin.templ | 124 +++++++++++++--------------- plugins/admin/admin_templ.go | 32 ++++---- plugins/counter/counter.templ | 31 +++---- plugins/counter/counter_templ.go | 16 ++-- plugins/emojy/list.templ | 48 +++++------ plugins/emojy/list_templ.go | 14 ++-- plugins/meme/meme.templ | 134 ++++++++++++++----------------- plugins/meme/meme_templ.go | 38 +++++---- plugins/secrets/secrets.templ | 44 ++++------ plugins/secrets/secrets_templ.go | 8 +- 12 files changed, 286 insertions(+), 315 deletions(-) diff --git a/bot/web/index.templ b/bot/web/index.templ index cc555a2..a648fa8 100644 --- a/bot/web/index.templ +++ b/bot/web/index.templ @@ -4,8 +4,23 @@ import "fmt" templ (w *Web) Header(title string) { - + + if title != "" { { w.botName() } - { title } @@ -17,8 +32,6 @@ templ (w *Web) Header(title string) { templ (w *Web) Footer() { - - } templ (w *Web) Index(title string, contents templ.Component) { @@ -29,41 +42,42 @@ templ (w *Web) Index(title string, contents templ.Component) { @w.Nav(title) - if contents != nil { - @contents - } +
+ if contents != nil { + @contents + } +
- @w.Footer() + } templ (w *Web) Nav(currentPage string) { - -
-
-
-
+ + } + + + } templ (w *Web) showStats() { -
-

Stats

-
-
@@ -79,6 +93,4 @@ templ (w *Web) showStats() {
{ w.stats.Uptime() }
-
-
} \ No newline at end of file diff --git a/bot/web/index_templ.go b/bot/web/index_templ.go index 179095e..51796b1 100644 --- a/bot/web/index_templ.go +++ b/bot/web/index_templ.go @@ -25,7 +25,7 @@ func (w *Web) Header(title string) 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 } @@ -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: 10, Col: 32} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 25, 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: 10, Col: 44} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 25, 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: 12, Col: 32} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 27, Col: 32} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -103,7 +103,7 @@ func (w *Web) Footer() templ.Component { templ_7745c5c3_Var5 = 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 } @@ -143,17 +143,25 @@ func (w *Web) Index(title string, contents templ.Component) templ.Component { 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 contents != nil { templ_7745c5c3_Err = contents.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 } @@ -177,20 +185,20 @@ func (w *Web) Nav(currentPage string) templ.Component { templ_7745c5c3_Var7 = 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 } @@ -283,14 +291,14 @@ func (w *Web) showStats() templ.Component { templ_7745c5c3_Var13 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Stats

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

Stats

Messages Seen") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } 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: 70, Col: 56} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 84, Col: 56} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { @@ -303,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: 74, Col: 57} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 88, Col: 57} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { @@ -316,13 +324,13 @@ 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: 78, Col: 34} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 92, Col: 34} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) 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 } diff --git a/plugins/admin/admin.templ b/plugins/admin/admin.templ index 2dae034..6e23cbc 100644 --- a/plugins/admin/admin.templ +++ b/plugins/admin/admin.templ @@ -3,60 +3,46 @@ package admin import "fmt" templ (a *AdminPlugin) page() { -
-
-
-

App Pass

-
-
-
- -
-
- -
-
- - -
-
+ +

App Pass

+ + + + -
-
-
-
-
+
+ } templ (a *AdminPlugin) showPassword(entry PassEntry) { -
ID{ fmt.Sprintf(" %d", entry.ID) }
-
Password { entry.Secret }:{ entry.Pass }
+

New Entry

+

ID: { fmt.Sprintf(" %d", entry.ID) }

+

Password: { entry.Secret }:{ entry.Pass }

} templ (a *AdminPlugin) entries(items []PassEntry) { -
- if len(items) == 0 { - No items - } -
    - for _, entry := range items { -
  • - - { fmt.Sprintf("%d", entry.ID) } -
  • - } -
-
+

Entry List

+ if len(items) == 0 { +

No items

+ } + } templ renderError(err error) { @@ -64,27 +50,25 @@ templ renderError(err error) { } templ vars(items []configEntry) { -
-

Variables

- - - - - - - - - for _, item := range items { - - - - } - if len(items) == 0 { - - - - } - -
KeyValue
{ item.Key }{ item.Value }
No data
-
+

Variables

+ + + + + + + + + for _, item := range items { + + + + } + if len(items) == 0 { + + + + } + +
KeyValue
{ item.Key }{ item.Value }
No data
} diff --git a/plugins/admin/admin_templ.go b/plugins/admin/admin_templ.go index 72416e3..3aa3c60 100644 --- a/plugins/admin/admin_templ.go +++ b/plugins/admin/admin_templ.go @@ -25,7 +25,7 @@ func (a *AdminPlugin) page() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

App Pass

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

App Pass

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -49,27 +49,27 @@ func (a *AdminPlugin) showPassword(entry PassEntry) templ.Component { templ_7745c5c3_Var2 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
ID") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

New Entry

ID: ") 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", entry.ID)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 35, Col: 86} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 22, Col: 41} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

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

Password: ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(entry.Secret) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 36, Col: 77} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 23, Col: 31} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -82,13 +82,13 @@ func (a *AdminPlugin) showPassword(entry PassEntry) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(entry.Pass) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 36, Col: 92} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 23, Col: 46} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) 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 } @@ -112,12 +112,12 @@ func (a *AdminPlugin) entries(items []PassEntry) templ.Component { templ_7745c5c3_Var6 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Entry List

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if len(items) == 0 { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("No items") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

No items

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -150,7 +150,7 @@ func (a *AdminPlugin) entries(items []PassEntry) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", entry.ID)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 54, Col: 57} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 41, Col: 49} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -161,7 +161,7 @@ func (a *AdminPlugin) entries(items []PassEntry) 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 } @@ -192,7 +192,7 @@ func renderError(err error) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(err.Error()) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 62, Col: 22} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 48, Col: 22} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -222,7 +222,7 @@ func vars(items []configEntry) templ.Component { templ_7745c5c3_Var10 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Variables

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

Variables

KeyValue
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -234,7 +234,7 @@ func vars(items []configEntry) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(item.Key) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 78, Col: 38} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 63, Col: 30} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -247,7 +247,7 @@ func vars(items []configEntry) templ.Component { var templ_7745c5c3_Var12 string templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(item.Value) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 78, Col: 61} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 63, Col: 53} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) if templ_7745c5c3_Err != nil { @@ -264,7 +264,7 @@ func vars(items []configEntry) templ.Component { return templ_7745c5c3_Err } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
KeyValue
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/plugins/counter/counter.templ b/plugins/counter/counter.templ index 3bdec65..694bc9a 100644 --- a/plugins/counter/counter.templ +++ b/plugins/counter/counter.templ @@ -9,31 +9,26 @@ func urlFor(who, what, dir string) string { func (p *CounterPlugin) allItems() map[string][]Item { items, err := GetAllItemsByUser(p.db) if err != nil { - return map[string][]Item{"error": []Item{}} + return map[string][]Item{"error": {}} } return items } templ (p *CounterPlugin) index() { -
-
-

Counter

-
-
-
- Password - -
-
- - for user, items := range p.allItems() { +

Counter

+ +
+ for user, items := range p.allItems() { + - for _, thing := range items { - @p.renderItem(user, thing) - } + + for _, thing := range items { + @p.renderItem(user, thing) } -
{ user }
-
+ } + } templ (p *CounterPlugin) renderItem(user string, item Item) { diff --git a/plugins/counter/counter_templ.go b/plugins/counter/counter_templ.go index 9cd4946..de2d999 100644 --- a/plugins/counter/counter_templ.go +++ b/plugins/counter/counter_templ.go @@ -19,7 +19,7 @@ func urlFor(who, what, dir string) string { func (p *CounterPlugin) allItems() map[string][]Item { items, err := GetAllItemsByUser(p.db) if err != nil { - return map[string][]Item{"error": []Item{}} + return map[string][]Item{"error": {}} } return items } @@ -37,25 +37,25 @@ func (p *CounterPlugin) index() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Counter

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

Counter

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for user, items := range p.allItems() { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -66,7 +66,7 @@ func (p *CounterPlugin) index() templ.Component { } } } - _, 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(user) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/counter/counter.templ`, Line: 29, Col: 60} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/counter/counter.templ`, Line: 24, Col: 60} } _, 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 } @@ -105,7 +105,7 @@ func (p *CounterPlugin) renderItem(user string, item Item) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(item.Item) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/counter/counter.templ`, Line: 41, Col: 23} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/counter/counter.templ`, Line: 36, Col: 23} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -118,7 +118,7 @@ func (p *CounterPlugin) renderItem(user string, item Item) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", item.Count)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/counter/counter.templ`, Line: 44, Col: 43} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/counter/counter.templ`, Line: 39, Col: 43} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { diff --git a/plugins/emojy/list.templ b/plugins/emojy/list.templ index 0c4b35a..eacc423 100644 --- a/plugins/emojy/list.templ +++ b/plugins/emojy/list.templ @@ -1,35 +1,25 @@ package emojy templ (p *EmojyPlugin) listTempl(emojy emojyMap) { -
-
-
-

Emojy

-
-
-
-
- @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 e9fb0b2..27ff61f 100644 --- a/plugins/emojy/list_templ.go +++ b/plugins/emojy/list_templ.go @@ -23,7 +23,7 @@ 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

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

Emojy

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -31,13 +31,13 @@ func (p *EmojyPlugin) listTempl(emojy emojyMap) templ.Component { 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 } for _, v := range emojy { 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: 26, Col: 33} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/emojy/list.templ`, Line: 18, Col: 29} } _, 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("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/plugins/meme/meme.templ b/plugins/meme/meme.templ index 1aeabfa..0464d55 100644 --- a/plugins/meme/meme.templ +++ b/plugins/meme/meme.templ @@ -1,94 +1,80 @@ package meme templ (p *MemePlugin) index(all webResps) { -
-

Meme

+

New Meme

-
-
- -
-
- -
-
- -
-
- -
-
+ + + +
+ +

Current Memes

+
+
for _, meme := range all { +
@p.Show(meme) +
}
} templ (p *MemePlugin) Show(meme webResp) { -
-
-
- { -
-

{ meme.Name }

-
-
-
-
-
-                { meme.Config }
-            
-
-
- -
-
+
+
+ { +

{ meme.Name }

+
+
+            { meme.Config }
+        
+
+ +
+
} templ (p *MemePlugin) Edit(meme webResp) {
-
-
- { -
-
- - -
-
- - -
-
+
+
+ { +
+ + +
+ + +
+
} \ No newline at end of file diff --git a/plugins/meme/meme_templ.go b/plugins/meme/meme_templ.go index d6b7b50..615e978 100644 --- a/plugins/meme/meme_templ.go +++ b/plugins/meme/meme_templ.go @@ -23,15 +23,23 @@ 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("

New Meme

Current Memes

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, meme := range all { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } templ_7745c5c3_Err = p.Show(meme).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 + } } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { @@ -57,7 +65,7 @@ func (p *MemePlugin) Show(meme webResp) templ.Component { templ_7745c5c3_Var2 = 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 } var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(meme.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/meme/meme.templ`, Line: 44, Col: 34} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/meme/meme.templ`, Line: 36, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) 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
 		}
 		var templ_7745c5c3_Var4 string
 		templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(meme.Config)
 		if templ_7745c5c3_Err != nil {
-			return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/meme/meme.templ`, Line: 50, Col: 29}
+			return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/meme/meme.templ`, Line: 39, Col: 25}
 		}
 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
 		if templ_7745c5c3_Err != nil {
 			return templ_7745c5c3_Err
 		}
-		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"outerHTML\">Edit") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -147,7 +155,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("
\"")
\"")