@backgold/template-kit 0.1.0 → 0.1.1

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.
Files changed (52) hide show
  1. package/dist/{chunk-KOB36GSF.js → chunk-RJAVFRC6.js} +9 -4
  2. package/dist/{constants-DvTNj4JI.d-Batjcj3Z.d.ts → constants-BAIo_Q5U.d-lQbj1e1-.d.ts} +11 -1
  3. package/dist/{content-api-CYeY0vU8.d.ts → content-api-Cox1-wz5.d.ts} +250 -3
  4. package/dist/contract/content-api-examples.d.ts +17 -3
  5. package/dist/contract/content-api-examples.js +146 -3
  6. package/dist/contract/content-api.d.ts +2 -2
  7. package/dist/contract/content-api.js +1 -1
  8. package/dist/contract/site-templates.d.ts +4 -3
  9. package/dist/contract/site-templates.js +1 -1
  10. package/package.json +5 -5
  11. package/src/components/chrome/Brand.astro +23 -16
  12. package/src/components/sections/About/credentials.ts +0 -10
  13. package/src/components/sections/About/index.astro +6 -3
  14. package/src/components/sections/About/left.astro +6 -3
  15. package/src/components/sections/About/letter.astro +6 -3
  16. package/src/components/sections/About/portrait.astro +2 -2
  17. package/src/components/sections/ContentPost/lesson.ts +14 -7
  18. package/src/components/sections/ContentPost/prose.astro +80 -0
  19. package/src/components/sections/Hero/cover.astro +9 -3
  20. package/src/components/sections/Hero/donate.astro +3 -3
  21. package/src/components/sections/Hero/index.astro +2 -2
  22. package/src/components/sections/Hero/overlap.astro +3 -3
  23. package/src/components/sections/Hero/split.astro +9 -6
  24. package/src/components/sections/Hero/statement.astro +3 -3
  25. package/src/components/sections/Hero/video.astro +3 -3
  26. package/src/components/sections/VoterTools/Lookup.astro +43 -0
  27. package/src/components/sections/VoterTools/dates.astro +9 -5
  28. package/src/components/sections/VoterTools/index.astro +12 -9
  29. package/src/components/sections/VoterTools/polling.astro +9 -6
  30. package/src/components/sections/VoterTools/voter-tools.ts +5 -4
  31. package/src/components/sections/index.ts +3 -0
  32. package/src/components/sections/modules/ModuleFrame.astro +4 -2
  33. package/src/components/store/CollectionPage.astro +40 -0
  34. package/src/components/store/ProductCard.astro +32 -0
  35. package/src/components/store/ProductGrid.astro +16 -0
  36. package/src/components/store/ProductPage.astro +146 -0
  37. package/src/components/store/StorePage.astro +137 -0
  38. package/src/components/store/StoreScript.astro +572 -0
  39. package/src/components/volunteer/props.ts +1 -1
  40. package/src/index.js +0 -1
  41. package/src/layouts/Site.astro +19 -3
  42. package/src/lib/chrome.ts +6 -4
  43. package/src/lib/donate-frame.ts +44 -4
  44. package/src/lib/live.ts +6 -5
  45. package/src/lib/section.ts +11 -0
  46. package/src/lib/shifts.ts +2 -1
  47. package/src/lib/store.ts +521 -0
  48. package/src/routes/catch-all.astro +168 -19
  49. package/src/styles/site.css +71 -0
  50. package/src/styles/store.css +634 -0
  51. package/src/template.ts +1 -1
  52. package/src/routes/volunteer.astro +0 -37
