AnthoLume/ngtemplates/components/daily_read_card_templ.go

121 lines
5.8 KiB
Go
Raw Normal View History

2024-10-06 21:01:37 +00:00
// Code generated by templ - DO NOT EDIT.
2025-01-25 20:01:18 +00:00
// templ: version: v0.3.819
2024-10-06 21:01:37 +00:00
package components
//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-06 21:01:37 +00:00
import (
"fmt"
"reichard.io/antholume/graph"
)
func DailyReadChart(dailyReadSVG graph.SVGGraphData) 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-06 21:01:37 +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-06 21:01:37 +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_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"relative w-full bg-white shadow-lg dark:bg-gray-700 rounded\"><p class=\"absolute top-3 left-5 text-sm font-semibold text-gray-700 border-b border-gray-200 w-max dark:text-white dark:border-gray-500\">Daily Read Totals</p><div class=\"relative\"><svg viewBox=\"")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("26 0 755 %d", dailyReadSVG.Height))
if templ_7745c5c3_Err != nil {
2025-01-25 20:01:18 +00:00
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ngtemplates/components/daily_read_card.templ`, Line: 14, Col: 65}
2024-10-06 21:01:37 +00:00
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
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, "\" preserveAspectRatio=\"none\" width=\"100%\" height=\"6em\"><!-- Bezier Line Graph --><path fill=\"#316BBE\" fill-opacity=\"0.5\" stroke=\"none\" d=\"")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%s %s", dailyReadSVG.BezierPath, dailyReadSVG.BezierFill))
if templ_7745c5c3_Err != nil {
2025-01-25 20:01:18 +00:00
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ngtemplates/components/daily_read_card.templ`, Line: 20, Col: 79}
2024-10-06 21:01:37 +00:00
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
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, "\"></path> <path fill=\"none\" stroke=\"#316BBE\" d=\"")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(dailyReadSVG.BezierPath)
if templ_7745c5c3_Err != nil {
2025-01-25 20:01:18 +00:00
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ngtemplates/components/daily_read_card.templ`, Line: 22, Col: 66}
2024-10-06 21:01:37 +00:00
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
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, "\"></path></svg><div class=\"flex absolute w-full h-full top-0\" style=\"width: calc(100%*31/30); transform: translateX(-50%); left: 50%\"><!-- Required for iOS \"Hover\" Events (onclick) -->")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, item := range dailyReadSVG.LinePoints {
2025-01-25 20:01:18 +00:00
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<div onclick class=\"opacity-0 hover:opacity-100 w-full\" style=\"background: linear-gradient(rgba(128, 128, 128, 0.5), rgba(128, 128, 128, 0.5)) no-repeat center/2px 100%\"><div class=\"flex flex-col items-center p-2 rounded absolute top-3 dark:text-white text-xs pointer-events-none\" style=\"transform: translateX(-50%); background-color: rgba(128, 128, 128, 0.2); left: 50%\"><span>")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(item.Data.Label)
if templ_7745c5c3_Err != nil {
2025-01-25 20:01:18 +00:00
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ngtemplates/components/daily_read_card.templ`, Line: 39, Col: 30}
2024-10-06 21:01:37 +00:00
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
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, 6, "</span> <span>")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprint(item.Data.Value))
if templ_7745c5c3_Err != nil {
2025-01-25 20:01:18 +00:00
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ngtemplates/components/daily_read_card.templ`, Line: 40, Col: 42}
2024-10-06 21:01:37 +00:00
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
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, 7, " minutes</span></div></div>")
2024-10-06 21:01:37 +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, 8, "</div></div></div>")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-25 20:01:18 +00:00
return nil
2024-10-06 21:01:37 +00:00
})
}
2025-01-25 20:01:18 +00:00
var _ = templruntime.GeneratedTemplate