@atmo-dev/kit 0.10.1 → 0.11.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.
@@ -9,10 +9,13 @@
9
9
 
10
10
  let {
11
11
  event,
12
- actor
12
+ actor,
13
+ href
13
14
  }: {
14
15
  event: FlatEventRecord;
15
16
  actor?: string;
17
+ /** Where the card links, for an event whose page is not its creator's. */
18
+ href?: string;
16
19
  } = $props();
17
20
 
18
21
  function formatDateTime(dateStr: string): string {
@@ -85,7 +88,7 @@
85
88
  </script>
86
89
 
87
90
  <a
88
- href={eventUrl(event, actor)}
91
+ href={href ?? eventUrl(event, actor)}
89
92
  class="group grid grid-cols-[5rem_minmax(0,1fr)] gap-3 rounded-ui outline-offset-4 transition-colors focus-visible:outline-2 focus-visible:outline-accent-700 sm:grid-cols-[6rem_minmax(0,1fr)] sm:gap-3.5 dark:focus-visible:outline-accent-300"
90
93
  >
91
94
  <div class="w-full">
@@ -2,6 +2,8 @@ import { type FlatEventRecord } from './contrail.js';
2
2
  type $$ComponentProps = {
3
3
  event: FlatEventRecord;
4
4
  actor?: string;
5
+ /** Where the card links, for an event whose page is not its creator's. */
6
+ href?: string;
5
7
  };
6
8
  declare const EventCard: import("svelte").Component<$$ComponentProps, {}, "">;
7
9
  type EventCard = ReturnType<typeof EventCard>;
@@ -94,6 +94,8 @@
94
94
  let selectedPreset: string | null = $state(
95
95
  initialThumbnailFile ? null : eventData === null ? DEFAULT_PRESET : null
96
96
  );
97
+ let images = $derived(adapter.features.images !== false);
98
+ let showVisibility = $derived(adapter.features.visibility !== false);
97
99
  let submitting = $state(false);
98
100
  let error: string | null = $state(null);
99
101
  let titleEditor = $state<Editor | null>(null);
@@ -132,7 +134,7 @@
132
134
  }
133
135
 
