@aglyn/plugins-events-calendar 1.20.2 → 1.21.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/plugins-events-calendar",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/aglyn": "1.
|
|
29
|
-
"@aglyn/shared-data-mdi": "1.
|
|
30
|
-
"@aglyn/shared-ui-jsx": "1.
|
|
31
|
-
"@aglyn/shared-ui-snackstack": "1.
|
|
32
|
-
"@aglyn/shared-util-timestamp": "1.
|
|
33
|
-
"@aglyn/tenant-data-admin": "1.
|
|
34
|
-
"@aglyn/tenant-feature-instance": "1.
|
|
35
|
-
"@aglyn/tenant-runtime": "1.
|
|
28
|
+
"@aglyn/aglyn": "1.21.0",
|
|
29
|
+
"@aglyn/shared-data-mdi": "1.21.0",
|
|
30
|
+
"@aglyn/shared-ui-jsx": "1.21.0",
|
|
31
|
+
"@aglyn/shared-ui-snackstack": "1.21.0",
|
|
32
|
+
"@aglyn/shared-util-timestamp": "1.21.0",
|
|
33
|
+
"@aglyn/tenant-data-admin": "1.21.0",
|
|
34
|
+
"@aglyn/tenant-feature-instance": "1.21.0",
|
|
35
|
+
"@aglyn/tenant-runtime": "1.21.0",
|
|
36
36
|
"@swc/helpers": "0.5.23"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
import { type ConsolePluginPageProps } from '@aglyn/aglyn';
|
|
2
|
-
/**
|
|
3
|
-
* Events manager (AGL-145 → AGL-394): the Event Calendar add-on's console
|
|
4
|
-
* surface, now owned by the plugin so the console shell renders it through
|
|
5
|
-
* the ConsoleExtension registry rather than a hardcoded page. Events carry
|
|
6
|
-
* schedule/location/organizer/cover and a draft/published status; visitors
|
|
7
|
-
* see published events through the Event List canvas element.
|
|
8
|
-
*
|
|
9
|
-
* Reaching this component means the org holds `eventCalendar`. The shell
|
|
10
|
-
* resolves that entitlement and renders its own refusal instead of mounting
|
|
11
|
-
* anything an extension registered (AGL-2484), so there is no unentitled
|
|
12
|
-
* state to render here; the sentence a refused org reads is registered as
|
|
13
|
-
* this plugin's `upgradeNotice` in `plugin.ts`.
|
|
14
|
-
*/
|
|
15
2
|
export declare function EventsConsolePage(props: ConsolePluginPageProps): import("react").JSX.Element;
|
|
16
3
|
export declare namespace EventsConsolePage {
|
|
17
4
|
var displayName: string;
|
|
@@ -22,6 +22,8 @@ import { CardDisplay, useConfirmationContext } from "@aglyn/shared-ui-jsx";
|
|
|
22
22
|
import { useSnackbar } from "@aglyn/shared-ui-snackstack";
|
|
23
23
|
import { Timestamp } from "@aglyn/shared-util-timestamp";
|
|
24
24
|
import { ceilingedWindow, useFirestore, useFirestoreCollection, writeGuardedBySeed } from "@aglyn/tenant-feature-instance";
|
|
25
|
+
import { isSeedChecking, seedCheckingText } from "@aglyn/tenant-feature-instance/hooks/use-seed-edits";
|
|
26
|
+
import { useSeedDraft } from "@aglyn/tenant-feature-instance/hooks/use-seed-draft";
|
|
25
27
|
import { Alert, Button, Chip, Dialog, DialogActions, DialogContent, DialogTitle, Stack, TextField, Typography } from "@mui/material";
|
|
26
28
|
import { collection, deleteField, doc, limit, orderBy, query, setDoc, updateDoc } from "firebase/firestore";
|
|
27
29
|
import { useCallback, useMemo, useState } from "react";
|
|
@@ -111,7 +113,22 @@ import { EVENTS_TRANSFER_RESOURCE } from "../transfer/events-transfer-key.js";
|
|
|
111
113
|
* anything an extension registered (AGL-2484), so there is no unentitled
|
|
112
114
|
* state to render here; the sentence a refused org reads is registered as
|
|
113
115
|
* this plugin's `upgradeNotice` in `plugin.ts`.
|
|
114
|
-
*/
|
|
116
|
+
*/ /** A stored event as the editor holds it. */ function eventDraftOf(event) {
|
|
117
|
+
var _event_title, _event_location, _event_organizer, _event_description, _event_coverImage, _event_coverImageAlt;
|
|
118
|
+
return {
|
|
119
|
+
id: event.$id,
|
|
120
|
+
title: (_event_title = event.title) != null ? _event_title : '',
|
|
121
|
+
startsAt: toLocalInput(event.startsAtMs),
|
|
122
|
+
endsAt: toLocalInput(event.endsAtMs),
|
|
123
|
+
location: (_event_location = event.location) != null ? _event_location : '',
|
|
124
|
+
organizer: (_event_organizer = event.organizer) != null ? _event_organizer : '',
|
|
125
|
+
description: (_event_description = event.description) != null ? _event_description : '',
|
|
126
|
+
coverImage: (_event_coverImage = event.coverImage) != null ? _event_coverImage : '',
|
|
127
|
+
coverImageAlt: (_event_coverImageAlt = event.coverImageAlt) != null ? _event_coverImageAlt : '',
|
|
128
|
+
status: event.status === 'published' ? 'published' : 'draft'
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
export function EventsConsolePage(props) {
|
|
115
132
|
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7;
|
|
116
133
|
var _draft_coverImage;
|
|
117
134
|
const { hostId } = props;
|
|
@@ -143,7 +160,19 @@ import { EVENTS_TRANSFER_RESOURCE } from "../transfer/events-transfer-key.js";
|
|
|
143
160
|
page,
|
|
144
161
|
pageSize
|
|
145
162
|
]);
|
|
146
|
-
|
|
163
|
+
/*
|
|
164
|
+
* The editor's draft, kept as EDITS over the event as the list has it now
|
|
165
|
+
* (AGL-4047): opened from the cache's row, the server's copy replaces it
|
|
166
|
+
* under every field nobody touched (`status` among them), and Save is held
|
|
167
|
+
* until it has.
|
|
168
|
+
*/ const [draft, setDraft] = useSeedDraft((opened)=>{
|
|
169
|
+
const row = opened.id ? events.find((event)=>event.$id === opened.id) : undefined;
|
|
170
|
+
return row ? eventDraftOf(row) : undefined;
|
|
171
|
+
});
|
|
172
|
+
const draftChecking = Boolean(draft == null ? void 0 : draft.id) && isSeedChecking({
|
|
173
|
+
fromCache: eventsFromCache,
|
|
174
|
+
unreadable: eventsUnreadable
|
|
175
|
+
});
|
|
147
176
|
/*
|
|
148
177
|
* Import and Export open the console's wizard and dialog on this site's
|
|
149
178
|
* events. Outside the console shell there is no launcher, and no buttons.
|
|
@@ -257,6 +286,7 @@ import { EVENTS_TRANSFER_RESOURCE } from "../transfer/events-transfer-key.js";
|
|
|
257
286
|
});
|
|
258
287
|
}
|
|
259
288
|
}, [
|
|
289
|
+
setDraft,
|
|
260
290
|
draft,
|
|
261
291
|
firestore,
|
|
262
292
|
hostId,
|
|
@@ -342,21 +372,7 @@ import { EVENTS_TRANSFER_RESOURCE } from "../transfer/events-transfer-key.js";
|
|
|
342
372
|
}),
|
|
343
373
|
/*#__PURE__*/ _jsx(Button, {
|
|
344
374
|
size: "small",
|
|
345
|
-
onClick: ()=>
|
|
346
|
-
var _event_title, _event_location, _event_organizer, _event_description, _event_coverImage, _event_coverImageAlt;
|
|
347
|
-
return setDraft({
|
|
348
|
-
id: event.$id,
|
|
349
|
-
title: (_event_title = event.title) != null ? _event_title : '',
|
|
350
|
-
startsAt: toLocalInput(event.startsAtMs),
|
|
351
|
-
endsAt: toLocalInput(event.endsAtMs),
|
|
352
|
-
location: (_event_location = event.location) != null ? _event_location : '',
|
|
353
|
-
organizer: (_event_organizer = event.organizer) != null ? _event_organizer : '',
|
|
354
|
-
description: (_event_description = event.description) != null ? _event_description : '',
|
|
355
|
-
coverImage: (_event_coverImage = event.coverImage) != null ? _event_coverImage : '',
|
|
356
|
-
coverImageAlt: (_event_coverImageAlt = event.coverImageAlt) != null ? _event_coverImageAlt : '',
|
|
357
|
-
status: event.status === 'published' ? 'published' : 'draft'
|
|
358
|
-
});
|
|
359
|
-
},
|
|
375
|
+
onClick: ()=>setDraft(eventDraftOf(event)),
|
|
360
376
|
children: 'Edit'
|
|
361
377
|
}),
|
|
362
378
|
/*#__PURE__*/ _jsx(Button, {
|
|
@@ -547,7 +563,16 @@ import { EVENTS_TRANSFER_RESOURCE } from "../transfer/events-transfer-key.js";
|
|
|
547
563
|
/*#__PURE__*/ _jsxs(Stack, {
|
|
548
564
|
direction: "row",
|
|
549
565
|
spacing: 1,
|
|
566
|
+
sx: {
|
|
567
|
+
alignItems: 'center'
|
|
568
|
+
},
|
|
550
569
|
children: [
|
|
570
|
+
draftChecking ? /*#__PURE__*/ _jsx(Typography, {
|
|
571
|
+
variant: "body2",
|
|
572
|
+
color: "text.secondary",
|
|
573
|
+
role: "status",
|
|
574
|
+
children: seedCheckingText('event')
|
|
575
|
+
}) : null,
|
|
551
576
|
/*#__PURE__*/ _jsx(Button, {
|
|
552
577
|
onClick: ()=>setDraft(null),
|
|
553
578
|
children: 'Cancel'
|
|
@@ -555,7 +580,7 @@ import { EVENTS_TRANSFER_RESOURCE } from "../transfer/events-transfer-key.js";
|
|
|
555
580
|
/*#__PURE__*/ _jsx(Button, {
|
|
556
581
|
variant: "contained",
|
|
557
582
|
color: "primary",
|
|
558
|
-
disabled: !(draft == null ? void 0 : draft.title.trim()),
|
|
583
|
+
disabled: draftChecking || !(draft == null ? void 0 : draft.title.trim()),
|
|
559
584
|
onClick: handleSave,
|
|
560
585
|
children: 'Save event'
|
|
561
586
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/events-calendar/src/lib/components/events-console-page.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport { TransferResumeImport } from '@aglyn/aglyn/app-utils/transfer-resume-import'\nimport {\n createResourceUid,\n MEDIA_ALT_MAX_LENGTH,\n pluginDocsHelp,\n useTransferLauncher,\n} from '@aglyn/aglyn'\nimport { type ConsolePluginPageProps } from '@aglyn/aglyn'\nimport { CardDisplay, useConfirmationContext } from '@aglyn/shared-ui-jsx'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { Timestamp } from '@aglyn/shared-util-timestamp'\nimport {\n ceilingedWindow,\n useFirestore,\n useFirestoreCollection,\n writeGuardedBySeed,\n type ListenHandle,\n} from '@aglyn/tenant-feature-instance'\nimport {\n Alert,\n Button,\n Chip,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Stack,\n TextField,\n Typography,\n} from '@mui/material'\nimport {\n collection,\n deleteField,\n doc,\n limit,\n orderBy,\n query,\n setDoc,\n updateDoc,\n} from 'firebase/firestore'\nimport { useCallback, useMemo, useState } from 'react'\nimport { ListPagination } from '@aglyn/shared-ui-jsx/components/list-pagination.component'\nimport { TABLE_PAGE_SIZE_DEFAULT } from '@aglyn/shared-ui-jsx/const/table-pagination'\nimport { eventWrite } from '../model/event-write'\nimport { EVENTS_TRANSFER_RESOURCE } from '../transfer/events-transfer-key'\n\n/**\n * How many event documents this page reads.\n *\n * A CEILING, not a page size: the rows are filtered for soft deletes and\n * re-sorted after reading, so a server page would arrive holding anywhere\n * from zero to ten events and the count under it would be about candidates\n * rather than about events.\n */\nconst EVENT_CEILING = 200\n\ninterface EventDraft {\n id: string | null\n title: string\n startsAt: string\n endsAt: string\n location: string\n organizer: string\n description: string\n coverImage: string\n coverImageAlt: string\n status: 'draft' | 'published'\n}\n\ninterface EventRecord {\n $id: string\n title?: string\n startsAtMs?: number\n endsAtMs?: number\n location?: string\n organizer?: string\n description?: string\n coverImage?: string\n coverImageAlt?: string\n /** `deleted` is written by the delete, beside `deletedAt`. */\n status?: 'draft' | 'published' | 'deleted'\n deletedAt?: unknown\n}\n\n/**\n * A host's events.\n *\n * This was a hand-rolled `onSnapshot` with its own retry, and it carried a\n * FOURTH copy of the AGL-1066 defect: `attempt = 0` in the success handler.\n * Under `persistentLocalCache` the cached emission that precedes every\n * refusal handed the budget back, so `unreadable` — the whole point of the\n * counter — could not fire in the one state that needed it, a populated\n * editor over a read that had stopped working.\n *\n * Rather than repair a fourth counter, the copy is gone. `useFirestoreCollection`\n * is the same `onSnapshot`-plus-retry that absorbs the AGL-216/217\n * post-sign-in denial, and it carries the signals this page's save needs\n * (`fromCache`, and `serverDenied` for the refusal the budget cannot yet\n * express) plus denial reporting into `session-health` this page never had.\n * There was never a reason it could not: the file has imported from\n * `@aglyn/tenant-feature-instance` all along.\n */\nfunction useHostEvents(hostId: string): {\n events: EventRecord[]\n truncated: boolean\n fromCache: boolean\n /** The listener, so a save waits on that read alone (AGL-4135). */\n listen: ListenHandle\n unreadable: boolean\n} {\n const firestore = useFirestore()\n const { data, status, fromCache, listen } = useFirestoreCollection<EventRecord>(\n () =>\n hostId\n ? query(\n collection(firestore, 'hosts', hostId, 'events'),\n /*\n * ORDERED, so the window is the newest 200 rather than a sample.\n *\n * A `limit()` with no `orderBy` returns documents in ID order, so\n * this was reading an arbitrary 200 of the collection and then\n * sorting them by date in the browser — which looks newest-first\n * and is not: a site past 200 events would simply never see the\n * ones whose ids sorted late, including the next one happening.\n *\n * `orderBy` DROPS documents missing the field, so it is only safe\n * once every writer is known to set it, and every one does for\n * `startsAtMs`. The editor refuses a save without it (the guard\n * in `handleSave`); the events import writes through the same\n * rule (`model/event-write.ts`), which refuses a row without one;\n * a site package restore writes the stored events it carries,\n * start included. The server feed already orders by it.\n */\n orderBy('startsAtMs', 'desc'),\n /*\n * One document more than the ceiling, so \"there is more than\n * this\" is a fact rather than a comparison against the cap —\n * which is wrong in exactly the case it matters, a site holding\n * precisely 200 events. The probe row is dropped below and is\n * never rendered or counted.\n */\n limit(EVENT_CEILING + 1),\n )\n : null,\n [firestore, hostId],\n { idField: '$id' },\n )\n\n const { rows, truncated } = ceilingedWindow<EventRecord>(data, EVENT_CEILING)\n return { events: rows, truncated, fromCache, listen, unreadable: status === 'error' }\n}\n\n/** datetime-local ↔ epoch-ms without timezone surprises. */\nfunction toLocalInput(ms: number | null | undefined): string {\n if (!ms) return ''\n const date = new Date(ms)\n const pad = (value: number) => String(value).padStart(2, '0')\n return (\n `${date.getFullYear()}-${pad(date.getMonth() + 1)}-` +\n `${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`\n )\n}\n\n/**\n * Events manager (AGL-145 → AGL-394): the Event Calendar add-on's console\n * surface, now owned by the plugin so the console shell renders it through\n * the ConsoleExtension registry rather than a hardcoded page. Events carry\n * schedule/location/organizer/cover and a draft/published status; visitors\n * see published events through the Event List canvas element.\n *\n * Reaching this component means the org holds `eventCalendar`. The shell\n * resolves that entitlement and renders its own refusal instead of mounting\n * anything an extension registered (AGL-2484), so there is no unentitled\n * state to render here; the sentence a refused org reads is registered as\n * this plugin's `upgradeNotice` in `plugin.ts`.\n */\nexport function EventsConsolePage(props: ConsolePluginPageProps) {\n const { hostId } = props\n const firestore = useFirestore()\n const { enqueueSnackbar } = useSnackbar()\n const { confirm } = useConfirmationContext()\n\n const {\n events: eventDocs,\n /**\n * The rows this editor is seeded from are unconfirmed by the server\n * (AGL-1358). Editing copies a whole stored event into `draft` and one\n * `setDoc` writes all of it back, so `merge: true` protects nothing.\n * `status` is the field that costs the most: a cached seed can\n * UNPUBLISH a live, indexed event — or republish one that was pulled\n * down — from the Save button of an unrelated edit, and `endsAtMs` is\n * rewritten on every save whether or not anyone touched the schedule.\n */\n fromCache: eventsFromCache,\n listen: eventsListen,\n truncated: eventsTruncated,\n unreadable: eventsUnreadable,\n } = useHostEvents(hostId)\n const events = eventDocs\n .filter((event) => !event.deletedAt)\n .sort((a, b) => (b.startsAtMs ?? 0) - (a.startsAtMs ?? 0))\n\n /*\n * The page is a SLICE of the ceiling this page already holds. Sorting is\n * allowed here for the reason it is not allowed on a server-paged list: the\n * whole window is in hand, so newest-first is the order of the window and\n * not of one arbitrary page inside it.\n */\n const [page, setPage] = useState(0)\n const [pageSize, setPageSize] = useState(TABLE_PAGE_SIZE_DEFAULT)\n const visibleEvents = useMemo(\n () => events.slice(page * pageSize, page * pageSize + pageSize),\n [events, page, pageSize],\n )\n\n const [draft, setDraft] = useState<EventDraft | null>(null)\n\n /*\n * Import and Export open the console's wizard and dialog on this site's\n * events. Outside the console shell there is no launcher, and no buttons.\n * The list needs no refresh after an import: it is a live listener.\n */\n const transfer = useTransferLauncher()\n const transferTarget = { resource: EVENTS_TRANSFER_RESOURCE, scope: 'host' as const, hostId }\n // Import for those who may write the records, Export for those who may read them.\n const canImport = Boolean(transfer?.can('import', transferTarget))\n const canExport = Boolean(transfer?.can('export', transferTarget))\n const transferActions =\n transfer && (canImport || canExport) ? (\n <Stack direction=\"row\" spacing={1}>\n {/* An import left unfinished, reopened where it stopped (AGL-3549). */}\n <TransferResumeImport target={transferTarget} />\n {canImport && (\n <Button size=\"small\" onClick={() => transfer.openImport(transferTarget)}>\n {'Import'}\n </Button>\n )}\n {canExport && (\n <Button\n size=\"small\"\n onClick={() =>\n transfer.openExport(transferTarget)\n }\n >\n {'Export'}\n </Button>\n )}\n </Stack>\n ) : null\n\n const handleSave = useCallback(async () => {\n if (!draft || !draft.title.trim()) return\n const startsAtMs = draft.startsAt ? new Date(draft.startsAt).getTime() : 0\n const endsAtMs = draft.endsAt ? new Date(draft.endsAt).getTime() : 0\n if (!startsAtMs) {\n return void enqueueSnackbar('Set a start time', {\n variant: 'warning',\n persist: false,\n })\n }\n try {\n const id = draft.id ?? createResourceUid()\n /**\n * Refuse an EDIT whose seed the server never confirmed (AGL-1358).\n *\n * One `setDoc` serves create and edit here, so the guard has to be\n * conditioned on `draft.id` rather than sitting on a branch of its\n * own. A NEW event is built from blanks at a fresh uid and can\n * overwrite nothing, while the first snapshot of any listener is\n * `fromCache: true` — an unconditional guard would refuse every\n * create, which is the common case, not a corner.\n *\n * The guard WRAPS the write. An early return is a shape you can keep\n * while losing the protection; here the write is only reachable\n * through the verdict.\n */\n const verdict = await writeGuardedBySeed(\n {\n subject: 'event',\n unreadable: Boolean(draft.id) && eventsUnreadable,\n fromCache: Boolean(draft.id) && eventsFromCache,\n listen: eventsListen,\n },\n async () => {\n // The stored form is the shared rule's (`model/event-write.ts`),\n // which the events import writes through too. This is a `merge`\n // write, so whatever the rule removes has to be DELETED here —\n // leaving the key out would keep it (AGL-2418: a cover\n // description outliving its cover).\n const write = eventWrite({\n title: draft.title,\n startsAtMs,\n endsAtMs,\n location: draft.location,\n organizer: draft.organizer,\n description: draft.description,\n coverImage: draft.coverImage,\n coverImageAlt: draft.coverImageAlt,\n status: draft.status,\n })\n await setDoc(\n doc(firestore, 'hosts', hostId, 'events', id),\n {\n ...write.fields,\n ...Object.fromEntries(\n write.remove.map((key) => [key, deleteField()]),\n ),\n updatedAt: Timestamp.now(),\n ...(draft.id ? {} : { createdAt: Timestamp.now() }),\n },\n { merge: true },\n )\n },\n )\n // Before `setDraft(null)`, so a refusal keeps the dialog open with\n // what was typed — in the same warning vocabulary as the start-time\n // refusal above it.\n if (!verdict.ok) {\n return void enqueueSnackbar(verdict.message, {\n variant: 'warning',\n persist: false,\n })\n }\n setDraft(null)\n enqueueSnackbar('Event saved', { variant: 'success', persist: false })\n } catch (error) {\n console.error(error)\n enqueueSnackbar('An error has occurred', {\n variant: 'error',\n allowDuplicate: true,\n })\n }\n }, [\n draft,\n firestore,\n hostId,\n enqueueSnackbar,\n eventsFromCache,\n eventsListen,\n eventsUnreadable,\n ])\n\n const handleDelete = useCallback(\n (event: EventRecord) => async () => {\n const confirmed = await confirm({\n title: 'Delete this event?',\n description: `\"${event.title}\" disappears from your site.`,\n confirmationText: 'Delete',\n confirmationButtonProps: { color: 'error' },\n })\n .then(() => true)\n .catch(() => false)\n if (!confirmed) return\n // `status` too: the public listing asks for `status == 'published'`\n // on its query, and cannot ask for a missing `deletedAt`.\n await updateDoc(doc(firestore, 'hosts', hostId, 'events', event.$id), {\n deletedAt: Timestamp.now(),\n status: 'deleted',\n })\n },\n [confirm, firestore, hostId],\n )\n\n return (\n <CardDisplay\n header={'Events'}\n help={pluginDocsHelp('events', { anchor: '#manage-events' })}\n HeaderProps={transferActions ? { action: transferActions } : undefined}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={1}>\n {events.length === 0 ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Create events here, then drop an Event List element on any ' +\n 'page — published events render with SEO Event markup.'}\n </Typography>\n ) : (\n visibleEvents.map((event) => (\n <Stack\n key={event.$id}\n direction=\"row\"\n spacing={1}\n sx={{ alignItems: 'center' }}\n >\n <Chip\n size=\"small\"\n label={event.status ?? 'draft'}\n color={event.status === 'published' ? 'success' : 'default'}\n />\n <Stack sx={{ flex: 1, minWidth: 0 }}>\n <Typography variant=\"body2\" noWrap>\n {event.title}\n </Typography>\n <Typography variant=\"caption\" color=\"text.secondary\" noWrap>\n {new Date(event.startsAtMs ?? 0).toLocaleString()}\n {event.location ? ` · ${event.location}` : ''}\n </Typography>\n </Stack>\n <Button\n size=\"small\"\n onClick={() =>\n setDraft({\n id: event.$id,\n title: event.title ?? '',\n startsAt: toLocalInput(event.startsAtMs),\n endsAt: toLocalInput(event.endsAtMs),\n location: event.location ?? '',\n organizer: event.organizer ?? '',\n description: event.description ?? '',\n coverImage: event.coverImage ?? '',\n coverImageAlt: event.coverImageAlt ?? '',\n status: event.status === 'published' ? 'published' : 'draft',\n })\n }\n >\n {'Edit'}\n </Button>\n <Button size=\"small\" color=\"error\" onClick={handleDelete(event)}>\n {'Delete'}\n </Button>\n </Stack>\n ))\n )}\n {events.length === 0 ? null : (\n <ListPagination\n page={page}\n pageSize={pageSize}\n rowCount={visibleEvents.length}\n // The events this page HOLDS, after the soft-deleted ones are\n // dropped — a slice of rows already read, so the total is exact\n // for the window. The alert below says when the window is short\n // of the site.\n count={events.length}\n onPageChange={setPage}\n onPageSizeChange={setPageSize}\n />\n )}\n {eventsTruncated ? (\n <Alert severity=\"info\">\n {`Showing the newest ${EVENT_CEILING} events. This site has ` +\n 'more, and the older ones are not reachable from here.'}\n </Alert>\n ) : null}\n <Button\n size=\"small\"\n color=\"primary\"\n sx={{ alignSelf: 'flex-start' }}\n onClick={() =>\n setDraft({\n id: null,\n title: '',\n startsAt: '',\n endsAt: '',\n location: '',\n organizer: '',\n description: '',\n coverImage: '',\n coverImageAlt: '',\n status: 'draft',\n })\n }\n >\n {'Add event'}\n </Button>\n </Stack>\n\n <Dialog\n open={Boolean(draft)}\n onClose={() => setDraft(null)}\n maxWidth=\"sm\"\n fullWidth\n >\n <DialogTitle>{draft?.id ? 'Edit event' : 'Add event'}</DialogTitle>\n <DialogContent\n sx={{ display: 'flex', flexDirection: 'column', gap: 1.5, pt: 1 }}\n >\n <TextField\n label=\"Title\"\n value={draft?.title ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, title: event.target.value } : prev,\n )\n }\n size=\"small\"\n autoFocus\n sx={{ mt: 1 }}\n />\n <Stack direction=\"row\" spacing={1}>\n <TextField\n label=\"Starts\"\n type=\"datetime-local\"\n value={draft?.startsAt ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, startsAt: event.target.value } : prev,\n )\n }\n size=\"small\"\n slotProps={{ inputLabel: { shrink: true } }}\n sx={{ flex: 1 }}\n />\n <TextField\n label=\"Ends\"\n type=\"datetime-local\"\n value={draft?.endsAt ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, endsAt: event.target.value } : prev,\n )\n }\n size=\"small\"\n slotProps={{ inputLabel: { shrink: true } }}\n sx={{ flex: 1 }}\n />\n </Stack>\n <Stack direction=\"row\" spacing={1}>\n <TextField\n label=\"Location\"\n value={draft?.location ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, location: event.target.value } : prev,\n )\n }\n size=\"small\"\n sx={{ flex: 1 }}\n />\n <TextField\n label=\"Organizer\"\n value={draft?.organizer ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, organizer: event.target.value } : prev,\n )\n }\n size=\"small\"\n sx={{ flex: 1 }}\n />\n </Stack>\n <TextField\n label=\"Cover image URL\"\n value={draft?.coverImage ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, coverImage: event.target.value } : prev,\n )\n }\n size=\"small\"\n />\n {/*\n AGL-2418, matching the collection entry editor's wording. Shown\n only beside a cover, because a description with nothing to\n describe is a field nobody can answer. Left empty the thumbnail\n renders `alt=\"\"`, which is right here — the title sits next to\n it — so this is for the cover that carries something the title\n does not: a face, a venue, a poster with the lineup on it.\n */}\n {draft?.coverImage?.trim() ? (\n <TextField\n label=\"Cover image description\"\n placeholder=\"What the picture shows\"\n value={draft?.coverImageAlt ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev\n ? {\n ...prev,\n coverImageAlt: event.target.value.slice(\n 0,\n MEDIA_ALT_MAX_LENGTH,\n ),\n }\n : prev,\n )\n }\n size=\"small\"\n helperText={\n 'Read aloud by screen readers. Leave empty if the picture is decorative.'\n }\n />\n ) : null}\n <TextField\n label=\"Description\"\n value={draft?.description ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, description: event.target.value } : prev,\n )\n }\n size=\"small\"\n multiline\n minRows={3}\n />\n </DialogContent>\n <DialogActions sx={{ justifyContent: 'space-between' }}>\n <Button\n onClick={() =>\n setDraft((prev) =>\n prev\n ? {\n ...prev,\n status:\n prev.status === 'published' ? 'draft' : 'published',\n }\n : prev,\n )\n }\n >\n {draft?.status === 'published' ? 'Set to draft' : 'Set published'}\n </Button>\n <Stack direction=\"row\" spacing={1}>\n <Button onClick={() => setDraft(null)}>{'Cancel'}</Button>\n <Button\n variant=\"contained\"\n color=\"primary\"\n disabled={!draft?.title.trim()}\n onClick={handleSave}\n >\n {'Save event'}\n </Button>\n </Stack>\n </DialogActions>\n </Dialog>\n </CardDisplay>\n )\n}\nEventsConsolePage.displayName = 'EventsConsolePage'\n\nexport default EventsConsolePage\n"],"names":["TransferResumeImport","createResourceUid","MEDIA_ALT_MAX_LENGTH","pluginDocsHelp","useTransferLauncher","CardDisplay","useConfirmationContext","useSnackbar","Timestamp","ceilingedWindow","useFirestore","useFirestoreCollection","writeGuardedBySeed","Alert","Button","Chip","Dialog","DialogActions","DialogContent","DialogTitle","Stack","TextField","Typography","collection","deleteField","doc","limit","orderBy","query","setDoc","updateDoc","useCallback","useMemo","useState","ListPagination","TABLE_PAGE_SIZE_DEFAULT","eventWrite","EVENTS_TRANSFER_RESOURCE","EVENT_CEILING","useHostEvents","hostId","firestore","data","status","fromCache","listen","idField","rows","truncated","events","unreadable","toLocalInput","ms","date","Date","pad","value","String","padStart","getFullYear","getMonth","getDate","getHours","getMinutes","EventsConsolePage","props","draft","enqueueSnackbar","confirm","eventDocs","eventsFromCache","eventsListen","eventsTruncated","eventsUnreadable","filter","event","deletedAt","sort","a","b","startsAtMs","page","setPage","pageSize","setPageSize","visibleEvents","slice","setDraft","transfer","transferTarget","resource","scope","canImport","Boolean","can","canExport","transferActions","direction","spacing","target","size","onClick","openImport","openExport","handleSave","title","trim","startsAt","getTime","endsAtMs","endsAt","variant","persist","id","verdict","subject","write","location","organizer","description","coverImage","coverImageAlt","fields","Object","fromEntries","remove","map","key","updatedAt","now","createdAt","merge","ok","message","error","console","allowDuplicate","handleDelete","confirmed","confirmationText","confirmationButtonProps","color","then","catch","$id","header","help","anchor","HeaderProps","action","undefined","contentGutterX","contentGutterY","length","sx","alignItems","label","flex","minWidth","noWrap","toLocaleString","rowCount","count","onPageChange","onPageSizeChange","severity","alignSelf","open","onClose","maxWidth","fullWidth","display","flexDirection","gap","pt","onChange","prev","autoFocus","mt","type","slotProps","inputLabel","shrink","placeholder","helperText","multiline","minRows","justifyContent","disabled","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAASA,oBAAoB,QA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,oBACtB,KAACrF;gCACCuI,OAAM;gCACN2B,aAAY;gCACZ/H,KAAK,WAAEU,yBAAAA,MAAOuD,aAAa,oBAAI;gCAC/BsD,UAAU,CAACpG,QACTY,SAAS,CAACyF,OACRA,OACI,aACKA;4CACHvD,eAAe9C,MAAMwB,MAAM,CAAC3C,KAAK,CAAC8B,KAAK,CACrC,GACApF;6CAGJ8K;gCAGR5E,MAAK;gCACLoF,YACE;iCAGF;0CACJ,KAACnK;gCACCuI,OAAM;gCACNpG,KAAK,WAAEU,yBAAAA,MAAOqD,WAAW,oBAAI;gCAC7BwD,UAAU,CAACpG,QACTY,SAAS,CAACyF,OACRA,OAAO,aAAKA;4CAAMzD,aAAa5C,MAAMwB,MAAM,CAAC3C,KAAK;6CAAKwH;gCAG1D5E,MAAK;gCACLqF,SAAS;gCACTC,SAAS;;;;kCAGb,MAACzK;wBAAcyI,IAAI;4BAAEiC,gBAAgB;wBAAgB;;0CACnD,KAAC7K;gCACCuF,SAAS,IACPd,SAAS,CAACyF,OACRA,OACI,aACKA;4CACHrI,QACEqI,KAAKrI,MAAM,KAAK,cAAc,UAAU;6CAE5CqI;0CAIP9G,CAAAA,yBAAAA,MAAOvB,MAAM,MAAK,cAAc,iBAAiB;;0CAEpD,MAACvB;gCAAM6E,WAAU;gCAAMC,SAAS;;kDAC9B,KAACpF;wCAAOuF,SAAS,IAAMd,SAAS;kDAAQ;;kDACxC,KAACzE;wCACCiG,SAAQ;wCACR8B,OAAM;wCACN+C,UAAU,EAAC1H,yBAAAA,MAAOuC,KAAK,CAACC,IAAI;wCAC5BL,SAASG;kDAER;;;;;;;;;;AAOf;AACAxC,kBAAkB6H,WAAW,GAAG;AAEhC,eAAe7H,kBAAiB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/events-calendar/src/lib/components/events-console-page.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport { TransferResumeImport } from '@aglyn/aglyn/app-utils/transfer-resume-import'\nimport {\n createResourceUid,\n MEDIA_ALT_MAX_LENGTH,\n pluginDocsHelp,\n useTransferLauncher,\n} from '@aglyn/aglyn'\nimport { type ConsolePluginPageProps } from '@aglyn/aglyn'\nimport { CardDisplay, useConfirmationContext } from '@aglyn/shared-ui-jsx'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { Timestamp } from '@aglyn/shared-util-timestamp'\nimport {\n ceilingedWindow,\n useFirestore,\n useFirestoreCollection,\n writeGuardedBySeed,\n type ListenHandle,\n} from '@aglyn/tenant-feature-instance'\nimport {\n isSeedChecking,\n seedCheckingText,\n} from '@aglyn/tenant-feature-instance/hooks/use-seed-edits'\nimport { useSeedDraft } from '@aglyn/tenant-feature-instance/hooks/use-seed-draft'\nimport {\n Alert,\n Button,\n Chip,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Stack,\n TextField,\n Typography,\n} from '@mui/material'\nimport {\n collection,\n deleteField,\n doc,\n limit,\n orderBy,\n query,\n setDoc,\n updateDoc,\n} from 'firebase/firestore'\nimport { useCallback, useMemo, useState } from 'react'\nimport { ListPagination } from '@aglyn/shared-ui-jsx/components/list-pagination.component'\nimport { TABLE_PAGE_SIZE_DEFAULT } from '@aglyn/shared-ui-jsx/const/table-pagination'\nimport { eventWrite } from '../model/event-write'\nimport { EVENTS_TRANSFER_RESOURCE } from '../transfer/events-transfer-key'\n\n/**\n * How many event documents this page reads.\n *\n * A CEILING, not a page size: the rows are filtered for soft deletes and\n * re-sorted after reading, so a server page would arrive holding anywhere\n * from zero to ten events and the count under it would be about candidates\n * rather than about events.\n */\nconst EVENT_CEILING = 200\n\ninterface EventDraft {\n id: string | null\n title: string\n startsAt: string\n endsAt: string\n location: string\n organizer: string\n description: string\n coverImage: string\n coverImageAlt: string\n status: 'draft' | 'published'\n}\n\ninterface EventRecord {\n $id: string\n title?: string\n startsAtMs?: number\n endsAtMs?: number\n location?: string\n organizer?: string\n description?: string\n coverImage?: string\n coverImageAlt?: string\n /** `deleted` is written by the delete, beside `deletedAt`. */\n status?: 'draft' | 'published' | 'deleted'\n deletedAt?: unknown\n}\n\n/**\n * A host's events.\n *\n * This was a hand-rolled `onSnapshot` with its own retry, and it carried a\n * FOURTH copy of the AGL-1066 defect: `attempt = 0` in the success handler.\n * Under `persistentLocalCache` the cached emission that precedes every\n * refusal handed the budget back, so `unreadable` — the whole point of the\n * counter — could not fire in the one state that needed it, a populated\n * editor over a read that had stopped working.\n *\n * Rather than repair a fourth counter, the copy is gone. `useFirestoreCollection`\n * is the same `onSnapshot`-plus-retry that absorbs the AGL-216/217\n * post-sign-in denial, and it carries the signals this page's save needs\n * (`fromCache`, and `serverDenied` for the refusal the budget cannot yet\n * express) plus denial reporting into `session-health` this page never had.\n * There was never a reason it could not: the file has imported from\n * `@aglyn/tenant-feature-instance` all along.\n */\nfunction useHostEvents(hostId: string): {\n events: EventRecord[]\n truncated: boolean\n fromCache: boolean\n /** The listener, so a save waits on that read alone (AGL-4135). */\n listen: ListenHandle\n unreadable: boolean\n} {\n const firestore = useFirestore()\n const { data, status, fromCache, listen } = useFirestoreCollection<EventRecord>(\n () =>\n hostId\n ? query(\n collection(firestore, 'hosts', hostId, 'events'),\n /*\n * ORDERED, so the window is the newest 200 rather than a sample.\n *\n * A `limit()` with no `orderBy` returns documents in ID order, so\n * this was reading an arbitrary 200 of the collection and then\n * sorting them by date in the browser — which looks newest-first\n * and is not: a site past 200 events would simply never see the\n * ones whose ids sorted late, including the next one happening.\n *\n * `orderBy` DROPS documents missing the field, so it is only safe\n * once every writer is known to set it, and every one does for\n * `startsAtMs`. The editor refuses a save without it (the guard\n * in `handleSave`); the events import writes through the same\n * rule (`model/event-write.ts`), which refuses a row without one;\n * a site package restore writes the stored events it carries,\n * start included. The server feed already orders by it.\n */\n orderBy('startsAtMs', 'desc'),\n /*\n * One document more than the ceiling, so \"there is more than\n * this\" is a fact rather than a comparison against the cap —\n * which is wrong in exactly the case it matters, a site holding\n * precisely 200 events. The probe row is dropped below and is\n * never rendered or counted.\n */\n limit(EVENT_CEILING + 1),\n )\n : null,\n [firestore, hostId],\n { idField: '$id' },\n )\n\n const { rows, truncated } = ceilingedWindow<EventRecord>(data, EVENT_CEILING)\n return { events: rows, truncated, fromCache, listen, unreadable: status === 'error' }\n}\n\n/** datetime-local ↔ epoch-ms without timezone surprises. */\nfunction toLocalInput(ms: number | null | undefined): string {\n if (!ms) return ''\n const date = new Date(ms)\n const pad = (value: number) => String(value).padStart(2, '0')\n return (\n `${date.getFullYear()}-${pad(date.getMonth() + 1)}-` +\n `${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`\n )\n}\n\n/**\n * Events manager (AGL-145 → AGL-394): the Event Calendar add-on's console\n * surface, now owned by the plugin so the console shell renders it through\n * the ConsoleExtension registry rather than a hardcoded page. Events carry\n * schedule/location/organizer/cover and a draft/published status; visitors\n * see published events through the Event List canvas element.\n *\n * Reaching this component means the org holds `eventCalendar`. The shell\n * resolves that entitlement and renders its own refusal instead of mounting\n * anything an extension registered (AGL-2484), so there is no unentitled\n * state to render here; the sentence a refused org reads is registered as\n * this plugin's `upgradeNotice` in `plugin.ts`.\n */\n/** A stored event as the editor holds it. */\nfunction eventDraftOf(event: EventRecord): EventDraft {\n return {\n id: event.$id,\n title: event.title ?? '',\n startsAt: toLocalInput(event.startsAtMs),\n endsAt: toLocalInput(event.endsAtMs),\n location: event.location ?? '',\n organizer: event.organizer ?? '',\n description: event.description ?? '',\n coverImage: event.coverImage ?? '',\n coverImageAlt: event.coverImageAlt ?? '',\n status: event.status === 'published' ? 'published' : 'draft',\n }\n}\n\nexport function EventsConsolePage(props: ConsolePluginPageProps) {\n const { hostId } = props\n const firestore = useFirestore()\n const { enqueueSnackbar } = useSnackbar()\n const { confirm } = useConfirmationContext()\n\n const {\n events: eventDocs,\n /**\n * The rows this editor is seeded from are unconfirmed by the server\n * (AGL-1358). Editing copies a whole stored event into `draft` and one\n * `setDoc` writes all of it back, so `merge: true` protects nothing.\n * `status` is the field that costs the most: a cached seed can\n * UNPUBLISH a live, indexed event — or republish one that was pulled\n * down — from the Save button of an unrelated edit, and `endsAtMs` is\n * rewritten on every save whether or not anyone touched the schedule.\n */\n fromCache: eventsFromCache,\n listen: eventsListen,\n truncated: eventsTruncated,\n unreadable: eventsUnreadable,\n } = useHostEvents(hostId)\n const events = eventDocs\n .filter((event) => !event.deletedAt)\n .sort((a, b) => (b.startsAtMs ?? 0) - (a.startsAtMs ?? 0))\n\n /*\n * The page is a SLICE of the ceiling this page already holds. Sorting is\n * allowed here for the reason it is not allowed on a server-paged list: the\n * whole window is in hand, so newest-first is the order of the window and\n * not of one arbitrary page inside it.\n */\n const [page, setPage] = useState(0)\n const [pageSize, setPageSize] = useState(TABLE_PAGE_SIZE_DEFAULT)\n const visibleEvents = useMemo(\n () => events.slice(page * pageSize, page * pageSize + pageSize),\n [events, page, pageSize],\n )\n\n /*\n * The editor's draft, kept as EDITS over the event as the list has it now\n * (AGL-4047): opened from the cache's row, the server's copy replaces it\n * under every field nobody touched (`status` among them), and Save is held\n * until it has.\n */\n const [draft, setDraft] = useSeedDraft<EventDraft>((opened) => {\n const row = opened.id ? events.find((event) => event.$id === opened.id) : undefined\n return row ? eventDraftOf(row) : undefined\n })\n const draftChecking =\n Boolean(draft?.id) &&\n isSeedChecking({ fromCache: eventsFromCache, unreadable: eventsUnreadable })\n\n /*\n * Import and Export open the console's wizard and dialog on this site's\n * events. Outside the console shell there is no launcher, and no buttons.\n * The list needs no refresh after an import: it is a live listener.\n */\n const transfer = useTransferLauncher()\n const transferTarget = { resource: EVENTS_TRANSFER_RESOURCE, scope: 'host' as const, hostId }\n // Import for those who may write the records, Export for those who may read them.\n const canImport = Boolean(transfer?.can('import', transferTarget))\n const canExport = Boolean(transfer?.can('export', transferTarget))\n const transferActions =\n transfer && (canImport || canExport) ? (\n <Stack direction=\"row\" spacing={1}>\n {/* An import left unfinished, reopened where it stopped (AGL-3549). */}\n <TransferResumeImport target={transferTarget} />\n {canImport && (\n <Button size=\"small\" onClick={() => transfer.openImport(transferTarget)}>\n {'Import'}\n </Button>\n )}\n {canExport && (\n <Button\n size=\"small\"\n onClick={() =>\n transfer.openExport(transferTarget)\n }\n >\n {'Export'}\n </Button>\n )}\n </Stack>\n ) : null\n\n const handleSave = useCallback(async () => {\n if (!draft || !draft.title.trim()) return\n const startsAtMs = draft.startsAt ? new Date(draft.startsAt).getTime() : 0\n const endsAtMs = draft.endsAt ? new Date(draft.endsAt).getTime() : 0\n if (!startsAtMs) {\n return void enqueueSnackbar('Set a start time', {\n variant: 'warning',\n persist: false,\n })\n }\n try {\n const id = draft.id ?? createResourceUid()\n /**\n * Refuse an EDIT whose seed the server never confirmed (AGL-1358).\n *\n * One `setDoc` serves create and edit here, so the guard has to be\n * conditioned on `draft.id` rather than sitting on a branch of its\n * own. A NEW event is built from blanks at a fresh uid and can\n * overwrite nothing, while the first snapshot of any listener is\n * `fromCache: true` — an unconditional guard would refuse every\n * create, which is the common case, not a corner.\n *\n * The guard WRAPS the write. An early return is a shape you can keep\n * while losing the protection; here the write is only reachable\n * through the verdict.\n */\n const verdict = await writeGuardedBySeed(\n {\n subject: 'event',\n unreadable: Boolean(draft.id) && eventsUnreadable,\n fromCache: Boolean(draft.id) && eventsFromCache,\n listen: eventsListen,\n },\n async () => {\n // The stored form is the shared rule's (`model/event-write.ts`),\n // which the events import writes through too. This is a `merge`\n // write, so whatever the rule removes has to be DELETED here —\n // leaving the key out would keep it (AGL-2418: a cover\n // description outliving its cover).\n const write = eventWrite({\n title: draft.title,\n startsAtMs,\n endsAtMs,\n location: draft.location,\n organizer: draft.organizer,\n description: draft.description,\n coverImage: draft.coverImage,\n coverImageAlt: draft.coverImageAlt,\n status: draft.status,\n })\n await setDoc(\n doc(firestore, 'hosts', hostId, 'events', id),\n {\n ...write.fields,\n ...Object.fromEntries(\n write.remove.map((key) => [key, deleteField()]),\n ),\n updatedAt: Timestamp.now(),\n ...(draft.id ? {} : { createdAt: Timestamp.now() }),\n },\n { merge: true },\n )\n },\n )\n // Before `setDraft(null)`, so a refusal keeps the dialog open with\n // what was typed — in the same warning vocabulary as the start-time\n // refusal above it.\n if (!verdict.ok) {\n return void enqueueSnackbar(verdict.message, {\n variant: 'warning',\n persist: false,\n })\n }\n setDraft(null)\n enqueueSnackbar('Event saved', { variant: 'success', persist: false })\n } catch (error) {\n console.error(error)\n enqueueSnackbar('An error has occurred', {\n variant: 'error',\n allowDuplicate: true,\n })\n }\n }, [\n setDraft,\n draft,\n firestore,\n hostId,\n enqueueSnackbar,\n eventsFromCache,\n eventsListen,\n eventsUnreadable,\n ])\n\n const handleDelete = useCallback(\n (event: EventRecord) => async () => {\n const confirmed = await confirm({\n title: 'Delete this event?',\n description: `\"${event.title}\" disappears from your site.`,\n confirmationText: 'Delete',\n confirmationButtonProps: { color: 'error' },\n })\n .then(() => true)\n .catch(() => false)\n if (!confirmed) return\n // `status` too: the public listing asks for `status == 'published'`\n // on its query, and cannot ask for a missing `deletedAt`.\n await updateDoc(doc(firestore, 'hosts', hostId, 'events', event.$id), {\n deletedAt: Timestamp.now(),\n status: 'deleted',\n })\n },\n [confirm, firestore, hostId],\n )\n\n return (\n <CardDisplay\n header={'Events'}\n help={pluginDocsHelp('events', { anchor: '#manage-events' })}\n HeaderProps={transferActions ? { action: transferActions } : undefined}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={1}>\n {events.length === 0 ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Create events here, then drop an Event List element on any ' +\n 'page — published events render with SEO Event markup.'}\n </Typography>\n ) : (\n visibleEvents.map((event) => (\n <Stack\n key={event.$id}\n direction=\"row\"\n spacing={1}\n sx={{ alignItems: 'center' }}\n >\n <Chip\n size=\"small\"\n label={event.status ?? 'draft'}\n color={event.status === 'published' ? 'success' : 'default'}\n />\n <Stack sx={{ flex: 1, minWidth: 0 }}>\n <Typography variant=\"body2\" noWrap>\n {event.title}\n </Typography>\n <Typography variant=\"caption\" color=\"text.secondary\" noWrap>\n {new Date(event.startsAtMs ?? 0).toLocaleString()}\n {event.location ? ` · ${event.location}` : ''}\n </Typography>\n </Stack>\n <Button\n size=\"small\"\n onClick={() => setDraft(eventDraftOf(event))}\n >\n {'Edit'}\n </Button>\n <Button size=\"small\" color=\"error\" onClick={handleDelete(event)}>\n {'Delete'}\n </Button>\n </Stack>\n ))\n )}\n {events.length === 0 ? null : (\n <ListPagination\n page={page}\n pageSize={pageSize}\n rowCount={visibleEvents.length}\n // The events this page HOLDS, after the soft-deleted ones are\n // dropped — a slice of rows already read, so the total is exact\n // for the window. The alert below says when the window is short\n // of the site.\n count={events.length}\n onPageChange={setPage}\n onPageSizeChange={setPageSize}\n />\n )}\n {eventsTruncated ? (\n <Alert severity=\"info\">\n {`Showing the newest ${EVENT_CEILING} events. This site has ` +\n 'more, and the older ones are not reachable from here.'}\n </Alert>\n ) : null}\n <Button\n size=\"small\"\n color=\"primary\"\n sx={{ alignSelf: 'flex-start' }}\n onClick={() =>\n setDraft({\n id: null,\n title: '',\n startsAt: '',\n endsAt: '',\n location: '',\n organizer: '',\n description: '',\n coverImage: '',\n coverImageAlt: '',\n status: 'draft',\n })\n }\n >\n {'Add event'}\n </Button>\n </Stack>\n\n <Dialog\n open={Boolean(draft)}\n onClose={() => setDraft(null)}\n maxWidth=\"sm\"\n fullWidth\n >\n <DialogTitle>{draft?.id ? 'Edit event' : 'Add event'}</DialogTitle>\n <DialogContent\n sx={{ display: 'flex', flexDirection: 'column', gap: 1.5, pt: 1 }}\n >\n <TextField\n label=\"Title\"\n value={draft?.title ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, title: event.target.value } : prev,\n )\n }\n size=\"small\"\n autoFocus\n sx={{ mt: 1 }}\n />\n <Stack direction=\"row\" spacing={1}>\n <TextField\n label=\"Starts\"\n type=\"datetime-local\"\n value={draft?.startsAt ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, startsAt: event.target.value } : prev,\n )\n }\n size=\"small\"\n slotProps={{ inputLabel: { shrink: true } }}\n sx={{ flex: 1 }}\n />\n <TextField\n label=\"Ends\"\n type=\"datetime-local\"\n value={draft?.endsAt ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, endsAt: event.target.value } : prev,\n )\n }\n size=\"small\"\n slotProps={{ inputLabel: { shrink: true } }}\n sx={{ flex: 1 }}\n />\n </Stack>\n <Stack direction=\"row\" spacing={1}>\n <TextField\n label=\"Location\"\n value={draft?.location ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, location: event.target.value } : prev,\n )\n }\n size=\"small\"\n sx={{ flex: 1 }}\n />\n <TextField\n label=\"Organizer\"\n value={draft?.organizer ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, organizer: event.target.value } : prev,\n )\n }\n size=\"small\"\n sx={{ flex: 1 }}\n />\n </Stack>\n <TextField\n label=\"Cover image URL\"\n value={draft?.coverImage ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, coverImage: event.target.value } : prev,\n )\n }\n size=\"small\"\n />\n {/*\n AGL-2418, matching the collection entry editor's wording. Shown\n only beside a cover, because a description with nothing to\n describe is a field nobody can answer. Left empty the thumbnail\n renders `alt=\"\"`, which is right here — the title sits next to\n it — so this is for the cover that carries something the title\n does not: a face, a venue, a poster with the lineup on it.\n */}\n {draft?.coverImage?.trim() ? (\n <TextField\n label=\"Cover image description\"\n placeholder=\"What the picture shows\"\n value={draft?.coverImageAlt ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev\n ? {\n ...prev,\n coverImageAlt: event.target.value.slice(\n 0,\n MEDIA_ALT_MAX_LENGTH,\n ),\n }\n : prev,\n )\n }\n size=\"small\"\n helperText={\n 'Read aloud by screen readers. Leave empty if the picture is decorative.'\n }\n />\n ) : null}\n <TextField\n label=\"Description\"\n value={draft?.description ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, description: event.target.value } : prev,\n )\n }\n size=\"small\"\n multiline\n minRows={3}\n />\n </DialogContent>\n <DialogActions sx={{ justifyContent: 'space-between' }}>\n <Button\n onClick={() =>\n setDraft((prev) =>\n prev\n ? {\n ...prev,\n status:\n prev.status === 'published' ? 'draft' : 'published',\n }\n : prev,\n )\n }\n >\n {draft?.status === 'published' ? 'Set to draft' : 'Set published'}\n </Button>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n {draftChecking ? (\n <Typography variant=\"body2\" color=\"text.secondary\" role=\"status\">\n {seedCheckingText('event')}\n </Typography>\n ) : null}\n <Button onClick={() => setDraft(null)}>{'Cancel'}</Button>\n <Button\n variant=\"contained\"\n color=\"primary\"\n disabled={draftChecking || !draft?.title.trim()}\n onClick={handleSave}\n >\n {'Save event'}\n </Button>\n </Stack>\n </DialogActions>\n </Dialog>\n </CardDisplay>\n )\n}\nEventsConsolePage.displayName = 'EventsConsolePage'\n\nexport default EventsConsolePage\n"],"names":["TransferResumeImport","createResourceUid","MEDIA_ALT_MAX_LENGTH","pluginDocsHelp","useTransferLauncher","CardDisplay","useConfirmationContext","useSnackbar","Timestamp","ceilingedWindow","useFirestore","useFirestoreCollection","writeGuardedBySeed","isSeedChecking","seedCheckingText","useSeedDraft","Alert","Button","Chip","Dialog","DialogActions","DialogContent","DialogTitle","Stack","TextField","Typography","collection","deleteField","doc","limit","orderBy","query","setDoc","updateDoc","useCallback","useMemo","useState","ListPagination","TABLE_PAGE_SIZE_DEFAULT","eventWrite","EVENTS_TRANSFER_RESOURCE","EVENT_CEILING","useHostEvents","hostId","firestore","data","status","fromCache","listen","idField","rows","truncated","events","unreadable","toLocalInput","ms","date","Date","pad","value","String","padStart","getFullYear","getMonth","getDate","getHours","getMinutes","eventDraftOf","event","id","$id","title","startsAt","startsAtMs","endsAt","endsAtMs","location","organizer","description","coverImage","coverImageAlt","EventsConsolePage","props","draft","enqueueSnackbar","confirm","eventDocs","eventsFromCache","eventsListen","eventsTruncated","eventsUnreadable","filter","deletedAt","sort","a","b","page","setPage","pageSize","setPageSize","visibleEvents","slice","setDraft","opened","row","find","undefined","draftChecking","Boolean","transfer","transferTarget","resource","scope","canImport","can","canExport","transferActions","direction","spacing","target","size","onClick","openImport","openExport","handleSave","trim","getTime","variant","persist","verdict","subject","write","fields","Object","fromEntries","remove","map","key","updatedAt","now","createdAt","merge","ok","message","error","console","allowDuplicate","handleDelete","confirmed","confirmationText","confirmationButtonProps","color","then","catch","header","help","anchor","HeaderProps","action","contentGutterX","contentGutterY","length","sx","alignItems","label","flex","minWidth","noWrap","toLocaleString","rowCount","count","onPageChange","onPageSizeChange","severity","alignSelf","open","onClose","maxWidth","fullWidth","display","flexDirection","gap","pt","onChange","prev","autoFocus","mt","type","slotProps","inputLabel","shrink","placeholder","helperText","multiline","minRows","justifyContent","role","disabled","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAASA,oBAAoB,QAAQ,gDAA+C;AACpF,SACEC,iBAAiB,EACjBC,oBAAoB,EACpBC,cAAc,EACdC,mBAAmB,QACd,eAAc;AAErB,SAASC,WAAW,EAAEC,sBAAsB,QAAQ,uBAAsB;AAC1E,SAASC,WAAW,QAAQ,8BAA6B;AACzD,SAASC,SAAS,QAAQ,+BAA8B;AACxD,SACEC,eAAe,EACfC,YAAY,EACZC,sBAAsB,EACtBC,kBAAkB,QAEb,iCAAgC;AACvC,SACEC,cAAc,EACdC,gBAAgB,QACX,sDAAqD;AAC5D,SAASC,YAAY,QAAQ,sDAAqD;AAClF,SACEC,KAAK,EACLC,MA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