@streamlayer/react-ui 0.99.0 → 0.100.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/lib/assets/style.css +1 -1
- package/lib/hooks/showIn.js +45 -0
- package/lib/ui/app/Features/Gamification/Leaderboard.d.ts +1 -2
- package/lib/ui/app/Features/Gamification/Leaderboard.js +24 -26
- package/lib/ui/app/Features/Gamification/Question.js +19 -19
- package/lib/ui/app/Features/Gamification/Tabs.d.ts +1 -2
- package/lib/ui/app/Features/Gamification/Tabs.js +27 -37
- package/lib/ui/app/Features/Gamification/index.d.ts +1 -2
- package/lib/ui/app/Features/Gamification/index.js +46 -40
- package/lib/ui/app/Features/index.d.ts +1 -2
- package/lib/ui/app/Features/index.js +16 -17
- package/lib/ui/app/Notifications/Onboarding/index.js +33 -33
- package/lib/ui/app/masters.js +42 -42
- package/lib/ui/app/useSdkScroll.js +30 -27
- package/lib/ui/gamification/leaderboard/list-item/index.d.ts +0 -1
- package/lib/ui/gamification/leaderboard/list-item/index.js +16 -16
- package/lib/ui/gamification/leaderboard/static.js +31 -24
- package/lib/ui/gamification/question/index.d.ts +1 -3
- package/lib/ui/gamification/question/index.js +25 -26
- package/lib/ui/gamification/question/insight/index.d.ts +0 -1
- package/lib/ui/gamification/question/insight/index.js +7 -7
- package/lib/ui/gamification/question/list/index.js +19 -35
- package/lib/ui/gamification/question/twitter/index.d.ts +0 -1
- package/lib/ui/gamification/question/twitter/index.js +8 -8
- package/lib/ui/gamification/vote/alert/index.d.ts +8 -0
- package/lib/ui/gamification/vote/alert/index.js +11 -0
- package/lib/ui/gamification/vote/{expired-alert → alert}/styles.js +7 -7
- package/lib/ui/gamification/vote/feedback/index.js +31 -31
- package/lib/ui/gamification/vote/index.d.ts +1 -0
- package/lib/ui/gamification/vote/index.js +109 -89
- package/lib/ui/gamification/vote/styles.d.ts +1 -0
- package/lib/ui/gamification/vote/styles.js +14 -8
- package/lib/ui/gamification/vote/vote-option/index.js +28 -28
- package/lib/ui/gamification/vote/vote-option/styles.d.ts +1 -0
- package/lib/ui/gamification/vote/vote-option/styles.js +34 -29
- package/lib/ui/modal/index.js +31 -31
- package/lib/ui/show-in/index.d.ts +1 -0
- package/lib/ui/show-in/index.js +12 -10
- package/package.json +19 -20
- package/lib/ui/gamification/vote/expired-alert/index.d.ts +0 -7
- package/lib/ui/gamification/vote/expired-alert/index.js +0 -11
- /package/lib/ui/gamification/vote/{expired-alert → alert}/styles.d.ts +0 -0
|
@@ -1,69 +1,69 @@
|
|
|
1
1
|
import { jsx as i, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import { QuestionType as
|
|
2
|
+
import { QuestionType as d } from "@streamlayer/sdk-web-types";
|
|
3
3
|
import { SvgIcon as h } from "../../../icons/index.js";
|
|
4
|
-
import { ShowInContainer as j, Container as
|
|
5
|
-
const
|
|
4
|
+
import { ShowInContainer as j, Container as E, FeedbackContainer as r, IconPrediction as C, FeedbackDescription as l, FeedbackIconWrap as a, FeedbackHeader as F, FeedbackText as P, DynamicWrap as L, FeedbackTitle as Y } from "./styles.js";
|
|
5
|
+
const J = ({
|
|
6
6
|
feedbackMessages: t,
|
|
7
|
-
questionVotedCorrectly:
|
|
7
|
+
questionVotedCorrectly: u,
|
|
8
8
|
questionVoted: m,
|
|
9
|
-
questionType:
|
|
9
|
+
questionType: e,
|
|
10
10
|
hasCorrectAnswer: b,
|
|
11
|
-
showExpiredNotification:
|
|
12
|
-
showClosedNotificationTrivia:
|
|
11
|
+
showExpiredNotification: w,
|
|
12
|
+
showClosedNotificationTrivia: x,
|
|
13
13
|
votedInCurrentRender: p,
|
|
14
14
|
votedAfterQuestionClosed: S,
|
|
15
15
|
voteErrorMessage: c,
|
|
16
|
-
enteredAnActiveQuestion:
|
|
16
|
+
enteredAnActiveQuestion: D,
|
|
17
17
|
marketClosed: W,
|
|
18
18
|
percentsAnimated: Q
|
|
19
19
|
}) => {
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
-
c && /* @__PURE__ */ n(
|
|
20
|
+
const y = m && (e === d.TRIVIA || e === d.PREDICTION), O = e === d.PREDICTION && !b, k = W && e === d.PREDICTION && !m && !D || e === d.PREDICTION && S && p && D, T = y && O, N = y && b, R = e === d.PREDICTION && m && p && b, f = m && e === d.POLL && p, I = u ? "correct" : "incorrect", o = u ? t == null ? void 0 : t.correctFeedback : t == null ? void 0 : t.incorrectFeedback;
|
|
21
|
+
return w || x || T || N || k || f || R || c ? /* @__PURE__ */ i(j, { enabled: p, animate: Q, children: /* @__PURE__ */ n(E, { "data-prediction": O, children: [
|
|
22
|
+
c && !k && /* @__PURE__ */ n(r, { children: [
|
|
23
23
|
/* @__PURE__ */ i(C, { name: "questionExpired" }),
|
|
24
|
-
/* @__PURE__ */ i(
|
|
24
|
+
/* @__PURE__ */ i(l, { children: c })
|
|
25
25
|
] }),
|
|
26
|
-
!c &&
|
|
26
|
+
!c && w && /* @__PURE__ */ n(r, { children: [
|
|
27
27
|
/* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(h, { name: "questionExpired" }) }),
|
|
28
28
|
/* @__PURE__ */ n("div", { children: [
|
|
29
|
-
/* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(
|
|
30
|
-
/* @__PURE__ */ i(
|
|
29
|
+
/* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(l, { children: "Question Expired" }) }),
|
|
30
|
+
/* @__PURE__ */ i(P, { children: "You can still answer to see if you're correct, but no points are awarded for expired questions." })
|
|
31
31
|
] })
|
|
32
32
|
] }),
|
|
33
|
-
!c &&
|
|
33
|
+
!c && x && /* @__PURE__ */ n(r, { children: [
|
|
34
34
|
/* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(h, { name: "questionExpired" }) }),
|
|
35
35
|
/* @__PURE__ */ n("div", { children: [
|
|
36
|
-
/* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(
|
|
37
|
-
/* @__PURE__ */ i(
|
|
36
|
+
/* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(l, { children: "Question Closed" }) }),
|
|
37
|
+
/* @__PURE__ */ i(P, { children: "This question was answered after the moderator closed the question. So the points for this answer won’t tally." })
|
|
38
38
|
] })
|
|
39
39
|
] }),
|
|
40
|
-
|
|
40
|
+
k && /* @__PURE__ */ n(r, { children: [
|
|
41
41
|
/* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(h, { name: "questionExpired" }) }),
|
|
42
42
|
/* @__PURE__ */ n("div", { children: [
|
|
43
|
-
/* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(
|
|
44
|
-
/* @__PURE__ */ i(
|
|
43
|
+
/* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(l, { children: "Question Closed" }) }),
|
|
44
|
+
/* @__PURE__ */ i(P, { children: "This event has already taken place, so the ability to make a prediction on its outcome is no longer available." })
|
|
45
45
|
] })
|
|
46
46
|
] }),
|
|
47
|
-
!c && T && /* @__PURE__ */ n(
|
|
47
|
+
!c && T && /* @__PURE__ */ n(r, { children: [
|
|
48
48
|
/* @__PURE__ */ i(C, { name: "icon-prediction" }),
|
|
49
|
-
/* @__PURE__ */ n(
|
|
49
|
+
/* @__PURE__ */ n(l, { children: [
|
|
50
50
|
"Your pick has been recorded. ",
|
|
51
|
-
/* @__PURE__ */ i(
|
|
51
|
+
/* @__PURE__ */ i(L, { children: "We’ll notify you of the result." })
|
|
52
52
|
] })
|
|
53
53
|
] }),
|
|
54
|
-
!c && f && /* @__PURE__ */ n(
|
|
54
|
+
!c && f && /* @__PURE__ */ n(r, { children: [
|
|
55
55
|
/* @__PURE__ */ i(a, { "data-feedback-type": "correct", children: /* @__PURE__ */ i(h, { name: "correct" }) }),
|
|
56
|
-
/* @__PURE__ */ i(
|
|
56
|
+
/* @__PURE__ */ i(l, { children: "Thanks for answering. Please stay tuned for the next question." })
|
|
57
57
|
] }),
|
|
58
|
-
!c && (N || R) && /* @__PURE__ */ n(
|
|
59
|
-
/* @__PURE__ */ i(a, { "data-feedback-type":
|
|
58
|
+
!c && (N || R) && /* @__PURE__ */ n(r, { children: [
|
|
59
|
+
/* @__PURE__ */ i(a, { "data-feedback-type": I, children: /* @__PURE__ */ i(h, { name: I }) }),
|
|
60
60
|
/* @__PURE__ */ i("div", { children: /* @__PURE__ */ n(F, { children: [
|
|
61
|
-
/* @__PURE__ */ i(
|
|
62
|
-
/* @__PURE__ */ i(
|
|
61
|
+
/* @__PURE__ */ i(Y, { "data-feedback-type": I, children: o == null ? void 0 : o.title }),
|
|
62
|
+
/* @__PURE__ */ i(l, { children: o == null ? void 0 : o.description })
|
|
63
63
|
] }) })
|
|
64
64
|
] })
|
|
65
65
|
] }) }) : null;
|
|
66
66
|
};
|
|
67
67
|
export {
|
|
68
|
-
|
|
68
|
+
J as Feedback
|
|
69
69
|
};
|
|
@@ -1,147 +1,167 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
1
|
+
import { jsx as s, jsxs as y, Fragment as D } from "react/jsx-runtime";
|
|
2
|
+
import { useHideTransition as ht } from "../../../hooks/showIn.js";
|
|
3
|
+
import { useRef as J, useState as c, useEffect as g, useCallback as w, useMemo as u } from "react";
|
|
4
|
+
import { QuestionType as a, QuestionStatus as k } from "@streamlayer/sdk-web-types";
|
|
5
|
+
import { Skeleton as N } from "../../skeleton/index.js";
|
|
6
|
+
import { Alert as Tt } from "./alert/index.js";
|
|
7
|
+
import { Feedback as gt } from "./feedback/index.js";
|
|
8
|
+
import { Container as K, Content as U, Options as X, QuestionScrollContainer as yt, AlertContainer as It, Title as Vt } from "./styles.js";
|
|
9
|
+
import { VotingOption as Ct } from "./vote-option/index.js";
|
|
10
|
+
import { WinBar as Et } from "./win-bar/index.js";
|
|
11
|
+
const vt = (t, l) => {
|
|
10
12
|
switch (t) {
|
|
11
13
|
case "already_voted":
|
|
12
|
-
return
|
|
14
|
+
return l === a.POLL ? "You’ve already answered this question on another device." : "You’ve already answered this question on another device. So the points for this answer won't tally.";
|
|
13
15
|
default:
|
|
14
16
|
return "Something went wrong, please try again";
|
|
15
17
|
}
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
}, kt = () => /* @__PURE__ */ s(K, { children: /* @__PURE__ */ y(U, { children: [
|
|
19
|
+
/* @__PURE__ */ s(N, { loading: !0, style: { height: "40px", borderRadius: "100px" } }),
|
|
20
|
+
/* @__PURE__ */ s(N, { loading: !0, style: { height: "24px", margin: "16px 0" } }),
|
|
21
|
+
/* @__PURE__ */ s(X, { children: Array.from({ length: 5 }).map((t, l) => /* @__PURE__ */ s(N, { loading: !0, style: { height: "44px" } }, l)) })
|
|
22
|
+
] }) }), Nt = ({ openedQuestion: t, isLoading: l, vote: b, close: M }) => {
|
|
23
|
+
var z, G;
|
|
24
|
+
const Z = t.subject, r = t.type, h = t.status, I = (z = t.options) == null ? void 0 : z.options, T = t.marketClosed, A = t.id, L = J(), [V, $] = c(!1), [R, Q] = c(!1), [C, B] = c(!0), [f, tt] = c(!1), [W, et] = c(!1), [Y, p] = c(""), [x, rt] = c(""), [O, j] = c(!1), [it, nt] = c(!1), { runAnimation: E, finished: H } = ht();
|
|
25
|
+
g(() => {
|
|
26
|
+
H && M();
|
|
27
|
+
}, [M, H]), g(() => {
|
|
28
|
+
r === a.PREDICTION ? T && B(!1) : h === k.RESOLVED && B(!1);
|
|
21
29
|
}, []);
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
}, []),
|
|
25
|
-
async (
|
|
26
|
-
if (!
|
|
27
|
-
const m =
|
|
28
|
-
|
|
30
|
+
const st = w((n) => {
|
|
31
|
+
Q(n), $(!0);
|
|
32
|
+
}, []), P = J(!1), F = w(
|
|
33
|
+
async (n) => {
|
|
34
|
+
if (!P.current && (P.current = !0, A)) {
|
|
35
|
+
const m = n.currentTarget.value;
|
|
36
|
+
p(m);
|
|
29
37
|
try {
|
|
30
|
-
await
|
|
38
|
+
await b(A, m);
|
|
31
39
|
} catch (v) {
|
|
32
|
-
|
|
40
|
+
rt(vt(v.message, r)), p(""), console.error("Error while voting", v), P.current = !1;
|
|
33
41
|
}
|
|
34
42
|
}
|
|
35
43
|
},
|
|
36
|
-
[r,
|
|
37
|
-
),
|
|
38
|
-
|
|
39
|
-
}, [
|
|
40
|
-
()
|
|
44
|
+
[r, A, p, b]
|
|
45
|
+
), ot = w(() => {
|
|
46
|
+
tt(!0), E({ delay: 3500 });
|
|
47
|
+
}, [E]), at = w(() => {
|
|
48
|
+
et(!0), E({ delay: 3500 });
|
|
49
|
+
}, [E]), e = u(
|
|
50
|
+
() => t == null ? void 0 : t.answers.find((n) => n.youVoted === !0),
|
|
41
51
|
[t]
|
|
42
52
|
), o = u(
|
|
43
|
-
() => !!(t != null && t.answers.find((
|
|
53
|
+
() => !!(t != null && t.answers.find((n) => n.correct === !0)),
|
|
44
54
|
[t]
|
|
45
|
-
),
|
|
46
|
-
() => t == null ? void 0 : t.answers.find((
|
|
55
|
+
), i = u(
|
|
56
|
+
() => t == null ? void 0 : t.answers.find((n) => n.correct === !0),
|
|
47
57
|
[t]
|
|
48
58
|
);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, [e]),
|
|
52
|
-
clearTimeout(
|
|
59
|
+
g(() => {
|
|
60
|
+
e && V && !it && (L.current = setTimeout(at, 1e4), nt(!0));
|
|
61
|
+
}, [e]), g(() => () => {
|
|
62
|
+
clearTimeout(L.current);
|
|
53
63
|
}, []);
|
|
54
|
-
const
|
|
64
|
+
const S = u(() => t ? t.answers.map((n) => {
|
|
55
65
|
var m;
|
|
56
66
|
return {
|
|
57
|
-
...
|
|
67
|
+
...n,
|
|
58
68
|
questionVoted: !!e,
|
|
59
|
-
youSelected:
|
|
60
|
-
isLoading:
|
|
69
|
+
youSelected: Y === n.id,
|
|
70
|
+
isLoading: l,
|
|
61
71
|
hasCorrectAnswer: o,
|
|
62
72
|
questionType: t.type,
|
|
63
|
-
answerTimeExpired:
|
|
64
|
-
questionStatus:
|
|
73
|
+
answerTimeExpired: f,
|
|
74
|
+
questionStatus: h,
|
|
65
75
|
imageMode: (m = t.appearance) == null ? void 0 : m.images,
|
|
66
|
-
onVote:
|
|
76
|
+
onVote: F
|
|
67
77
|
};
|
|
68
78
|
}) : [], [
|
|
69
79
|
o,
|
|
80
|
+
f,
|
|
70
81
|
l,
|
|
71
|
-
d,
|
|
72
82
|
t,
|
|
73
83
|
e,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
84
|
+
h,
|
|
85
|
+
F,
|
|
86
|
+
Y
|
|
77
87
|
]);
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
}, [
|
|
82
|
-
const
|
|
83
|
-
if (r ===
|
|
88
|
+
g(() => {
|
|
89
|
+
const n = S.some(({ percentageDecimal: v }) => v !== 0), m = e && r === a.PREDICTION;
|
|
90
|
+
x && (!n || T && m) && j(!0);
|
|
91
|
+
}, [S, x, T, r, e]);
|
|
92
|
+
const ct = I && (I.case === "trivia" || I.case === "prediction") ? I.value : void 0, d = h === k.RESOLVED && r === a.TRIVIA && !e && !C, _ = r === a.TRIVIA && R, q = u(() => r === a.PREDICTION ? !!(e && !o || e && o && (i != null && i.youVoted)) : !0, [r, e, o, i]), lt = u(() => {
|
|
93
|
+
if (r === a.PREDICTION && e && (!o || o && (i != null && i.youVoted)))
|
|
84
94
|
return e.points;
|
|
85
|
-
if (!(
|
|
86
|
-
return e ? e.correct ? e.pointsEarned : 0 :
|
|
87
|
-
}, [
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
|
|
95
|
+
if (!(d || f))
|
|
96
|
+
return e ? e.correct ? e.pointsEarned : 0 : i == null ? void 0 : i.points;
|
|
97
|
+
}, [f, e, i, d, r, o]), ft = u(() => r === a.PREDICTION && e ? o ? o && (i != null && i.youVoted) ? "You won" : "" : "To win" : d || f ? "Time expired" : r === a.POLL ? "Time remaining" : e ? "You won" : "To win", [f, r, e, d, o, i]), mt = !q || q && r === a.PREDICTION && V && !O, ut = (r === a.TRIVIA || r === a.PREDICTION) && e && o && (i == null ? void 0 : i.youVoted), dt = e || d || _ || r === a.TRIVIA && h === k.RESOLVED && C;
|
|
98
|
+
return /* @__PURE__ */ s(yt, { children: /* @__PURE__ */ s(K, { children: /* @__PURE__ */ y(U, { children: [
|
|
99
|
+
/* @__PURE__ */ s(
|
|
100
|
+
gt,
|
|
91
101
|
{
|
|
92
|
-
feedbackMessages:
|
|
102
|
+
feedbackMessages: ct,
|
|
93
103
|
questionVoted: !!e,
|
|
94
104
|
questionVotedCorrectly: e == null ? void 0 : e.correct,
|
|
95
105
|
questionType: r,
|
|
96
106
|
hasCorrectAnswer: o,
|
|
97
|
-
showExpiredNotification:
|
|
98
|
-
showClosedNotificationTrivia:
|
|
99
|
-
votedInCurrentRender:
|
|
107
|
+
showExpiredNotification: d,
|
|
108
|
+
showClosedNotificationTrivia: _,
|
|
109
|
+
votedInCurrentRender: V,
|
|
100
110
|
votedAfterQuestionClosed: R,
|
|
101
111
|
enteredAnActiveQuestion: C,
|
|
102
|
-
marketClosed:
|
|
103
|
-
percentsAnimated:
|
|
104
|
-
voteErrorMessage:
|
|
112
|
+
marketClosed: T,
|
|
113
|
+
percentsAnimated: O,
|
|
114
|
+
voteErrorMessage: x
|
|
105
115
|
}
|
|
106
116
|
),
|
|
107
|
-
q && /* @__PURE__ */
|
|
108
|
-
|
|
117
|
+
q && /* @__PURE__ */ s(
|
|
118
|
+
Et,
|
|
109
119
|
{
|
|
110
|
-
title:
|
|
111
|
-
points:
|
|
112
|
-
onTimerExpired:
|
|
120
|
+
title: ft,
|
|
121
|
+
points: lt,
|
|
122
|
+
onTimerExpired: ot,
|
|
113
123
|
questionType: t.type,
|
|
114
|
-
isTimer: !
|
|
124
|
+
isTimer: !l,
|
|
115
125
|
isPlayingTimer: !e,
|
|
116
|
-
animatePoints:
|
|
117
|
-
timerDuration:
|
|
118
|
-
votedInCurrentRender:
|
|
119
|
-
percentsAnimated:
|
|
126
|
+
animatePoints: ut,
|
|
127
|
+
timerDuration: dt ? 0 : Number(((G = t == null ? void 0 : t.appearance) == null ? void 0 : G.autoHideInterval) || "30"),
|
|
128
|
+
votedInCurrentRender: V,
|
|
129
|
+
percentsAnimated: O
|
|
120
130
|
}
|
|
121
131
|
),
|
|
122
|
-
|
|
123
|
-
|
|
132
|
+
f || W ? /* @__PURE__ */ s(It, { children: /* @__PURE__ */ s(
|
|
133
|
+
Tt,
|
|
124
134
|
{
|
|
135
|
+
icon: "icon-check-circle",
|
|
125
136
|
title: "More to come...",
|
|
126
|
-
description:
|
|
137
|
+
description: W ? /* @__PURE__ */ y(D, { children: [
|
|
138
|
+
"Stay tuned for more questions ",
|
|
139
|
+
/* @__PURE__ */ s("br", {}),
|
|
140
|
+
" and insights."
|
|
141
|
+
] }) : /* @__PURE__ */ y(D, { children: [
|
|
142
|
+
"Watch for additional enhanced stream ",
|
|
143
|
+
/* @__PURE__ */ s("br", {}),
|
|
144
|
+
" interactive experience."
|
|
145
|
+
] })
|
|
127
146
|
}
|
|
128
|
-
) : /* @__PURE__ */
|
|
129
|
-
/* @__PURE__ */
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
|
|
147
|
+
) }) : /* @__PURE__ */ y(D, { children: [
|
|
148
|
+
/* @__PURE__ */ s(Vt, { style: mt ? { marginTop: 0 } : {}, children: Z }),
|
|
149
|
+
/* @__PURE__ */ s(X, { children: S.map((n) => /* @__PURE__ */ s(
|
|
150
|
+
Ct,
|
|
132
151
|
{
|
|
133
|
-
...
|
|
134
|
-
markThatVoted:
|
|
135
|
-
onPercentsAnimated: () =>
|
|
152
|
+
...n,
|
|
153
|
+
markThatVoted: st,
|
|
154
|
+
onPercentsAnimated: () => j(!0),
|
|
136
155
|
votedAfterQuestionClosed: R,
|
|
137
156
|
enteredAnActiveQuestion: C,
|
|
138
|
-
marketClosed:
|
|
157
|
+
marketClosed: T
|
|
139
158
|
},
|
|
140
|
-
|
|
159
|
+
n.id
|
|
141
160
|
)) })
|
|
142
161
|
] })
|
|
143
162
|
] }) }) });
|
|
144
163
|
};
|
|
145
164
|
export {
|
|
146
|
-
|
|
165
|
+
Nt as Vote,
|
|
166
|
+
kt as VoteSkeleton
|
|
147
167
|
};
|
|
@@ -4,3 +4,4 @@ export declare const QuestionScrollContainer: any;
|
|
|
4
4
|
export declare const Content: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
5
5
|
export declare const Title: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
6
6
|
export declare const Options: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
7
|
+
export declare const AlertContainer: any;
|
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
import { styled as s } from "@linaria/react";
|
|
2
2
|
import { SDKScrollContainer as o } from "../../app/styles.js";
|
|
3
|
+
import { ShowIn as n } from "../../show-in/index.js";
|
|
3
4
|
const l = /* @__PURE__ */ s("div")({
|
|
4
5
|
name: "Container",
|
|
5
6
|
class: "c14ielyq",
|
|
6
7
|
propsAsIs: !1
|
|
7
|
-
}),
|
|
8
|
+
}), t = () => o, i = /* @__PURE__ */ s(t())({
|
|
8
9
|
name: "QuestionScrollContainer",
|
|
9
10
|
class: "q1tlqx57",
|
|
10
11
|
propsAsIs: !0
|
|
11
|
-
}),
|
|
12
|
+
}), p = /* @__PURE__ */ s("div")({
|
|
12
13
|
name: "Content",
|
|
13
14
|
class: "c1hq58md",
|
|
14
15
|
propsAsIs: !1
|
|
15
|
-
}),
|
|
16
|
+
}), m = /* @__PURE__ */ s("div")({
|
|
16
17
|
name: "Title",
|
|
17
18
|
class: "t1c8nxcx",
|
|
18
19
|
propsAsIs: !1
|
|
19
|
-
}),
|
|
20
|
+
}), C = /* @__PURE__ */ s("div")({
|
|
20
21
|
name: "Options",
|
|
21
22
|
class: "oiozuc3",
|
|
22
23
|
propsAsIs: !1
|
|
24
|
+
}), e = () => n, A = /* @__PURE__ */ s(e())({
|
|
25
|
+
name: "AlertContainer",
|
|
26
|
+
class: "apnc44r",
|
|
27
|
+
propsAsIs: !0
|
|
23
28
|
});
|
|
24
29
|
export {
|
|
30
|
+
A as AlertContainer,
|
|
25
31
|
l as Container,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
p as Content,
|
|
33
|
+
C as Options,
|
|
34
|
+
i as QuestionScrollContainer,
|
|
35
|
+
m as Title
|
|
30
36
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
2
2
|
import { useState as j, useLayoutEffect as U } from "react";
|
|
3
|
-
import { QuestionImages as a, QuestionType as o, QuestionStatus as
|
|
4
|
-
import { AnimatedCounter as
|
|
5
|
-
import { IconDefault as
|
|
6
|
-
const
|
|
7
|
-
[a.CENTERED]: (t) => /* @__PURE__ */ e(
|
|
8
|
-
[a.TRANSPARENT]: (t) => /* @__PURE__ */ e(
|
|
9
|
-
[a.ROUNDED]: (t) => /* @__PURE__ */ e(
|
|
3
|
+
import { QuestionImages as a, QuestionType as o, QuestionStatus as p } from "@streamlayer/sdk-web-types";
|
|
4
|
+
import { AnimatedCounter as W } from "../../../animated-counter/index.js";
|
|
5
|
+
import { IconDefault as $, IconContainer as y, IconWrap as F, IconCircle as M, ButtonContainer as z, ButtonPctWrap as G, ButtonPct as H, ButtonBody as J, Title as K, Pts as X, Indicators as Y, CheckIcon as Z, Percentage as _ } from "./styles.js";
|
|
6
|
+
const h = {
|
|
7
|
+
[a.CENTERED]: (t) => /* @__PURE__ */ e($, { alt: "option-icon", src: t }),
|
|
8
|
+
[a.TRANSPARENT]: (t) => /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(F, { style: { backgroundImage: `url(${t})` } }) }),
|
|
9
|
+
[a.ROUNDED]: (t) => /* @__PURE__ */ e(M, { alt: "option-icon", src: t }),
|
|
10
10
|
[a.NONE]: () => null,
|
|
11
11
|
[a.UNSET]: () => null
|
|
12
|
-
},
|
|
12
|
+
}, q = ({ questionType: t, hasCorrectAnswer: c, correct: n, youVoted: r, questionVoted: i }) => {
|
|
13
13
|
if (t === o.POLL && r)
|
|
14
14
|
return "correct";
|
|
15
15
|
if (t === o.PREDICTION) {
|
|
@@ -19,13 +19,13 @@ const E = {
|
|
|
19
19
|
return "correct";
|
|
20
20
|
}
|
|
21
21
|
return t === o.TRIVIA && i && r ? n ? "correct" : "incorrect" : "unset";
|
|
22
|
-
},
|
|
22
|
+
}, tt = ({
|
|
23
23
|
questionType: t,
|
|
24
24
|
questionVoted: c,
|
|
25
25
|
correct: n,
|
|
26
26
|
hasCorrectAnswer: r,
|
|
27
27
|
questionStatus: i
|
|
28
|
-
}) => t === o.TRIVIA ? c && n : t === o.PREDICTION ? c && n && r || i ===
|
|
28
|
+
}) => t === o.TRIVIA ? c && n : t === o.PREDICTION ? c && n && r || i === p.RESOLVED && n : !1, ct = (t) => {
|
|
29
29
|
var S;
|
|
30
30
|
const {
|
|
31
31
|
// option props
|
|
@@ -33,12 +33,12 @@ const E = {
|
|
|
33
33
|
icon: n,
|
|
34
34
|
text: r,
|
|
35
35
|
percentageDecimal: i,
|
|
36
|
-
points:
|
|
36
|
+
points: D,
|
|
37
37
|
// extra props
|
|
38
38
|
onVote: w,
|
|
39
39
|
markThatVoted: A,
|
|
40
40
|
onPercentsAnimated: f,
|
|
41
|
-
youSelected:
|
|
41
|
+
youSelected: E,
|
|
42
42
|
questionVoted: s,
|
|
43
43
|
imageMode: C,
|
|
44
44
|
answerTimeExpired: O,
|
|
@@ -50,7 +50,7 @@ const E = {
|
|
|
50
50
|
votedAfterQuestionClosed: x,
|
|
51
51
|
enteredAnActiveQuestion: R,
|
|
52
52
|
marketClosed: I
|
|
53
|
-
} = t, [L, T] = j(0), m =
|
|
53
|
+
} = t, [L, T] = j(0), m = q(t), B = tt({ questionType: d, questionVoted: s, correct: k, hasCorrectAnswer: v, questionStatus: P }), u = I && d === o.PREDICTION, N = s || u, Q = d === o.PREDICTION && !s && !I, V = s && !E && m !== "incorrect";
|
|
54
54
|
return U(() => {
|
|
55
55
|
T(0), requestAnimationFrame(() => {
|
|
56
56
|
T(i);
|
|
@@ -59,18 +59,18 @@ const E = {
|
|
|
59
59
|
z,
|
|
60
60
|
{
|
|
61
61
|
value: c,
|
|
62
|
-
"data-selected":
|
|
62
|
+
"data-selected": E,
|
|
63
63
|
"data-answer-state": m,
|
|
64
64
|
disabled: s || g || O || u && !R || u && R && x,
|
|
65
65
|
"data-is-not-checked": V,
|
|
66
66
|
onClick: (b) => {
|
|
67
67
|
A(
|
|
68
|
-
d === o.PREDICTION ? I : P ===
|
|
68
|
+
d === o.PREDICTION ? I : P === p.RESOLVED
|
|
69
69
|
), w(b);
|
|
70
70
|
},
|
|
71
71
|
children: [
|
|
72
|
-
/* @__PURE__ */ e(
|
|
73
|
-
|
|
72
|
+
/* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(
|
|
73
|
+
H,
|
|
74
74
|
{
|
|
75
75
|
"data-answer-state": m,
|
|
76
76
|
style: { width: `${N ? L : 0}%` },
|
|
@@ -78,17 +78,17 @@ const E = {
|
|
|
78
78
|
u || f == null || f();
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
),
|
|
82
|
-
/* @__PURE__ */ l(
|
|
83
|
-
n && C && ((S =
|
|
84
|
-
/* @__PURE__ */ e(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
/* @__PURE__ */ e(
|
|
81
|
+
) }),
|
|
82
|
+
/* @__PURE__ */ l(J, { children: [
|
|
83
|
+
n && C && ((S = h[C]) == null ? void 0 : S.call(h, n)),
|
|
84
|
+
/* @__PURE__ */ e(K, { children: r }),
|
|
85
|
+
Q && /* @__PURE__ */ l("div", { children: [
|
|
86
|
+
D,
|
|
87
|
+
/* @__PURE__ */ e(X, { children: "pts" })
|
|
88
88
|
] }),
|
|
89
|
-
N && /* @__PURE__ */ l(
|
|
90
|
-
|
|
91
|
-
/* @__PURE__ */ e(
|
|
89
|
+
N && /* @__PURE__ */ l(Y, { children: [
|
|
90
|
+
B && /* @__PURE__ */ e(Z, { name: "selected" }),
|
|
91
|
+
/* @__PURE__ */ e(_, { children: /* @__PURE__ */ e(W, { value: i, suffix: "%" }) })
|
|
92
92
|
] })
|
|
93
93
|
] })
|
|
94
94
|
]
|
|
@@ -96,5 +96,5 @@ const E = {
|
|
|
96
96
|
);
|
|
97
97
|
};
|
|
98
98
|
export {
|
|
99
|
-
|
|
99
|
+
ct as VotingOption
|
|
100
100
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const ButtonContainer: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown>>;
|
|
3
|
+
export declare const ButtonPctWrap: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
3
4
|
export declare const ButtonPct: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
4
5
|
export declare const ButtonBody: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
|
|
5
6
|
export declare const IconContainer: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|