diff --git a/internal/web/calendar.go b/internal/web/calendar.go new file mode 100644 index 0000000..8f25e40 --- /dev/null +++ b/internal/web/calendar.go @@ -0,0 +1,628 @@ +package web + +import ( + "context" + "crypto/rand" + "encoding/hex" + "fmt" + "net/http" + "regexp" + "sort" + "strconv" + "strings" + "time" + + ical "github.com/emersion/go-ical" + "github.com/yourusername/caldav-server/internal/web/templates" +) + +// eventIDRe validates an event's object ID as it appears in a URL path +// segment: a filename like "3f9a2b8c1d4e5f60ab12cd34ef56ab78.ics". +var eventIDRe = regexp.MustCompile(`^[a-zA-Z0-9_-]{1,128}\.ics$`) + +// dateLayout/timeLayout are the HTML date/time input formats used +// throughout the event form. +const dateLayout = "2006-01-02" +const timeLayout = "15:04" + +// newEventID generates a random filename for a new event object, +// mirroring the ".ics" convention used by the CalDAV backend +// (internal/caldav). +func newEventID() (string, error) { + buf := make([]byte, 16) + if _, err := rand.Read(buf); err != nil { + return "", err + } + return hex.EncodeToString(buf) + ".ics", nil +} + +// ownsCalendar reports whether cal is one of username's own calendars +// (never one shared with them by another user — the web calendar UI only +// manages a user's own calendars, consistent with contacts/files). +func (s *Server) ownsCalendar(username, cal string) (bool, error) { + if !resourceNameRe.MatchString(cal) { + return false, nil + } + cals, err := s.dbase.ListCalendars(username) + if err != nil { + return false, err + } + for _, c := range cals { + if c.Name == cal { + return true, nil + } + } + return false, nil +} + +func (s *Server) handleCalendarsHome(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet { + w.Header().Set("Allow", "GET") + http.Error(w, "method not allowed", http.StatusMethodNotAllowed) + return + } + username := userFromContext(r.Context()) + cals, err := s.dbase.ListCalendars(username) + if err != nil { + s.logger.Error("listing calendars", "error", err) + http.Error(w, "internal error", http.StatusInternalServerError) + return + } + sort.Slice(cals, func(i, j int) bool { return cals[i].Name < cals[j].Name }) + + var summaries []templates.CalendarSummary + for _, c := range cals { + summaries = append(summaries, templates.CalendarSummary{Name: c.Name, Color: c.Color}) + } + + w.Header().Set("Content-Type", "text/html; charset=utf-8") + _ = templates.CalendarsHome(username, summaries).Render(context.Background(), w) +} + +func (s *Server) handleCalendarMonth(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet { + w.Header().Set("Allow", "GET") + http.Error(w, "method not allowed", http.StatusMethodNotAllowed) + return + } + username := userFromContext(r.Context()) + cal := r.PathValue("cal") + ok, err := s.ownsCalendar(username, cal) + if err != nil { + s.logger.Error("checking calendar ownership", "error", err) + http.Error(w, "internal error", http.StatusInternalServerError) + return + } + if !ok { + http.NotFound(w, r) + return + } + + year, month := parseYearMonth(r) + color, _ := s.dbase.GetCalendarColor(username, cal) + + data, err := s.buildMonthView(username, cal, color, year, month) + if err != nil { + s.logger.Error("building month view", "calendar", cal, "error", err) + http.Error(w, "internal error", http.StatusInternalServerError) + return + } + + w.Header().Set("Content-Type", "text/html; charset=utf-8") + _ = templates.MonthView(username, data).Render(context.Background(), w) +} + +// parseYearMonth reads ?year=&month= query params, defaulting to the +// current month if absent or invalid. +func parseYearMonth(r *http.Request) (year int, month time.Month) { + now := time.Now() + year, month = now.Year(), now.Month() + if y, err := strconv.Atoi(r.URL.Query().Get("year")); err == nil && y >= 1 && y <= 9999 { + year = y + } + if m, err := strconv.Atoi(r.URL.Query().Get("month")); err == nil && m >= 1 && m <= 12 { + month = time.Month(m) + } + return year, month +} + +// buildMonthView loads every event in cal, then places each occurrence's +// days onto a 6-week grid covering the requested month (plus enough +// leading/trailing days of neighboring months to fill full weeks). +// Recurring events (RRULE) are not expanded — only an event's own +// DTSTART/DTEND span is considered. +func (s *Server) buildMonthView(username, cal, color string, year int, month time.Month) (templates.MonthViewData, error) { + loc := time.Local + first := time.Date(year, month, 1, 0, 0, 0, 0, loc) + // Monday-first offset: time.Weekday has Sunday=0..Saturday=6. + offset := (int(first.Weekday()) + 6) % 7 + gridStart := first.AddDate(0, 0, -offset) + const totalDays = 42 // 6 weeks + + today := time.Now().In(loc).Format(dateLayout) + + days := make([]templates.MonthDay, totalDays) + dayIndex := make(map[string]int, totalDays) + for i := 0; i < totalDays; i++ { + d := gridStart.AddDate(0, 0, i) + dateStr := d.Format(dateLayout) + days[i] = templates.MonthDay{ + Date: dateStr, + Day: d.Day(), + InMonth: d.Month() == month, + IsToday: dateStr == today, + } + dayIndex[dateStr] = i + } + gridEnd := gridStart.AddDate(0, 0, totalDays-1) + + ids, err := s.store.ListObjects(username, "cal-"+cal) + if err != nil { + return templates.MonthViewData{}, err + } + for _, id := range ids { + data, err := s.store.GetObject(username, "cal-"+cal, id) + if err != nil { + continue + } + form, err := eventFormFromICS(id, data) + if err != nil { + s.logger.Warn("decoding calendar object", "calendar", cal, "id", id, "error", err) + continue + } + startDay, endDay, err := eventDayRange(form, loc) + if err != nil { + continue + } + if endDay.Before(gridStart) || startDay.After(gridEnd) { + continue + } + if startDay.Before(gridStart) { + startDay = gridStart + } + if endDay.After(gridEnd) { + endDay = gridEnd + } + // Cap the number of days a single event can add to the grid, in + // case of malformed data with a wildly distant DTEND. + for d, n := startDay, 0; !d.After(endDay) && n < totalDays; d, n = d.AddDate(0, 0, 1), n+1 { + idx, ok := dayIndex[d.Format(dateLayout)] + if !ok { + continue + } + timeText := "" + if !form.AllDay { + timeText = form.StartTime + } + days[idx].Events = append(days[idx].Events, templates.EventSummary{ + ID: id, + Summary: form.Summary, + TimeText: timeText, + AllDay: form.AllDay, + }) + } + } + + // Keep each day's events in a stable, readable order: all-day events + // first, then timed events sorted by start time. + for i := range days { + evs := days[i].Events + sort.SliceStable(evs, func(a, b int) bool { + if evs[a].AllDay != evs[b].AllDay { + return evs[a].AllDay + } + return evs[a].TimeText < evs[b].TimeText + }) + } + + weeks := make([][]templates.MonthDay, 0, 6) + for i := 0; i < totalDays; i += 7 { + weeks = append(weeks, days[i:i+7]) + } + + prevMonth := first.AddDate(0, -1, 0) + nextMonth := first.AddDate(0, 1, 0) + monthURL := func(y int, m time.Month) string { + return fmt.Sprintf("/web/calendar/%s?year=%d&month=%d", cal, y, int(m)) + } + + return templates.MonthViewData{ + Cal: cal, + Color: color, + MonthLabel: first.Format("January 2006"), + Weeks: weeks, + PrevMonthURL: monthURL(prevMonth.Year(), prevMonth.Month()), + NextMonthURL: monthURL(nextMonth.Year(), nextMonth.Month()), + TodayURL: "/web/calendar/" + cal, + }, nil +} + +// eventDayRange returns the inclusive [start, end] calendar-day span an +// event occupies, in loc, for placing it on the month grid. +func eventDayRange(form templates.EventFormData, loc *time.Location) (start, end time.Time, err error) { + start, err = time.ParseInLocation(dateLayout, form.StartDate, loc) + if err != nil { + return time.Time{}, time.Time{}, err + } + endDate := form.EndDate + if endDate == "" { + endDate = form.StartDate + } + end, err = time.ParseInLocation(dateLayout, endDate, loc) + if err != nil { + return time.Time{}, time.Time{}, err + } + if end.Before(start) { + end = start + } + return start, end, nil +} + +func (s *Server) handleEventNew(w http.ResponseWriter, r *http.Request) { + username := userFromContext(r.Context()) + cal := r.PathValue("cal") + ok, err := s.ownsCalendar(username, cal) + if err != nil { + s.logger.Error("checking calendar ownership", "error", err) + http.Error(w, "internal error", http.StatusInternalServerError) + return + } + if !ok { + http.NotFound(w, r) + return + } + + switch r.Method { + case http.MethodGet: + form := newEventFormDefaults(cal, r.URL.Query().Get("date")) + w.Header().Set("Content-Type", "text/html; charset=utf-8") + _ = templates.EventForm(username, form, "").Render(context.Background(), w) + case http.MethodPost: + s.saveEventFromForm(w, r, username, cal, "") + default: + w.Header().Set("Allow", "GET, POST") + http.Error(w, "method not allowed", http.StatusMethodNotAllowed) + } +} + +// newEventFormDefaults builds the initial form values for a brand new +// event. If dateParam is a valid "YYYY-MM-DD" (e.g. from clicking a day +// cell in the month grid), the event defaults to an all-day event on that +// date; otherwise it defaults to a one-hour timed event starting at the +// next full hour today. +func newEventFormDefaults(cal, dateParam string) templates.EventFormData { + if _, err := time.Parse(dateLayout, dateParam); err == nil { + return templates.EventFormData{Cal: cal, AllDay: true, StartDate: dateParam, EndDate: dateParam} + } + now := time.Now() + start := now.Truncate(time.Hour).Add(time.Hour) + end := start.Add(time.Hour) + return templates.EventFormData{ + Cal: cal, + StartDate: start.Format(dateLayout), + StartTime: start.Format(timeLayout), + EndDate: end.Format(dateLayout), + EndTime: end.Format(timeLayout), + } +} + +func (s *Server) handleEventEdit(w http.ResponseWriter, r *http.Request) { + username := userFromContext(r.Context()) + cal := r.PathValue("cal") + id := r.PathValue("id") + ok, err := s.ownsCalendar(username, cal) + if err != nil { + s.logger.Error("checking calendar ownership", "error", err) + http.Error(w, "internal error", http.StatusInternalServerError) + return + } + if !ok || !eventIDRe.MatchString(id) { + http.NotFound(w, r) + return + } + + switch r.Method { + case http.MethodGet: + data, err := s.store.GetObject(username, "cal-"+cal, id) + if err != nil { + http.NotFound(w, r) + return + } + form, err := eventFormFromICS(id, data) + if err != nil { + s.logger.Error("decoding event", "error", err) + http.Error(w, "internal error", http.StatusInternalServerError) + return + } + form.Cal = cal + w.Header().Set("Content-Type", "text/html; charset=utf-8") + _ = templates.EventForm(username, form, "").Render(context.Background(), w) + case http.MethodPost: + s.saveEventFromForm(w, r, username, cal, id) + default: + w.Header().Set("Allow", "GET, POST") + http.Error(w, "method not allowed", http.StatusMethodNotAllowed) + } +} + +func (s *Server) handleEventDelete(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + w.Header().Set("Allow", "POST") + http.Error(w, "method not allowed", http.StatusMethodNotAllowed) + return + } + username := userFromContext(r.Context()) + cal := r.PathValue("cal") + id := r.PathValue("id") + ok, err := s.ownsCalendar(username, cal) + if err != nil { + s.logger.Error("checking calendar ownership", "error", err) + http.Error(w, "internal error", http.StatusInternalServerError) + return + } + if !ok || !eventIDRe.MatchString(id) { + http.NotFound(w, r) + return + } + if err := s.store.DeleteObject(username, "cal-"+cal, id); err != nil { + http.NotFound(w, r) + return + } + http.Redirect(w, r, "/web/calendar/"+cal, http.StatusSeeOther) +} + +// eventFormInput holds the parsed, not-yet-validated values submitted by +// the event form. +type eventFormInput struct { + Summary string + Description string + Location string + AllDay bool + StartDate string + StartTime string + EndDate string + EndTime string +} + +func parseEventForm(r *http.Request) eventFormInput { + return eventFormInput{ + Summary: strings.TrimSpace(r.PostForm.Get("summary")), + Description: strings.TrimSpace(r.PostForm.Get("description")), + Location: strings.TrimSpace(r.PostForm.Get("location")), + AllDay: r.PostForm.Get("all_day") != "", + StartDate: strings.TrimSpace(r.PostForm.Get("start_date")), + StartTime: strings.TrimSpace(r.PostForm.Get("start_time")), + EndDate: strings.TrimSpace(r.PostForm.Get("end_date")), + EndTime: strings.TrimSpace(r.PostForm.Get("end_time")), + } +} + +// saveEventFromForm handles both event creation (id == "") and editing +// (id preserves the existing event's UID). +func (s *Server) saveEventFromForm(w http.ResponseWriter, r *http.Request, username, cal, id string) { + if err := r.ParseForm(); err != nil { + http.Error(w, "invalid form", http.StatusBadRequest) + return + } + in := parseEventForm(r) + + reRender := func(errMsg string) { + form := templates.EventFormData{ + Cal: cal, ID: id, Summary: in.Summary, Description: in.Description, Location: in.Location, + AllDay: in.AllDay, StartDate: in.StartDate, StartTime: in.StartTime, EndDate: in.EndDate, EndTime: in.EndTime, + } + w.Header().Set("Content-Type", "text/html; charset=utf-8") + _ = templates.EventForm(username, form, errMsg).Render(context.Background(), w) + } + + if in.Summary == "" { + reRender("Title is required") + return + } + + start, end, err := computeEventTimes(in) + if err != nil { + reRender(err.Error()) + return + } + + var uid string + if id == "" { + newID, err := newEventID() + if err != nil { + s.logger.Error("generating event id", "error", err) + http.Error(w, "internal error", http.StatusInternalServerError) + return + } + id = newID + uid = strings.TrimSuffix(id, ".ics") + } else { + data, err := s.store.GetObject(username, "cal-"+cal, id) + if err != nil { + http.NotFound(w, r) + return + } + existing, err := ical.NewDecoder(strings.NewReader(string(data))).Decode() + if err != nil { + s.logger.Error("decoding existing event", "error", err) + http.Error(w, "internal error", http.StatusInternalServerError) + return + } + if events := existing.Events(); len(events) > 0 { + if uidProp := events[0].Props.Get(ical.PropUID); uidProp != nil { + uid = uidProp.Value + } + } + if uid == "" { + uid = strings.TrimSuffix(id, ".ics") + } + } + + newCal := buildEventCalendar(uid, in, start, end) + if err := s.saveEvent(username, cal, id, newCal); err != nil { + s.logger.Error("saving event", "error", err) + http.Error(w, "internal error", http.StatusInternalServerError) + return + } + + http.Redirect(w, r, "/web/calendar/"+cal, http.StatusSeeOther) +} + +// computeEventTimes validates and converts the submitted form fields into +// concrete start/end instants (for timed events) or dates (for all-day +// events, where end is returned as the exclusive DTEND day). +func computeEventTimes(in eventFormInput) (start, end time.Time, err error) { + if in.StartDate == "" { + return time.Time{}, time.Time{}, fmt.Errorf("start date is required") + } + endDate := in.EndDate + if endDate == "" { + endDate = in.StartDate + } + + if in.AllDay { + start, err = time.ParseInLocation(dateLayout, in.StartDate, time.Local) + if err != nil { + return time.Time{}, time.Time{}, fmt.Errorf("invalid start date") + } + end, err = time.ParseInLocation(dateLayout, endDate, time.Local) + if err != nil { + return time.Time{}, time.Time{}, fmt.Errorf("invalid end date") + } + if end.Before(start) { + return time.Time{}, time.Time{}, fmt.Errorf("end date must not be before start date") + } + // DTEND for all-day events is exclusive: the end date the user + // picks is the last day the event covers, so add one day. + end = end.AddDate(0, 0, 1) + return start, end, nil + } + + if in.StartTime == "" || in.EndTime == "" { + return time.Time{}, time.Time{}, fmt.Errorf("start and end time are required for timed events") + } + start, err = time.ParseInLocation(dateLayout+"T"+timeLayout, in.StartDate+"T"+in.StartTime, time.Local) + if err != nil { + return time.Time{}, time.Time{}, fmt.Errorf("invalid start date/time") + } + end, err = time.ParseInLocation(dateLayout+"T"+timeLayout, endDate+"T"+in.EndTime, time.Local) + if err != nil { + return time.Time{}, time.Time{}, fmt.Errorf("invalid end date/time") + } + if !end.After(start) { + return time.Time{}, time.Time{}, fmt.Errorf("end must be after start") + } + return start, end, nil +} + +// buildEventCalendar builds a fresh VCALENDAR/VEVENT from the submitted +// form input and resolved start/end instants. +func buildEventCalendar(uid string, in eventFormInput, start, end time.Time) *ical.Calendar { + cal := ical.NewCalendar() + cal.Props.SetText(ical.PropVersion, "2.0") + cal.Props.SetText(ical.PropProductID, "-//nidus//web calendar//EN") + + ev := ical.NewEvent() + ev.Props.SetText(ical.PropUID, uid) + ev.Props.SetDateTime(ical.PropDateTimeStamp, time.Now().UTC()) + ev.Props.SetText(ical.PropSummary, in.Summary) + if in.Description != "" { + ev.Props.SetText(ical.PropDescription, in.Description) + } + if in.Location != "" { + ev.Props.SetText(ical.PropLocation, in.Location) + } + + if in.AllDay { + ev.Props.SetDate(ical.PropDateTimeStart, start) + ev.Props.SetDate(ical.PropDateTimeEnd, end) + } else { + ev.Props.SetDateTime(ical.PropDateTimeStart, start.UTC()) + ev.Props.SetDateTime(ical.PropDateTimeEnd, end.UTC()) + } + + cal.Children = append(cal.Children, ev.Component) + return cal +} + +func (s *Server) saveEvent(username, cal, id string, calendar *ical.Calendar) error { + var buf strings.Builder + enc := ical.NewEncoder(&buf) + if err := enc.Encode(calendar); err != nil { + return fmt.Errorf("encoding ical: %w", err) + } + return s.store.PutObject(username, "cal-"+cal, id, []byte(buf.String())) +} + +// eventFormFromICS decodes a single-VEVENT .ics object into the shared +// EventFormData shape used both for pre-filling the edit form and for +// placing the event on the month grid. +func eventFormFromICS(id string, data []byte) (templates.EventFormData, error) { + calendar, err := ical.NewDecoder(strings.NewReader(string(data))).Decode() + if err != nil { + return templates.EventFormData{}, err + } + events := calendar.Events() + if len(events) == 0 { + return templates.EventFormData{}, fmt.Errorf("no VEVENT in %s", id) + } + ev := events[0] + + form := templates.EventFormData{ID: id} + if p := ev.Props.Get(ical.PropSummary); p != nil { + form.Summary = p.Value + } + if p := ev.Props.Get(ical.PropDescription); p != nil { + form.Description = p.Value + } + if p := ev.Props.Get(ical.PropLocation); p != nil { + form.Location = p.Value + } + + startProp := ev.Props.Get(ical.PropDateTimeStart) + endProp := ev.Props.Get(ical.PropDateTimeEnd) + if startProp == nil { + return templates.EventFormData{}, fmt.Errorf("missing DTSTART in %s", id) + } + + allDay := startProp.ValueType() == ical.ValueDate || len(startProp.Value) == 8 // RFC 5545 DATE value, e.g. "20060102" + form.AllDay = allDay + + if allDay { + start, err := startProp.DateTime(time.Local) + if err != nil { + return templates.EventFormData{}, err + } + form.StartDate = start.Format(dateLayout) + end := start.AddDate(0, 0, 1) + if endProp != nil { + if e, err := endProp.DateTime(time.Local); err == nil { + end = e + } + } + // Displayed end date is the last inclusive day (DTEND is exclusive). + form.EndDate = end.AddDate(0, 0, -1).Format(dateLayout) + } else { + // go-ical's Prop.DateTime always parses a "Z"-suffixed UTC value + // as UTC regardless of the loc argument passed in, so the + // returned time must be explicitly converted to the local zone + // before formatting for display. + start, err := startProp.DateTime(time.Local) + if err != nil { + return templates.EventFormData{}, err + } + start = start.In(time.Local) + form.StartDate = start.Format(dateLayout) + form.StartTime = start.Format(timeLayout) + end := start.Add(time.Hour) + if endProp != nil { + if e, err := endProp.DateTime(time.Local); err == nil { + end = e.In(time.Local) + } + } + form.EndDate = end.Format(dateLayout) + form.EndTime = end.Format(timeLayout) + } + + return form, nil +} diff --git a/internal/web/server.go b/internal/web/server.go index 70108a1..55aea51 100644 --- a/internal/web/server.go +++ b/internal/web/server.go @@ -54,6 +54,11 @@ func (s *Server) Handler(staticFS http.FileSystem) http.Handler { mux.HandleFunc("/contacts/{book}/{id}/edit", s.requireLogin(s.handleContactEdit)) mux.HandleFunc("/contacts/{book}/{id}/delete", s.requireLogin(s.handleContactDelete)) mux.HandleFunc("/contacts/{book}/{id}/export", s.requireLogin(s.handleContactExportOne)) + mux.HandleFunc("/calendar", s.requireLogin(s.handleCalendarsHome)) + mux.HandleFunc("/calendar/{cal}", s.requireLogin(s.handleCalendarMonth)) + mux.HandleFunc("/calendar/{cal}/new", s.requireLogin(s.handleEventNew)) + mux.HandleFunc("/calendar/{cal}/{id}/edit", s.requireLogin(s.handleEventEdit)) + mux.HandleFunc("/calendar/{cal}/{id}/delete", s.requireLogin(s.handleEventDelete)) return mux } diff --git a/internal/web/templates/calendar.templ b/internal/web/templates/calendar.templ new file mode 100644 index 0000000..d6bdea0 --- /dev/null +++ b/internal/web/templates/calendar.templ @@ -0,0 +1,225 @@ +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) { +

