@streamlayer/react-ui 0.97.1 → 0.98.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/ui/app/Features/Gamification/UserSummary.js +11 -11
- package/lib/ui/app/Points/index.js +14 -14
- package/lib/ui/app/useMastersApp.js +25 -23
- package/lib/ui/gamification/vote/feedback/index.d.ts +1 -1
- package/lib/ui/gamification/vote/feedback/index.js +64 -73
- package/lib/ui/gamification/vote/feedback/styles.js +1 -1
- package/lib/ui/gamification/vote/index.js +90 -85
- package/lib/ui/gamification/vote/vote-option/index.js +28 -28
- package/lib/ui/gamification/vote/win-bar/index.d.ts +2 -0
- package/lib/ui/gamification/vote/win-bar/index.js +44 -25
- package/lib/ui/gamification/vote/win-bar/styles.d.ts +1 -0
- package/lib/ui/gamification/vote/win-bar/styles.js +28 -21
- package/lib/ui/modal/index.js +34 -32
- package/lib/ui/show-in/index.d.ts +7 -3
- package/lib/ui/show-in/index.js +43 -21
- package/package.json +9 -9
|
@@ -1,82 +1,73 @@
|
|
|
1
|
-
import { jsx as i, jsxs as n, Fragment as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ShowInContainer as E, Container as K, IconPrediction as j, FeedbackDescription as l, FeedbackIconWrap as m, FeedbackHeader as F, FeedbackText as I, DynamicWrap as z, FeedbackTitle as G } from "./styles.js";
|
|
1
|
+
import { jsx as i, jsxs as n, Fragment as e } from "react/jsx-runtime";
|
|
2
|
+
import { QuestionType as r } from "@streamlayer/sdk-web-types";
|
|
3
|
+
import { SvgIcon as h } from "../../../icons/index.js";
|
|
4
|
+
import { ShowInContainer as C, Container as L, IconPrediction as W, FeedbackDescription as l, FeedbackIconWrap as a, FeedbackHeader as F, FeedbackText as k, DynamicWrap as Y, FeedbackTitle as E } from "./styles.js";
|
|
6
5
|
import "@linaria/react";
|
|
6
|
+
import "react";
|
|
7
7
|
import "../../../show-in/index.js";
|
|
8
8
|
import "@linaria/core";
|
|
9
|
-
const
|
|
10
|
-
feedbackMessages:
|
|
11
|
-
questionVotedCorrectly:
|
|
12
|
-
questionVoted:
|
|
13
|
-
questionType:
|
|
14
|
-
hasCorrectAnswer:
|
|
15
|
-
showExpiredNotification:
|
|
16
|
-
showClosedNotificationTrivia:
|
|
17
|
-
votedInCurrentRender:
|
|
18
|
-
votedAfterQuestionClosed:
|
|
9
|
+
const _ = ({
|
|
10
|
+
feedbackMessages: t,
|
|
11
|
+
questionVotedCorrectly: u,
|
|
12
|
+
questionVoted: m,
|
|
13
|
+
questionType: d,
|
|
14
|
+
hasCorrectAnswer: b,
|
|
15
|
+
showExpiredNotification: x,
|
|
16
|
+
showClosedNotificationTrivia: I,
|
|
17
|
+
votedInCurrentRender: p,
|
|
18
|
+
votedAfterQuestionClosed: f,
|
|
19
19
|
voteErrorMessage: c,
|
|
20
|
-
enteredAnActiveQuestion:
|
|
21
|
-
marketClosed:
|
|
22
|
-
percentsAnimated:
|
|
20
|
+
enteredAnActiveQuestion: w,
|
|
21
|
+
marketClosed: Q,
|
|
22
|
+
percentsAnimated: j
|
|
23
23
|
}) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/* @__PURE__ */ i(l, { children: c })
|
|
36
|
-
] }),
|
|
37
|
-
!c && w && /* @__PURE__ */ n(t, { children: [
|
|
38
|
-
/* @__PURE__ */ i(m, { children: /* @__PURE__ */ i(a, { name: "questionExpired" }) }),
|
|
39
|
-
/* @__PURE__ */ n("div", { children: [
|
|
40
|
-
/* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(l, { children: "Question Expired" }) }),
|
|
41
|
-
/* @__PURE__ */ i(I, { children: "You can still answer to see if you're correct, but no points are awarded for expired questions." })
|
|
42
|
-
] })
|
|
43
|
-
] }),
|
|
44
|
-
!c && P && /* @__PURE__ */ n(t, { children: [
|
|
45
|
-
/* @__PURE__ */ i(m, { children: /* @__PURE__ */ i(a, { name: "questionExpired" }) }),
|
|
46
|
-
/* @__PURE__ */ n("div", { children: [
|
|
47
|
-
/* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(l, { children: "Question Closed" }) }),
|
|
48
|
-
/* @__PURE__ */ i(I, { children: "This question was answered after the moderator closed the question. So the points for this answer won’t tally." })
|
|
49
|
-
] })
|
|
50
|
-
] }),
|
|
51
|
-
!c && O && /* @__PURE__ */ n(t, { children: [
|
|
52
|
-
/* @__PURE__ */ i(m, { children: /* @__PURE__ */ i(a, { name: "questionExpired" }) }),
|
|
53
|
-
/* @__PURE__ */ n("div", { children: [
|
|
54
|
-
/* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(l, { children: "Question Closed" }) }),
|
|
55
|
-
/* @__PURE__ */ i(I, { children: "This event has already taken place, so the ability to make a prediction on its outcome is no longer available." })
|
|
56
|
-
] })
|
|
57
|
-
] }),
|
|
58
|
-
!c && R && /* @__PURE__ */ n(t, { children: [
|
|
59
|
-
/* @__PURE__ */ i(j, { name: "icon-prediction" }),
|
|
60
|
-
/* @__PURE__ */ n(l, { children: [
|
|
61
|
-
"Your pick has been recorded. ",
|
|
62
|
-
/* @__PURE__ */ i(z, { children: "We’ll notify you of the result." })
|
|
63
|
-
] })
|
|
64
|
-
] }),
|
|
65
|
-
!c && S && /* @__PURE__ */ n(t, { children: [
|
|
66
|
-
/* @__PURE__ */ i(m, { "data-feedback-type": "correct", children: /* @__PURE__ */ i(a, { name: "correct" }) }),
|
|
67
|
-
/* @__PURE__ */ i(l, { children: "Thanks for answering. Please stay tuned for the next question." })
|
|
68
|
-
] }),
|
|
69
|
-
!c && (T || N) && !P && /* @__PURE__ */ n(t, { children: [
|
|
70
|
-
/* @__PURE__ */ i(m, { "data-feedback-type": b, children: /* @__PURE__ */ i(a, { name: b }) }),
|
|
71
|
-
/* @__PURE__ */ i("div", { children: /* @__PURE__ */ n(F, { children: [
|
|
72
|
-
/* @__PURE__ */ i(G, { "data-feedback-type": b, children: h == null ? void 0 : h.title }),
|
|
73
|
-
/* @__PURE__ */ i(l, { children: h == null ? void 0 : h.description })
|
|
74
|
-
] }) })
|
|
75
|
-
] })
|
|
24
|
+
const D = m && (d === r.TRIVIA || d === r.PREDICTION), y = d === r.PREDICTION && !b, O = Q && d === r.PREDICTION && !m && !w || d === r.PREDICTION && f && p && w, R = D && y, T = D && b, N = d === r.PREDICTION && m && p && b, S = m && d === r.POLL && p, P = u ? "correct" : "incorrect", o = u ? t == null ? void 0 : t.correctFeedback : t == null ? void 0 : t.incorrectFeedback;
|
|
25
|
+
return x || I || R || T || O || S || N || c ? /* @__PURE__ */ i(C, { enabled: p, animate: j, children: /* @__PURE__ */ n(L, { "data-prediction": y, children: [
|
|
26
|
+
c && /* @__PURE__ */ n(e, { children: [
|
|
27
|
+
/* @__PURE__ */ i(W, { name: "questionExpired" }),
|
|
28
|
+
/* @__PURE__ */ i(l, { children: c })
|
|
29
|
+
] }),
|
|
30
|
+
!c && x && /* @__PURE__ */ n(e, { children: [
|
|
31
|
+
/* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(h, { name: "questionExpired" }) }),
|
|
32
|
+
/* @__PURE__ */ n("div", { children: [
|
|
33
|
+
/* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(l, { children: "Question Expired" }) }),
|
|
34
|
+
/* @__PURE__ */ i(k, { children: "You can still answer to see if you're correct, but no points are awarded for expired questions." })
|
|
76
35
|
] })
|
|
77
|
-
}
|
|
78
|
-
|
|
36
|
+
] }),
|
|
37
|
+
!c && I && /* @__PURE__ */ n(e, { children: [
|
|
38
|
+
/* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(h, { name: "questionExpired" }) }),
|
|
39
|
+
/* @__PURE__ */ n("div", { children: [
|
|
40
|
+
/* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(l, { children: "Question Closed" }) }),
|
|
41
|
+
/* @__PURE__ */ i(k, { children: "This question was answered after the moderator closed the question. So the points for this answer won’t tally." })
|
|
42
|
+
] })
|
|
43
|
+
] }),
|
|
44
|
+
!c && O && /* @__PURE__ */ n(e, { children: [
|
|
45
|
+
/* @__PURE__ */ i(a, { children: /* @__PURE__ */ i(h, { name: "questionExpired" }) }),
|
|
46
|
+
/* @__PURE__ */ n("div", { children: [
|
|
47
|
+
/* @__PURE__ */ i(F, { children: /* @__PURE__ */ i(l, { children: "Question Closed" }) }),
|
|
48
|
+
/* @__PURE__ */ i(k, { children: "This event has already taken place, so the ability to make a prediction on its outcome is no longer available." })
|
|
49
|
+
] })
|
|
50
|
+
] }),
|
|
51
|
+
!c && R && /* @__PURE__ */ n(e, { children: [
|
|
52
|
+
/* @__PURE__ */ i(W, { name: "icon-prediction" }),
|
|
53
|
+
/* @__PURE__ */ n(l, { children: [
|
|
54
|
+
"Your pick has been recorded. ",
|
|
55
|
+
/* @__PURE__ */ i(Y, { children: "We’ll notify you of the result." })
|
|
56
|
+
] })
|
|
57
|
+
] }),
|
|
58
|
+
!c && S && /* @__PURE__ */ n(e, { children: [
|
|
59
|
+
/* @__PURE__ */ i(a, { "data-feedback-type": "correct", children: /* @__PURE__ */ i(h, { name: "correct" }) }),
|
|
60
|
+
/* @__PURE__ */ i(l, { children: "Thanks for answering. Please stay tuned for the next question." })
|
|
61
|
+
] }),
|
|
62
|
+
!c && (T || N) && !I && /* @__PURE__ */ n(e, { children: [
|
|
63
|
+
/* @__PURE__ */ i(a, { "data-feedback-type": P, children: /* @__PURE__ */ i(h, { name: P }) }),
|
|
64
|
+
/* @__PURE__ */ i("div", { children: /* @__PURE__ */ n(F, { children: [
|
|
65
|
+
/* @__PURE__ */ i(E, { "data-feedback-type": P, children: o == null ? void 0 : o.title }),
|
|
66
|
+
/* @__PURE__ */ i(l, { children: o == null ? void 0 : o.description })
|
|
67
|
+
] }) })
|
|
68
|
+
] })
|
|
69
|
+
] }) }) : null;
|
|
79
70
|
};
|
|
80
71
|
export {
|
|
81
|
-
|
|
72
|
+
_ as Feedback
|
|
82
73
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { styled as s } from "@linaria/react";
|
|
2
2
|
import { SvgIcon as e } from "../../../icons/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { GrowingShowIn as a } from "../../../show-in/index.js";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "react";
|
|
6
6
|
import "@linaria/core";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx 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 a, jsxs as L, Fragment as rt } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l, useEffect as x, useCallback as D, useRef as et, useMemo as f } from "react";
|
|
3
|
+
import { QuestionType as n, QuestionStatus as q } from "@streamlayer/sdk-web-types";
|
|
4
|
+
import { ExpiredAlert as it } from "./expired-alert/index.js";
|
|
5
|
+
import { Feedback as ot } from "./feedback/index.js";
|
|
6
|
+
import { QuestionScrollContainer as st, Container as nt, Content as at, Title as ct, Options as mt } from "./styles.js";
|
|
7
|
+
import { VotingOption as lt } from "./vote-option/index.js";
|
|
8
|
+
import { WinBar as ft } from "./win-bar/index.js";
|
|
9
9
|
import "../../icons/index.js";
|
|
10
10
|
import "@linaria/react";
|
|
11
11
|
import "./expired-alert/styles.js";
|
|
@@ -20,132 +20,137 @@ import "../../timer/index.js";
|
|
|
20
20
|
import "react-countdown-circle-timer";
|
|
21
21
|
import "../../theme/constants.js";
|
|
22
22
|
import "./win-bar/styles.js";
|
|
23
|
-
const
|
|
24
|
-
var
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}, [w]), g(() => {
|
|
29
|
-
o === a.PREDICTION ? h && q(!1) : u === x.RESOLVED && q(!1);
|
|
23
|
+
const kt = ({ openedQuestion: t, isLoading: h, vote: A, close: p }) => {
|
|
24
|
+
var B, W;
|
|
25
|
+
const Y = t.subject, o = t.type, d = t.status, E = (B = t.options) == null ? void 0 : B.options, y = t.marketClosed, C = t.id, [T, F] = l(!1), [V, H] = l(!1), [I, N] = l(!0), [c, _] = l(!1), [S, v] = l(""), [w, z] = l(""), [R, k] = l(!1);
|
|
26
|
+
x(() => {
|
|
27
|
+
o === n.PREDICTION ? y && N(!1) : d === q.RESOLVED && N(!1);
|
|
30
28
|
}, []);
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
}, []),
|
|
34
|
-
async (
|
|
35
|
-
if (!
|
|
36
|
-
const
|
|
37
|
-
v(
|
|
29
|
+
const G = D((e) => {
|
|
30
|
+
H(e), F(!0);
|
|
31
|
+
}, []), g = et(!1), M = D(
|
|
32
|
+
async (e) => {
|
|
33
|
+
if (!g.current && (g.current = !0, C)) {
|
|
34
|
+
const m = e.currentTarget.value;
|
|
35
|
+
v(m);
|
|
38
36
|
try {
|
|
39
|
-
await
|
|
37
|
+
await A(C, m);
|
|
40
38
|
} catch (j) {
|
|
41
|
-
const
|
|
42
|
-
|
|
39
|
+
const tt = 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";
|
|
40
|
+
z(tt), v(""), console.error("Error while voting", j), g.current = !1;
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
43
|
},
|
|
46
|
-
[
|
|
47
|
-
),
|
|
48
|
-
|
|
49
|
-
}, [p]), r =
|
|
50
|
-
() => t == null ? void 0 : t.answers.find((
|
|
44
|
+
[C, v, A]
|
|
45
|
+
), J = D(() => {
|
|
46
|
+
_(!0), setTimeout(p, 3e3);
|
|
47
|
+
}, [p]), r = f(
|
|
48
|
+
() => t == null ? void 0 : t.answers.find((e) => e.youVoted === !0),
|
|
51
49
|
[t]
|
|
52
|
-
), s =
|
|
53
|
-
() => !!(t != null && t.answers.find((
|
|
50
|
+
), s = f(
|
|
51
|
+
() => !!(t != null && t.answers.find((e) => e.correct === !0)),
|
|
54
52
|
[t]
|
|
55
|
-
),
|
|
56
|
-
() => t == null ? void 0 : t.answers.find((
|
|
53
|
+
), i = f(
|
|
54
|
+
() => t == null ? void 0 : t.answers.find((e) => e.correct === !0),
|
|
57
55
|
[t]
|
|
58
56
|
);
|
|
59
|
-
|
|
60
|
-
let
|
|
61
|
-
return o ===
|
|
62
|
-
clearTimeout(
|
|
57
|
+
x(() => {
|
|
58
|
+
let e;
|
|
59
|
+
return o === n.PREDICTION && r && T && (e = setTimeout(p, 1e4)), () => {
|
|
60
|
+
clearTimeout(e);
|
|
63
61
|
};
|
|
64
62
|
}, [r]);
|
|
65
|
-
const
|
|
66
|
-
var
|
|
63
|
+
const O = f(() => t ? t.answers.map((e) => {
|
|
64
|
+
var m;
|
|
67
65
|
return {
|
|
68
|
-
...
|
|
66
|
+
...e,
|
|
69
67
|
questionVoted: !!r,
|
|
70
|
-
youSelected:
|
|
71
|
-
isLoading:
|
|
68
|
+
youSelected: S === e.id,
|
|
69
|
+
isLoading: h,
|
|
72
70
|
hasCorrectAnswer: s,
|
|
73
71
|
questionType: t.type,
|
|
74
72
|
answerTimeExpired: c,
|
|
75
|
-
questionStatus:
|
|
76
|
-
imageMode: (
|
|
77
|
-
onVote:
|
|
73
|
+
questionStatus: d,
|
|
74
|
+
imageMode: (m = t.appearance) == null ? void 0 : m.images,
|
|
75
|
+
onVote: M
|
|
78
76
|
};
|
|
79
77
|
}) : [], [
|
|
80
78
|
s,
|
|
81
79
|
c,
|
|
82
|
-
|
|
80
|
+
h,
|
|
83
81
|
t,
|
|
84
82
|
r,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
])
|
|
89
|
-
|
|
83
|
+
d,
|
|
84
|
+
M,
|
|
85
|
+
S
|
|
86
|
+
]);
|
|
87
|
+
x(() => {
|
|
88
|
+
const e = O.some(({ percentageDecimal: m }) => m !== 0);
|
|
89
|
+
w && !e && k(!0);
|
|
90
|
+
}, [O, w]);
|
|
91
|
+
const K = E && (E.case === "trivia" || E.case === "prediction") ? E.value : void 0, u = d === q.RESOLVED && o === n.TRIVIA && !r && !I, b = o === n.TRIVIA && V && T && I, P = f(() => o === n.PREDICTION ? !!(r && !s || r && s && (i != null && i.youVoted)) : !0, [o, r, s, i]), U = f(() => {
|
|
92
|
+
if (o === n.PREDICTION && r && (!s || s && (i != null && i.youVoted)))
|
|
90
93
|
return r.points;
|
|
91
|
-
if (!(
|
|
92
|
-
return r ? r.correct ? r.pointsEarned : 0 :
|
|
93
|
-
}, [c, r,
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
|
|
94
|
+
if (!(u || c))
|
|
95
|
+
return r ? r.correct ? r.pointsEarned : 0 : i == null ? void 0 : i.points;
|
|
96
|
+
}, [c, r, i, u, o, s]), X = f(() => o === n.PREDICTION && r ? s ? s && (i != null && i.youVoted) ? "You won" : "" : "To win" : u || c ? "Time expired" : o === n.POLL ? "Time remaining" : r ? "You won" : "To win", [c, o, r, u, s, i]), Z = !P || P && o === n.PREDICTION && T && !R, $ = (o === n.TRIVIA || o === n.PREDICTION) && r && s && (i == null ? void 0 : i.youVoted), Q = r || u || b || o === n.TRIVIA && d === q.RESOLVED && I;
|
|
97
|
+
return /* @__PURE__ */ a(st, { children: /* @__PURE__ */ a(nt, { children: /* @__PURE__ */ L(at, { children: [
|
|
98
|
+
/* @__PURE__ */ a(
|
|
99
|
+
ot,
|
|
97
100
|
{
|
|
98
101
|
feedbackMessages: K,
|
|
99
102
|
questionVoted: !!r,
|
|
100
103
|
questionVotedCorrectly: r == null ? void 0 : r.correct,
|
|
101
104
|
questionType: o,
|
|
102
105
|
hasCorrectAnswer: s,
|
|
103
|
-
showExpiredNotification:
|
|
104
|
-
showClosedNotificationTrivia:
|
|
105
|
-
votedInCurrentRender:
|
|
106
|
-
votedAfterQuestionClosed:
|
|
107
|
-
enteredAnActiveQuestion:
|
|
108
|
-
marketClosed:
|
|
109
|
-
percentsAnimated:
|
|
106
|
+
showExpiredNotification: u,
|
|
107
|
+
showClosedNotificationTrivia: b,
|
|
108
|
+
votedInCurrentRender: T,
|
|
109
|
+
votedAfterQuestionClosed: V,
|
|
110
|
+
enteredAnActiveQuestion: I,
|
|
111
|
+
marketClosed: y,
|
|
112
|
+
percentsAnimated: R,
|
|
110
113
|
voteErrorMessage: w
|
|
111
114
|
}
|
|
112
115
|
),
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
P && /* @__PURE__ */ a(
|
|
117
|
+
ft,
|
|
115
118
|
{
|
|
116
119
|
title: X,
|
|
117
120
|
points: U,
|
|
118
|
-
onTimerExpired:
|
|
121
|
+
onTimerExpired: J,
|
|
119
122
|
questionType: t.type,
|
|
120
|
-
isTimer: !
|
|
123
|
+
isTimer: !h,
|
|
121
124
|
isPlayingTimer: !r,
|
|
122
|
-
animatePoints:
|
|
123
|
-
timerDuration:
|
|
125
|
+
animatePoints: $,
|
|
126
|
+
timerDuration: Q ? 0 : Number(((W = t == null ? void 0 : t.appearance) == null ? void 0 : W.autoHideInterval) || "30"),
|
|
127
|
+
votedInCurrentRender: T,
|
|
128
|
+
percentsAnimated: R
|
|
124
129
|
}
|
|
125
130
|
),
|
|
126
|
-
c ? /* @__PURE__ */
|
|
127
|
-
|
|
131
|
+
c ? /* @__PURE__ */ a(
|
|
132
|
+
it,
|
|
128
133
|
{
|
|
129
134
|
title: "More to come...",
|
|
130
135
|
description: "Watch for additional enhanced stream interactive experience."
|
|
131
136
|
}
|
|
132
|
-
) : /* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
/* @__PURE__ */
|
|
135
|
-
|
|
137
|
+
) : /* @__PURE__ */ L(rt, { children: [
|
|
138
|
+
/* @__PURE__ */ a(ct, { style: Z ? { marginTop: 0 } : {}, children: Y }),
|
|
139
|
+
/* @__PURE__ */ a(mt, { children: O.map((e) => /* @__PURE__ */ a(
|
|
140
|
+
lt,
|
|
136
141
|
{
|
|
137
|
-
...
|
|
138
|
-
markThatVoted:
|
|
139
|
-
onPercentsAnimated: () =>
|
|
140
|
-
votedAfterQuestionClosed:
|
|
141
|
-
enteredAnActiveQuestion:
|
|
142
|
-
marketClosed:
|
|
142
|
+
...e,
|
|
143
|
+
markThatVoted: G,
|
|
144
|
+
onPercentsAnimated: () => k(!0),
|
|
145
|
+
votedAfterQuestionClosed: V,
|
|
146
|
+
enteredAnActiveQuestion: I,
|
|
147
|
+
marketClosed: y
|
|
143
148
|
},
|
|
144
|
-
|
|
149
|
+
e.id
|
|
145
150
|
)) })
|
|
146
151
|
] })
|
|
147
152
|
] }) }) });
|
|
148
153
|
};
|
|
149
154
|
export {
|
|
150
|
-
|
|
155
|
+
kt as Vote
|
|
151
156
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
2
2
|
import { useState as j, useLayoutEffect as U } from "react";
|
|
3
3
|
import { QuestionImages as a, QuestionType as o, QuestionStatus as A } from "@streamlayer/sdk-web-types";
|
|
4
4
|
import { AnimatedCounter as $ } from "../../../animated-counter/index.js";
|
|
@@ -7,35 +7,35 @@ import "react-countup";
|
|
|
7
7
|
import "@linaria/react";
|
|
8
8
|
import "../../../icons/index.js";
|
|
9
9
|
const I = {
|
|
10
|
-
[a.CENTERED]: (t) => /* @__PURE__ */
|
|
11
|
-
[a.TRANSPARENT]: (t) => /* @__PURE__ */
|
|
12
|
-
[a.ROUNDED]: (t) => /* @__PURE__ */
|
|
10
|
+
[a.CENTERED]: (t) => /* @__PURE__ */ e(y, { alt: "option-icon", src: t }),
|
|
11
|
+
[a.TRANSPARENT]: (t) => /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(M, { style: { backgroundImage: `url(${t})` } }) }),
|
|
12
|
+
[a.ROUNDED]: (t) => /* @__PURE__ */ e(W, { alt: "option-icon", src: t }),
|
|
13
13
|
[a.NONE]: () => null,
|
|
14
14
|
[a.UNSET]: () => null
|
|
15
|
-
}, _ = ({ questionType: t, hasCorrectAnswer: c, correct:
|
|
16
|
-
if (t === o.POLL &&
|
|
15
|
+
}, _ = ({ questionType: t, hasCorrectAnswer: c, correct: n, youVoted: r, questionVoted: i }) => {
|
|
16
|
+
if (t === o.POLL && r)
|
|
17
17
|
return "correct";
|
|
18
18
|
if (t === o.PREDICTION) {
|
|
19
|
-
if (c &&
|
|
20
|
-
return
|
|
21
|
-
if (
|
|
19
|
+
if (c && i)
|
|
20
|
+
return r ? n ? "correct" : "incorrect" : "unset";
|
|
21
|
+
if (r)
|
|
22
22
|
return "correct";
|
|
23
23
|
}
|
|
24
|
-
return t === o.TRIVIA &&
|
|
24
|
+
return t === o.TRIVIA && i && r ? n ? "correct" : "incorrect" : "unset";
|
|
25
25
|
}, q = ({
|
|
26
26
|
questionType: t,
|
|
27
27
|
questionVoted: c,
|
|
28
|
-
correct:
|
|
29
|
-
hasCorrectAnswer:
|
|
30
|
-
questionStatus:
|
|
31
|
-
}) => t === o.TRIVIA ? c &&
|
|
28
|
+
correct: n,
|
|
29
|
+
hasCorrectAnswer: r,
|
|
30
|
+
questionStatus: i
|
|
31
|
+
}) => t === o.TRIVIA ? c && n : t === o.PREDICTION ? c && n && r || i === A.RESOLVED && n : !1, at = (t) => {
|
|
32
32
|
var T;
|
|
33
33
|
const {
|
|
34
34
|
// option props
|
|
35
35
|
id: c,
|
|
36
|
-
icon:
|
|
37
|
-
text:
|
|
38
|
-
percentageDecimal:
|
|
36
|
+
icon: n,
|
|
37
|
+
text: r,
|
|
38
|
+
percentageDecimal: i,
|
|
39
39
|
points: N,
|
|
40
40
|
// extra props
|
|
41
41
|
onVote: S,
|
|
@@ -53,12 +53,12 @@ const I = {
|
|
|
53
53
|
votedAfterQuestionClosed: x,
|
|
54
54
|
enteredAnActiveQuestion: P,
|
|
55
55
|
marketClosed: l
|
|
56
|
-
} = t, [L, p] = j(
|
|
56
|
+
} = t, [L, p] = j(0), 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
57
|
return U(() => {
|
|
58
|
-
|
|
59
|
-
p(
|
|
60
|
-
})
|
|
61
|
-
}, [
|
|
58
|
+
p(0), requestAnimationFrame(() => {
|
|
59
|
+
p(i);
|
|
60
|
+
});
|
|
61
|
+
}, [i]), /* @__PURE__ */ u(
|
|
62
62
|
z,
|
|
63
63
|
{
|
|
64
64
|
value: c,
|
|
@@ -72,7 +72,7 @@ const I = {
|
|
|
72
72
|
), S(b);
|
|
73
73
|
},
|
|
74
74
|
children: [
|
|
75
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ e(
|
|
76
76
|
G,
|
|
77
77
|
{
|
|
78
78
|
"data-answer-state": m,
|
|
@@ -81,15 +81,15 @@ const I = {
|
|
|
81
81
|
}
|
|
82
82
|
),
|
|
83
83
|
/* @__PURE__ */ u(H, { children: [
|
|
84
|
-
|
|
85
|
-
/* @__PURE__ */
|
|
84
|
+
n && h && ((T = I[h]) == null ? void 0 : T.call(I, n)),
|
|
85
|
+
/* @__PURE__ */ e(J, { children: r }),
|
|
86
86
|
B && /* @__PURE__ */ u("div", { children: [
|
|
87
87
|
N,
|
|
88
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ e(K, { children: "pts" })
|
|
89
89
|
] }),
|
|
90
90
|
R && /* @__PURE__ */ u(X, { children: [
|
|
91
|
-
Q && /* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */
|
|
91
|
+
Q && /* @__PURE__ */ e(Y, { name: "selected" }),
|
|
92
|
+
/* @__PURE__ */ e(Z, { children: /* @__PURE__ */ e($, { value: i, suffix: "%" }) })
|
|
93
93
|
] })
|
|
94
94
|
] })
|
|
95
95
|
]
|
|
@@ -8,6 +8,8 @@ interface WinBarProps {
|
|
|
8
8
|
animatePoints?: boolean;
|
|
9
9
|
questionType?: QuestionType;
|
|
10
10
|
timerDuration?: number;
|
|
11
|
+
votedInCurrentRender: boolean;
|
|
12
|
+
percentsAnimated: boolean;
|
|
11
13
|
onTimerExpired?: () => void;
|
|
12
14
|
}
|
|
13
15
|
export declare const WinBar: React.FC<WinBarProps>;
|
|
@@ -1,36 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { QuestionType as
|
|
3
|
-
import { AnimatedCounter as
|
|
4
|
-
import { Timer as
|
|
5
|
-
import { WinBarContainer as
|
|
1
|
+
import { jsx as r, jsxs as n, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import { QuestionType as t } from "@streamlayer/sdk-web-types";
|
|
3
|
+
import { AnimatedCounter as P } from "../../../animated-counter/index.js";
|
|
4
|
+
import { Timer as s } from "../../../timer/index.js";
|
|
5
|
+
import { ShowInContainer as I, WinBarContainer as f, Content as u, Title as O, WinIcon as T, Points as j, PointsCount as x, PointsUnits as y } from "./styles.js";
|
|
6
6
|
import "react-countup";
|
|
7
7
|
import "@linaria/react";
|
|
8
8
|
import "react";
|
|
9
9
|
import "react-countdown-circle-timer";
|
|
10
10
|
import "../../../theme/constants.js";
|
|
11
11
|
import "../../../icons/index.js";
|
|
12
|
-
|
|
12
|
+
import "../../../show-in/index.js";
|
|
13
|
+
import "@linaria/core";
|
|
14
|
+
const F = ({
|
|
13
15
|
title: e,
|
|
14
|
-
points:
|
|
16
|
+
points: o,
|
|
15
17
|
isPlayingTimer: m,
|
|
16
|
-
isTimer:
|
|
17
|
-
animatePoints:
|
|
18
|
-
questionType:
|
|
18
|
+
isTimer: a,
|
|
19
|
+
animatePoints: c,
|
|
20
|
+
questionType: i,
|
|
19
21
|
timerDuration: d,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
votedInCurrentRender: l,
|
|
23
|
+
percentsAnimated: p,
|
|
24
|
+
onTimerExpired: h
|
|
25
|
+
}) => /* @__PURE__ */ r(
|
|
26
|
+
I,
|
|
27
|
+
{
|
|
28
|
+
enabled: i === t.PREDICTION && l,
|
|
29
|
+
animate: p,
|
|
30
|
+
children: /* @__PURE__ */ n(
|
|
31
|
+
f,
|
|
32
|
+
{
|
|
33
|
+
style: {
|
|
34
|
+
justifyContent: i === t.PREDICTION ? "center" : "space-between"
|
|
35
|
+
},
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ n(u, { children: [
|
|
38
|
+
e && /* @__PURE__ */ r(O, { children: e }),
|
|
39
|
+
o !== void 0 && i !== t.POLL && /* @__PURE__ */ n(C, { children: [
|
|
40
|
+
/* @__PURE__ */ r(T, { name: "icon-trophy" }),
|
|
41
|
+
/* @__PURE__ */ n(j, { children: [
|
|
42
|
+
/* @__PURE__ */ r(x, { children: c ? /* @__PURE__ */ r(P, { value: o, delay: 0.3 }) : o }),
|
|
43
|
+
/* @__PURE__ */ r(y, { children: "PTS" })
|
|
44
|
+
] })
|
|
45
|
+
] })
|
|
46
|
+
] }),
|
|
47
|
+
a && i !== t.PREDICTION && /* @__PURE__ */ r(s, { isPlaying: m, onTimerExpired: h, duration: d })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
);
|
|
34
53
|
export {
|
|
35
|
-
|
|
54
|
+
F as WinBar
|
|
36
55
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
export declare const ShowInContainer: any;
|
|
2
3
|
export declare const WinBarContainer: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
3
4
|
export declare const Content: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
4
5
|
export declare const Title: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|