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