Calendar

+ if len(calendars) == 0 { +

+ You don't have any calendars yet — create one from the + dashboard first. +

+ } else { + + } + } +} + +templ MonthView(username string, data MonthViewData) { + @Layout("Calendar", username) { +
+
+ ← Calendars +

+ + { data.Cal } +

+
+
+ + Today + + { data.MonthLabel } + + New event + +
+
+ +
+ for _, wd := range weekdayLabels() { +
{ wd }
+ } + for _, week := range data.Weeks { + for _, day := range week { + @monthDayCell(data.Cal, day) + } + } +
+ } +} + +templ monthDayCell(cal string, day MonthDay) { +
+ + for _, ev := range day.Events { + + if !ev.AllDay && ev.TimeText != "" { + { ev.TimeText } + } + { " " + ev.Summary } + + } +
+} + +templ EventForm(username string, data EventFormData, errMsg string) { + @Layout("Calendar", username) { + ← { data.Cal } +

+ if data.ID == "" { + New event + } else { + Edit event + } +

+ if errMsg != "" { +

{ errMsg }

+ } +
+
+ + +
+ + + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ + +
+
+ + +
+ +
+ + if data.ID != "" { + + + + } +
+ + + + } +} + +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"} +} diff --git a/internal/web/templates/calendar_templ.go b/internal/web/templates/calendar_templ.go new file mode 100644 index 0000000..4e43a6a --- /dev/null +++ b/internal/web/templates/calendar_templ.go @@ -0,0 +1,805 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.3.1020 +package templates + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import templruntime "github.com/a-h/templ/runtime" + +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 +} + +func CalendarsHome(username string, calendars []CalendarSummary) templ.Component { + 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) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

