package handlers import ( "log" "net/http" templateHandlers "synlotto-website/internal/handlers/template" templateHelpers "synlotto-website/internal/helpers/template" "synlotto-website/internal/platform/bootstrap" "github.com/gin-gonic/gin" ) func Home(app *bootstrap.App) gin.HandlerFunc { return func(c *gin.Context) { data := templateHandlers.BuildTemplateData(app, c.Writer, c.Request) ctx := templateHelpers.TemplateContext(c.Writer, c.Request, data) tmpl := templateHelpers.LoadTemplateFiles("layout.html", "web/templates/index.html") c.Header("Content-Type", "text/html; charset=utf-8") if err := tmpl.ExecuteTemplate(c.Writer, "layout", ctx); err != nil { log.Println("❌ Template render error:", err) c.String(http.StatusInternalServerError, "Template render error: %v", err) return } } }