package templates
// ShareRow is a single share grant shown in the UI, for either a calendar
// or an address book (Kind distinguishes them for form targets).
type ShareRow struct {
ResourceName string
SharedWith string
Permission string // "read" or "write"
}
// ResourceCard describes one of the user's own calendars/address books
// plus who it's currently shared with.
type ResourceCard struct {
Kind string // "calendar" or "addressbook"
Name string
Shares []ShareRow
}
// SharedWithMeItem describes a resource another user has shared with the
// current user.
type SharedWithMeItem struct {
Kind string
Owner string
Name string
Permission string
}
templ Dashboard(username string, resources []ResourceCard, sharedWithMe []SharedWithMeItem) {
@Layout("Dashboard", username) {
Your calendars & address books
@ResourceList(resources)
if len(sharedWithMe) > 0 {
}
}
}
// ResourceList renders the #resources container. It's re-rendered as a
// whole after a create/delete (which changes the set of cards), whereas a
// share update only swaps a single ResourceCardView.
templ ResourceList(resources []ResourceCard) {
for _, r := range resources {
@ResourceCardView(r)
}
if len(resources) == 0 {
You don't have any calendars or address books yet — add one above.