Calendar

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if len(calendars) == 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "

You don't have any calendars yet — create one from the dashboard first.

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + return nil + }) + templ_7745c5c3_Err = Layout("Calendar", username).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func MonthView(username string, data MonthViewData) templ.Component { + 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) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var6 := templ.GetChildren(ctx) + if templ_7745c5c3_Var6 == nil { + templ_7745c5c3_Var6 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var7 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "
← Calendars

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var9 string + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(data.Cal) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/templates/calendar.templ`, Line: 83, Col: 15} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "

Today ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var13 string + templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(data.MonthLabel) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/templates/calendar.templ`, Line: 90, Col: 60} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, " New event
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, wd := range weekdayLabels() { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var15 string + templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(wd) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/templates/calendar.templ`, Line: 100, Col: 90} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + for _, week := range data.Weeks { + for _, day := range week { + templ_7745c5c3_Err = monthDayCell(data.Cal, day).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = Layout("Calendar", username).Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func monthDayCell(cal string, day MonthDay) templ.Component { + 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) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var16 := templ.GetChildren(ctx) + if templ_7745c5c3_Var16 == nil { + templ_7745c5c3_Var16 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + var templ_7745c5c3_Var17 = []any{"bg-white min-h-[6rem] p-1.5 flex flex-col gap-1", templ.KV("bg-gray-50 text-gray-400", !day.InMonth)} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var17...) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var19 = []any{"text-xs font-medium rounded-full w-5 h-5 flex items-center justify-center", templ.KV("bg-indigo-600 text-white", day.IsToday), templ.KV("hover:bg-gray-100", !day.IsToday)} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var19...) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var22 string + templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprint(day.Day)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/templates/calendar.templ`, Line: 119, Col: 25} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, ev := range day.Events { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !ev.AllDay && ev.TimeText != "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var25 string + templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(ev.TimeText) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/templates/calendar.templ`, Line: 129, Col: 44} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + var templ_7745c5c3_Var26 string + templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(" " + ev.Summary) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/templates/calendar.templ`, Line: 131, Col: 22} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +func EventForm(username string, data EventFormData, errMsg string) templ.Component { + 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) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var27 := templ.GetChildren(ctx) + if templ_7745c5c3_Var27 == nil { + templ_7745c5c3_Var27 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var28 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "← ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var30 string + templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(data.Cal) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/templates/calendar.templ`, Line: 139, Col: 118} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if data.ID == "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "New event") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "Edit event") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if errMsg != "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var31 string + templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(errMsg) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/templates/calendar.templ`, Line: 148, Col: 98} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var35 = []any{templ.KV("hidden", data.AllDay)} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var35...) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var39 = []any{templ.KV("hidden", data.AllDay)} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var39...) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if data.ID != "" { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) + templ_7745c5c3_Err = Layout("Calendar", username).Render(templ.WithChildren(ctx, templ_7745c5c3_Var28), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return nil + }) +} + +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"} +} + +var _ = templruntime.GeneratedTemplate diff --git a/internal/web/templates/layout.templ b/internal/web/templates/layout.templ index 93b3e3e..97f5dce 100644 --- a/internal/web/templates/layout.templ +++ b/internal/web/templates/layout.templ @@ -18,6 +18,7 @@ templ Layout(title string, username string) { if username != "" { Files Contacts + Calendar } if username != "" { diff --git a/internal/web/templates/layout_templ.go b/internal/web/templates/layout_templ.go index 0546f8d..a09b485 100644 --- a/internal/web/templates/layout_templ.go +++ b/internal/web/templates/layout_templ.go @@ -47,7 +47,7 @@ func Layout(title string, username string) templ.Component { return templ_7745c5c3_Err } if username != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "Files Contacts") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "Files Contacts Calendar") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -64,7 +64,7 @@ func Layout(title string, username string) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(username) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/templates/layout.templ`, Line: 25, Col: 23} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/templates/layout.templ`, Line: 26, Col: 23} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { diff --git a/web/static/app.css b/web/static/app.css index f2f753f..beea29a 100644 --- a/web/static/app.css +++ b/web/static/app.css @@ -1,2 +1,2 @@ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */ -@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-200:oklch(88.5% .062 18.334);--color-red-600:oklch(57.7% .245 27.325);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-900:oklch(21% .034 264.665);--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-xl:36rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-wide:.025em;--radius-md:.375rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.relative{position:relative}.static{position:static}.col-span-2{grid-column:span 2/span 2}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-10{margin-top:calc(var(--spacing) * 10)}.mr-3{margin-right:calc(var(--spacing) * 3)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.ml-2{margin-left:calc(var(--spacing) * 2)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-full{height:100%}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-10{width:calc(var(--spacing) * 10)}.w-12{width:calc(var(--spacing) * 12)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-36{width:calc(var(--spacing) * 36)}.w-auto{width:auto}.w-full{width:100%}.max-w-4xl{max-width:var(--container-4xl)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.table-fixed{table-layout:fixed}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:var(--spacing)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-gray-100>:not(:last-child)){border-color:var(--color-gray-100)}:where(.divide-gray-200>:not(:last-child)){border-color:var(--color-gray-200)}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-gray-50{border-color:var(--color-gray-50)}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-indigo-400{border-color:var(--color-indigo-400)}.border-red-200{border-color:var(--color-red-200)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-indigo-50{background-color:var(--color-indigo-50)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-red-50{background-color:var(--color-red-50)}.bg-white{background-color:var(--color-white)}.object-cover{object-fit:cover}.p-0{padding:0}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-900{color:var(--color-gray-900)}.text-indigo-600{color:var(--color-indigo-600)}.text-red-600{color:var(--color-red-600)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}.hover\:text-indigo-600:hover{color:var(--color-indigo-600)}.hover\:underline:hover{text-decoration-line:underline}}.focus\:border-indigo-500:focus{border-color:var(--color-indigo-500)}.focus\:ring-indigo-500:focus{--tw-ring-color:var(--color-indigo-500)}@media (min-width:40rem){.sm\:w-auto{width:auto}.sm\:flex-row{flex-direction:row}.sm\:items-end{align-items:flex-end}}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000} \ No newline at end of file +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-200:oklch(88.5% .062 18.334);--color-red-600:oklch(57.7% .245 27.325);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-900:oklch(21% .034 264.665);--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-xl:36rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-wide:.025em;--radius-md:.375rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.relative{position:relative}.static{position:static}.col-span-2{grid-column:span 2/span 2}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-10{margin-top:calc(var(--spacing) * 10)}.mr-3{margin-right:calc(var(--spacing) * 3)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.ml-2{margin-left:calc(var(--spacing) * 2)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.h-3{height:calc(var(--spacing) * 3)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-full{height:100%}.min-h-\[6rem\]{min-height:6rem}.w-3{width:calc(var(--spacing) * 3)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-10{width:calc(var(--spacing) * 10)}.w-12{width:calc(var(--spacing) * 12)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-36{width:calc(var(--spacing) * 36)}.w-auto{width:auto}.w-full{width:100%}.max-w-4xl{max-width:var(--container-4xl)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.table-fixed{table-layout:fixed}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:var(--spacing)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-px{gap:1px}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-gray-100>:not(:last-child)){border-color:var(--color-gray-100)}:where(.divide-gray-200>:not(:last-child)){border-color:var(--color-gray-200)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-gray-50{border-color:var(--color-gray-50)}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-indigo-400{border-color:var(--color-indigo-400)}.border-red-200{border-color:var(--color-red-200)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-indigo-50{background-color:var(--color-indigo-50)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-red-50{background-color:var(--color-red-50)}.bg-white{background-color:var(--color-white)}.object-cover{object-fit:cover}.p-0{padding:0}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.pt-2{padding-top:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-900{color:var(--color-gray-900)}.text-indigo-600{color:var(--color-indigo-600)}.text-indigo-700{color:var(--color-indigo-700)}.text-red-600{color:var(--color-red-600)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-indigo-100:hover{background-color:var(--color-indigo-100)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}.hover\:text-indigo-600:hover{color:var(--color-indigo-600)}.hover\:underline:hover{text-decoration-line:underline}}.focus\:border-indigo-500:focus{border-color:var(--color-indigo-500)}.focus\:ring-indigo-500:focus{--tw-ring-color:var(--color-indigo-500)}@media (min-width:40rem){.sm\:w-auto{width:auto}.sm\:flex-row{flex-direction:row}.sm\:items-end{align-items:flex-end}}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000} \ No newline at end of file diff --git a/web/static/calendar.js b/web/static/calendar.js new file mode 100644 index 0000000..a74f341 --- /dev/null +++ b/web/static/calendar.js @@ -0,0 +1,12 @@ +"use strict"; +// Event form behavior: hide/show the start/end time fields depending on +// whether the "All-day event" checkbox is checked. +(function initEventForm() { + const allDay = document.getElementById("all-day"); + const startTimeField = document.getElementById("start-time-field"); + const endTimeField = document.getElementById("end-time-field"); + allDay?.addEventListener("change", () => { + startTimeField?.classList.toggle("hidden", allDay.checked); + endTimeField?.classList.toggle("hidden", allDay.checked); + }); +})(); diff --git a/web/ts/calendar.ts b/web/ts/calendar.ts new file mode 100644 index 0000000..4055e1c --- /dev/null +++ b/web/ts/calendar.ts @@ -0,0 +1,12 @@ +// Event form behavior: hide/show the start/end time fields depending on +// whether the "All-day event" checkbox is checked. +(function initEventForm(): void { + const allDay = document.getElementById("all-day") as HTMLInputElement | null; + const startTimeField = document.getElementById("start-time-field"); + const endTimeField = document.getElementById("end-time-field"); + + allDay?.addEventListener("change", () => { + startTimeField?.classList.toggle("hidden", allDay.checked); + endTimeField?.classList.toggle("hidden", allDay.checked); + }); +})();