package templates import "fmt" // CalendarSummary is one of the user's own calendars, listed on the // calendar home page. type CalendarSummary struct { Name string Color string // hex color like "#3b82f6", "" if unset } // EventSummary is a single event shown inside a month-view day cell. type EventSummary struct { ID string Summary string TimeText string // e.g. "14:00" or "" for all-day events AllDay bool } // MonthDay is one day cell in the month grid. type MonthDay struct { Date string // "YYYY-MM-DD", used for links and the "new event" date Day int // day-of-month number shown in the cell InMonth bool // false for the leading/trailing days of neighboring months IsToday bool Events []EventSummary } // MonthViewData is everything the month grid template needs to render one // month of a single calendar. type MonthViewData struct { Cal string Color string MonthLabel string // e.g. "August 2026" Weeks [][]MonthDay PrevMonthURL string NextMonthURL string TodayURL string } // EventFormData pre-fills the create/edit event form. type EventFormData struct { Cal string ID string // empty when creating a new event Summary string Description string Location string AllDay bool StartDate string // "YYYY-MM-DD" StartTime string // "HH:MM", empty when AllDay EndDate string // "YYYY-MM-DD" EndTime string // "HH:MM", empty when AllDay } templ CalendarsHome(username string, calendars []CalendarSummary) { @Layout("Calendar", username) {
You don't have any calendars yet — create one from the dashboard first.
} else {{ errMsg }
} } } func eventFormAction(data EventFormData) templ.SafeURL { if data.ID == "" { return templ.URL("/web/calendar/" + data.Cal + "/new") } return templ.URL("/web/calendar/" + data.Cal + "/" + data.ID + "/edit") } func weekdayLabels() []string { return []string{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"} }