@campphillip/widgets 4.0.9 → 4.0.10
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/dist/EventApiContainer.js +26 -24
- package/dist/EventContainer.js +84 -92
- package/dist/calendar.widget.js +19 -17
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { E as c, f as
|
|
3
|
-
const
|
|
1
|
+
import { j as e, r as o } from "./vendor.js";
|
|
2
|
+
import { E as c, f as x } from "./EventContainer.js";
|
|
3
|
+
const d = () => /* @__PURE__ */ e.jsxs(
|
|
4
4
|
"svg",
|
|
5
5
|
{
|
|
6
6
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -14,48 +14,50 @@ const u = () => /* @__PURE__ */ t.jsxs(
|
|
|
14
14
|
strokeLinejoin: "round",
|
|
15
15
|
className: "feather feather-calendar",
|
|
16
16
|
children: [
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */
|
|
17
|
+
/* @__PURE__ */ e.jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
18
|
+
/* @__PURE__ */ e.jsx("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
|
|
19
|
+
/* @__PURE__ */ e.jsx("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
|
|
20
|
+
/* @__PURE__ */ e.jsx("line", { x1: "3", y1: "10", x2: "21", y2: "10" })
|
|
21
21
|
]
|
|
22
22
|
}
|
|
23
|
-
),
|
|
24
|
-
calendarButton:
|
|
25
|
-
},
|
|
26
|
-
events:
|
|
23
|
+
), h = "_calendarButton_1m4jh_1", u = {
|
|
24
|
+
calendarButton: h
|
|
25
|
+
}, v = ({
|
|
26
|
+
events: t,
|
|
27
27
|
loading: n
|
|
28
28
|
}) => {
|
|
29
|
-
const s = /* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
29
|
+
const s = /* @__PURE__ */ e.jsxs("a", { className: u.calendarButton, href: "/calendar", children: [
|
|
30
|
+
/* @__PURE__ */ e.jsx(d, {}),
|
|
31
31
|
"Check out our calendar"
|
|
32
32
|
] });
|
|
33
|
-
return /* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ e.jsx(
|
|
34
34
|
c,
|
|
35
35
|
{
|
|
36
|
-
events:
|
|
36
|
+
events: t,
|
|
37
37
|
loading: n,
|
|
38
38
|
title: "What's going on at Camp?",
|
|
39
39
|
headerActions: s
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
|
-
},
|
|
43
|
-
events:
|
|
42
|
+
}, j = ({
|
|
43
|
+
events: t,
|
|
44
44
|
loading: n
|
|
45
|
-
}) => /* @__PURE__ */
|
|
45
|
+
}) => /* @__PURE__ */ e.jsx(
|
|
46
46
|
c,
|
|
47
47
|
{
|
|
48
|
-
events:
|
|
48
|
+
events: t,
|
|
49
49
|
loading: n,
|
|
50
50
|
title: "Upcoming Board Events"
|
|
51
51
|
}
|
|
52
|
-
),
|
|
52
|
+
), E = ({ type: t }) => {
|
|
53
53
|
const [n, s] = o.useState([]), [a, i] = o.useState(!0);
|
|
54
54
|
return o.useEffect(() => {
|
|
55
55
|
async function l() {
|
|
56
|
-
const x = e === "events" ? h : d;
|
|
57
56
|
try {
|
|
58
|
-
const r = await x(
|
|
57
|
+
const r = await x({
|
|
58
|
+
eventType: t === "events" ? "event" : "board-event",
|
|
59
|
+
limit: 3
|
|
60
|
+
});
|
|
59
61
|
s(r);
|
|
60
62
|
} catch (r) {
|
|
61
63
|
console.error(r);
|
|
@@ -64,8 +66,8 @@ const u = () => /* @__PURE__ */ t.jsxs(
|
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
l();
|
|
67
|
-
}, [
|
|
69
|
+
}, [t]), t === "events" ? /* @__PURE__ */ e.jsx(v, { events: n, loading: a }) : /* @__PURE__ */ e.jsx(j, { events: n, loading: a });
|
|
68
70
|
};
|
|
69
71
|
export {
|
|
70
|
-
|
|
72
|
+
E
|
|
71
73
|
};
|
package/dist/EventContainer.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { s as
|
|
2
|
-
import { j as e, S as
|
|
3
|
-
const V = async () =>
|
|
1
|
+
import { s as N, u as y } from "./sanityClient.js";
|
|
2
|
+
import { j as e, S as M, a as f, b as x, P as S, i as g, f as C, d as q, R as D, r as B } from "./vendor.js";
|
|
3
|
+
const V = async (t) => {
|
|
4
|
+
const { eventType: a = "event", limit: n, includePassedEvents: r = !1 } = t || {}, v = r ? "" : "&& endDate >= now()", u = n ? `[0...${n}]` : "", l = `*[_type == '${a}' ${v}] | order(startDate asc) ${u}
|
|
4
5
|
{
|
|
5
6
|
name,
|
|
6
7
|
image,
|
|
@@ -10,162 +11,153 @@ const V = async () => await j.fetch(`*[_type == 'event'] | order(startDate asc)
|
|
|
10
11
|
shortDescription,
|
|
11
12
|
buttons,
|
|
12
13
|
isSummerCampEvent
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
image,
|
|
17
|
-
imageType,
|
|
18
|
-
startDate,
|
|
19
|
-
endDate,
|
|
20
|
-
shortDescription,
|
|
21
|
-
buttons,
|
|
22
|
-
isSummerCampEvent
|
|
23
|
-
}`), E = "_eventCard_17x4q_1", b = "_eventCardBody_17x4q_13", T = "_image_17x4q_27", W = "_square_17x4q_34", $ = "_eventCardTitle_17x4q_39", G = "_eventCardDate_17x4q_46", k = "_eventCardDescription_17x4q_51", H = "_eventButtons_17x4q_55", w = "_eventButton_17x4q_55", I = "_summerCamp_17x4q_140", n = {
|
|
14
|
+
}`;
|
|
15
|
+
return await N.fetch(l);
|
|
16
|
+
}, E = "_eventCard_17x4q_1", T = "_eventCardBody_17x4q_13", $ = "_image_17x4q_27", b = "_square_17x4q_34", W = "_eventCardTitle_17x4q_39", G = "_eventCardDate_17x4q_46", k = "_eventCardDescription_17x4q_51", H = "_eventButtons_17x4q_55", w = "_eventButton_17x4q_55", F = "_summerCamp_17x4q_140", m = {
|
|
24
17
|
eventCard: E,
|
|
25
|
-
eventCardBody:
|
|
26
|
-
image:
|
|
27
|
-
square:
|
|
28
|
-
eventCardTitle:
|
|
18
|
+
eventCardBody: T,
|
|
19
|
+
image: $,
|
|
20
|
+
square: b,
|
|
21
|
+
eventCardTitle: W,
|
|
29
22
|
eventCardDate: G,
|
|
30
23
|
eventCardDescription: k,
|
|
31
24
|
eventButtons: H,
|
|
32
25
|
eventButton: w,
|
|
33
|
-
summerCamp:
|
|
34
|
-
},
|
|
26
|
+
summerCamp: F
|
|
27
|
+
}, _ = ({
|
|
35
28
|
name: t,
|
|
36
29
|
image: a,
|
|
37
|
-
imageType:
|
|
38
|
-
startDate:
|
|
39
|
-
endDate:
|
|
40
|
-
shortDescription:
|
|
41
|
-
buttons:
|
|
42
|
-
loading:
|
|
43
|
-
containerStyle:
|
|
30
|
+
imageType: n,
|
|
31
|
+
startDate: r,
|
|
32
|
+
endDate: v,
|
|
33
|
+
shortDescription: u,
|
|
34
|
+
buttons: l,
|
|
35
|
+
loading: j,
|
|
36
|
+
containerStyle: c,
|
|
44
37
|
isSummerCampEvent: o
|
|
45
38
|
}) => {
|
|
46
|
-
const
|
|
47
|
-
return /* @__PURE__ */ e.jsx(
|
|
39
|
+
const p = I(r, v);
|
|
40
|
+
return /* @__PURE__ */ e.jsx(M, { baseColor: "#dcdcdc", children: /* @__PURE__ */ e.jsxs(
|
|
48
41
|
"div",
|
|
49
42
|
{
|
|
50
|
-
className:
|
|
51
|
-
|
|
52
|
-
o &&
|
|
43
|
+
className: f(
|
|
44
|
+
m.eventCard,
|
|
45
|
+
o && m.summerCamp
|
|
53
46
|
),
|
|
54
|
-
style: { ...
|
|
47
|
+
style: { ...c },
|
|
55
48
|
children: [
|
|
56
49
|
a ? /* @__PURE__ */ e.jsx(
|
|
57
50
|
"img",
|
|
58
51
|
{
|
|
59
|
-
src:
|
|
60
|
-
className:
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
src: y(a).height(400).url(),
|
|
53
|
+
className: f(
|
|
54
|
+
m.image,
|
|
55
|
+
n === "square" && m.square
|
|
63
56
|
),
|
|
64
57
|
crossOrigin: "anonymous",
|
|
65
58
|
alt: ""
|
|
66
59
|
}
|
|
67
|
-
) : /* @__PURE__ */ e.jsx("div", { className:
|
|
68
|
-
|
|
60
|
+
) : /* @__PURE__ */ e.jsx("div", { className: m.image, children: /* @__PURE__ */ e.jsx(
|
|
61
|
+
x,
|
|
69
62
|
{
|
|
70
63
|
height: 400,
|
|
71
64
|
style: { lineHeight: "normal" }
|
|
72
65
|
}
|
|
73
66
|
) }),
|
|
74
|
-
/* @__PURE__ */ e.jsxs("div", { className:
|
|
67
|
+
/* @__PURE__ */ e.jsxs("div", { className: m.eventCardBody, children: [
|
|
75
68
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
76
|
-
/* @__PURE__ */ e.jsx("h3", { className:
|
|
77
|
-
/* @__PURE__ */ e.jsx("div", { className:
|
|
69
|
+
/* @__PURE__ */ e.jsx("h3", { className: m.eventCardTitle, children: t || /* @__PURE__ */ e.jsx(x, {}) }),
|
|
70
|
+
/* @__PURE__ */ e.jsx("div", { className: m.eventCardDate, children: p || /* @__PURE__ */ e.jsx(x, {}) })
|
|
78
71
|
] }),
|
|
79
|
-
/* @__PURE__ */ e.jsx("div", { className:
|
|
80
|
-
/* @__PURE__ */ e.jsx("div", { className:
|
|
72
|
+
/* @__PURE__ */ e.jsx("div", { className: m.eventCardDescription, children: u ? /* @__PURE__ */ e.jsx(S, { value: u }) : /* @__PURE__ */ e.jsx(x, { count: 7 }) }),
|
|
73
|
+
/* @__PURE__ */ e.jsx("div", { className: m.eventButtons, children: l ? l.map(({ url: s, text: i, _key: h }) => /* @__PURE__ */ e.jsx(
|
|
81
74
|
"a",
|
|
82
75
|
{
|
|
83
76
|
href: s,
|
|
84
|
-
className:
|
|
85
|
-
children: /* @__PURE__ */ e.jsx("div", { children:
|
|
77
|
+
className: m.eventButton,
|
|
78
|
+
children: /* @__PURE__ */ e.jsx("div", { children: i })
|
|
86
79
|
},
|
|
87
|
-
|
|
88
|
-
)) :
|
|
80
|
+
h
|
|
81
|
+
)) : j && /* @__PURE__ */ e.jsx(x, { className: m.eventButton }) })
|
|
89
82
|
] })
|
|
90
83
|
]
|
|
91
84
|
}
|
|
92
85
|
) });
|
|
93
86
|
};
|
|
94
|
-
function
|
|
87
|
+
function I(t, a) {
|
|
95
88
|
if (!t || !a) return null;
|
|
96
|
-
const
|
|
97
|
-
return
|
|
89
|
+
const n = new Date(t), r = new Date(a);
|
|
90
|
+
return g(n, r) ? C(n, "MMMM d") : q(n, r) ? C(n, "MMMM d") + " – " + C(r, "d") : C(n, "MMMM d") + " – " + C(r, "MMMM d");
|
|
98
91
|
}
|
|
99
|
-
const
|
|
100
|
-
eventsContainer:
|
|
101
|
-
eventsHeader:
|
|
102
|
-
eventsList:
|
|
92
|
+
const L = "_eventsContainer_1fuij_1", P = "_eventsHeader_1fuij_11", R = "_eventsList_1fuij_28", O = "_eventWrapper_1fuij_34", z = "_summerCampGroup_1fuij_38", J = "_summerCampTitle_1fuij_50", K = "_empty_1fuij_60", d = {
|
|
93
|
+
eventsContainer: L,
|
|
94
|
+
eventsHeader: P,
|
|
95
|
+
eventsList: R,
|
|
103
96
|
eventWrapper: O,
|
|
104
97
|
summerCampGroup: z,
|
|
105
98
|
summerCampTitle: J,
|
|
106
99
|
empty: K
|
|
107
|
-
},
|
|
100
|
+
}, X = ({
|
|
108
101
|
events: t,
|
|
109
102
|
loading: a,
|
|
110
|
-
className:
|
|
111
|
-
title:
|
|
112
|
-
headerActions:
|
|
113
|
-
groupSummerCampEvents:
|
|
103
|
+
className: n,
|
|
104
|
+
title: r = "What's going on at Camp?",
|
|
105
|
+
headerActions: v,
|
|
106
|
+
groupSummerCampEvents: u = !1
|
|
114
107
|
}) => {
|
|
115
|
-
const
|
|
108
|
+
const l = D.useMemo(() => {
|
|
116
109
|
if (!t) return [];
|
|
117
|
-
if (!
|
|
118
|
-
return t.map((s,
|
|
119
|
-
const
|
|
120
|
-
if (
|
|
121
|
-
return t.map((s,
|
|
122
|
-
let
|
|
123
|
-
return t.flatMap((s,
|
|
124
|
-
}, [t,
|
|
125
|
-
return /* @__PURE__ */ e.jsxs("div", { className: `${
|
|
126
|
-
(
|
|
127
|
-
|
|
128
|
-
|
|
110
|
+
if (!u)
|
|
111
|
+
return t.map((s, i) => ({ isSummerCamp: !1, events: [s], startIndex: i }));
|
|
112
|
+
const c = t.filter((s) => s.isSummerCampEvent), o = t.findIndex((s) => s.isSummerCampEvent);
|
|
113
|
+
if (c.length === 0)
|
|
114
|
+
return t.map((s, i) => ({ isSummerCamp: !1, events: [s], startIndex: i }));
|
|
115
|
+
let p = !1;
|
|
116
|
+
return t.flatMap((s, i) => s.isSummerCampEvent ? p ? [] : (p = !0, [{ isSummerCamp: !0, events: c, startIndex: o }]) : [{ isSummerCamp: !1, events: [s], startIndex: i }]);
|
|
117
|
+
}, [t, u]), j = l.findIndex((c) => c.isSummerCamp);
|
|
118
|
+
return /* @__PURE__ */ e.jsxs("div", { className: `${d.eventsContainer} ${n || ""}`, children: [
|
|
119
|
+
(r || v) && /* @__PURE__ */ e.jsxs("div", { className: d.eventsHeader, children: [
|
|
120
|
+
r && /* @__PURE__ */ e.jsx("h1", { children: r }),
|
|
121
|
+
v
|
|
129
122
|
] }),
|
|
130
|
-
/* @__PURE__ */ e.jsx("div", { className:
|
|
131
|
-
/* @__PURE__ */ e.jsx("div", { className:
|
|
132
|
-
/* @__PURE__ */ e.jsx("div", { className:
|
|
133
|
-
/* @__PURE__ */ e.jsx("div", { className:
|
|
134
|
-
] }) :
|
|
135
|
-
const
|
|
136
|
-
return
|
|
123
|
+
/* @__PURE__ */ e.jsx("div", { className: d.eventsList, children: a ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
124
|
+
/* @__PURE__ */ e.jsx("div", { className: d.eventWrapper, children: /* @__PURE__ */ e.jsx(_, { loading: a }, "loading-1") }),
|
|
125
|
+
/* @__PURE__ */ e.jsx("div", { className: d.eventWrapper, children: /* @__PURE__ */ e.jsx(_, { loading: a }, "loading-2") }),
|
|
126
|
+
/* @__PURE__ */ e.jsx("div", { className: d.eventWrapper, children: /* @__PURE__ */ e.jsx(_, { loading: a }, "loading-3") })
|
|
127
|
+
] }) : l.length > 0 ? l.map((c, o) => {
|
|
128
|
+
const p = o === j;
|
|
129
|
+
return c.isSummerCamp ? /* @__PURE__ */ e.jsxs(
|
|
137
130
|
"div",
|
|
138
131
|
{
|
|
139
|
-
className:
|
|
140
|
-
id:
|
|
132
|
+
className: d.summerCampGroup,
|
|
133
|
+
id: p ? "summer-camp" : void 0,
|
|
141
134
|
children: [
|
|
142
|
-
/* @__PURE__ */ e.jsx("h2", { className:
|
|
143
|
-
|
|
144
|
-
|
|
135
|
+
/* @__PURE__ */ e.jsx("h2", { className: d.summerCampTitle, children: "🏕️ Summer Camp" }),
|
|
136
|
+
c.events.map((s, i) => /* @__PURE__ */ B.createElement(
|
|
137
|
+
_,
|
|
145
138
|
{
|
|
146
139
|
...s,
|
|
147
|
-
key: `${o}-${
|
|
140
|
+
key: `${o}-${i}`,
|
|
148
141
|
loading: a
|
|
149
142
|
}
|
|
150
143
|
))
|
|
151
144
|
]
|
|
152
145
|
},
|
|
153
146
|
`group-${o}`
|
|
154
|
-
) :
|
|
155
|
-
|
|
147
|
+
) : c.events.map((s, i) => /* @__PURE__ */ e.jsx("div", { className: d.eventWrapper, children: /* @__PURE__ */ e.jsx(
|
|
148
|
+
_,
|
|
156
149
|
{
|
|
157
150
|
...s,
|
|
158
151
|
loading: a
|
|
159
152
|
}
|
|
160
|
-
) }, `${o}-${
|
|
161
|
-
}) : /* @__PURE__ */ e.jsxs("div", { className:
|
|
153
|
+
) }, `${o}-${i}`));
|
|
154
|
+
}) : /* @__PURE__ */ e.jsxs("div", { className: d.empty, children: [
|
|
162
155
|
/* @__PURE__ */ e.jsx("img", { src: "https://d2114hmso7dut1.cloudfront.net/customers/096355b6-1a03-11eb-a9c3-0614187498c1/sites/096f9d4e-1a03-11eb-b2dd-0614187498c1/files/67900ba0-5f83-11eb-9222-e3d4d8baf1a9/original/file.png?t=1611630366" }),
|
|
163
156
|
"No upcoming events. Check back later!"
|
|
164
157
|
] }) })
|
|
165
158
|
] });
|
|
166
159
|
};
|
|
167
160
|
export {
|
|
168
|
-
|
|
169
|
-
X as a,
|
|
161
|
+
X as E,
|
|
170
162
|
V as f
|
|
171
163
|
};
|
package/dist/calendar.widget.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { j as t, r as o, c as
|
|
2
|
-
import { E, f as
|
|
3
|
-
const
|
|
4
|
-
summerEventsButton:
|
|
1
|
+
import { j as t, r as o, c as u, R as i } from "./vendor.js";
|
|
2
|
+
import { E as l, f as E } from "./EventContainer.js";
|
|
3
|
+
const d = "_summerEventsButton_qc18l_2", p = {
|
|
4
|
+
summerEventsButton: d
|
|
5
5
|
}, v = ({
|
|
6
6
|
events: e,
|
|
7
7
|
loading: s
|
|
@@ -9,7 +9,7 @@ const p = "_summerEventsButton_qc18l_2", f = {
|
|
|
9
9
|
const n = e?.some((r) => r.isSummerCampEvent) ? /* @__PURE__ */ t.jsxs(
|
|
10
10
|
"a",
|
|
11
11
|
{
|
|
12
|
-
className:
|
|
12
|
+
className: p.summerEventsButton,
|
|
13
13
|
href: "#summer-camp",
|
|
14
14
|
children: [
|
|
15
15
|
/* @__PURE__ */ t.jsx("span", { children: "🏕️" }),
|
|
@@ -18,7 +18,7 @@ const p = "_summerEventsButton_qc18l_2", f = {
|
|
|
18
18
|
}
|
|
19
19
|
) : null;
|
|
20
20
|
return /* @__PURE__ */ t.jsx(
|
|
21
|
-
|
|
21
|
+
l,
|
|
22
22
|
{
|
|
23
23
|
events: e,
|
|
24
24
|
loading: s,
|
|
@@ -27,28 +27,30 @@ const p = "_summerEventsButton_qc18l_2", f = {
|
|
|
27
27
|
groupSummerCampEvents: !0
|
|
28
28
|
}
|
|
29
29
|
);
|
|
30
|
-
},
|
|
31
|
-
const [
|
|
30
|
+
}, f = () => {
|
|
31
|
+
const [e, s] = o.useState([]), [c, n] = o.useState(!0);
|
|
32
32
|
return o.useEffect(() => {
|
|
33
|
-
async function
|
|
33
|
+
async function r() {
|
|
34
34
|
try {
|
|
35
|
-
const a = await
|
|
36
|
-
|
|
35
|
+
const a = await E({
|
|
36
|
+
includePassedEvents: !0
|
|
37
|
+
});
|
|
38
|
+
s(a);
|
|
37
39
|
} catch (a) {
|
|
38
40
|
console.error(a);
|
|
39
41
|
} finally {
|
|
40
|
-
|
|
42
|
+
n(!1);
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
|
-
|
|
45
|
+
r();
|
|
44
46
|
}, []), /* @__PURE__ */ t.jsx(
|
|
45
47
|
v,
|
|
46
48
|
{
|
|
47
|
-
events:
|
|
48
|
-
loading:
|
|
49
|
+
events: e,
|
|
50
|
+
loading: c
|
|
49
51
|
}
|
|
50
52
|
);
|
|
51
53
|
}, m = document.getElementById("camp-calendar");
|
|
52
|
-
m &&
|
|
53
|
-
/* @__PURE__ */ t.jsx(i.StrictMode, { children: /* @__PURE__ */ t.jsx(
|
|
54
|
+
m && u.createRoot(m).render(
|
|
55
|
+
/* @__PURE__ */ t.jsx(i.StrictMode, { children: /* @__PURE__ */ t.jsx(f, {}) })
|
|
54
56
|
);
|