M components/adminpartials.templ => components/adminpartials.templ +37 -9
@@ 1,15 1,43 @@
package components
import "git.src.quest/~skye/felu-ddns/db"
+import "strconv"
templ AdminPartialsUsersList(users []db.User) {
- <div class="flex flex-col">
- for _, user := range users {
- <div class="flex border p-2">
- <div>
- { user.Email }
- </div>
- </div>
- }
- </div>
+ <table class="table-auto">
+ <thead>
+ <tr>
+ <th class="text-start p-2">
+ Id
+ </th>
+ <th class="text-start p-2">
+ Email
+ </th>
+ <th class="text-start p-2">
+ Is Admin
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ for _, user := range users {
+ <tr class="border">
+ <td>
+ <div class="p-2">
+ { user.Id }
+ </div>
+ </td>
+ <td>
+ <div class="p-2">
+ { user.Email }
+ </div>
+ </td>
+ <td>
+ <div class="p-2">
+ { strconv.FormatBool(user.IsAdmin) }
+ </div>
+ </td>
+ </tr>
+ }
+ </tbody>
+ </table>
}
M components/adminpartials_templ.go => components/adminpartials_templ.go +52 -6
@@ 10,6 10,7 @@ import "io"
import "bytes"
import "git.src.quest/~skye/felu-ddns/db"
+import "strconv"
func AdminPartialsUsersList(users []db.User) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
@@ 24,26 25,71 @@ func AdminPartialsUsersList(users []db.User) templ.Component {
var_1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- _, err = templBuffer.WriteString("<div class=\"flex flex-col\">")
+ _, err = templBuffer.WriteString("<table class=\"table-auto\"><thead><tr><th class=\"text-start p-2\">")
+ if err != nil {
+ return err
+ }
+ var_2 := `Id`
+ _, err = templBuffer.WriteString(var_2)
+ if err != nil {
+ return err
+ }
+ _, err = templBuffer.WriteString("</th><th class=\"text-start p-2\">")
+ if err != nil {
+ return err
+ }
+ var_3 := `Email`
+ _, err = templBuffer.WriteString(var_3)
+ if err != nil {
+ return err
+ }
+ _, err = templBuffer.WriteString("</th><th class=\"text-start p-2\">")
+ if err != nil {
+ return err
+ }
+ var_4 := `Is Admin`
+ _, err = templBuffer.WriteString(var_4)
+ if err != nil {
+ return err
+ }
+ _, err = templBuffer.WriteString("</th></tr></thead><tbody>")
if err != nil {
return err
}
for _, user := range users {
- _, err = templBuffer.WriteString("<div class=\"flex border p-2\"><div>")
+ _, err = templBuffer.WriteString("<tr class=\"border\"><td><div class=\"p-2\">")
+ if err != nil {
+ return err
+ }
+ var var_5 string = user.Id
+ _, err = templBuffer.WriteString(templ.EscapeString(var_5))
+ if err != nil {
+ return err
+ }
+ _, err = templBuffer.WriteString("</div></td><td><div class=\"p-2\">")
+ if err != nil {
+ return err
+ }
+ var var_6 string = user.Email
+ _, err = templBuffer.WriteString(templ.EscapeString(var_6))
+ if err != nil {
+ return err
+ }
+ _, err = templBuffer.WriteString("</div></td><td><div class=\"p-2\">")
if err != nil {
return err
}
- var var_2 string = user.Email
- _, err = templBuffer.WriteString(templ.EscapeString(var_2))
+ var var_7 string = strconv.FormatBool(user.IsAdmin)
+ _, err = templBuffer.WriteString(templ.EscapeString(var_7))
if err != nil {
return err
}
- _, err = templBuffer.WriteString("</div></div>")
+ _, err = templBuffer.WriteString("</div></td></tr>")
if err != nil {
return err
}
}
- _, err = templBuffer.WriteString("</div>")
+ _, err = templBuffer.WriteString("</tbody></table>")
if err != nil {
return err
}
M components/manageadmin.templ => components/manageadmin.templ +4 -0
@@ 6,6 6,10 @@ templ ManageAdmin() {
something something admin page
<br/>probs have like stats and that kinda stuff here
</div>
+ <div class="flex flex-col">
+ <a class="border p-2" href="/manage/admin/users">Users</a>
+ <a class="border p-2" href="/manage/admin/domains">Domains</a>
+ </div>
}
}
M components/manageadmin_templ.go => components/manageadmin_templ.go +33 -15
@@ 46,7 46,25 @@ func ManageAdmin() templ.Component {
if err != nil {
return err
}
- _, err = templBuffer.WriteString("</div>")
+ _, err = templBuffer.WriteString("</div> <div class=\"flex flex-col\"><a class=\"border p-2\" href=\"/manage/admin/users\">")
+ if err != nil {
+ return err
+ }
+ var_5 := `Users`
+ _, err = templBuffer.WriteString(var_5)
+ if err != nil {
+ return err
+ }
+ _, err = templBuffer.WriteString("</a><a class=\"border p-2\" href=\"/manage/admin/domains\">")
+ if err != nil {
+ return err
+ }
+ var_6 := `Domains`
+ _, err = templBuffer.WriteString(var_6)
+ if err != nil {
+ return err
+ }
+ _, err = templBuffer.WriteString("</a></div>")
if err != nil {
return err
}
@@ 74,12 92,12 @@ func ManageAdminUsers() templ.Component {
defer templ.ReleaseBuffer(templBuffer)
}
ctx = templ.InitializeContext(ctx)
- var_5 := templ.GetChildren(ctx)
- if var_5 == nil {
- var_5 = templ.NopComponent
+ var_7 := templ.GetChildren(ctx)
+ if var_7 == nil {
+ var_7 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- var_6 := templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
+ var_8 := templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
templBuffer, templIsBuffer := w.(*bytes.Buffer)
if !templIsBuffer {
templBuffer = templ.GetBuffer()
@@ 89,8 107,8 @@ func ManageAdminUsers() templ.Component {
if err != nil {
return err
}
- var_7 := `list of users here, with also the ability to add new users`
- _, err = templBuffer.WriteString(var_7)
+ var_9 := `list of users here, with also the ability to add new users`
+ _, err = templBuffer.WriteString(var_9)
if err != nil {
return err
}
@@ 103,7 121,7 @@ func ManageAdminUsers() templ.Component {
}
return err
})
- err = ManageBase("ManageAdmin").Render(templ.WithChildren(ctx, var_6), templBuffer)
+ err = ManageBase("ManageAdmin").Render(templ.WithChildren(ctx, var_8), templBuffer)
if err != nil {
return err
}
@@ 122,12 140,12 @@ func ManageAdminDomains() templ.Component {
defer templ.ReleaseBuffer(templBuffer)
}
ctx = templ.InitializeContext(ctx)
- var_8 := templ.GetChildren(ctx)
- if var_8 == nil {
- var_8 = templ.NopComponent
+ var_10 := templ.GetChildren(ctx)
+ if var_10 == nil {
+ var_10 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- var_9 := templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
+ var_11 := templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
templBuffer, templIsBuffer := w.(*bytes.Buffer)
if !templIsBuffer {
templBuffer = templ.GetBuffer()
@@ 137,8 155,8 @@ func ManageAdminDomains() templ.Component {
if err != nil {
return err
}
- var_10 := `list of all domains on the instance, with owner details and such`
- _, err = templBuffer.WriteString(var_10)
+ var_12 := `list of all domains on the instance, with owner details and such`
+ _, err = templBuffer.WriteString(var_12)
if err != nil {
return err
}
@@ 151,7 169,7 @@ func ManageAdminDomains() templ.Component {
}
return err
})
- err = ManageBase("ManageAdmin").Render(templ.WithChildren(ctx, var_9), templBuffer)
+ err = ManageBase("ManageAdmin").Render(templ.WithChildren(ctx, var_11), templBuffer)
if err != nil {
return err
}
M static/styles.css => static/styles.css +12 -0
@@ 538,6 538,10 @@ video {
display: flex;
}
+.table {
+ display: table;
+}
+
.w-full {
width: 100%;
}
@@ 546,6 550,10 @@ video {
max-width: 64rem;
}
+.table-auto {
+ table-layout: auto;
+}
+
.flex-col {
flex-direction: column;
}
@@ 592,6 600,10 @@ video {
text-align: center;
}
+.text-start {
+ text-align: start;
+}
+
.text-4xl {
font-size: 2.25rem;
line-height: 2.5rem;