package renderer

import (
	"net/http"

	agendastorage "git.coopgo.io/coopgo-platform/agenda/storage"
)

const dashboardMenu = "dashboard"

func (renderer *Renderer) Dashboard(w http.ResponseWriter, r *http.Request, accounts []any, nbaccounts int, count_members int, events []agendastorage.Event) {
	files := renderer.ThemeConfig.GetStringSlice("views.dashboard.files")
	state := NewState(r, renderer.ThemeConfig, dashboardMenu)
	state.ViewState = map[string]any{
		"beneficiaries": map[string]any{
			"count":  nbaccounts,
			"latest": accounts,
		},
		"count_members": count_members,
		"events":        events,
	}

	renderer.Render("dashboard", w, r, files, state)
}
