@streamlayer/react-ui 1.18.1 → 1.19.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.
- package/lib/app/app/Notifications/index.js +1 -1
- package/lib/app/masters/BetPack/BetPackContent/EmergencyScreen/index.js +12 -8
- package/lib/app/masters/BetPack/BetPackContent/EndScreen/index.js +42 -14
- package/lib/app/masters/BetPack/BetPackContent/EndScreen/styles.d.ts +12 -0
- package/lib/app/masters/BetPack/BetPackContent/EndScreen/styles.js +40 -20
- package/lib/app/masters/BetPack/BetPackContent/ScreenContainer/index.js +8 -4
- package/lib/app/masters/BetPack/BetPackContent/ScreenContainer/useDynamicParentFont.d.ts +4 -0
- package/lib/app/masters/BetPack/BetPackContent/ScreenContainer/useDynamicParentFont.js +27 -0
- package/lib/app/masters/BetPack/BetPackContent/StartScreen/index.js +21 -19
- package/lib/app/masters/BetPack/BetPackContent/StartScreen/styles.d.ts +1 -0
- package/lib/app/masters/BetPack/BetPackContent/StartScreen/styles.js +22 -17
- package/lib/app/masters/BetPack/BetPackContent/index.js +88 -62
- package/lib/app/masters/BetPack/BetPackContent/styles.d.ts +1 -0
- package/lib/app/masters/BetPack/BetPackContent/styles.js +8 -7
- package/lib/app/masters/BetPack/index.js +59 -53
- package/lib/app/masters/Features/Gamification/Question.js +3 -3
- package/lib/app/masters/Features/Gamification/Tabs.d.ts +0 -7
- package/lib/app/masters/Features/Gamification/Tabs.js +9 -42
- package/lib/app/masters/Features/Gamification/UserSummary.js +15 -14
- package/lib/app/masters/Features/Gamification/index.d.ts +1 -6
- package/lib/app/masters/Features/Gamification/index.js +37 -76
- package/lib/app/masters/Features/index.d.ts +1 -6
- package/lib/app/masters/Features/index.js +15 -25
- package/lib/app/masters/Header/index.d.ts +3 -0
- package/lib/app/masters/Header/index.js +38 -0
- package/lib/app/masters/Notifications/index.js +1 -1
- package/lib/app/masters/masters.d.ts +1 -0
- package/lib/app/masters/masters.js +75 -92
- package/lib/app/masters/story/index.d.ts +1 -0
- package/lib/app/masters/story/index.js +21 -22
- package/lib/app/masters/styles.d.ts +0 -10
- package/lib/app/masters/styles.js +13 -23
- package/lib/app/masters/useSdkResponsive.js +1 -1
- package/lib/app/masters/useSdkScroll.js +1 -1
- package/lib/app/useClipboardCopy.js +1 -1
- package/lib/app/useSdkResponsive.js +1 -1
- package/lib/app/useSdkScroll.js +1 -1
- package/lib/assets/style.css +1 -1
- package/lib/index-BEm7B1u1.js +72 -0
- package/lib/index-DALxy-8N.js +5437 -0
- package/lib/ui/gamification/user-statistics/index.d.ts +1 -0
- package/lib/ui/gamification/user-statistics/index.js +47 -39
- package/lib/ui/gamification/user-statistics/styles.d.ts +2 -0
- package/lib/ui/gamification/user-statistics/styles.js +34 -24
- package/lib/ui/gamification/vote/feedback/index.d.ts +1 -0
- package/lib/ui/gamification/vote/feedback/index.js +60 -47
- package/lib/ui/gamification/vote/feedback/styles.d.ts +12 -0
- package/lib/ui/gamification/vote/feedback/styles.js +47 -27
- package/lib/ui/gamification/vote/index.js +145 -136
- package/lib/ui/gamification/vote/styles.d.ts +3 -1
- package/lib/ui/gamification/vote/styles.js +42 -32
- package/lib/ui/gamification/vote/vote-option/index.d.ts +1 -0
- package/lib/ui/gamification/vote/vote-option/index.js +59 -60
- package/lib/ui/gamification/vote/vote-option/styles.d.ts +1 -0
- package/lib/ui/gamification/vote/vote-option/styles.js +16 -11
- package/lib/ui/icons/index.d.ts +3 -0
- package/lib/ui/icons/index.js +69 -51
- package/lib/ui/loader/index.js +4 -3
- package/lib/ui/modal/index.js +1 -1
- package/lib/ui/theme/masters-theme.js +152 -32
- package/lib/ui/theme/theme.js +66 -20
- package/package.json +16 -15
- package/lib/app/masters/Features/Gamification/Friends.d.ts +0 -3
- package/lib/app/masters/Features/Gamification/Friends.js +0 -19
- package/lib/app/masters/Features/Gamification/Leaderboard.d.ts +0 -8
- package/lib/app/masters/Features/Gamification/Leaderboard.js +0 -56
- package/lib/index-B1QdimmR.js +0 -19047
- package/lib/index-CZvwzN5o.js +0 -75
- package/lib/index-xuotMAFm.js +0 -118
|
@@ -1,191 +1,200 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r, jsxs as m, Fragment as O } from "react/jsx-runtime";
|
|
2
2
|
import { useHideTransition as gt } from "../../../hooks/showIn.js";
|
|
3
|
-
import { useRef as U, useState as
|
|
3
|
+
import { useRef as U, useState as l, useEffect as p, useCallback as S, useMemo as g } from "react";
|
|
4
4
|
import { QuestionType as a, QuestionStatus as b } from "@streamlayer/sdk-web-types";
|
|
5
5
|
import { Skeleton as L } from "../../skeleton/index.js";
|
|
6
6
|
import { Alert as It } from "./alert/index.js";
|
|
7
7
|
import { Feedback as X } from "./feedback/index.js";
|
|
8
|
-
import { Container as Z, Content as $, Options as Q, QuestionScrollContainer as Ct,
|
|
9
|
-
import { VotingOption as
|
|
10
|
-
import { WinBar as
|
|
11
|
-
const
|
|
8
|
+
import { Container as Z, Content as $, Options as Q, QuestionScrollContainer as Ct, TopShadow as Vt, AlertContainer as pt, EarlyPrediction as vt, EarlyPredictionIcon as yt, Title as wt, OptionsWrap as At, BottomShadow as Et, SponsorLogo as Rt, SponsorIcon as Ot } from "./styles.js";
|
|
9
|
+
import { VotingOption as St } from "./vote-option/index.js";
|
|
10
|
+
import { WinBar as xt } from "./win-bar/index.js";
|
|
11
|
+
const qt = (e, u) => {
|
|
12
12
|
switch (e) {
|
|
13
13
|
case "already_voted":
|
|
14
|
-
return
|
|
14
|
+
return u === 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.";
|
|
15
15
|
default:
|
|
16
16
|
return "Something went wrong, please try again";
|
|
17
17
|
}
|
|
18
|
-
},
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
] }) }),
|
|
18
|
+
}, jt = () => /* @__PURE__ */ r(Z, { children: /* @__PURE__ */ m($, { children: [
|
|
19
|
+
/* @__PURE__ */ r(L, { loading: !0, style: { height: "40px", borderRadius: "100px" } }),
|
|
20
|
+
/* @__PURE__ */ r(L, { loading: !0, style: { height: "24px", margin: "16px 0" } }),
|
|
21
|
+
/* @__PURE__ */ r(Q, { children: Array.from({ length: 5 }).map((e, u) => /* @__PURE__ */ r(L, { loading: !0, style: { height: "44px" } }, u)) })
|
|
22
|
+
] }) }), Ht = ({ openedQuestion: e, isLoading: u, vote: M, close: W, isEarlyPrediction: c }) => {
|
|
23
23
|
var J, K;
|
|
24
|
-
const tt = e.subject,
|
|
25
|
-
|
|
24
|
+
const tt = e.subject, n = e.type, I = e.status, v = (J = e.options) == null ? void 0 : J.options, T = e.marketClosed, x = e.id, B = U(), [C, et] = l(!1), [y, rt] = l(!1), [V, Y] = l(!0), [f, nt] = l(!1), [j, ot] = l(!1), [H, q] = l(""), [w, st] = l(""), [A, F] = l(!1), [it, at] = l(!1), { runAnimation: E, finished: _ } = gt();
|
|
25
|
+
p(() => {
|
|
26
26
|
_ && W();
|
|
27
|
-
}, [W, _]),
|
|
28
|
-
|
|
27
|
+
}, [W, _]), p(() => {
|
|
28
|
+
n === a.PREDICTION ? T && Y(!1) : I === b.RESOLVED && Y(!1);
|
|
29
29
|
}, []);
|
|
30
|
-
const ct =
|
|
31
|
-
rt(
|
|
32
|
-
}, []),
|
|
33
|
-
async (
|
|
34
|
-
if (!
|
|
35
|
-
const
|
|
36
|
-
|
|
30
|
+
const ct = S((s) => {
|
|
31
|
+
rt(s), et(!0);
|
|
32
|
+
}, []), D = U(!1), z = S(
|
|
33
|
+
async (s) => {
|
|
34
|
+
if (!D.current && (D.current = !0, x)) {
|
|
35
|
+
const h = s.currentTarget.value;
|
|
36
|
+
q(h);
|
|
37
37
|
try {
|
|
38
|
-
await M(x,
|
|
38
|
+
await M(x, h);
|
|
39
39
|
} catch (R) {
|
|
40
|
-
|
|
40
|
+
st(qt(R.message, n)), q(""), console.error("Error while voting", R), D.current = !1;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
-
[
|
|
45
|
-
), lt =
|
|
46
|
-
nt(!0),
|
|
47
|
-
}, [
|
|
48
|
-
|
|
49
|
-
}, [
|
|
50
|
-
() => !!(e != null && e.answers.find((
|
|
44
|
+
[n, x, q, M]
|
|
45
|
+
), lt = S(() => {
|
|
46
|
+
nt(!0), E({ delay: 3500 });
|
|
47
|
+
}, [E]), mt = S(() => {
|
|
48
|
+
ot(!0), E({ delay: 3500 });
|
|
49
|
+
}, [E]), t = e == null ? void 0 : e.answers.find((s) => s.youVoted === !0), i = g(
|
|
50
|
+
() => !!(e != null && e.answers.find((s) => s.correct === !0)),
|
|
51
51
|
[e]
|
|
52
|
-
),
|
|
53
|
-
() => e == null ? void 0 : e.answers.find((
|
|
52
|
+
), o = g(
|
|
53
|
+
() => e == null ? void 0 : e.answers.find((s) => s.correct === !0),
|
|
54
54
|
[e]
|
|
55
55
|
);
|
|
56
|
-
|
|
57
|
-
t && C && !
|
|
58
|
-
}, [t]),
|
|
59
|
-
clearTimeout(
|
|
56
|
+
p(() => {
|
|
57
|
+
t && C && !it && (B.current = setTimeout(mt, 1e4), at(!0));
|
|
58
|
+
}, [t]), p(() => () => {
|
|
59
|
+
clearTimeout(B.current);
|
|
60
60
|
}, []);
|
|
61
|
-
const
|
|
62
|
-
var
|
|
61
|
+
const k = g(() => e ? e.answers.map((s) => {
|
|
62
|
+
var h;
|
|
63
63
|
return {
|
|
64
|
-
...
|
|
64
|
+
...s,
|
|
65
65
|
questionVoted: !!t,
|
|
66
|
-
youSelected: H ===
|
|
67
|
-
isLoading:
|
|
68
|
-
hasCorrectAnswer:
|
|
66
|
+
youSelected: H === s.id,
|
|
67
|
+
isLoading: u,
|
|
68
|
+
hasCorrectAnswer: i,
|
|
69
69
|
questionType: e.type,
|
|
70
70
|
answerTimeExpired: f,
|
|
71
71
|
questionStatus: I,
|
|
72
|
-
imageMode: (
|
|
72
|
+
imageMode: (h = e.appearance) == null ? void 0 : h.images,
|
|
73
73
|
onVote: z
|
|
74
74
|
};
|
|
75
75
|
}) : [], [
|
|
76
|
-
|
|
76
|
+
i,
|
|
77
77
|
f,
|
|
78
|
-
|
|
78
|
+
u,
|
|
79
79
|
e,
|
|
80
80
|
t,
|
|
81
81
|
I,
|
|
82
82
|
z,
|
|
83
83
|
H
|
|
84
84
|
]);
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
}, [
|
|
89
|
-
const G = v && (v.case === "trivia" || v.case === "prediction") ? v.value : void 0,
|
|
90
|
-
if (
|
|
85
|
+
p(() => {
|
|
86
|
+
const s = k.some(({ percentageDecimal: R }) => R !== 0), h = t && n === a.PREDICTION;
|
|
87
|
+
w && (!s || T && h) && F(!0);
|
|
88
|
+
}, [k, w, T, n, t]);
|
|
89
|
+
const G = v && (v.case === "trivia" || v.case === "prediction") ? v.value : void 0, d = I === b.RESOLVED && n === a.TRIVIA && !t && !V, N = n === a.TRIVIA && y, P = g(() => n === a.PREDICTION ? c ? !1 : !!(t && !i || t && i && (o != null && o.youVoted)) : !0, [n, t, i, o, c]), ut = g(() => {
|
|
90
|
+
if (n === a.PREDICTION && t && (!i || i && (o != null && o.youVoted)))
|
|
91
91
|
return t.points;
|
|
92
|
-
if (!(
|
|
93
|
-
return t ? t.correct ? t.pointsEarned : 0 :
|
|
94
|
-
}, [f, t,
|
|
95
|
-
return /* @__PURE__ */
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
feedbackMessages: G,
|
|
100
|
-
questionVoted: !!t,
|
|
101
|
-
questionVotedCorrectly: t == null ? void 0 : t.correct,
|
|
102
|
-
questionType: r,
|
|
103
|
-
hasCorrectAnswer: s,
|
|
104
|
-
showExpiredNotification: u,
|
|
105
|
-
showClosedNotificationTrivia: P,
|
|
106
|
-
votedInCurrentRender: C,
|
|
107
|
-
votedAfterQuestionClosed: p,
|
|
108
|
-
enteredAnActiveQuestion: V,
|
|
109
|
-
marketClosed: T,
|
|
110
|
-
percentsAnimated: A,
|
|
111
|
-
voteErrorMessage: E
|
|
112
|
-
}
|
|
113
|
-
),
|
|
114
|
-
k && /* @__PURE__ */ n(
|
|
115
|
-
Ot,
|
|
116
|
-
{
|
|
117
|
-
title: ut,
|
|
118
|
-
points: ft,
|
|
119
|
-
onTimerExpired: lt,
|
|
120
|
-
questionType: e.type,
|
|
121
|
-
isTimer: !m,
|
|
122
|
-
isPlayingTimer: !t,
|
|
123
|
-
animatePoints: ht,
|
|
124
|
-
timerDuration: Tt ? 0 : Number(((K = e == null ? void 0 : e.appearance) == null ? void 0 : K.autoHideInterval) || "30"),
|
|
125
|
-
votedInCurrentRender: C,
|
|
126
|
-
percentsAnimated: A
|
|
127
|
-
}
|
|
128
|
-
),
|
|
129
|
-
!l && (f || j) ? /* @__PURE__ */ n(Vt, { children: /* @__PURE__ */ n(
|
|
130
|
-
It,
|
|
131
|
-
{
|
|
132
|
-
icon: "icon-check-circle",
|
|
133
|
-
title: "More to come...",
|
|
134
|
-
description: j ? /* @__PURE__ */ h(N, { children: [
|
|
135
|
-
"Stay tuned for more questions ",
|
|
136
|
-
/* @__PURE__ */ n("br", {}),
|
|
137
|
-
" and insights."
|
|
138
|
-
] }) : /* @__PURE__ */ h(N, { children: [
|
|
139
|
-
"Watch for additional enhanced stream ",
|
|
140
|
-
/* @__PURE__ */ n("br", {}),
|
|
141
|
-
" interactive experience."
|
|
142
|
-
] })
|
|
143
|
-
}
|
|
144
|
-
) }) : /* @__PURE__ */ h(N, { children: [
|
|
145
|
-
l && /* @__PURE__ */ h(yt, { children: [
|
|
146
|
-
/* @__PURE__ */ n(vt, { name: "iconEarlyPrediction" }),
|
|
147
|
-
"EARLY PREDICTION"
|
|
148
|
-
] }),
|
|
149
|
-
/* @__PURE__ */ n(pt, { style: dt ? { marginTop: 0 } : {}, id: "voteTitle", children: tt }),
|
|
150
|
-
l && /* @__PURE__ */ n(
|
|
92
|
+
if (!(d || f))
|
|
93
|
+
return t ? t.correct ? t.pointsEarned : 0 : o == null ? void 0 : o.points;
|
|
94
|
+
}, [f, t, o, d, n, i]), ft = g(() => n === a.PREDICTION && t ? i ? i && (o != null && o.youVoted) ? "You won" : "" : "To win" : d || f ? "Time expired" : n === a.POLL ? "Time remaining" : t ? "You won" : "To win", [f, n, t, d, i, o]), dt = !P || P && n === a.PREDICTION && C && !A, ht = (n === a.TRIVIA || n === a.PREDICTION) && t && i && (o == null ? void 0 : o.youVoted), Tt = t || d || N || n === a.TRIVIA && I === b.RESOLVED && V;
|
|
95
|
+
return /* @__PURE__ */ m(Ct, { children: [
|
|
96
|
+
c && /* @__PURE__ */ r(Vt, {}),
|
|
97
|
+
/* @__PURE__ */ r(Z, { style: c ? { marginTop: "-40px" } : {}, children: /* @__PURE__ */ m($, { id: "questionContent", children: [
|
|
98
|
+
!c && /* @__PURE__ */ r(
|
|
151
99
|
X,
|
|
152
100
|
{
|
|
153
101
|
feedbackMessages: G,
|
|
154
102
|
questionVoted: !!t,
|
|
155
103
|
questionVotedCorrectly: t == null ? void 0 : t.correct,
|
|
156
|
-
questionType:
|
|
157
|
-
hasCorrectAnswer:
|
|
158
|
-
showExpiredNotification:
|
|
159
|
-
showClosedNotificationTrivia:
|
|
104
|
+
questionType: n,
|
|
105
|
+
hasCorrectAnswer: i,
|
|
106
|
+
showExpiredNotification: d,
|
|
107
|
+
showClosedNotificationTrivia: N,
|
|
160
108
|
votedInCurrentRender: C,
|
|
161
|
-
votedAfterQuestionClosed:
|
|
109
|
+
votedAfterQuestionClosed: y,
|
|
162
110
|
enteredAnActiveQuestion: V,
|
|
163
111
|
marketClosed: T,
|
|
164
112
|
percentsAnimated: A,
|
|
165
|
-
voteErrorMessage:
|
|
166
|
-
|
|
167
|
-
correctAnswer: i
|
|
113
|
+
voteErrorMessage: w,
|
|
114
|
+
votedAnswer: t
|
|
168
115
|
}
|
|
169
116
|
),
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
|
|
172
|
-
|
|
117
|
+
P && /* @__PURE__ */ r(
|
|
118
|
+
xt,
|
|
119
|
+
{
|
|
120
|
+
title: ft,
|
|
121
|
+
points: ut,
|
|
122
|
+
onTimerExpired: lt,
|
|
123
|
+
questionType: e.type,
|
|
124
|
+
isTimer: !u,
|
|
125
|
+
isPlayingTimer: !t,
|
|
126
|
+
animatePoints: ht,
|
|
127
|
+
timerDuration: Tt ? 0 : Number(((K = e == null ? void 0 : e.appearance) == null ? void 0 : K.autoHideInterval) || "30"),
|
|
128
|
+
votedInCurrentRender: C,
|
|
129
|
+
percentsAnimated: A
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
!c && (f || j) ? /* @__PURE__ */ r(pt, { children: /* @__PURE__ */ r(
|
|
133
|
+
It,
|
|
134
|
+
{
|
|
135
|
+
icon: "icon-check-circle",
|
|
136
|
+
title: "More to come...",
|
|
137
|
+
description: j ? /* @__PURE__ */ m(O, { children: [
|
|
138
|
+
"Stay tuned for more questions ",
|
|
139
|
+
/* @__PURE__ */ r("br", {}),
|
|
140
|
+
" and insights."
|
|
141
|
+
] }) : /* @__PURE__ */ m(O, { children: [
|
|
142
|
+
"Watch for additional enhanced stream ",
|
|
143
|
+
/* @__PURE__ */ r("br", {}),
|
|
144
|
+
" interactive experience."
|
|
145
|
+
] })
|
|
146
|
+
}
|
|
147
|
+
) }) : /* @__PURE__ */ m(O, { children: [
|
|
148
|
+
c && /* @__PURE__ */ m(vt, { children: [
|
|
149
|
+
/* @__PURE__ */ r(yt, { name: "iconEarlyPrediction" }),
|
|
150
|
+
"EARLY PREDICTION"
|
|
151
|
+
] }),
|
|
152
|
+
/* @__PURE__ */ r(wt, { style: dt ? { marginTop: 0 } : {}, children: tt }),
|
|
153
|
+
c && /* @__PURE__ */ r(
|
|
154
|
+
X,
|
|
173
155
|
{
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
156
|
+
feedbackMessages: G,
|
|
157
|
+
questionVoted: !!t,
|
|
158
|
+
questionVotedCorrectly: t == null ? void 0 : t.correct,
|
|
159
|
+
questionType: n,
|
|
160
|
+
hasCorrectAnswer: i,
|
|
161
|
+
showExpiredNotification: d,
|
|
162
|
+
showClosedNotificationTrivia: N,
|
|
163
|
+
votedInCurrentRender: C,
|
|
164
|
+
votedAfterQuestionClosed: y,
|
|
178
165
|
enteredAnActiveQuestion: V,
|
|
179
|
-
marketClosed: T
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
166
|
+
marketClosed: T,
|
|
167
|
+
percentsAnimated: A,
|
|
168
|
+
voteErrorMessage: w,
|
|
169
|
+
isEarlyPrediction: c,
|
|
170
|
+
correctAnswer: o,
|
|
171
|
+
votedAnswer: t
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ m(At, { children: [
|
|
175
|
+
/* @__PURE__ */ r(Q, { children: k.map((s) => /* @__PURE__ */ r(
|
|
176
|
+
St,
|
|
177
|
+
{
|
|
178
|
+
...s,
|
|
179
|
+
markThatVoted: ct,
|
|
180
|
+
onPercentsAnimated: () => F(!0),
|
|
181
|
+
votedAfterQuestionClosed: y,
|
|
182
|
+
enteredAnActiveQuestion: V,
|
|
183
|
+
marketClosed: T,
|
|
184
|
+
isEarlyPrediction: c
|
|
185
|
+
},
|
|
186
|
+
s.id
|
|
187
|
+
)) }),
|
|
188
|
+
c && /* @__PURE__ */ m(O, { children: [
|
|
189
|
+
/* @__PURE__ */ r(Et, {}),
|
|
190
|
+
/* @__PURE__ */ r(Rt, { children: /* @__PURE__ */ r(Ot, { name: "mastersLogoWhite" }) })
|
|
191
|
+
] })
|
|
192
|
+
] })
|
|
184
193
|
] })
|
|
185
|
-
] })
|
|
186
|
-
] })
|
|
194
|
+
] }) })
|
|
195
|
+
] });
|
|
187
196
|
};
|
|
188
197
|
export {
|
|
189
|
-
|
|
190
|
-
|
|
198
|
+
Ht as Vote,
|
|
199
|
+
jt as VoteSkeleton
|
|
191
200
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export declare const Container: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
2
2
|
export declare const QuestionScrollContainer: any;
|
|
3
|
+
export declare const TopShadow: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
4
|
+
export declare const BottomShadow: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
5
|
+
export declare const SponsorLogo: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
3
6
|
export declare const Content: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
4
7
|
export declare const Title: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
5
8
|
export declare const OptionsWrap: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
@@ -8,4 +11,3 @@ export declare const AlertContainer: any;
|
|
|
8
11
|
export declare const EarlyPrediction: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
9
12
|
export declare const EarlyPredictionIcon: any;
|
|
10
13
|
export declare const SponsorIcon: any;
|
|
11
|
-
export declare const SponsorLogo: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
@@ -2,61 +2,71 @@ import { styled as s } from "@linaria/react";
|
|
|
2
2
|
import { SDKScrollContainer as n } from "../../../app/app/styles.js";
|
|
3
3
|
import { SvgIcon as o } from "../../icons/index.js";
|
|
4
4
|
import { ShowIn as t } from "../../show-in/index.js";
|
|
5
|
-
const
|
|
5
|
+
const d = /* @__PURE__ */ s("div")({
|
|
6
6
|
name: "Container",
|
|
7
7
|
class: "c14ielyq",
|
|
8
8
|
propsAsIs: !1
|
|
9
|
-
}),
|
|
9
|
+
}), e = () => n, I = /* @__PURE__ */ s(e())({
|
|
10
10
|
name: "QuestionScrollContainer",
|
|
11
11
|
class: "q1tlqx57",
|
|
12
12
|
propsAsIs: !0
|
|
13
13
|
}), A = /* @__PURE__ */ s("div")({
|
|
14
|
-
name: "
|
|
15
|
-
class: "
|
|
14
|
+
name: "TopShadow",
|
|
15
|
+
class: "t1hq58md",
|
|
16
16
|
propsAsIs: !1
|
|
17
17
|
}), f = /* @__PURE__ */ s("div")({
|
|
18
|
-
name: "
|
|
19
|
-
class: "
|
|
18
|
+
name: "BottomShadow",
|
|
19
|
+
class: "b1c8nxcx",
|
|
20
20
|
propsAsIs: !1
|
|
21
21
|
}), S = /* @__PURE__ */ s("div")({
|
|
22
|
-
name: "
|
|
23
|
-
class: "
|
|
22
|
+
name: "SponsorLogo",
|
|
23
|
+
class: "siozuc3",
|
|
24
|
+
propsAsIs: !1
|
|
25
|
+
}), v = /* @__PURE__ */ s("div")({
|
|
26
|
+
name: "Content",
|
|
27
|
+
class: "cpnc44r",
|
|
28
|
+
propsAsIs: !1
|
|
29
|
+
}), x = /* @__PURE__ */ s("div")({
|
|
30
|
+
name: "Title",
|
|
31
|
+
class: "tq7p3w0",
|
|
24
32
|
propsAsIs: !1
|
|
25
33
|
}), C = /* @__PURE__ */ s("div")({
|
|
34
|
+
name: "OptionsWrap",
|
|
35
|
+
class: "o1jlfj9g",
|
|
36
|
+
propsAsIs: !1
|
|
37
|
+
}), u = /* @__PURE__ */ s("div")({
|
|
26
38
|
name: "Options",
|
|
27
|
-
class: "
|
|
39
|
+
class: "o84pmnd",
|
|
28
40
|
propsAsIs: !1
|
|
29
|
-
}),
|
|
41
|
+
}), a = () => t, w = /* @__PURE__ */ s(a())({
|
|
30
42
|
name: "AlertContainer",
|
|
31
|
-
class: "
|
|
43
|
+
class: "a1dybjw9",
|
|
32
44
|
propsAsIs: !0
|
|
33
|
-
}),
|
|
45
|
+
}), y = /* @__PURE__ */ s("div")({
|
|
34
46
|
name: "EarlyPrediction",
|
|
35
|
-
class: "
|
|
47
|
+
class: "e1l05ict",
|
|
36
48
|
propsAsIs: !1
|
|
37
|
-
}),
|
|
49
|
+
}), r = () => o, h = /* @__PURE__ */ s(r())({
|
|
38
50
|
name: "EarlyPredictionIcon",
|
|
39
|
-
class: "
|
|
51
|
+
class: "ez9juex",
|
|
40
52
|
propsAsIs: !0
|
|
41
|
-
}), p = () => o,
|
|
53
|
+
}), p = () => o, q = /* @__PURE__ */ s(p())({
|
|
42
54
|
name: "SponsorIcon",
|
|
43
|
-
class: "
|
|
55
|
+
class: "s8p4aob",
|
|
44
56
|
propsAsIs: !0
|
|
45
|
-
}), q = /* @__PURE__ */ s("div")({
|
|
46
|
-
name: "SponsorLogo",
|
|
47
|
-
class: "s1l05ict",
|
|
48
|
-
propsAsIs: !1
|
|
49
57
|
});
|
|
50
58
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
q as
|
|
61
|
-
|
|
59
|
+
w as AlertContainer,
|
|
60
|
+
f as BottomShadow,
|
|
61
|
+
d as Container,
|
|
62
|
+
v as Content,
|
|
63
|
+
y as EarlyPrediction,
|
|
64
|
+
h as EarlyPredictionIcon,
|
|
65
|
+
u as Options,
|
|
66
|
+
C as OptionsWrap,
|
|
67
|
+
I as QuestionScrollContainer,
|
|
68
|
+
q as SponsorIcon,
|
|
69
|
+
S as SponsorLogo,
|
|
70
|
+
x as Title,
|
|
71
|
+
A as TopShadow
|
|
62
72
|
};
|
|
@@ -14,5 +14,6 @@ export type VotingOptionProps = ExtendedQuestionAnswer & {
|
|
|
14
14
|
onVote: (e: React.MouseEvent<HTMLButtonElement>) => Promise<void>;
|
|
15
15
|
markThatVoted: (votedAfterQuestionClosed: boolean) => void;
|
|
16
16
|
onPercentsAnimated?: () => void;
|
|
17
|
+
isEarlyPrediction?: boolean;
|
|
17
18
|
};
|
|
18
19
|
export declare const VotingOption: React.FC<VotingOptionProps>;
|
|
@@ -1,100 +1,99 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { QuestionImages as a, QuestionType as o, QuestionStatus as
|
|
1
|
+
import { jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { useState as U, useLayoutEffect as V } from "react";
|
|
3
|
+
import { QuestionImages as a, QuestionType as o, QuestionStatus as D } from "@streamlayer/sdk-web-types";
|
|
4
4
|
import { AnimatedCounter as $ } from "../../../animated-counter/index.js";
|
|
5
|
-
import { IconDefault as
|
|
6
|
-
const
|
|
7
|
-
[a.CENTERED]: (t) => /* @__PURE__ */ e(
|
|
8
|
-
[a.TRANSPARENT]: (t) => /* @__PURE__ */ e(
|
|
9
|
-
[a.ROUNDED]: (t) => /* @__PURE__ */ e(
|
|
5
|
+
import { IconDefault as F, IconContainer as M, IconWrap as z, IconCircle as G, ButtonContainer as H, ButtonPctWrap as J, ButtonPct as K, ButtonBody as X, Title as Y, PtsWrap as Z, Pts as _, Indicators as q, CheckIcon as tt, Percentage as et } from "./styles.js";
|
|
6
|
+
const E = {
|
|
7
|
+
[a.CENTERED]: (t) => /* @__PURE__ */ e(F, { "data-testid": "vote-icon", alt: "option-icon", src: t }),
|
|
8
|
+
[a.TRANSPARENT]: (t) => /* @__PURE__ */ e(M, { "data-testid": "vote-icon", children: /* @__PURE__ */ e(z, { style: { backgroundImage: `url(${t})` } }) }),
|
|
9
|
+
[a.ROUNDED]: (t) => /* @__PURE__ */ e(G, { "data-testid": "vote-icon", alt: "option-icon", src: t }),
|
|
10
10
|
[a.NONE]: () => null,
|
|
11
11
|
[a.UNSET]: () => null
|
|
12
|
-
},
|
|
12
|
+
}, nt = ({ questionType: t, hasCorrectAnswer: c, correct: n, youVoted: r, questionVoted: i }) => {
|
|
13
13
|
if (t === o.POLL && r)
|
|
14
14
|
return "voted";
|
|
15
15
|
if (t === o.PREDICTION) {
|
|
16
|
-
if (!
|
|
16
|
+
if (!c && i)
|
|
17
17
|
return r ? "voted" : "unset";
|
|
18
|
-
if (
|
|
18
|
+
if (c && i)
|
|
19
19
|
return r ? n ? "correct" : "incorrect" : "unset";
|
|
20
20
|
if (r)
|
|
21
21
|
return "correct";
|
|
22
22
|
}
|
|
23
23
|
return t === o.TRIVIA && i && r ? n ? "correct" : "incorrect" : "unset";
|
|
24
|
-
},
|
|
24
|
+
}, rt = ({
|
|
25
25
|
questionType: t,
|
|
26
|
-
questionVoted:
|
|
26
|
+
questionVoted: c,
|
|
27
27
|
correct: n,
|
|
28
28
|
hasCorrectAnswer: r,
|
|
29
29
|
questionStatus: i
|
|
30
|
-
}) => t === o.TRIVIA ?
|
|
31
|
-
var
|
|
30
|
+
}) => t === o.TRIVIA ? c && n : t === o.PREDICTION ? c && n && r || i === D.RESOLVED && n : !1, dt = (t) => {
|
|
31
|
+
var S;
|
|
32
32
|
const {
|
|
33
33
|
// option props
|
|
34
|
-
id:
|
|
34
|
+
id: c,
|
|
35
35
|
icon: n,
|
|
36
36
|
text: r,
|
|
37
37
|
percentageDecimal: i,
|
|
38
|
-
points:
|
|
38
|
+
points: O,
|
|
39
39
|
// extra props
|
|
40
|
-
onVote:
|
|
41
|
-
markThatVoted:
|
|
40
|
+
onVote: g,
|
|
41
|
+
markThatVoted: v,
|
|
42
42
|
onPercentsAnimated: f,
|
|
43
|
-
youSelected:
|
|
44
|
-
youVoted:
|
|
45
|
-
questionVoted:
|
|
46
|
-
imageMode:
|
|
47
|
-
answerTimeExpired:
|
|
48
|
-
questionStatus:
|
|
43
|
+
youSelected: h,
|
|
44
|
+
youVoted: w,
|
|
45
|
+
questionVoted: s,
|
|
46
|
+
imageMode: P,
|
|
47
|
+
answerTimeExpired: A,
|
|
48
|
+
questionStatus: C,
|
|
49
49
|
isLoading: k,
|
|
50
50
|
questionType: d,
|
|
51
51
|
correct: x,
|
|
52
|
-
hasCorrectAnswer:
|
|
53
|
-
votedAfterQuestionClosed:
|
|
54
|
-
enteredAnActiveQuestion:
|
|
55
|
-
marketClosed: I
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
hasCorrectAnswer: B,
|
|
53
|
+
votedAfterQuestionClosed: L,
|
|
54
|
+
enteredAnActiveQuestion: R,
|
|
55
|
+
marketClosed: I,
|
|
56
|
+
isEarlyPrediction: Q
|
|
57
|
+
} = t, [W, T] = U(0), m = nt(t), b = rt({ questionType: d, questionVoted: s, correct: x, hasCorrectAnswer: B, questionStatus: C }), l = I && d === o.PREDICTION, p = s || l, j = d === o.PREDICTION && !s && !I, N = s && !h && m !== "incorrect" && !w;
|
|
58
|
+
return V(() => {
|
|
59
|
+
T(0), requestAnimationFrame(() => {
|
|
60
|
+
T(i);
|
|
60
61
|
});
|
|
61
|
-
}, [i]), /* @__PURE__ */
|
|
62
|
-
|
|
62
|
+
}, [i]), /* @__PURE__ */ u(
|
|
63
|
+
H,
|
|
63
64
|
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"data-selected": E,
|
|
65
|
+
value: c,
|
|
66
|
+
"data-selected": h,
|
|
67
67
|
"data-answer-state": m,
|
|
68
|
-
disabled:
|
|
69
|
-
"data-is-not-checked":
|
|
70
|
-
onClick: (
|
|
71
|
-
|
|
72
|
-
d === o.PREDICTION ? I :
|
|
73
|
-
),
|
|
68
|
+
disabled: s || k || A || l && !R || l && R && L,
|
|
69
|
+
"data-is-not-checked": N,
|
|
70
|
+
onClick: (y) => {
|
|
71
|
+
v(
|
|
72
|
+
d === o.PREDICTION ? I : C === D.RESOLVED
|
|
73
|
+
), g(y);
|
|
74
74
|
},
|
|
75
75
|
children: [
|
|
76
|
-
/* @__PURE__ */ e(
|
|
77
|
-
|
|
76
|
+
/* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(
|
|
77
|
+
K,
|
|
78
78
|
{
|
|
79
|
-
id: "voteAnswerRct",
|
|
80
79
|
"data-answer-state": m,
|
|
81
|
-
"data-is-not-checked":
|
|
82
|
-
style: { width: `${
|
|
80
|
+
"data-is-not-checked": N,
|
|
81
|
+
style: { width: `${p ? W : 0}%` },
|
|
83
82
|
onTransitionEnd: () => {
|
|
84
|
-
|
|
83
|
+
l || f == null || f();
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
) }),
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
n &&
|
|
90
|
-
/* @__PURE__ */ e(
|
|
91
|
-
j && /* @__PURE__ */
|
|
92
|
-
|
|
93
|
-
/* @__PURE__ */ e(
|
|
87
|
+
/* @__PURE__ */ u(X, { children: [
|
|
88
|
+
n && P && ((S = E[P]) == null ? void 0 : S.call(E, n)),
|
|
89
|
+
/* @__PURE__ */ e(Y, { children: r }),
|
|
90
|
+
j && /* @__PURE__ */ u(Z, { children: [
|
|
91
|
+
O,
|
|
92
|
+
/* @__PURE__ */ e(_, { children: "pts" })
|
|
94
93
|
] }),
|
|
95
|
-
|
|
96
|
-
b && /* @__PURE__ */ e(
|
|
97
|
-
/* @__PURE__ */ e(
|
|
94
|
+
p && /* @__PURE__ */ u(q, { children: [
|
|
95
|
+
b && /* @__PURE__ */ e(tt, { name: Q ? "selectedBetPack" : "selected" }),
|
|
96
|
+
/* @__PURE__ */ e(et, { children: /* @__PURE__ */ e($, { value: i, suffix: "%" }) })
|
|
98
97
|
] })
|
|
99
98
|
] })
|
|
100
99
|
]
|
|
@@ -102,5 +101,5 @@ const h = {
|
|
|
102
101
|
);
|
|
103
102
|
};
|
|
104
103
|
export {
|
|
105
|
-
|
|
104
|
+
dt as VotingOption
|
|
106
105
|
};
|
|
@@ -17,6 +17,7 @@ export declare const IconCircle: {
|
|
|
17
17
|
}>;
|
|
18
18
|
export declare const Title: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLSpanElement> & import('react').HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
|
|
19
19
|
export declare const Indicators: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLSpanElement> & import('react').HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
|
|
20
|
+
export declare const PtsWrap: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
20
21
|
export declare const Pts: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLSpanElement> & import('react').HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
|
|
21
22
|
export declare const Percentage: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLSpanElement> & import('react').HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
|
|
22
23
|
export declare const CheckIcon: any;
|