package handlers import ( "database/sql" "net/http" "text/template" "synlotto-website/helpers" ) func NotificationsHandler(db *sql.DB) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { data := BuildTemplateData(db, w, r) context := helpers.TemplateContext(w, r, data) tmpl := template.Must(template.New("notifications.html"). Funcs(helpers.TemplateFuncs()). ParseFiles( "templates/layout.html", "templates/topbar.html", "templates/notifications/index.html", )) err := tmpl.ExecuteTemplate(w, "layout", context) if err != nil { http.Error(w, "Error rendering notifications page", http.StatusInternalServerError) } } }