AnthoLume/ngtemplates/pages/home_templ.go

126 lines
5.0 KiB
Go
Raw Normal View History

2024-10-04 23:40:03 +00:00
// Code generated by templ - DO NOT EDIT.
2025-01-25 20:01:18 +00:00
// templ: version: v0.3.819
2024-10-04 23:40:03 +00:00
package pages
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
2025-01-25 20:01:18 +00:00
import templruntime "github.com/a-h/templ/runtime"
2024-10-04 23:40:03 +00:00
import (
"reichard.io/antholume/database"
"reichard.io/antholume/graph"
"reichard.io/antholume/ngtemplates/common"
2024-10-06 21:01:37 +00:00
"reichard.io/antholume/ngtemplates/components"
2024-10-04 23:40:03 +00:00
)
func Home(
settings common.Settings,
dailyReadSVG graph.SVGGraphData,
userStreaks []database.UserStreak,
2024-10-06 21:01:37 +00:00
userStatistics common.UserStatistics,
userMetadata common.UserMetadata,
2024-10-04 23:40:03 +00:00
) templ.Component {
2025-01-25 20:01:18 +00:00
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
2024-10-04 23:40:03 +00:00
if !templ_7745c5c3_IsBuffer {
2025-01-25 20:01:18 +00:00
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
2024-10-04 23:40:03 +00:00
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
2025-01-25 20:01:18 +00:00
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
2024-10-04 23:40:03 +00:00
if !templ_7745c5c3_IsBuffer {
2025-01-25 20:01:18 +00:00
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"flex flex-col gap-4\"><div class=\"w-full\">")
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-06 21:01:37 +00:00
templ_7745c5c3_Err = components.DailyReadChart(dailyReadSVG).Render(ctx, templ_7745c5c3_Buffer)
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-25 20:01:18 +00:00
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</div><div class=\"grid grid-cols-2 gap-4 md:grid-cols-4\">")
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-06 21:01:37 +00:00
templ_7745c5c3_Err = components.InfoCardLink("Documents", userMetadata.DocumentCount, "./documents").Render(ctx, templ_7745c5c3_Buffer)
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-06 21:01:37 +00:00
templ_7745c5c3_Err = components.InfoCardLink("Activity Records", userMetadata.ActivityCount, "./activity").Render(ctx, templ_7745c5c3_Buffer)
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-06 21:01:37 +00:00
templ_7745c5c3_Err = components.InfoCardLink("Progress Records", userMetadata.ProgressCount, "./progress").Render(ctx, templ_7745c5c3_Buffer)
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-06 21:01:37 +00:00
templ_7745c5c3_Err = components.InfoCard("Devices", userMetadata.DeviceCount).Render(ctx, templ_7745c5c3_Buffer)
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-25 20:01:18 +00:00
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "</div><div class=\"grid grid-cols-1 gap-4 md:grid-cols-2\">")
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, item := range userStreaks {
2024-10-06 21:01:37 +00:00
templ_7745c5c3_Err = components.StreakCard(item).Render(ctx, templ_7745c5c3_Buffer)
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
2025-01-25 20:01:18 +00:00
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</div><div class=\"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3\">")
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-06 21:01:37 +00:00
templ_7745c5c3_Err = components.LeaderboardCard("WPM", userStatistics.WPM).Render(ctx, templ_7745c5c3_Buffer)
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-06 21:01:37 +00:00
templ_7745c5c3_Err = components.LeaderboardCard("Duration", userStatistics.Duration).Render(ctx, templ_7745c5c3_Buffer)
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-06 21:01:37 +00:00
templ_7745c5c3_Err = components.LeaderboardCard("Words", userStatistics.Words).Render(ctx, templ_7745c5c3_Buffer)
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-25 20:01:18 +00:00
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</div></div>")
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-25 20:01:18 +00:00
return nil
2024-10-04 23:40:03 +00:00
})
2024-10-06 21:01:37 +00:00
templ_7745c5c3_Err = layout(settings, "Home").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
2024-10-04 23:40:03 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-25 20:01:18 +00:00
return nil
2024-10-04 23:40:03 +00:00
})
}
2025-01-25 20:01:18 +00:00
var _ = templruntime.GeneratedTemplate