@vermeulen.solutions/eventual 0.18.6 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  <p align="center">
8
8
  <a href="https://github.com/Vermeulen-Solutions/eventual-rsvp-core/actions/workflows/ci.yml"><img src="https://github.com/Vermeulen-Solutions/eventual-rsvp-core/actions/workflows/ci.yml/badge.svg" alt="CI Status" /></a>
9
9
  <a href="https://www.npmjs.com/package/@vermeulen.solutions/eventual"><img src="https://img.shields.io/npm/v/%40vermeulen.solutions%2Feventual?color=176b57&label=npm%20helpers" alt="Latest npm version of the helpers" /></a>
10
- <a href="https://plugins.emdashcms.com/plugins/@vermeulen.solutions/eventual"><img src="https://img.shields.io/badge/EmDash_Registry-0.18.6-0b4d3d" alt="EmDash Plugin Registry" /></a>
10
+ <a href="https://plugins.emdashcms.com/plugins/@vermeulen.solutions/eventual"><img src="https://img.shields.io/badge/EmDash_Registry-0.19.0-0b4d3d" alt="EmDash Plugin Registry" /></a>
11
11
  <a href="https://emdashcms.com"><img src="https://img.shields.io/badge/EmDash-1.2%20to%201.6-0b4d3d" alt="EmDash Compatibility" /></a>
12
12
  <a href="./LICENSE"><img src="https://img.shields.io/badge/License-MIT-d89521" alt="License: MIT" /></a>
13
13
  <img src="https://img.shields.io/badge/TypeScript-strict-3178c6" alt="TypeScript Strict" />
@@ -18,7 +18,7 @@
18
18
 