134
136
  function populateThumbnailFromEventData() {
135
- if (!eventData) return;
137
+ if (!eventData || !images) return;
136
138
  if (eventData.media && eventData.media.length > 0) {
137
139
  const media = getEventThumbnail(eventData.media);
138
140
  if (media?.content) {
@@ -212,7 +214,7 @@
212
214
 
213
215
  try {
214
216
  // Generate thumbnail from preset if selected and no custom upload
215
- if (selectedPreset && !thumbnailFile) {
217
+ if (images && selectedPreset && !thumbnailFile) {
216
218
  const rendered = await renderPresetThumbnail({
217
219
  design: selectedPreset,
218
220
  seed: hashSeed(rkey),
@@ -227,14 +229,18 @@
227
229
  }
228
230
 
229
231
  const existingMedia = (eventData?.media ?? []) as Array<Record<string, unknown>>;
230
- const media = await buildThumbnailMedia({
231
- isNew,
232
- thumbnailChanged,
233
- thumbnailFile,
234
- existingMedia,
235
- uploadBlob: (blob) =>
236
- adapter.uploadBlob(blob) as unknown as Promise<Record<string, unknown>>
237
- });
232
+ const media = images
233
+ ? await buildThumbnailMedia({
234
+ isNew,
235
+ thumbnailChanged,
236
+ thumbnailFile,
237
+ existingMedia,
238
+ uploadBlob: (blob) =>
239
+ adapter.uploadBlob(blob) as unknown as Promise<Record<string, unknown>>
240
+ })
241
+ : existingMedia.length > 0
242
+ ? existingMedia
243
+ : undefined;
238
244
 
239
245
  const record = await buildEventRecord({
240
246
  eventData,
@@ -245,7 +251,7 @@
245
251
  endsAt,
246
252
  timezone,
247
253
  mode,
248
- visibility,
254
+ visibility: showVisibility ? visibility : null,
249
255
  theme: eventTheme,
250
256
  links,
251
257
  location,
@@ -288,7 +294,8 @@
288
294
  collection: 'community.lexicon.calendar.event',
289
295
  rkey
290
296
  });
291
- const eventUri = `at://${viewer.did}/community.lexicon.calendar.event/${rkey}`;
297
+ const eventUri =
298
+ eventData?.uri || `at://${viewer.did}/community.lexicon.calendar.event/${rkey}`;
292
299
  await adapter.notifyUpdate?.(eventUri);
293
300
  adapter.onDeleted?.();
294
301
  } catch (e) {
@@ -326,16 +333,18 @@
326
333
  <div
327
334
  class="grid grid-cols-1 gap-8 md:grid-cols-[14rem_1fr] md:gap-x-10 md:gap-y-6 lg:grid-cols-[16rem_1fr]"
328
335
  >
329
- <ThumbnailSection
330
- {rkey}
331
- {name}
332
- dateStr={thumbnailDateStr}
333
- accent={eventTheme.accentColor}
334
- bind:thumbnailFile
335
- bind:thumbnailPreview
336
- bind:thumbnailChanged
337
- bind:selectedPreset
338
- />
336
+ {#if images}
337
+ <ThumbnailSection
338
+ {rkey}
339
+ {name}
340
+ dateStr={thumbnailDateStr}
341
+ accent={eventTheme.accentColor}
342
+ bind:thumbnailFile
343
+ bind:thumbnailPreview
344
+ bind:thumbnailChanged
345
+ bind:selectedPreset
346
+ />
347
+ {/if}
339
348
 
340
349
  <!-- Right column: event details -->
341
350
  <div class="order-2 min-w-0 md:order-0 md:col-start-2 md:row-span-5 md:row-start-1">
@@ -371,29 +380,31 @@
371
380
  </div>
372
381
 
373
382
  <!-- Visibility toggle -->
374
- <div class="mb-8">
375
- <ToggleGroup
376
- type="single"
377
- bind:value={
378
- () => visibility,
379
- (val) => {
380
- if (val) visibility = val as Visibility;
383
+ {#if showVisibility}
384
+ <div class="mb-8">
385
+ <ToggleGroup
386
+ type="single"
387
+ bind:value={
388
+ () => visibility,
389
+ (val) => {
390
+ if (val) visibility = val as Visibility;
391
+ }
381
392
  }
382
- }
383
- class="w-fit"
384
- size="xs"
385
- >
386
- <ToggleGroupItem value="public">Public</ToggleGroupItem>
387
- <ToggleGroupItem value="unlisted">Unlisted</ToggleGroupItem>
388
- </ToggleGroup>
389
- <div class="mt-1.5 text-xs text-base-600 dark:text-base-400">
390
- {#if visibility === 'public'}
391
- Anyone can view and it appears in discovery.
392
- {:else}
393
- Public to anyone with the link, but hidden from discovery.
394
- {/if}
393
+ class="w-fit"
394
+ size="xs"
395
+ >
396
+ <ToggleGroupItem value="public">Public</ToggleGroupItem>
397
+ <ToggleGroupItem value="unlisted">Unlisted</ToggleGroupItem>
398
+ </ToggleGroup>
399
+ <div class="mt-1.5 text-xs text-base-600 dark:text-base-400">
400
+ {#if visibility === 'public'}
401
+ Anyone can view and it appears in discovery.
402
+ {:else}
403
+ Public to anyone with the link, but hidden from discovery.
404
+ {/if}
405
+ </div>
395
406
  </div>
396
- </div>
407
+ {/if}
397
408
 
398
409
  <!-- Date row -->
399
410
  <div class="mb-5 grid min-w-0 gap-2">
@@ -48,6 +48,7 @@
48
48
  pageUrl,
49
49
  embedMode = false,
50
50
  shareUrlOverride,
51
+ share = true,
51
52
  extraActions,
52
53
  attendeeActions,
53
54
  loadAttendees
@@ -62,6 +63,9 @@
62
63
  * of the canonical atmo.rsvp event URL. Useful for embedders that want
63
64
  * share links to point at their own event page. */
64
65
  shareUrlOverride?: string;
66
+ /** False for an event with no public page to share, such as a private one: no share pop-up
67
+ * after creating the event or answering Going. */
68
+ share?: boolean;
65
69
  /** App-owned actions such as private reporting; omitted in embeds. */
66
70
  extraActions?: Snippet;
67
71
  /** App-owned actions below the attendee lists, with current RSVP counts. */
@@ -143,6 +147,7 @@
143
147
  url.searchParams.delete('created');
144
148
  history.replaceState({}, '', url.pathname);
145
149
  launchConfetti();
150
+ if (!share) return;
146
151
  shareModalTitle = 'Event created!';
147
152
  shareModalText = `I'm hosting "${eventData.name}"!\n\n${shareUrl}`;
148
153
  canSetEventComments = isHost;
@@ -200,7 +205,8 @@
200
205
  return null;
201
206
  });
202
207
 
203
- let eventUri = $derived(`at://${did}/community.lexicon.calendar.event/${rkey}`);
208
+ // The record's own address, which isn't in its creator's repo for every event (one in a space).
209
+ let eventUri = $derived(eventData.uri || `at://${did}/community.lexicon.calendar.event/${rkey}`);
204
210
 
205
211
  let ogImageUrl = $derived(data.ogImage ?? `${pageUrl.origin}${pageUrl.pathname}/og.png`);
206
212
 
@@ -243,7 +249,7 @@
243
249
  handle: viewer.handle,
244
250
  url: `/p/${encodeURIComponent(viewer.handle || viewer.did)}`
245
251
  });
246
- if (status === 'interested') return;
252
+ if (status === 'interested' || !share) return;
247
253
  shareModalTitle = "You're going!";
248
254
  shareModalText = `I'm going to "${eventData.name}".\n\n${shareUrl}`;
249
255
  canSetEventComments = false;
@@ -14,6 +14,9 @@ type $$ComponentProps = {
14
14
  * of the canonical atmo.rsvp event URL. Useful for embedders that want
15
15
  * share links to point at their own event page. */
16
16
  shareUrlOverride?: string;
17
+ /** False for an event with no public page to share, such as a private one: no share pop-up
18
+ * after creating the event or answering Going. */
19
+ share?: boolean;
17
20
  /** App-owned actions such as private reporting; omitted in embeds. */
18
21
  extraActions?: Snippet;
19
22
  /** App-owned actions below the attendee lists, with current RSVP counts. */
@@ -33,6 +33,17 @@ export type EditorAdapter = {
33
33
  features: {
34
34
  delete: boolean;
35
35
  recurring: boolean;
36
+ /**
37
+ * False to offer and upload no cover image in the editor, for an event whose page can't
38
+ * show one, such as one that isn't public. EventView doesn't read it: it shows whatever
39
+ * `eventData.media` holds.
40
+ */
41
+ images?: boolean;
42
+ /**
43
+ * False for an event with no public listing to appear in: no Public / Unlisted switch, and
44
+ * the record's discovery preference is left as it is.
45
+ */
46
+ visibility?: boolean;
36
47
  };
37
48
  putRecord(opts: {
38
49
  collection: string;
@@ -30,7 +30,8 @@ export declare function buildEventRecord(args: {
30
30
  endsAt: string;
31
31
  timezone: string;
32
32
  mode: EventMode;
33
- visibility: Visibility;
33
+ /** Null when no Public / Unlisted choice was offered: the discovery preference is left as it is. */
34
+ visibility: Visibility | null;
34
35
  theme: EventTheme;
35
36
  links: Array<{
36
37
  uri: string;
@@ -158,11 +158,14 @@ export async function buildEventRecord(args) {
158
158
  if (Array.isArray(record.locations)) {
159
159
  record.locations = normalizeEventLocations(record.locations);
160
160
  }
161
- const existingPrefs = (record.preferences ??
162
- {});
163
- record.preferences = {
164
- ...existingPrefs,
165
- showInDiscovery: visibility !== 'unlisted'
166
- };
161
+ // With no Public / Unlisted choice offered, the record keeps whatever preference it had.
162
+ if (visibility !== null) {
163
+ const existingPrefs = (record.preferences ??
164
+ {});
165
+ record.preferences = {
166
+ ...existingPrefs,
167
+ showInDiscovery: visibility !== 'unlisted'
168
+ };
169
+ }
167
170
  return record;
168
171
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atmo-dev/kit",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "description": "The shared UI foundation for Atmo apps.",
5
5
  "license": "MIT",
6
6
  "repository": {