@streamlayer/react-ui 0.96.2 → 0.97.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/analytics.js +50 -0
- package/lib/index-z0QjLiEL.js +75 -0
- package/lib/ui/app/Features/FeatureProvider.d.ts +1 -0
- package/lib/ui/app/Features/FeatureProvider.js +34 -6
- package/lib/ui/app/Features/Gamification/Friends.d.ts +0 -2
- package/lib/ui/app/Features/Gamification/Friends.js +20 -23
- package/lib/ui/app/Features/Gamification/Leaderboard.js +31 -25
- package/lib/ui/app/Features/Gamification/Question.js +4 -2
- package/lib/ui/app/Features/Gamification/QuestionsList.js +11 -8
- package/lib/ui/app/Features/Gamification/Tabs.js +30 -25
- package/lib/ui/app/Features/Gamification/UserSummary.js +14 -12
- package/lib/ui/app/Features/Gamification/gamification-feature.js +6 -2
- package/lib/ui/app/Features/Gamification/index.d.ts +10 -0
- package/lib/ui/app/Features/Gamification/index.js +73 -68
- package/lib/ui/app/Features/index.d.ts +8 -0
- package/lib/ui/app/Features/index.js +112 -16
- package/lib/ui/app/Navigation/MastersNavigation/index.js +5 -4
- package/lib/ui/app/Navigation/index.js +7 -6
- package/lib/ui/app/Notifications/Onboarding/index.d.ts +2 -0
- package/lib/ui/app/Notifications/Onboarding/index.js +76 -78
- package/lib/ui/app/Notifications/index.js +98 -91
- package/lib/ui/app/Points/index.js +20 -17
- package/lib/ui/app/masters.js +167 -86
- package/lib/ui/app/useMastersApp.js +12 -11
- package/lib/ui/app/useSdkFeature.js +13 -16
- package/lib/ui/app/useSdkResponsive.js +1 -1
- package/lib/ui/app/useSdkScroll.d.ts +1 -1
- package/lib/ui/app/useSdkScroll.js +28 -25
- package/lib/ui/gamification/invite-link/index.js +26 -12
- package/lib/ui/gamification/onboarding/index.d.ts +0 -2
- package/lib/ui/gamification/onboarding/index.js +46 -46
- package/lib/ui/gamification/onboarding/slides/onboarding-instructions/index.d.ts +2 -2
- package/lib/ui/gamification/onboarding/slides/onboarding-instructions/index.js +21 -20
- package/lib/ui/gamification/onboarding/slides/onboarding-instructions/styles.d.ts +1 -0
- package/lib/ui/gamification/onboarding/slides/onboarding-instructions/styles.js +20 -15
- package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/index.d.ts +0 -3
- package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/index.js +34 -29
- package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/styles.d.ts +0 -3
- package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/styles.js +17 -32
- package/lib/ui/gamification/points/index.d.ts +1 -0
- package/lib/ui/gamification/points/index.js +9 -9
- package/lib/ui/gamification/question/index.d.ts +1 -0
- package/lib/ui/gamification/question/index.js +31 -24
- package/lib/ui/gamification/question/insight/index.js +11 -15
- package/lib/ui/gamification/question/list/index.d.ts +3 -1
- package/lib/ui/gamification/question/list/index.js +50 -34
- package/lib/ui/gamification/question/notification/index.js +23 -25
- package/lib/ui/gamification/question/notification/insight/index.js +10 -9
- package/lib/ui/gamification/question/notification/tweet/index.js +3 -2
- package/lib/ui/gamification/question/styles.d.ts +2 -0
- package/lib/ui/gamification/question/styles.js +39 -28
- package/lib/ui/gamification/question/twitter/index.js +14 -18
- package/lib/ui/gamification/user-statistics/index.d.ts +3 -2
- package/lib/ui/gamification/user-statistics/index.js +48 -45
- package/lib/ui/gamification/vote/feedback/index.d.ts +3 -2
- package/lib/ui/gamification/vote/feedback/index.js +74 -58
- package/lib/ui/gamification/vote/feedback/styles.d.ts +2 -0
- package/lib/ui/gamification/vote/feedback/styles.js +33 -21
- package/lib/ui/gamification/vote/index.js +94 -83
- package/lib/ui/gamification/vote/insight-details/index.js +7 -6
- package/lib/ui/gamification/vote/twitter-details/index.js +3 -2
- package/lib/ui/gamification/vote/vote-option/index.d.ts +2 -1
- package/lib/ui/gamification/vote/vote-option/index.js +47 -39
- package/lib/ui/icons/index.d.ts +1 -2
- package/lib/ui/icons/index.js +122 -49
- package/lib/ui/modal/index.js +27 -21
- package/lib/ui/navigation/button/Channels.js +6 -5
- package/lib/ui/navigation/button/FeaturedGroups.js +4 -3
- package/lib/ui/navigation/button/LeaderBoard.js +6 -5
- package/lib/ui/navigation/button/index.js +20 -7
- package/lib/ui/navigation/button/styles.d.ts +3 -0
- package/lib/ui/navigation/button/styles.js +9 -6
- package/lib/ui/questions/insight/index.js +16 -16
- package/lib/ui/questions/twitter/index.js +3 -2
- package/lib/ui/show-in/index.d.ts +2 -0
- package/lib/ui/show-in/index.js +24 -14
- package/lib/ui/timer/index.js +32 -28
- package/lib/ui/video-player/index.js +41 -39
- package/lib/ui/video-player/styles.d.ts +1 -0
- package/lib/ui/video-player/styles.js +10 -9
- package/package.json +22 -21
- package/lib/index-keh7OLCY.js +0 -67
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { QuestionType as
|
|
4
|
-
import { ExpiredAlert as
|
|
5
|
-
import { Feedback as
|
|
6
|
-
import { QuestionScrollContainer as
|
|
7
|
-
import { VotingOption as
|
|
8
|
-
import { WinBar as
|
|
1
|
+
import { jsx as n, jsxs as B, Fragment as tt } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useEffect as g, useCallback as O, useRef as rt, useMemo as l } from "react";
|
|
3
|
+
import { QuestionType as a, QuestionStatus as x } from "@streamlayer/sdk-web-types";
|
|
4
|
+
import { ExpiredAlert as et } from "./expired-alert/index.js";
|
|
5
|
+
import { Feedback as it } from "./feedback/index.js";
|
|
6
|
+
import { QuestionScrollContainer as ot, Container as st, Content as at, Title as nt, Options as ct } from "./styles.js";
|
|
7
|
+
import { VotingOption as mt } from "./vote-option/index.js";
|
|
8
|
+
import { WinBar as lt } from "./win-bar/index.js";
|
|
9
9
|
import "../../icons/index.js";
|
|
10
10
|
import "@linaria/react";
|
|
11
11
|
import "./expired-alert/styles.js";
|
|
12
12
|
import "./feedback/styles.js";
|
|
13
|
+
import "../../show-in/index.js";
|
|
14
|
+
import "@linaria/core";
|
|
13
15
|
import "../../app/styles.js";
|
|
14
16
|
import "../../animated-counter/index.js";
|
|
15
17
|
import "react-countup";
|
|
@@ -18,123 +20,132 @@ import "../../timer/index.js";
|
|
|
18
20
|
import "react-countdown-circle-timer";
|
|
19
21
|
import "../../theme/constants.js";
|
|
20
22
|
import "./win-bar/styles.js";
|
|
21
|
-
const
|
|
22
|
-
var
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const Nt = ({ openedQuestion: t, isLoading: E, vote: P, close: p }) => {
|
|
24
|
+
var M, b;
|
|
25
|
+
const L = t.subject, o = t.type, u = t.status, I = (M = t.options) == null ? void 0 : M.options, h = t.marketClosed, y = t.id, [V, W] = m(!1), [C, Y] = m(!1), [T, q] = m(!0), [c, F] = m(!1), [A, v] = m(""), [w, H] = m(""), [_, D] = m(!1);
|
|
26
|
+
g(() => {
|
|
27
|
+
w && D(!0);
|
|
28
|
+
}, [w]), g(() => {
|
|
29
|
+
o === a.PREDICTION ? h && q(!1) : u === x.RESOLVED && q(!1);
|
|
26
30
|
}, []);
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
}, []),
|
|
30
|
-
async (
|
|
31
|
-
if (
|
|
32
|
-
const
|
|
33
|
-
|
|
31
|
+
const z = O((i) => {
|
|
32
|
+
Y(i), W(!0);
|
|
33
|
+
}, []), R = rt(!1), S = O(
|
|
34
|
+
async (i) => {
|
|
35
|
+
if (!R.current && (R.current = !0, y)) {
|
|
36
|
+
const d = i.currentTarget.value;
|
|
37
|
+
v(d);
|
|
38
|
+
try {
|
|
39
|
+
await P(y, d);
|
|
40
|
+
} catch (j) {
|
|
41
|
+
const Q = j.message === "already_voted" ? "You’ve already answered this question on other device. So the points for this answer won't tally." : "Something went wrong, please try again";
|
|
42
|
+
H(Q), v(""), console.error("Error while voting", j), R.current = !1;
|
|
43
|
+
}
|
|
34
44
|
}
|
|
35
45
|
},
|
|
36
|
-
[
|
|
37
|
-
),
|
|
38
|
-
|
|
39
|
-
}, [
|
|
40
|
-
() => t == null ? void 0 : t.answers.find((
|
|
46
|
+
[y, v, P]
|
|
47
|
+
), G = O(() => {
|
|
48
|
+
F(!0), setTimeout(p, 3e3);
|
|
49
|
+
}, [p]), r = l(
|
|
50
|
+
() => t == null ? void 0 : t.answers.find((i) => i.youVoted === !0),
|
|
41
51
|
[t]
|
|
42
|
-
), s =
|
|
43
|
-
() => !!(t != null && t.answers.find((
|
|
52
|
+
), s = l(
|
|
53
|
+
() => !!(t != null && t.answers.find((i) => i.correct === !0)),
|
|
44
54
|
[t]
|
|
45
|
-
),
|
|
46
|
-
() => t == null ? void 0 : t.answers.find((
|
|
55
|
+
), e = l(
|
|
56
|
+
() => t == null ? void 0 : t.answers.find((i) => i.correct === !0),
|
|
47
57
|
[t]
|
|
48
|
-
)
|
|
49
|
-
|
|
58
|
+
);
|
|
59
|
+
g(() => {
|
|
60
|
+
let i;
|
|
61
|
+
return o === a.PREDICTION && r && V && (i = setTimeout(p, 1e4)), () => {
|
|
62
|
+
clearTimeout(i);
|
|
63
|
+
};
|
|
64
|
+
}, [r]);
|
|
65
|
+
const J = l(() => t ? t.answers.map((i) => {
|
|
66
|
+
var d;
|
|
50
67
|
return {
|
|
51
|
-
...
|
|
68
|
+
...i,
|
|
52
69
|
questionVoted: !!r,
|
|
53
|
-
youSelected:
|
|
54
|
-
isLoading:
|
|
70
|
+
youSelected: A === i.id,
|
|
71
|
+
isLoading: E,
|
|
55
72
|
hasCorrectAnswer: s,
|
|
56
73
|
questionType: t.type,
|
|
57
74
|
answerTimeExpired: c,
|
|
58
|
-
questionStatus:
|
|
59
|
-
imageMode: (
|
|
60
|
-
onVote:
|
|
75
|
+
questionStatus: u,
|
|
76
|
+
imageMode: (d = t.appearance) == null ? void 0 : d.images,
|
|
77
|
+
onVote: S
|
|
61
78
|
};
|
|
62
79
|
}) : [], [
|
|
63
80
|
s,
|
|
64
81
|
c,
|
|
65
|
-
|
|
82
|
+
E,
|
|
66
83
|
t,
|
|
67
84
|
r,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
]),
|
|
72
|
-
if (
|
|
85
|
+
u,
|
|
86
|
+
S,
|
|
87
|
+
A
|
|
88
|
+
]), K = I && (I.case === "trivia" || I.case === "prediction") ? I.value : void 0, f = u === x.RESOLVED && o === a.TRIVIA && !r && !T, N = o === a.TRIVIA && C && V && T, k = l(() => o === a.PREDICTION ? !!(r && !s || r && s && (e != null && e.youVoted)) : !0, [o, r, s, e]), U = l(() => {
|
|
89
|
+
if (o === a.PREDICTION && r && (!s || s && (e != null && e.youVoted)))
|
|
73
90
|
return r.points;
|
|
74
|
-
if (!(
|
|
75
|
-
return
|
|
76
|
-
}, [
|
|
77
|
-
|
|
78
|
-
r,
|
|
79
|
-
i,
|
|
80
|
-
m,
|
|
81
|
-
l,
|
|
82
|
-
a,
|
|
83
|
-
s
|
|
84
|
-
]), H = f(() => a === o.PREDICTION && r ? s ? s && (i != null && i.youVoted) ? "You won" : "" : "To win" : l || c ? "Time expired" : a === o.POLL ? "Time remaining" : r ? "You won" : "To win", [c, a, r, l, s, i]), z = (a === o.TRIVIA || a === o.PREDICTION) && r && s && (i == null ? void 0 : i.youVoted), G = r || l || S || a === o.TRIVIA && m === E.RESOLVED && T;
|
|
85
|
-
return /* @__PURE__ */ n(Z, { children: /* @__PURE__ */ n(_, { children: /* @__PURE__ */ k($, { children: [
|
|
91
|
+
if (!(f || c))
|
|
92
|
+
return r ? r.correct ? r.pointsEarned : 0 : e == null ? void 0 : e.points;
|
|
93
|
+
}, [c, r, e, f, o, s]), X = l(() => o === a.PREDICTION && r ? s ? s && (e != null && e.youVoted) ? "You won" : "" : "To win" : f || c ? "Time expired" : o === a.POLL ? "Time remaining" : r ? "You won" : "To win", [c, o, r, f, s, e]), Z = (o === a.TRIVIA || o === a.PREDICTION) && r && s && (e == null ? void 0 : e.youVoted), $ = r || f || N || o === a.TRIVIA && u === x.RESOLVED && T;
|
|
94
|
+
return /* @__PURE__ */ n(ot, { children: /* @__PURE__ */ n(st, { children: /* @__PURE__ */ B(at, { children: [
|
|
86
95
|
/* @__PURE__ */ n(
|
|
87
|
-
|
|
96
|
+
it,
|
|
88
97
|
{
|
|
89
|
-
feedbackMessages:
|
|
98
|
+
feedbackMessages: K,
|
|
90
99
|
questionVoted: !!r,
|
|
91
100
|
questionVotedCorrectly: r == null ? void 0 : r.correct,
|
|
92
|
-
questionType:
|
|
101
|
+
questionType: o,
|
|
93
102
|
hasCorrectAnswer: s,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
votedAfterQuestionClosed: y,
|
|
103
|
+
showExpiredNotification: f,
|
|
104
|
+
showClosedNotificationTrivia: N,
|
|
105
|
+
votedInCurrentRender: V,
|
|
106
|
+
votedAfterQuestionClosed: C,
|
|
99
107
|
enteredAnActiveQuestion: T,
|
|
100
|
-
marketClosed:
|
|
108
|
+
marketClosed: h,
|
|
109
|
+
percentsAnimated: _,
|
|
110
|
+
voteErrorMessage: w
|
|
101
111
|
}
|
|
102
112
|
),
|
|
103
|
-
|
|
104
|
-
|
|
113
|
+
k && /* @__PURE__ */ n(
|
|
114
|
+
lt,
|
|
105
115
|
{
|
|
106
|
-
title:
|
|
107
|
-
points:
|
|
108
|
-
onTimerExpired:
|
|
116
|
+
title: X,
|
|
117
|
+
points: U,
|
|
118
|
+
onTimerExpired: G,
|
|
109
119
|
questionType: t.type,
|
|
110
|
-
isTimer: !
|
|
120
|
+
isTimer: !E,
|
|
111
121
|
isPlayingTimer: !r,
|
|
112
|
-
animatePoints:
|
|
113
|
-
timerDuration:
|
|
122
|
+
animatePoints: Z,
|
|
123
|
+
timerDuration: $ ? 0 : Number(((b = t == null ? void 0 : t.appearance) == null ? void 0 : b.autoHideInterval) || "30")
|
|
114
124
|
}
|
|
115
125
|
),
|
|
116
126
|
c ? /* @__PURE__ */ n(
|
|
117
|
-
|
|
127
|
+
et,
|
|
118
128
|
{
|
|
119
129
|
title: "More to come...",
|
|
120
130
|
description: "Watch for additional enhanced stream interactive experience."
|
|
121
131
|
}
|
|
122
|
-
) : /* @__PURE__ */
|
|
123
|
-
/* @__PURE__ */ n(
|
|
124
|
-
/* @__PURE__ */ n(
|
|
125
|
-
|
|
132
|
+
) : /* @__PURE__ */ B(tt, { children: [
|
|
133
|
+
/* @__PURE__ */ n(nt, { style: k ? {} : { marginTop: 0 }, children: L }),
|
|
134
|
+
/* @__PURE__ */ n(ct, { children: J.map((i) => /* @__PURE__ */ n(
|
|
135
|
+
mt,
|
|
126
136
|
{
|
|
127
|
-
...
|
|
128
|
-
markThatVoted:
|
|
129
|
-
|
|
137
|
+
...i,
|
|
138
|
+
markThatVoted: z,
|
|
139
|
+
onPercentsAnimated: () => D(!0),
|
|
140
|
+
votedAfterQuestionClosed: C,
|
|
130
141
|
enteredAnActiveQuestion: T,
|
|
131
|
-
marketClosed:
|
|
142
|
+
marketClosed: h
|
|
132
143
|
},
|
|
133
|
-
|
|
144
|
+
i.id
|
|
134
145
|
)) })
|
|
135
146
|
] })
|
|
136
147
|
] }) }) });
|
|
137
148
|
};
|
|
138
149
|
export {
|
|
139
|
-
|
|
150
|
+
Nt as Vote
|
|
140
151
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { jsxs as o, jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import { SvgIcon as
|
|
2
|
+
import { SvgIcon as p } from "../../../icons/index.js";
|
|
3
3
|
import { InsightContent as b } from "../../../questions/insight/index.js";
|
|
4
4
|
import { Container as k, WebLinkBtn as c } from "./styles.js";
|
|
5
5
|
import "@linaria/react";
|
|
6
6
|
import "react";
|
|
7
7
|
import "@streamlayer/sdk-web-types";
|
|
8
8
|
import "../../../video-player/index.js";
|
|
9
|
+
import "@linaria/core";
|
|
9
10
|
import "../../../video-player/styles.js";
|
|
10
11
|
import "../../../questions/insight/styles.js";
|
|
11
|
-
const
|
|
12
|
-
/* @__PURE__ */ m(b, { instantView: r, ...
|
|
13
|
-
(r == null ? void 0 : r.webLink) && /* @__PURE__ */ o(c, { href: r == null ? void 0 : r.webLink.url, target: "_blank", children: [
|
|
12
|
+
const D = ({ instantView: r, ...l }) => /* @__PURE__ */ o(k, { children: [
|
|
13
|
+
/* @__PURE__ */ m(b, { instantView: r, ...l, isDetail: !0 }),
|
|
14
|
+
(r == null ? void 0 : r.webLink) && /* @__PURE__ */ o(c, { href: r == null ? void 0 : r.webLink.url, target: "_blank", "data-analytics": "web-link", children: [
|
|
14
15
|
r == null ? void 0 : r.webLink.label,
|
|
15
|
-
/* @__PURE__ */ m(
|
|
16
|
+
/* @__PURE__ */ m(p, { name: "icon-external-link" })
|
|
16
17
|
] })
|
|
17
18
|
] });
|
|
18
19
|
export {
|
|
19
|
-
|
|
20
|
+
D as InsightDetails
|
|
20
21
|
};
|
|
@@ -2,6 +2,7 @@ import { jsxs as r, jsx as i } from "react/jsx-runtime";
|
|
|
2
2
|
import { TwitterContent as o } from "../../../questions/twitter/index.js";
|
|
3
3
|
import { Container as m, Quote as e } from "./styles.js";
|
|
4
4
|
import "../../../video-player/index.js";
|
|
5
|
+
import "@linaria/core";
|
|
5
6
|
import "react";
|
|
6
7
|
import "../../../icons/index.js";
|
|
7
8
|
import "@linaria/react";
|
|
@@ -10,10 +11,10 @@ import "../../../questions/twitter/account/index.js";
|
|
|
10
11
|
import "../../../../utils/common.js";
|
|
11
12
|
import "../../../questions/twitter/account/styles.js";
|
|
12
13
|
import "../../../questions/twitter/styles.js";
|
|
13
|
-
const
|
|
14
|
+
const C = (t) => /* @__PURE__ */ r(m, { children: [
|
|
14
15
|
t.title && /* @__PURE__ */ i(e, { children: t.title }),
|
|
15
16
|
/* @__PURE__ */ i(o, { ...t, isDetail: !0 })
|
|
16
17
|
] });
|
|
17
18
|
export {
|
|
18
|
-
|
|
19
|
+
C as TwitterDetails
|
|
19
20
|
};
|
|
@@ -12,7 +12,8 @@ export type VotingOptionProps = ExtendedQuestionAnswer & {
|
|
|
12
12
|
votedAfterQuestionClosed: boolean;
|
|
13
13
|
enteredAnActiveQuestion: boolean;
|
|
14
14
|
marketClosed: boolean;
|
|
15
|
-
onVote: (e: React.MouseEvent<HTMLButtonElement>) => void
|
|
15
|
+
onVote: (e: React.MouseEvent<HTMLButtonElement>) => Promise<void>;
|
|
16
16
|
markThatVoted: (votedAfterQuestionClosed: boolean) => void;
|
|
17
|
+
onPercentsAnimated?: () => void;
|
|
17
18
|
};
|
|
18
19
|
export declare const VotingOption: React.FC<VotingOptionProps>;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as n, jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { QuestionImages as a, QuestionType as o, QuestionStatus as
|
|
4
|
-
import { AnimatedCounter as
|
|
5
|
-
import { IconDefault as
|
|
2
|
+
import { useState as j, useLayoutEffect as U } from "react";
|
|
3
|
+
import { QuestionImages as a, QuestionType as o, QuestionStatus as A } from "@streamlayer/sdk-web-types";
|
|
4
|
+
import { AnimatedCounter as $ } from "../../../animated-counter/index.js";
|
|
5
|
+
import { IconDefault as y, IconContainer as F, IconWrap as M, IconCircle as W, ButtonContainer as z, ButtonPct as G, ButtonBody as H, Title as J, Pts as K, Indicators as X, CheckIcon as Y, Percentage as Z } from "./styles.js";
|
|
6
6
|
import "react-countup";
|
|
7
7
|
import "@linaria/react";
|
|
8
8
|
import "../../../icons/index.js";
|
|
9
9
|
const I = {
|
|
10
|
-
[a.CENTERED]: (t) => /* @__PURE__ */ n(
|
|
11
|
-
[a.TRANSPARENT]: (t) => /* @__PURE__ */ n(
|
|
12
|
-
[a.ROUNDED]: (t) => /* @__PURE__ */ n(
|
|
10
|
+
[a.CENTERED]: (t) => /* @__PURE__ */ n(y, { alt: "option-icon", src: t }),
|
|
11
|
+
[a.TRANSPARENT]: (t) => /* @__PURE__ */ n(F, { children: /* @__PURE__ */ n(M, { style: { backgroundImage: `url(${t})` } }) }),
|
|
12
|
+
[a.ROUNDED]: (t) => /* @__PURE__ */ n(W, { alt: "option-icon", src: t }),
|
|
13
13
|
[a.NONE]: () => null,
|
|
14
14
|
[a.UNSET]: () => null
|
|
15
|
-
},
|
|
15
|
+
}, _ = ({ questionType: t, hasCorrectAnswer: c, correct: r, youVoted: i, questionVoted: e }) => {
|
|
16
16
|
if (t === o.POLL && i)
|
|
17
17
|
return "correct";
|
|
18
18
|
if (t === o.PREDICTION) {
|
|
@@ -22,66 +22,74 @@ const I = {
|
|
|
22
22
|
return "correct";
|
|
23
23
|
}
|
|
24
24
|
return t === o.TRIVIA && e && i ? r ? "correct" : "incorrect" : "unset";
|
|
25
|
-
},
|
|
25
|
+
}, q = ({
|
|
26
26
|
questionType: t,
|
|
27
27
|
questionVoted: c,
|
|
28
28
|
correct: r,
|
|
29
29
|
hasCorrectAnswer: i,
|
|
30
30
|
questionStatus: e
|
|
31
|
-
}) => t === o.TRIVIA ? c && r : t === o.PREDICTION ? c && r && i || e ===
|
|
32
|
-
var
|
|
31
|
+
}) => t === o.TRIVIA ? c && r : t === o.PREDICTION ? c && r && i || e === A.RESOLVED && r : !1, at = (t) => {
|
|
32
|
+
var T;
|
|
33
33
|
const {
|
|
34
34
|
// option props
|
|
35
35
|
id: c,
|
|
36
36
|
icon: r,
|
|
37
37
|
text: i,
|
|
38
38
|
percentageDecimal: e,
|
|
39
|
-
points:
|
|
39
|
+
points: N,
|
|
40
40
|
// extra props
|
|
41
|
-
onVote:
|
|
41
|
+
onVote: S,
|
|
42
42
|
markThatVoted: D,
|
|
43
|
-
|
|
43
|
+
onPercentsAnimated: w,
|
|
44
|
+
youSelected: E,
|
|
44
45
|
questionVoted: s,
|
|
45
|
-
imageMode:
|
|
46
|
-
answerTimeExpired:
|
|
46
|
+
imageMode: h,
|
|
47
|
+
answerTimeExpired: O,
|
|
47
48
|
questionStatus: C,
|
|
48
|
-
isLoading:
|
|
49
|
+
isLoading: g,
|
|
49
50
|
questionType: d,
|
|
50
|
-
correct:
|
|
51
|
-
hasCorrectAnswer:
|
|
51
|
+
correct: k,
|
|
52
|
+
hasCorrectAnswer: v,
|
|
52
53
|
votedAfterQuestionClosed: x,
|
|
53
54
|
enteredAnActiveQuestion: P,
|
|
54
55
|
marketClosed: l
|
|
55
|
-
} = t, [L, p] =
|
|
56
|
-
return
|
|
56
|
+
} = t, [L, p] = j(e), m = _(t), Q = q({ questionType: d, questionVoted: s, correct: k, hasCorrectAnswer: v, questionStatus: C }), f = l && d === o.PREDICTION, R = s || f, B = d === o.PREDICTION && !s && !l, V = s && !E && m !== "incorrect";
|
|
57
|
+
return U(() => {
|
|
57
58
|
e > 0 && (p(0), requestAnimationFrame(() => {
|
|
58
59
|
p(e);
|
|
59
60
|
}));
|
|
60
61
|
}, [e]), /* @__PURE__ */ u(
|
|
61
|
-
|
|
62
|
+
z,
|
|
62
63
|
{
|
|
63
64
|
value: c,
|
|
64
|
-
"data-selected":
|
|
65
|
+
"data-selected": E,
|
|
65
66
|
"data-answer-state": m,
|
|
66
|
-
disabled: s ||
|
|
67
|
-
"data-is-not-checked":
|
|
68
|
-
onClick: (
|
|
67
|
+
disabled: s || g || O || f && !P || f && P && x,
|
|
68
|
+
"data-is-not-checked": V,
|
|
69
|
+
onClick: (b) => {
|
|
69
70
|
D(
|
|
70
|
-
d === o.PREDICTION ? l : C ===
|
|
71
|
-
),
|
|
71
|
+
d === o.PREDICTION ? l : C === A.RESOLVED
|
|
72
|
+
), S(b);
|
|
72
73
|
},
|
|
73
74
|
children: [
|
|
74
|
-
/* @__PURE__ */ n(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
/* @__PURE__ */ n(
|
|
76
|
+
G,
|
|
77
|
+
{
|
|
78
|
+
"data-answer-state": m,
|
|
79
|
+
style: { width: `${R ? L : 0}%` },
|
|
80
|
+
onTransitionEnd: w
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ u(H, { children: [
|
|
84
|
+
r && h && ((T = I[h]) == null ? void 0 : T.call(I, r)),
|
|
85
|
+
/* @__PURE__ */ n(J, { children: i }),
|
|
86
|
+
B && /* @__PURE__ */ u("div", { children: [
|
|
87
|
+
N,
|
|
88
|
+
/* @__PURE__ */ n(K, { children: "pts" })
|
|
81
89
|
] }),
|
|
82
|
-
R && /* @__PURE__ */ u(
|
|
83
|
-
|
|
84
|
-
/* @__PURE__ */ n(
|
|
90
|
+
R && /* @__PURE__ */ u(X, { children: [
|
|
91
|
+
Q && /* @__PURE__ */ n(Y, { name: "selected" }),
|
|
92
|
+
/* @__PURE__ */ n(Z, { children: /* @__PURE__ */ n($, { value: e, suffix: "%" }) })
|
|
85
93
|
] })
|
|
86
94
|
] })
|
|
87
95
|
]
|
|
@@ -89,5 +97,5 @@ const I = {
|
|
|
89
97
|
);
|
|
90
98
|
};
|
|
91
99
|
export {
|
|
92
|
-
|
|
100
|
+
at as VotingOption
|
|
93
101
|
};
|
package/lib/ui/icons/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare const icons: {
|
|
|
11
11
|
'icon-insight': any;
|
|
12
12
|
'icon-poll': any;
|
|
13
13
|
'icon-play': any;
|
|
14
|
+
'icon-pause': any;
|
|
14
15
|
'icon-masters-logo': any;
|
|
15
16
|
'icon-logout': any;
|
|
16
17
|
'icon-link': any;
|
|
@@ -36,8 +37,6 @@ export declare const icons: {
|
|
|
36
37
|
'icon-btn-feature-groups': any;
|
|
37
38
|
'icon-btn-leaderboard': any;
|
|
38
39
|
'icon-arrow': any;
|
|
39
|
-
'icon-facebook': any;
|
|
40
|
-
'icon-twitter': any;
|
|
41
40
|
'icon-twitter-verified': any;
|
|
42
41
|
correct: any;
|
|
43
42
|
incorrect: any;
|