19
19
  Plan and publish events in [EmDash CMS](https://emdashcms.com). Write announcements, choose venues and organizers, set repeat schedules, and share events through your website and calendar subscriptions.
20
20
 
21
- **Current release: 0.18.6**, the same version on the EmDash Registry and on npm. Events are edited in EmDash's own collections, with rich text, images, drafts and translations. Your site builder connects the feeds to visitor pages; the screenshots below show the optional Astro showcase.
21
+ **Current release: 0.19.0**, the same version on the EmDash Registry and on npm. Events are edited in EmDash's own collections, with rich text, images, drafts and translations. Your site builder adds the visitor pages from the package; the screenshots below show them.
22
22
 
23
23
  In 0.14.x, old events stored inside the plugin are shown only when an administrator explicitly enables **Show old events saved inside the plugin**. Native collections remain authoritative. See [what changed](./docs/release-notes-0.14.0.md).
24
24
 
@@ -49,19 +49,19 @@ Requires **EmDash >=1.2.0 <2.0.0**; tested on 1.2.0, 1.4.0, 1.5.0 and 1.6.0. **1
49
49
  ## Visual Tour
50
50
 
51
51
  ### 1. Website Calendar
52
- Render public events on your site using the included Astro showcase with seven responsive layouts, month navigation, and category filtering—with zero client-side JavaScript.
52
+ Show events on your site with two ready-made Astro pages from the package: an events page with seven views (list, timeline, cards, schedule, date strip, month and locations), month navigation and a category filter, and an event page with calendar buttons. They come in 21 languages, in light and dark, and without client-side JavaScript; see [Event pages](./docs/developer-guide.md#event-pages).
53
53
 
54
54
  <p align="center">
55
- <img src="./images/registry-0.11.0/05-public-events.jpg" alt="Public Event Browser" width="90%" />
55
+ <img src="./images/registry-0.19.0/event-pages-list.png" alt="The events page in the list view" width="90%" />
56
56
  </p>
57
57
 
58
58
  ---
59
59
 
60
60
  ### 2. Event Details & One-Click Calendar Sync
61
- Visitors can view full event details, join virtual meetings, get venue directions, and add events to Google Calendar, Outlook, Yahoo, or Apple Calendar.
61
+ Visitors can view full event details, join virtual meetings, get venue directions, and add events to Google Calendar, Outlook, Office 365 or any calendar app (iCal file).
62
62
 
63
63
  <p align="center">
64
- <img src="./images/registry-0.13.4/public-event-detail-fr-desktop.png" alt="Public event detail view" width="90%" />
64
+ <img src="./images/registry-0.19.0/event-page-detail.png" alt="An event page with date, place and calendar buttons" width="90%" />
65
65
  </p>
66
66
 
67
67
  ---
@@ -108,7 +108,7 @@ npm install @vermeulen.solutions/eventual
108
108
 
109
109
  Keep its version the same as the Registry backend. **Do not run `npm install eventual`:** the unscoped name is an unrelated package by another author.
110
110
 
111
- Use the **installed plugin ID** in API URLs and MCP tool names. A config-managed site uses `eventual`; a Registry install gets a generated ID that starts with `r_`. The **Subscribe** links on the Eventual RSVP admin page show it. Pass it as `pluginId` to `fetchPublicFeed`, and as `EVENTUAL_PLUGIN_ID` to the showcase. Install the backend one way only, from the Registry or from the config: the [developer guide](./docs/developer-guide.md#installation-and-plugin-id) explains what goes wrong otherwise, and [what to do before moving a site to the Registry](./docs/developer-guide.md#moving-a-site-from-the-config-to-the-registry).
111
+ Use the **installed plugin ID** in API URLs and MCP tool names. A config-managed site uses `eventual`; a Registry install gets a generated ID that starts with `r_`. The **Subscribe** links on the Eventual RSVP admin page show it. Pass it as `pluginId` to `fetchPublicFeed`, and to the event page loaders. Install the backend one way only, from the Registry or from the config: the [developer guide](./docs/developer-guide.md#installation-and-plugin-id) explains what goes wrong otherwise, and [what to do before moving a site to the Registry](./docs/developer-guide.md#moving-a-site-from-the-config-to-the-registry).
112
112
 
113
113
  The [developer guide](./docs/developer-guide.md) covers public JSON/ICS/image routes, SSR dispatch, tool names, settings, transfer formats, permissions and sandbox limits. It also explains installing the matching npm helpers. Eventual RSVP's MCP tools inspect native data; native edits and publication use EmDash's core tools.
114
114
 
@@ -124,7 +124,7 @@ npm run bundle
124
124
  npm run budget
125
125
  ```
126
126
 
127
- The backend shares EmDash's fixed sandbox RPC budget. Large feeds and migrations need host-specific verification; optional public URL lookups can be disabled when your site constructs its own links. [Details and checks](./docs/developer-guide.md#limits-and-checks).
127
+ The backend shares EmDash's sandbox call budget: the public feeds use up to 30 calls per request, everything else 10. Large feeds and migrations need host-specific verification; optional public URL lookups can be disabled when your site constructs its own links. [Details and checks](./docs/developer-guide.md#limits-and-checks).
128
128
 
129
129
  ---
130
130
 
@@ -134,8 +134,8 @@ The backend shares EmDash's fixed sandbox RPC budget. Large feeds and migrations
134
134
  - [Install and connect](./docs/collection-setup.md) — administrators and schema setup.
135
135
  - [Upgrade and migrate](./docs/upgrade-0.13.0.md) — existing sites and old plugin data.
136
136
  - [Developer guide](./docs/developer-guide.md) — integration and API reference.
137
- - [Changelog](./CHANGELOG.md) · [0.18.6 release notes](./docs/release-notes-0.18.6.md) · [0.18.5 release notes](./docs/release-notes-0.18.5.md) · [0.15.0 cache integration](./docs/release-notes-0.15.0.md) · [0.14.0 native collections](./docs/release-notes-0.14.0.md).
138
- - [Astro showcase](./examples/astro-events/README.md) — optional visitor pages.
137
+ - [Changelog](./CHANGELOG.md) · [0.19.0 release notes](./docs/release-notes-0.19.0.md) · [0.18.7 release notes](./docs/release-notes-0.18.7.md) · [0.18.6 release notes](./docs/release-notes-0.18.6.md) · [0.18.5 release notes](./docs/release-notes-0.18.5.md) · [0.15.0 cache integration](./docs/release-notes-0.15.0.md) · [0.14.0 native collections](./docs/release-notes-0.14.0.md).
138
+ - [Astro example site](./examples/astro-events/README.md) — the event pages in a small site.
139
139
  - [Release evidence and older records](./docs/history.md).
140
140
 
141
141
  ---
@@ -27,6 +27,8 @@ const uiLocale = locale ?? 'en';
27
27
  await loadEditorCatalog(uiLocale);
28
28
  const t = (text: string) => editorText(text, uiLocale);
29
29
 
30
+ // Calendar links: the group's name includes the event title, and each link's name is its visible
31
+ // text (no aria-label), so speech input and screen readers agree with what is on screen.
30
32
  function eventUrl(event: PublicEvent): string {
31
33
  return eventPageUrl(event, basePath);
32
34
  }
@@ -40,14 +42,15 @@ function eventUrl(event: PublicEvent): string {
40
42
  return (
41
43
  <li class="eventual-item">
42
44
  <a href={eventUrl(event)} class="eventual-title">{event.title}</a>
45
+ {(event.status === 'cancelled' || event.status === 'rescheduled') && <strong class={`eventual-status eventual-status-${event.status}`}>{t(event.status === 'cancelled' ? 'Cancelled' : 'Rescheduled')}</strong>}
43
46
  <time datetime={event.start} class="eventual-time">{displayEventDate(event, locale ?? event.locale ?? 'en-GB')}</time>
44
47
  {(event.venue?.name || event.location) && <span class="eventual-location">{event.venue?.name || event.location}</span>}
45
48
  {links && (
46
- <div class="eventual-calendar-links" role="group" aria-label={t('Add to calendar')}>
47
- <a href={links.google} target="_blank" rel="noopener noreferrer" aria-label={t('Add to Google Calendar')} class="eventual-cal-btn eventual-cal-google">Google</a>
48
- <a href={links.outlook} target="_blank" rel="noopener noreferrer" aria-label={t('Add to Outlook Calendar')} class="eventual-cal-btn eventual-cal-outlook">Outlook</a>
49
- <a href={links.office365} target="_blank" rel="noopener noreferrer" aria-label={t('Add to Office 365')} class="eventual-cal-btn eventual-cal-office">Office 365</a>
50
- <a href={links.ics} download aria-label={t('Download iCal file')} class="eventual-cal-btn eventual-cal-ics">.ics</a>
49
+ <div class="eventual-calendar-links" role="group" aria-label={`${t('Add to calendar')}: ${event.title}`}>
50
+ <a href={links.google} target="_blank" rel="noopener noreferrer" class="eventual-cal-btn eventual-cal-google">Google</a>
51
+ <a href={links.outlook} target="_blank" rel="noopener noreferrer" class="eventual-cal-btn eventual-cal-outlook">Outlook</a>
52
+ <a href={links.office365} target="_blank" rel="noopener noreferrer" class="eventual-cal-btn eventual-cal-office">Office 365</a>
53
+ <a href={links.ics} download class="eventual-cal-btn eventual-cal-ics">{t('Download iCal file')}</a>
51
54
  </div>
52
55
  )}
53
56
  </li>
@@ -55,3 +58,119 @@ function eventUrl(event: PublicEvent): string {
55
58
  })}
56
59
  </ul>
57
60
  )}
61
+
62
+ <!-- Light default styles. Global, because every class carries the `eventual-` prefix and sites style
63
+ the list from their own CSS. -->
64
+ <style is:global>
65
+ /* In the `eventual` cascade layer: unlayered site CSS always wins, and sites that use layers can
66
+ place `eventual` below their own components layer. */
67
+ @layer eventual {
68
+ /* Neutrals derive from the text colour around the list, so they suit any light or dark
69
+ background. Accent and status colours follow the page's color-scheme (light-dark()), so set
70
+ `color-scheme: dark` (or `light dark`) where the list sits on a dark surface. Override any
71
+ of the --eventual-list-* properties on the list or an ancestor. */
72
+ .eventual-list {
73
+ --_accent: var(--eventual-list-accent, light-dark(#075985, #7dd3fc));
74
+ --_muted: var(--eventual-list-muted, color-mix(in oklch, currentColor 72%, transparent));
75
+ --_border: var(--eventual-list-border, color-mix(in oklch, currentColor 18%, transparent));
76
+ --_radius: var(--eventual-list-radius, 999px);
77
+ --_cancelled: var(--eventual-list-cancelled, light-dark(#991b1b, #fca5a5));
78
+ --_rescheduled: var(--eventual-list-rescheduled, light-dark(#92400e, #fcd34d));
79
+ list-style: none;
80
+ margin: 0;
81
+ padding: 0;
82
+ }
83
+
84
+ .eventual-item {
85
+ display: grid;
86
+ grid-template-columns: minmax(0, auto) 1fr;
87
+ align-items: baseline;
88
+ gap: 0.25rem 0.625rem;
89
+ padding-block: 0.875rem;
90
+ border-block-start: 1px solid var(--_border);
91
+ }
92
+
93
+ .eventual-item:first-child {
94
+ border-block-start: 0;
95
+ padding-block-start: 0;
96
+ }
97
+
98
+ .eventual-title {
99
+ grid-column: 1;
100
+ font-weight: 600;
101
+ font-size: 1.0625em;
102
+ line-height: 1.35;
103
+ color: var(--_accent);
104
+ text-decoration-line: underline;
105
+ text-decoration-thickness: from-font;
106
+ text-underline-offset: 0.18em;
107
+ overflow-wrap: anywhere;
108
+ }
109
+
110
+ .eventual-title:hover {
111
+ text-decoration-thickness: 2px;
112
+ }
113
+
114
+ .eventual-status {
115
+ grid-column: 2;
116
+ justify-self: start;
117
+ padding: 0.0625rem 0.5rem;
118
+ border: 1px solid currentColor;
119
+ border-radius: var(--_radius);
120
+ font-size: 0.8125em;
121
+ font-weight: 600;
122
+ line-height: 1.5;
123
+ }
124
+
125
+ .eventual-status-cancelled {
126
+ color: var(--_cancelled);
127
+ }
128
+
129
+ .eventual-status-rescheduled {
130
+ color: var(--_rescheduled);
131
+ }
132
+
133
+ .eventual-time,
134
+ .eventual-location,
135
+ .eventual-calendar-links {
136
+ grid-column: 1 / -1;
137
+ }
138
+
139
+ .eventual-time,
140
+ .eventual-location {
141
+ color: var(--_muted);
142
+ font-size: 0.9375em;
143
+ }
144
+
145
+ .eventual-calendar-links {
146
+ display: flex;
147
+ flex-wrap: wrap;
148
+ gap: 0.375rem;
149
+ margin-block-start: 0.375rem;
150
+ }
151
+
152
+ .eventual-cal-btn {
153
+ display: inline-flex;
154
+ align-items: center;
155
+ min-block-size: 1.75rem;
156
+ padding: 0.125rem 0.75rem;
157
+ border: 1px solid var(--_border);
158
+ border-radius: var(--_radius);
159
+ color: var(--_accent);
160
+ font-size: 0.875em;
161
+ line-height: 1.3;
162
+ text-decoration: none;
163
+ }
164
+
165
+ .eventual-cal-btn:hover {
166
+ border-color: var(--_accent);
167
+ background: color-mix(in oklch, var(--_accent) 10%, transparent);
168
+ }
169
+
170
+ .eventual-title:focus-visible,
171
+ .eventual-cal-btn:focus-visible {
172
+ outline: 2px solid var(--_accent);
173
+ outline-offset: 2px;
174
+ }
175
+ }
176
+ </style>
@@ -33,6 +33,8 @@ export interface SchemaBlueprintOptions {
33
33
  bindRelations?: boolean;
34
34
  /** Opt in only when importing private-storage records from older prototypes. */
35
35
  legacyCompatibility?: boolean;
36
+ /** Time zone new events start in (IANA name). Default Europe/Zurich, for existing callers. */
37
+ defaultTimezone?: string;
36
38
  }
37
39
  export declare function createEventsCollectionBlueprint(options?: SchemaBlueprintOptions): CollectionBlueprint;
38
40
  export declare function createVenuesCollectionBlueprint(options?: SchemaBlueprintOptions): CollectionBlueprint;
@@ -77,7 +77,7 @@ export function createEventsCollectionBlueprint(options = {}) {
77
77
  field("start_date", "string"),
78
78
  field("end_date", "string"),
79
79
  field("all_day", "boolean", false, { defaultValue: false }),
80
- field("timezone", "string", false, { defaultValue: "Europe/Zurich" }),
80
+ field("timezone", "string", false, { defaultValue: options.defaultTimezone ?? "Europe/Zurich" }),
81
81
  field("location_type", "select", false, {
82
82
  widget: "eventual-editor:location-type",
83
83
  defaultValue: "physical",
@@ -0,0 +1,261 @@
1
+ ---
2
+ /**
3
+ * The events page body: view switch, month navigation, category filter and one of seven views.
4
+ * Render it inside your own layout with data from `loadEventBrowser` (which also gives the HTTP
5
+ * status and the page title). Styles: ./parts/Styles.astro, in the `eventual` cascade layer.
6
+ */
7
+ import type { EventBrowserData } from "./index";
8
+ import { eventHref } from "./index";
9
+ import { eventTimeParts } from "./grid";
10
+ import AgendaItem from "./parts/AgendaItem.astro";
11
+ import DateTile from "./parts/DateTile.astro";
12
+ import EventCard from "./parts/EventCard.astro";
13
+ import Icon from "./parts/Icon.astro";
14
+ import StatusBadge from "./parts/StatusBadge.astro";
15
+ import Styles from "./parts/Styles.astro";
16
+
17
+ interface Props {
18
+ data: EventBrowserData;
19
+ /** Level of the page heading (1 on an events page, 2 inside another page). */
20
+ headingLevel?: 1 | 2;
21
+ /** Page heading; default "Events in <month>". */
22
+ title?: string;
23
+ /** Text under the heading; false for none. */
24
+ intro?: string | false;
25
+ /** ID of the root element (a target for skip links). */
26
+ id?: string;
27
+ /** Colour scheme of this block; default: the page's. */
28
+ scheme?: "light" | "dark" | "light dark";
29
+ showFilter?: boolean;
30
+ showViewSwitch?: boolean;
31
+ class?: string;
32
+ }
33
+
34
+ const { data, headingLevel = 1, title, intro, id = "eventual-events", scheme, showFilter = true, showViewSwitch = true, class: className } = Astro.props;
35
+ const { text, state, locale } = data;
36
+ const H1 = `h${headingLevel}` as "h1";
37
+ const H2 = `h${headingLevel + 1}` as "h2";
38
+ const H3 = `h${headingLevel + 2}` as "h3";
39
+ const level3 = headingLevel + 2;
40
+ const fullDate = new Intl.DateTimeFormat(locale, { dateStyle: "full", timeZone: "UTC" });
41
+ const count = data.events.length;
42
+ const dots = (n: number) => Array.from({ length: Math.min(n, 3) });
43
+ const filterCategories = state.category && !data.categories.includes(state.category) ? [state.category, ...data.categories] : data.categories;
44
+ const viewHeading = state.view === "month" || state.view === "list" || state.view === "cards" || state.view === "dates"
45
+ ? text.month.events(data.monthTitle)
46
+ : `${text.views[state.view]}: ${data.monthTitle}`;
47
+ ---
48
+
49
+ <Styles />
50
+ <section id={id} class:list={["eventual-browser", className]} lang={data.lang} dir={data.dir} style={scheme ? `color-scheme: ${scheme}` : undefined} aria-labelledby={`${id}-title`}>
51
+ <header class="eventual-browser__header">
52
+ <H1 id={`${id}-title`} class="eventual-browser__title">{title ?? text.month.events(data.monthTitle)}</H1>
53
+ {intro !== false && <p class="eventual-browser__intro">{intro ?? text.intro}</p>}
54
+ </header>
55
+
56
+ <div class="eventual-controls">
57
+ {showViewSwitch && data.views.length > 1 && (
58
+ <nav class="eventual-views" aria-label={text.views.label}>
59
+ <ul>
60
+ {data.views.map((item) => <li><a href={item.href} aria-current={item.current ? "page" : undefined}><span>{item.label}</span></a></li>)}
61
+ </ul>
62
+ </nav>
63
+ )}
64
+ <div class="eventual-toolbar">
65
+ <nav class="eventual-months" aria-label={text.month.navigation}>
66
+ <span class="eventual-months__step">
67
+ <a class="eventual-button eventual-button--icon" href={data.previous.href}><Icon name="chevron-left" /><span class="eventual-sr-only">{data.previous.label}</span></a>
68
+ <a class="eventual-button eventual-button--icon" href={data.next.href}><Icon name="chevron-right" /><span class="eventual-sr-only">{data.next.label}</span></a>
69
+ </span>
70
+ <a class="eventual-button" href={data.current.href} aria-current={data.current.isCurrent ? "date" : undefined}>{data.current.label}</a>
71
+ </nav>
72
+ {showFilter && (
73
+ <form method="get" class="eventual-filter">
74
+ <input type="hidden" name="month" value={state.month} />
75
+ <input type="hidden" name="view" value={state.view} />
76
+ <label for={`${id}-category`}>{text.filter.label}</label>
77
+ <span class="eventual-select">
78
+ <select id={`${id}-category`} name="category">
79
+ <option value="">{text.filter.all}</option>
80
+ {filterCategories.map((category) => <option value={category} selected={category === state.category}>{category}</option>)}
81
+ </select>
82
+ <Icon name="chevron-down" />
83
+ </span>
84
+ <button type="submit" class="eventual-button">{text.filter.apply}</button>
85
+ </form>
86
+ )}
87
+ </div>
88
+ <p class="eventual-summary">
89
+ <span>{text.count(count)}</span>
90
+ {state.category && <><span aria-hidden="true">·</span><span>{text.filter.active(state.category)}</span><a href={data.clearHref}>{text.filter.clear}</a></>}
91
+ </p>
92
+ </div>
93
+
94
+ {data.status === 502 ? (
95
+ <div class="eventual-notice eventual-notice--error" role="alert">
96
+ <H2>{text.notice.unavailable}</H2>
97
+ <p>{text.notice.unavailableDetail}</p>
98
+ <p><a class="eventual-button" href={data.views.find((item) => item.current)?.href ?? "?"}>{text.notice.tryAgain}</a></p>
99
+ </div>
100
+ ) : count === 0 ? (
101
+ <div class="eventual-notice">
102
+ <Icon name="calendar" class="eventual-notice__icon" />
103
+ <H2>{state.category ? text.notice.emptyFiltered : text.notice.empty}</H2>
104
+ {state.category && <p><a href={data.clearHref}>{text.filter.clear}</a></p>}
105
+ </div>
106
+ ) : (
107
+ <section class={`eventual-view eventual-view--${state.view}`} aria-labelledby={`${id}-view`}>
108
+ <H2 id={`${id}-view`} class="eventual-sr-only">{viewHeading}</H2>
109
+
110
+ {state.view === "list" && (
111
+ <ul class="eventual-stack">
112
+ {data.events.map((event) => <li><AgendaItem event={event} data={data} level={level3} /></li>)}
113
+ </ul>
114
+ )}
115
+
116
+ {state.view === "timeline" && (
117
+ <ol class="eventual-timeline">
118
+ {data.dateGroups.map((group) => (
119
+ <li class="eventual-timeline__day">
120
+ <H3 class="eventual-timeline__date"><DateTile date={group.date} locale={locale} labelled={false} /><span class="eventual-sr-only">{group.label}</span></H3>
121
+ <span class="eventual-timeline__dot" aria-hidden="true"></span>
122
+ <ul class="eventual-stack eventual-timeline__events">
123
+ {group.events.map((event) => <li><EventCard event={event} data={data} level={level3 + 1} variant="timeline" /></li>)}
124
+ </ul>
125
+ </li>
126
+ ))}
127
+ </ol>
128
+ )}
129
+
130
+ {state.view === "cards" && (
131
+ <ul class="eventual-grid">
132
+ {data.events.map((event) => <li><EventCard event={event} data={data} level={level3} /></li>)}
133
+ </ul>
134
+ )}
135
+
136
+ {state.view === "schedule" && (
137
+ <ul class="eventual-stack">
138
+ {data.dateGroups.map((group, index) => (
139
+ <li>
140
+ <details class="eventual-day" open={index === 0}>
141
+ <summary>
142
+ <DateTile date={group.date} locale={locale} layout="short" labelled={false} />
143
+ <span class="eventual-day__text">
144
+ <span class="eventual-day__label">{group.label}</span>
145
+ <span class="eventual-day__count">{text.count(group.events.length)}</span>
146
+ </span>
147
+ <Icon name="chevron-down" class="eventual-day__chevron" />
148
+ </summary>
149
+ <ul class="eventual-rows">
150
+ {group.events.map((event) => <li><AgendaItem event={event} data={data} level={level3} showDate={false} compact /></li>)}
151
+ </ul>
152
+ </details>
153
+ </li>
154
+ ))}
155
+ </ul>
156
+ )}
157
+
158
+ {state.view === "dates" && (
159
+ <>
160
+ <nav class="eventual-datestrip" aria-label={text.dates.jump}>
161
+ <ul>
162
+ {data.dateGroups.map((group) => (
163
+ <li>
164
+ <a href={`#${group.id}`}>
165
+ <span class="eventual-datestrip__weekday" aria-hidden="true">{group.weekday}</span>
166
+ <span class="eventual-datestrip__day" aria-hidden="true">{group.day}</span>
167
+ <span class="eventual-datestrip__dots" aria-hidden="true">{dots(group.events.length).map(() => <i></i>)}</span>
168
+ <span class="eventual-sr-only">{group.label}</span>
169
+ </a>
170
+ </li>
171
+ ))}
172
+ </ul>
173
+ </nav>
174
+ {data.dateGroups.map((group) => (
175
+ <section class="eventual-group" id={group.id} tabindex="-1" aria-labelledby={`${group.id}-title`}>
176
+ <header class="eventual-group__header">
177
+ <DateTile date={group.date} locale={locale} layout="short" labelled={false} />
178
+ <H3 id={`${group.id}-title`} class="eventual-group__title">{group.label}</H3>
179
+ <span class="eventual-group__count">{text.count(group.events.length)}</span>
180
+ </header>
181
+ <ul class="eventual-rows">
182
+ {group.events.map((event) => <li><AgendaItem event={event} data={data} level={level3 + 1} showDate={false} compact /></li>)}
183
+ </ul>
184
+ </section>
185
+ ))}
186
+ </>
187
+ )}
188
+
189
+ {state.view === "locations" && data.locationGroups.map((group, index) => (
190
+ <section class="eventual-group eventual-group--place" aria-labelledby={`${id}-place-${index}`}>
191
+ <header class="eventual-group__header">
192
+ <span class="eventual-group__icon"><Icon name="pin" /></span>
193
+ <H3 id={`${id}-place-${index}`} class="eventual-group__title">{group.location}</H3>
194
+ {group.directionsUrl
195
+ ? <a class="eventual-group__link" href={group.directionsUrl} target="_blank" rel="noopener noreferrer">{text.event.directions}<Icon name="external" /><span class="eventual-sr-only"> {text.newTab}</span></a>
196
+ : <span class="eventual-group__count">{text.count(group.events.length)}</span>}
197
+ </header>
198
+ <ul class="eventual-rows">
199
+ {group.events.map((event) => <li><AgendaItem event={event} data={data} level={level3 + 1} compact showPlace={false} /></li>)}
200
+ </ul>
201
+ </section>
202
+ ))}
203
+
204
+ {state.view === "month" && (
205
+ <>
206
+ <div class="eventual-month-frame">
207
+ <table class="eventual-month">
208
+ <caption class="eventual-sr-only">{viewHeading}</caption>
209
+ <thead>
210
+ <tr>{data.weekdays.short.map((day, index) => <th scope="col"><span aria-hidden="true">{day}</span><span class="eventual-sr-only">{data.weekdays.long[index]}</span></th>)}</tr>
211
+ </thead>
212
+ <tbody>
213
+ {data.weeks.map((week) => (
214
+ <tr>
215
+ {week.map((cell) => (
216
+ <td class:list={["eventual-month__day", !cell.inMonth && "eventual-month__day--outside", cell.date === data.today && "eventual-month__day--today"]}>
217
+ <time class="eventual-month__number" datetime={cell.date} aria-current={cell.date === data.today ? "date" : undefined}>
218
+ <span aria-hidden="true">{cell.dayNumber}</span><span class="eventual-sr-only">{fullDate.format(new Date(`${cell.date}T12:00:00Z`))}</span>
219
+ </time>
220
+ {cell.events.length > 0 && (
221
+ <ul class="eventual-month__events">
222
+ {cell.events.map((event) => (
223
+ <li class:list={[event.status === "cancelled" && "eventual-is-cancelled"]}>
224
+ <a href={eventHref(event, data)}>
225
+ <span class="eventual-month__time">{event.allDay ? text.event.allDay : eventTimeParts(event, locale)?.start}</span>
226
+ <span class="eventual-month__name">{event.title}</span>
227
+ </a>
228
+ <StatusBadge event={event} text={text} locale={locale} />
229
+ </li>
230
+ ))}
231
+ </ul>
232
+ )}
233
+ </td>
234
+ ))}
235
+ </tr>
236
+ ))}
237
+ </tbody>
238
+ </table>
239
+ </div>
240
+ <div class="eventual-month-list" data-narrow-month>
241
+ {data.dateGroups.map((group) => (
242
+ <section class="eventual-group" aria-labelledby={`${group.id}-m`}>
243
+ <header class="eventual-group__header">
244
+ <DateTile date={group.date} locale={locale} layout="short" labelled={false} />
245
+ <H3 id={`${group.id}-m`} class="eventual-group__title">{group.label}</H3>
246
+ </header>
247
+ <ul class="eventual-rows">
248
+ {group.events.map((event) => <li><AgendaItem event={event} data={data} level={level3 + 1} showDate={false} compact /></li>)}
249
+ </ul>
250
+ </section>
251
+ ))}
252
+ </div>
253
+ </>
254
+ )}
255
+ </section>
256
+ )}
257
+
258
+ {data.subscriptionUrl && (
259
+ <p class="eventual-subscribe"><Icon name="rss" /><a href={data.subscriptionUrl}>{text.calendar.subscribe}</a></p>
260
+ )}
261
+ </section>
@@ -0,0 +1,113 @@
1
+ ---
2
+ /**
3
+ * An event's page body. Render it inside your own layout with data from `loadEventDetail`
4
+ * (which also gives the HTTP status, the title and the description for the head). Anything
5
+ * passed as children (for example RsvpForm or TicketCheckout) appears after the description.
6
+ */
7
+ import type { EventDetailData } from "./index";
8
+ import Icon from "./parts/Icon.astro";
9
+ import StatusBadge from "./parts/StatusBadge.astro";
10
+ import Styles from "./parts/Styles.astro";
11
+
12
+ interface Props {
13
+ data: EventDetailData;
14
+ headingLevel?: 1 | 2;
15
+ /** Link back to the events page; false for none. */
16
+ backHref?: string | false;
17
+ showSubscribe?: boolean;
18
+ /** Structured data for search engines (Event JSON-LD). */
19
+ jsonLd?: boolean;
20
+ scheme?: "light" | "dark" | "light dark";
21
+ class?: string;
22
+ }
23
+
24
+ const { data, headingLevel = 1, backHref = data.backHref, showSubscribe = true, jsonLd = true, scheme, class: className } = Astro.props;
25
+ const { text, event, locale } = data;
26
+ const H1 = `h${headingLevel}` as "h1";
27
+ const H2 = `h${headingLevel + 1}` as "h2";
28
+ const links = data.calendarLinks;
29
+ const contentLang = event?.locale && event.locale.split("-")[0] !== data.lang.split("-")[0] ? event.locale : undefined;
30
+ const newTab = { target: "_blank", rel: "noopener noreferrer" };
31
+ ---
32
+
33
+ <Styles />
34
+ <article class:list={["eventual-detail", className, event?.status === "cancelled" && "eventual-is-cancelled"]} lang={data.lang} dir={data.dir} style={scheme ? `color-scheme: ${scheme}` : undefined}>
35
+ {backHref && <p class="eventual-detail__back"><a href={backHref}><Icon name="chevron-left" />{text.event.back}</a></p>}
36
+
37
+ {data.status === 502 ? (
38
+ <div class="eventual-notice eventual-notice--error" role="alert">
39
+ <H1>{text.notice.unavailable}</H1>
40
+ <p>{text.notice.unavailableDetail}</p>
41
+ </div>
42
+ ) : !event ? (
43
+ <div class="eventual-notice">
44
+ <Icon name="calendar" class="eventual-notice__icon" />
45
+ <H1>{text.event.details}</H1>
46
+ <p>{text.notice.notFound}</p>
47
+ </div>
48
+ ) : (
49
+ <>
50
+ <header class="eventual-detail__header" lang={contentLang}>
51
+ <StatusBadge event={event} text={text} locale={locale} />
52
+ <H1 class="eventual-detail__title">{event.title}</H1>
53
+ </header>
54
+
55
+ <div class="eventual-detail__layout">
56
+ <div class="eventual-detail__panel">
57
+ <ul class="eventual-facts">
58
+ <li>
59
+ <Icon name="calendar" />
60
+ <span><time class="eventual-facts__strong" datetime={event.start}>{data.dateText}</time>{data.timeText && <span class="eventual-facts__line">{data.timeText}</span>}</span>
61
+ </li>
62
+ {event.location && (
63
+ <li>
64
+ <Icon name="pin" />
65
+ <span>
66
+ <span class="eventual-facts__strong">{event.location}</span>
67
+ {data.directionsUrl && <a class="eventual-facts__line" href={data.directionsUrl} {...newTab}>{text.event.directions}<Icon name="external" /><span class="eventual-sr-only"> {text.newTab}</span></a>}
68
+ </span>
69
+ </li>
70
+ )}
71
+ {event.organizer && <li><Icon name="user" /><span>{text.event.organizer(event.organizer)}</span></li>}
72
+ {data.websiteUrl && <li><Icon name="globe" /><a href={data.websiteUrl} {...newTab}>{text.event.website}<Icon name="external" /><span class="eventual-sr-only"> {text.newTab}</span></a></li>}
73
+ </ul>
74
+
75
+ <ul class="eventual-detail__actions">
76
+ {links && (
77
+ <li>
78
+ <details class="eventual-calmenu">
79
+ <summary class="eventual-button eventual-button--primary"><Icon name="calendar-plus" />{text.calendar.add}<Icon name="chevron-down" class="eventual-calmenu__chevron" /></summary>
80
+ <ul class="eventual-calmenu__options" aria-label={text.calendar.addFor(event.title)}>
81
+ <li><a href={links.google} {...newTab}>{text.calendar.google}<span class="eventual-sr-only"> {text.newTab}</span></a></li>
82
+ <li><a href={links.outlook} {...newTab}>{text.calendar.outlook}<span class="eventual-sr-only"> {text.newTab}</span></a></li>
83
+ <li><a href={links.office365} {...newTab}>{text.calendar.office365}<span class="eventual-sr-only"> {text.newTab}</span></a></li>
84
+ <li><a href={links.ics} download>{text.calendar.ics}</a></li>
85
+ </ul>
86
+ </details>
87
+ </li>
88
+ )}
89
+ {data.onlineUrl && <li><a class="eventual-button" href={data.onlineUrl} {...newTab}>{text.event.joinOnline}<Icon name="external" /><span class="eventual-sr-only"> {text.newTab}</span></a></li>}
90
+ {showSubscribe && data.subscriptionUrl && <li><a class="eventual-button eventual-button--quiet" href={data.subscriptionUrl}><Icon name="rss" />{text.calendar.subscribe}</a></li>}
91
+ </ul>
92
+ </div>
93
+
94
+ <div class="eventual-detail__main">
95
+ {data.imageUrl && <img class="eventual-detail__image" src={data.imageUrl} alt={event.imageMedia?.alt ?? ""} width={event.imageMedia?.width} height={event.imageMedia?.height} decoding="async" />}
96
+
97
+ {data.descriptionHtml && <div class="eventual-detail__description" lang={contentLang} set:html={data.descriptionHtml} />}
98
+
99
+ {event.categories.length > 0 && (
100
+ <section class="eventual-detail__categories" aria-labelledby="eventual-detail-categories">
101
+ <H2 id="eventual-detail-categories" class="eventual-sr-only">{text.event.categories}</H2>
102
+ <ul class="eventual-tags">{event.categories.map((category) => <li><Icon name="tag" />{category}</li>)}</ul>
103
+ </section>
104
+ )}
105
+
106
+ <slot />
107
+ </div>
108
+ </div>
109
+
110
+ {jsonLd && data.jsonLd && <script type="application/ld+json" set:html={data.jsonLd} />}
111
+ </>
112
+ )}
113
+ </article>