@@ -0,0 +1,634 @@
1
+ /*
2
+ The storefront (board 06 of the store design; src/lib/store.ts): the shop,
3
+ a department's shelf, a listing's page with its island, a collection's
4
+ page, and the header's Cart link. Colours are the band's short names
5
+ (site.css), so a template's tokens and the site's brand carry through;
6
+ nothing scrolls sideways, and every control is at least 44px tall.
7
+ */
8
+
9
+ .store-page [hidden],
10
+ .cart-link[hidden] {
11
+ display: none !important;
12
+ }
13
+
14
+ /* ── The header's Cart link ── */
15
+
16
+ .cart-link {
17
+ display: inline-flex;
18
+ align-items: center;
19
+ gap: 0.4375rem;
20
+ min-height: 2.75rem;
21
+ padding: 0 0.875rem;
22
+ border: 1px solid var(--line-strong);
23
+ border-radius: var(--pill);
24
+ color: var(--ink);
25
+ font-size: var(--text-sm);
26
+ font-weight: 700;
27
+ text-decoration: none;
28
+ white-space: nowrap;
29
+ }
30
+ .cart-link:hover {
31
+ text-decoration: underline;
32
+ }
33
+ .cart-link svg {
34
+ width: 1rem;
35
+ height: 1rem;
36
+ fill: none;
37
+ stroke: currentColor;
38
+ stroke-width: 1.9;
39
+ stroke-linecap: round;
40
+ stroke-linejoin: round;
41
+ }
42
+ .cart-count::before {
43
+ content: '·';
44
+ margin-right: 0.375rem;
45
+ color: var(--muted);
46
+ }
47
+
48
+ /* ── The page ── */
49
+
50
+ .store-page {
51
+ max-width: calc(var(--content) + 2 * var(--gutter));
52
+ margin: 0 auto;
53
+ padding: clamp(1.25rem, 1rem + 1.5vw, 2.25rem) var(--gutter) var(--space);
54
+ }
55
+ .store-page .crumbs {
56
+ margin-bottom: 1.125rem;
57
+ color: var(--muted);
58
+ font-size: var(--text-sm);
59
+ }
60
+ .store-page .crumbs a {
61
+ color: var(--link);
62
+ }
63
+ .store-head {
64
+ margin-bottom: clamp(1.5rem, 1rem + 1.5vw, 2.25rem);
65
+ }
66
+ .store-head h1 {
67
+ margin: 0;
68
+ max-width: 24ch;
69
+ }
70
+ .store-head .lede {
71
+ margin: 0.75rem 0 0;
72
+ }
73
+ /* A page at /store as the shop's opening keeps its own bands, and the grid starts under them. */
74
+ .store-home > .bg-section:last-of-type {
75
+ margin-bottom: clamp(1.5rem, 1rem + 1.5vw, 2.25rem);
76
+ }
77
+
78
+ .store-contribution {
79
+ margin: calc(-1 * clamp(0.75rem, 0.5rem + 0.75vw, 1.125rem)) 0 clamp(1.25rem, 1rem + 1vw, 1.75rem);
80
+ color: var(--muted);
81
+ font-size: var(--text-sm);
82
+ }
83
+ .store-cols {
84
+ display: grid;
85
+ gap: 1.5rem;
86
+ }
87
+ @media (min-width: 56rem) {
88
+ .store-cols {
89
+ grid-template-columns: 13.5rem minmax(0, 1fr);
90
+ gap: 2.5rem;
91
+ align-items: start;
92
+ }
93
+ }
94
+
95
+ /* The rail: two short lists; on a phone they wrap as pills above the grid. */
96
+ .store-rail-head {
97
+ margin: 0 0 0.5rem;
98
+ color: var(--muted);
99
+ font-size: var(--text-xs);
100
+ font-weight: 700;
101
+ letter-spacing: 0.12em;
102
+ text-transform: uppercase;
103
+ }
104
+ .store-rail ul {
105
+ display: flex;
106
+ flex-wrap: wrap;
107
+ gap: 0.5rem;
108
+ margin: 0 0 1.25rem;
109
+ padding: 0;
110
+ list-style: none;
111
+ }
112
+ .store-rail a {
113
+ display: flex;
114
+ align-items: center;
115
+ justify-content: space-between;
116
+ gap: 0.75rem;
117
+ min-height: 2.75rem;
118
+ padding: 0 0.875rem;
119
+ border: 1px solid var(--line);
120
+ border-radius: var(--pill);
121
+ color: var(--ink);
122
+ font-size: var(--text-sm);
123
+ font-weight: 600;
124
+ text-decoration: none;
125
+ }
126
+ .store-rail a span {
127
+ color: var(--muted);
128
+ font-weight: 500;
129
+ font-variant-numeric: tabular-nums;
130
+ }
131
+ .store-rail a[aria-current] {
132
+ border-color: var(--ink);
133
+ font-weight: 800;
134
+ }
135
+ .store-rail a:hover {
136
+ text-decoration: underline;
137
+ }
138
+ @media (min-width: 56rem) {
139
+ .store-rail ul {
140
+ display: block;
141
+ }
142
+ .store-rail a {
143
+ min-height: 2.75rem;
144
+ padding: 0 0.625rem;
145
+ border: 0;
146
+ border-radius: var(--radius);
147
+ }
148
+ .store-rail a[aria-current] {
149
+ background: var(--band-tint);
150
+ color: var(--band-tint-ink);
151
+ }
152
+ .store-rail-sub a {
153
+ padding-left: 1.5rem;
154
+ }
155
+ }
156
+
157
+ /* The filter panel under the rail's lists: the same heads and links, so a
158
+ chosen value is current as a department is; it stacks, never scrolls. */
159
+ .store-filters-clear {
160
+ margin: 0 0 0.5rem;
161
+ }
162
+ .store-rail .store-filters-clear a,
163
+ .store-empty-clear {
164
+ display: inline-flex;
165
+ align-items: center;
166
+ min-height: 2.75rem;
167
+ padding: 0;
168
+ border: 0;
169
+ border-radius: 0;
170
+ background: none;
171
+ color: var(--link);
172
+ font-weight: 700;
173
+ }
174
+
175
+ /* ── The grid and its cards ── */
176
+
177
+ .product-grid {
178
+ display: grid;
179
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
180
+ gap: clamp(0.875rem, 2vw, 1.5rem);
181
+ margin: 0;
182
+ padding: 0;
183
+ list-style: none;
184
+ }
185
+ @media (min-width: 40rem) {
186
+ .product-grid {
187
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
188
+ }
189
+ }
190
+ .product-card {
191
+ display: flex;
192
+ flex-direction: column;
193
+ height: 100%;
194
+ border: 1px solid var(--line);
195
+ border-radius: var(--radius-card);
196
+ overflow: hidden;
197
+ background: var(--surface);
198
+ color: var(--ink);
199
+ text-decoration: none;
200
+ }
201
+ .product-card:hover .product-card-name {
202
+ text-decoration: underline;
203
+ }
204
+ .product-card:focus-visible {
205
+ outline: 3px solid var(--ink);
206
+ outline-offset: 3px;
207
+ }
208
+ .product-card-photo {
209
+ position: relative;
210
+ display: block;
211
+ aspect-ratio: 1 / 1;
212
+ background: var(--band-tint);
213
+ }
214
+ .product-card-photo img {
215
+ display: block;
216
+ width: 100%;
217
+ height: 100%;
218
+ object-fit: cover;
219
+ }
220
+ .product-card-blank {
221
+ display: block;
222
+ width: 100%;
223
+ height: 100%;
224
+ background: var(--band-tint);
225
+ }
226
+ .product-card-flag {
227
+ position: absolute;
228
+ top: 0.625rem;
229
+ left: 0.625rem;
230
+ padding: 0.1875rem 0.625rem;
231
+ border-radius: var(--pill);
232
+ background: var(--surface);
233
+ color: var(--ink);
234
+ font-size: var(--text-xs);
235
+ font-weight: 700;
236
+ }
237
+ .product-card[data-availability='low'] .product-card-flag {
238
+ color: var(--accent);
239
+ }
240
+ .product-card-body {
241
+ display: flex;
242
+ flex-direction: column;
243
+ gap: 0.25rem;
244
+ padding: 0.875rem 1rem 1rem;
245
+ }
246
+ .product-card-name {
247
+ margin: 0;
248
+ font-family: var(--font);
249
+ font-size: var(--text);
250
+ font-weight: 700;
251
+ line-height: 1.3;
252
+ }
253
+ .product-card-price {
254
+ font-weight: 700;
255
+ font-variant-numeric: tabular-nums;
256
+ }
257
+ .product-card-word {
258
+ color: var(--muted);
259
+ font-size: var(--text-sm);
260
+ }
261
+
262
+ .store-pager {
263
+ display: flex;
264
+ flex-wrap: wrap;
265
+ gap: 0.75rem 1.5rem;
266
+ margin-top: 1.5rem;
267
+ }
268
+ .store-pager a {
269
+ display: inline-flex;
270
+ align-items: center;
271
+ min-height: 2.75rem;
272
+ }
273
+
274
+ /* ── The collection band: the shop's one call ── */
275
+
276
+ .store-band {
277
+ display: grid;
278
+ gap: 1.25rem;
279
+ margin-top: clamp(1.75rem, 1rem + 2vw, 2.75rem);
280
+ padding: clamp(1.25rem, 1rem + 1.5vw, 2rem);
281
+ border-radius: var(--radius-card);
282
+ background: var(--band-tint);
283
+ color: var(--band-tint-ink);
284
+ --ink: var(--band-tint-ink);
285
+ --muted: var(--band-tint-muted);
286
+ --accent: var(--band-tint-accent);
287
+ --link: var(--band-tint-link);
288
+ --button: var(--band-tint-button);
289
+ --button-ink: var(--band-tint-button-ink);
290
+ }
291
+ @media (min-width: 40rem) {
292
+ .store-band:has(.store-band-cover) {
293
+ grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
294
+ align-items: center;
295
+ }
296
+ }
297
+ .store-band-cover {
298
+ display: block;
299
+ width: 100%;
300
+ aspect-ratio: 16 / 10;
301
+ object-fit: cover;
302
+ border-radius: var(--radius);
303
+ }
304
+ .store-band-words h2 {
305
+ margin: 0 0 0.5rem;
306
+ }
307
+ .store-band-words p {
308
+ margin: 0;
309
+ }
310
+ .store-band-words .prose {
311
+ margin-bottom: 1rem;
312
+ }
313
+ .store-band-call {
314
+ margin-top: 1rem !important;
315
+ }
316
+
317
+ /* ── A listing's page ── */
318
+
319
+ .product-top {
320
+ display: grid;
321
+ gap: 1.5rem;
322
+ }
323
+ @media (min-width: 56rem) {
324
+ .product-top {
325
+ grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
326
+ gap: 3rem;
327
+ align-items: start;
328
+ }
329
+ }
330
+ .product-photo {
331
+ display: block;
332
+ width: 100%;
333
+ aspect-ratio: 1 / 1;
334
+ object-fit: cover;
335
+ border-radius: var(--radius-card);
336
+ background: var(--band-tint);
337
+ }
338
+ .product-thumbs {
339
+ display: flex;
340
+ flex-wrap: wrap;
341
+ gap: 0.5rem;
342
+ margin: 0.75rem 0 0;
343
+ padding: 0;
344
+ list-style: none;
345
+ }
346
+ .product-thumbs a {
347
+ display: block;
348
+ width: 3.5rem;
349
+ height: 3.5rem;
350
+ border: 2px solid transparent;
351
+ border-radius: var(--radius);
352
+ overflow: hidden;
353
+ }
354
+ .product-thumbs a[aria-current] {
355
+ border-color: var(--ink);
356
+ }
357
+ .product-thumbs img {
358
+ display: block;
359
+ width: 100%;
360
+ height: 100%;
361
+ object-fit: cover;
362
+ }
363
+ .product-words h1 {
364
+ margin: 0;
365
+ font-size: clamp(2rem, 1.5rem + 1.8vw, 2.875rem);
366
+ line-height: 1.05;
367
+ }
368
+ .product-words .lede {
369
+ margin: 0.625rem 0 0;
370
+ }
371
+
372
+ /* The island: the live price, the word, the choice, the questions, Add to cart. */
373
+ .island {
374
+ display: grid;
375
+ gap: 0.75rem;
376
+ margin-top: 1.25rem;
377
+ padding: 1.25rem;
378
+ border: 1px solid var(--line);
379
+ border-radius: var(--radius-card);
380
+ background: var(--surface);
381
+ }
382
+ .island > *,
383
+ .island-form > * {
384
+ margin: 0;
385
+ }
386
+ .island-price {
387
+ display: flex;
388
+ align-items: baseline;
389
+ flex-wrap: wrap;
390
+ gap: 0.625rem;
391
+ }
392
+ .island-now {
393
+ font-family: var(--font-display);
394
+ font-size: var(--h3);
395
+ font-weight: 800;
396
+ font-variant-numeric: tabular-nums;
397
+ }
398
+ .island-was {
399
+ color: var(--muted);
400
+ font-variant-numeric: tabular-nums;
401
+ }
402
+ .island-ship {
403
+ font-size: var(--text-sm);
404
+ font-weight: 600;
405
+ }
406
+ .island-contribution {
407
+ font-size: var(--text-sm);
408
+ }
409
+ .island-note-text {
410
+ margin: 0;
411
+ color: var(--muted);
412
+ font-size: var(--text-sm);
413
+ }
414
+ .product-maker {
415
+ margin-bottom: 0.5rem;
416
+ }
417
+ .island-line,
418
+ .island-help,
419
+ .island-note {
420
+ color: var(--muted);
421
+ font-size: var(--text-sm);
422
+ }
423
+ .island-items {
424
+ display: flex;
425
+ flex-wrap: wrap;
426
+ gap: 0.5rem;
427
+ padding: 0;
428
+ border: 0;
429
+ }
430
+ .island-items legend {
431
+ margin-bottom: 0.5rem;
432
+ font-size: var(--text-sm);
433
+ font-weight: 700;
434
+ }
435
+ .island-item {
436
+ position: relative;
437
+ }
438
+ .island-item input {
439
+ position: absolute;
440
+ opacity: 0;
441
+ inset: 0;
442
+ }
443
+ .island-item span {
444
+ display: inline-flex;
445
+ align-items: center;
446
+ min-width: 2.75rem;
447
+ min-height: 2.75rem;
448
+ justify-content: center;
449
+ padding: 0 0.875rem;
450
+ border: 1px solid var(--line-strong);
451
+ border-radius: var(--pill);
452
+ font-weight: 700;
453
+ }
454
+ .island-item input:checked + span {
455
+ border-color: var(--ink);
456
+ background: var(--ink);
457
+ color: var(--surface);
458
+ }
459
+ .island-item input:focus-visible + span {
460
+ outline: 3px solid var(--ink);
461
+ outline-offset: 2px;
462
+ }
463
+ .island-item input:disabled + span {
464
+ opacity: 0.7;
465
+ }
466
+ .island-form {
467
+ display: grid;
468
+ gap: 0.75rem;
469
+ }
470
+ .island-qty-row {
471
+ display: flex;
472
+ flex-wrap: wrap;
473
+ align-items: center;
474
+ gap: 0.75rem;
475
+ }
476
+ .island-qty {
477
+ display: inline-flex;
478
+ align-items: center;
479
+ border: 1px solid var(--line-strong);
480
+ border-radius: var(--pill);
481
+ }
482
+ .island-step {
483
+ width: 2.75rem;
484
+ height: 2.75rem;
485
+ border: 0;
486
+ background: transparent;
487
+ color: var(--ink);
488
+ font: inherit;
489
+ font-size: 1.25rem;
490
+ font-weight: 700;
491
+ cursor: pointer;
492
+ }
493
+ .island-qty input {
494
+ width: 3rem;
495
+ height: 2.75rem;
496
+ border: 0;
497
+ background: transparent;
498
+ color: var(--ink);
499
+ font: inherit;
500
+ font-weight: 700;
501
+ text-align: center;
502
+ -moz-appearance: textfield;
503
+ appearance: textfield;
504
+ }
505
+ .island-qty input::-webkit-inner-spin-button,
506
+ .island-qty input::-webkit-outer-spin-button {
507
+ -webkit-appearance: none;
508
+ margin: 0;
509
+ }
510
+ .island-questions {
511
+ display: grid;
512
+ gap: 0.75rem;
513
+ }
514
+ .island-questions:empty {
515
+ display: none;
516
+ }
517
+ .island-field {
518
+ display: grid;
519
+ gap: 0.3125rem;
520
+ }
521
+ .island-field label,
522
+ .island-field legend {
523
+ font-size: var(--text-sm);
524
+ font-weight: 700;
525
+ }
526
+ .island-field input:not([type='checkbox']),
527
+ .island-field select,
528
+ .island-field textarea {
529
+ width: 100%;
530
+ min-height: 2.75rem;
531
+ padding: 0.5rem 0.75rem;
532
+ border: 1px solid var(--line-strong);
533
+ border-radius: var(--radius);
534
+ background: var(--surface);
535
+ color: var(--ink);
536
+ font: inherit;
537
+ }
538
+ .island-field fieldset {
539
+ display: grid;
540
+ gap: 0.25rem;
541
+ margin: 0;
542
+ padding: 0;
543
+ border: 0;
544
+ }
545
+ .island-agree {
546
+ display: flex !important;
547
+ align-items: center;
548
+ gap: 0.5rem;
549
+ min-height: 2.75rem;
550
+ font-weight: 500 !important;
551
+ }
552
+ .island-agree input {
553
+ width: 1.125rem;
554
+ height: 1.125rem;
555
+ }
556
+ .island-add,
557
+ .island-retry,
558
+ .island-fallback {
559
+ width: 100%;
560
+ }
561
+ .island-add:disabled {
562
+ border-color: var(--line-strong);
563
+ background: transparent;
564
+ color: var(--muted);
565
+ cursor: not-allowed;
566
+ text-decoration: none;
567
+ }
568
+ .island-status:empty {
569
+ display: none;
570
+ }
571
+
572
+ .product-more {
573
+ display: grid;
574
+ gap: 1.75rem;
575
+ margin-top: clamp(2rem, 1.5rem + 2vw, 3rem);
576
+ }
577
+ @media (min-width: 56rem) {
578
+ .product-more {
579
+ grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
580
+ gap: 3rem;
581
+ }
582
+ }
583
+ .product-more h2,
584
+ .product-related h2 {
585
+ margin: 0 0 0.75rem;
586
+ font-size: var(--h3);
587
+ }
588
+ .product-related h2 a {
589
+ color: var(--link);
590
+ }
591
+ .product-attributes {
592
+ width: 100%;
593
+ border-collapse: collapse;
594
+ font-size: var(--text-sm);
595
+ }
596
+ .product-attributes th,
597
+ .product-attributes td {
598
+ padding: 0.625rem 0;
599
+ border-bottom: 1px solid var(--line);
600
+ text-align: left;
601
+ vertical-align: top;
602
+ overflow-wrap: anywhere;
603
+ }
604
+ .product-attributes th {
605
+ width: 45%;
606
+ padding-right: 1rem;
607
+ color: var(--muted);
608
+ font-weight: 600;
609
+ }
610
+ .product-related {
611
+ margin-top: clamp(2rem, 1.5rem + 2vw, 3rem);
612
+ }
613
+
614
+ /* ── A collection's page ── */
615
+
616
+ .collection-cover {
617
+ display: block;
618
+ width: 100%;
619
+ aspect-ratio: 3 / 1;
620
+ object-fit: cover;
621
+ border-radius: var(--radius-card);
622
+ margin-bottom: 1.5rem;
623
+ }
624
+ @media (max-width: 39.99rem) {
625
+ .collection-cover {
626
+ aspect-ratio: 16 / 9;
627
+ }
628
+ }
629
+
630
+ .store-more {
631
+ max-width: calc(var(--content) + 2 * var(--gutter));
632
+ margin: 0 auto;
633
+ padding: 0 var(--gutter) var(--space);
634
+ }
package/src/template.ts CHANGED
@@ -113,7 +113,7 @@ export interface TemplateConfig {
113
113
  closingCall?: AstroComponent
114
114
  /**
115
115
  * The component that draws the brand at the header's left, given
116
- * `{ name, logoUrl }` as the kit's Brand is (components/chrome/Brand.astro):
116
+ * `{ name, logoUrl, showName }` as the kit's Brand is (components/chrome/Brand.astro):
117
117
  * a template that sets the name in type beside the organization's mark
118
118
  * where a wide logo would read too small. The footer keeps the kit's Brand.
119
119
  * Left out, the kit's.
@@ -1,37 +0,0 @@
1
- ---
2
- // `/volunteer`: the organization's open volunteer shifts (GET /shifts, every
3
- // page of it up to 200, lib/shifts.ts), drawn by the template's
4
- // `volunteer:list` (volunteerLayoutFor; the kit's components/volunteer/list
5
- // when it registers none) under the site's header and footer, with the areas
6
- // of a page that holds events (GET /areas?holds=event): the Top banner and
7
- // Above the footer, and the Sidebar beside the list when it has an item
8
- // (under it on a phone), as on any page. An api that serves no shift feed
9
- // draws the layout's empty state. The page is cached by content version
10
- // like every page; the counts are read again after load.
11
- // The kit's integration serves it, for the template its `template` option
12
- // names (`virtual:backgold-template`).
13
- import { Area } from '@backgold/astro/components'
14
- import { areaEntriesOf } from '@backgold/astro/server'
15
- import Site from '../layouts/Site.astro'
16
- import { volunteerLayoutFor } from '../components/entries'
17
- import { VOLUNTEER_PATH, openShifts, volunteerAreas } from '../lib/shifts'
18
- import template from 'virtual:backgold-template'
19
-
20
- Astro.locals.template = template
21
- const bg = Astro.locals.backgold
22
- if (bg.setup !== null) return new Response(null, { status: 503 })
23
-
24
- const { client, site } = bg
25
- const siteName = site.name ?? site.domain
26
- const [shifts, areas] = await Promise.all([openShifts(client), volunteerAreas(client)])
27
- const ListLayout = volunteerLayoutFor(template, 'list')
28
- const sidebar = areaEntriesOf(areas, 'sidebar').length > 0
29
- ---
30
- <Site template={template} title={`Volunteer · ${siteName}`} description={`Open volunteer shifts with ${siteName}.`} canonicalPath={VOLUNTEER_PATH} page={null} areas={areas}>
31
- <div class:list={['layout', sidebar && 'layout-split']}>
32
- <div class="layout-main">
33
- <ListLayout shifts={shifts ?? []} siteName={siteName} />
34
- </div>
35
- {sidebar && <div class="layout-rail"><Area name="sidebar" areas={areas} components={template.sections} class="rail" /></div>}
36
- </div>
37
- </Site>