@streamlayer/react-ui 0.46.1 → 0.48.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.
Files changed (44) hide show
  1. package/lib/index.js +37 -33
  2. package/lib/ui/app/Features/Gamification/Leaderboard.d.ts +1 -1
  3. package/lib/ui/app/Features/Gamification/Leaderboard.js +15 -26
  4. package/lib/ui/app/Features/Gamification/Question.js +22 -56
  5. package/lib/ui/app/Features/Gamification/Tabs.js +19 -17
  6. package/lib/ui/app/Features/Gamification/index.js +21 -16
  7. package/lib/ui/app/Features/index.js +14 -9
  8. package/lib/ui/app/masters.js +14 -9
  9. package/lib/ui/demo/Gamification.js +19 -15
  10. package/lib/ui/demo/Highlights.js +9 -5
  11. package/lib/ui/demo/components/Leaderboard.js +8 -6
  12. package/lib/ui/demo/components/Question.js +22 -20
  13. package/lib/ui/demo/components/index.js +21 -17
  14. package/lib/ui/demo/index.js +9 -5
  15. package/lib/ui/gamification/detail/sponsor/index.d.ts +4 -0
  16. package/lib/ui/gamification/detail/sponsor/index.js +14 -0
  17. package/lib/ui/gamification/leaderboard-item/index.d.ts +1 -0
  18. package/lib/ui/gamification/leaderboard-item/index.js +17 -10
  19. package/lib/ui/gamification/leaderboard-item/styles.js +8 -10
  20. package/lib/ui/gamification/leaderboard-list/index.d.ts +1 -0
  21. package/lib/ui/gamification/leaderboard-list/index.js +34 -5
  22. package/lib/ui/gamification/vote/feedback/index.d.ts +14 -0
  23. package/lib/ui/gamification/vote/feedback/index.js +33 -0
  24. package/lib/ui/gamification/vote/feedback/styles.d.ts +8 -0
  25. package/lib/ui/gamification/vote/feedback/styles.js +70 -0
  26. package/lib/ui/gamification/vote/index.d.ts +3 -8
  27. package/lib/ui/gamification/vote/index.js +62 -49
  28. package/lib/ui/gamification/vote/styles.d.ts +1 -5
  29. package/lib/ui/gamification/vote/styles.js +18 -53
  30. package/lib/ui/gamification/vote/vote-option/index.d.ts +9 -17
  31. package/lib/ui/gamification/vote/vote-option/index.js +53 -5
  32. package/lib/ui/gamification/vote/vote-option/styles.d.ts +12 -8
  33. package/lib/ui/gamification/vote/vote-option/styles.js +119 -66
  34. package/lib/ui/icons/index.d.ts +2 -0
  35. package/lib/ui/icons/index.js +22 -20
  36. package/package.json +17 -12
  37. package/lib/index-7f3361f2.js +0 -71
  38. package/lib/ui/gamification/leaderboard-list/styles.d.ts +0 -2
  39. package/lib/ui/gamification/leaderboard-list/styles.js +0 -18
  40. package/lib/ui/gamification/vote/types.d.js +0 -1
  41. /package/lib/ui/gamification/{vote → detail}/header/index.d.ts +0 -0
  42. /package/lib/ui/gamification/{vote → detail}/header/index.js +0 -0
  43. /package/lib/ui/gamification/{vote → detail}/header/styles.d.ts +0 -0
  44. /package/lib/ui/gamification/{vote → detail}/header/styles.js +0 -0
@@ -17,8 +17,10 @@ import { Insights as c } from "./components/Insights.js";
17
17
  import { Insight as f } from "./components/Insight.js";
18
18
  import "../gamification/common-header/styles.js";
19
19
  import "../gamification/leaderboard-item-detail/styles.js";
20
+ import "react-virtualized-auto-sizer";
21
+ import "react-window";
22
+ import "react-window-infinite-loader";
20
23
  import "../gamification/leaderboard-item/styles.js";
21
- import "../gamification/leaderboard-list/styles.js";
22
24
  import "@linaria/react";
23
25
  import "@streamlayer/sdk-web-types";
24
26
  import "../button/index.js";
@@ -27,9 +29,11 @@ import "../gamification/constants.js";
27
29
  import "../gamification/question/styles.js";
28
30
  import "../icons/index.js";
29
31
  import "../gamification/vote/index.js";
30
- import "../../index-7f3361f2.js";
31
- import "../gamification/vote/vote-option/styles.js";
32
+ import "../gamification/vote/feedback/index.js";
33
+ import "../gamification/vote/feedback/styles.js";
32
34
  import "../gamification/vote/styles.js";
35
+ import "../gamification/vote/vote-option/index.js";
36
+ import "../gamification/vote/vote-option/styles.js";
33
37
  import "../gamification/vote/win-bar/index.js";
34
38
  import "../timer/index.js";
35
39
  import "react-countdown-circle-timer";
@@ -43,7 +47,7 @@ import "../gamification/detailed-insight/index.js";
43
47
  import "../gamification/common-header/index.js";
44
48
  import "../../icon-exit-d3f9fc80.js";
45
49
  import "../gamification/detailed-insight/styles.js";
46
- const rt = ({ highlights: i, sdk: e }) => {
50
+ const nt = ({ highlights: i, sdk: e }) => {
47
51
  const n = m(i.status), r = m(i.openedInsight), { slStreamId: o } = m(e.sdkStore);
48
52
  return n !== d.Ready ? /* @__PURE__ */ t("div", { children: "wait..." }) : o != null && o.loading ? /* @__PURE__ */ t(p, { children: /* @__PURE__ */ t("div", { children: "Event is loading" }) }) : o != null && o.data ? i.insights === void 0 ? /* @__PURE__ */ t("div", { children: "wait insights..." }) : /* @__PURE__ */ s(p, { children: [
49
53
  !r && /* @__PURE__ */ t(c, { highlights: i, store: i.insights.getStore() }),
@@ -58,5 +62,5 @@ const rt = ({ highlights: i, sdk: e }) => {
58
62
  ] }) : /* @__PURE__ */ t(p, { children: /* @__PURE__ */ t("div", { children: "Event is forbidden" }) });
59
63
  };
60
64
  export {
61
- rt as HighlightsComponent
65
+ nt as HighlightsComponent
62
66
  };
@@ -8,21 +8,23 @@ import "../../../icon-exit-d3f9fc80.js";
8
8
  import "../../gamification/common-header/styles.js";
9
9
  import "@linaria/react";
10
10
  import "../../gamification/leaderboard-item-detail/styles.js";
11
+ import "react-virtualized-auto-sizer";
12
+ import "react-window";
13
+ import "react-window-infinite-loader";
11
14
  import "../../gamification/leaderboard-item/index.js";
12
15
  import "../../../utils/common.js";
13
16
  import "../../gamification/leaderboard-item/styles.js";
14
- import "../../gamification/leaderboard-list/styles.js";
15
- const y = ({ store: s }) => {
16
- const { data: r } = u(s), [e, d] = b(void 0);
17
+ const C = ({ store: p }) => {
18
+ const { data: r } = u(p), [e, s] = b(void 0);
17
19
  if (!r)
18
20
  return /* @__PURE__ */ i("div", { children: "wait leader board..." });
19
21
  const o = (t) => {
20
22
  var m;
21
- const p = (m = r.find((n) => {
23
+ const d = (m = r.find((n) => {
22
24
  var a;
23
25
  return ((a = n.attributes) == null ? void 0 : a.userId) === t;
24
26
  })) == null ? void 0 : m.attributes;
25
- d(p);
27
+ s(d);
26
28
  };
27
29
  return /* @__PURE__ */ c(l, { children: [
28
30
  e && /* @__PURE__ */ i(f, { comeBack: () => o(null), ...e }),
@@ -36,5 +38,5 @@ const y = ({ store: s }) => {
36
38
  ] });
37
39
  };
38
40
  export {
39
- y as Leaderboard
41
+ C as Leaderboard
40
42
  };
@@ -1,17 +1,19 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { styled as f } from "@linaria/react";
3
- import { useState as n, useCallback as d, useMemo as a } from "react";
4
- import { Vote as p } from "../../gamification/vote/index.js";
3
+ import { useState as p, useCallback as n, useMemo as s } from "react";
4
+ import { Vote as d } from "../../gamification/vote/index.js";
5
+ import "../../gamification/vote/feedback/index.js";
5
6
  import "@streamlayer/sdk-web-types";
6
- import "../../../index-7f3361f2.js";
7
- import "../../gamification/vote/vote-option/styles.js";
7
+ import "../../icons/index.js";
8
+ import "../../gamification/vote/feedback/styles.js";
8
9
  import "../../gamification/vote/styles.js";
10
+ import "../../gamification/vote/vote-option/index.js";
11
+ import "../../gamification/vote/vote-option/styles.js";
9
12
  import "../../gamification/vote/win-bar/index.js";
10
13
  import "../../timer/index.js";
11
14
  import "react-countdown-circle-timer";
12
15
  import "../../theme/constants.js";
13
16
  import "../../gamification/vote/win-bar/styles.js";
14
- import "../../icons/index.js";
15
17
  const y = f.div`
16
18
  position: absolute;
17
19
  top: 0;
@@ -39,31 +41,31 @@ const y = f.div`
39
41
  transform: translateX(0);
40
42
  }
41
43
  }
42
- `, M = ({ openedQuestion: t, closeQuestion: h, vote: m }) => {
43
- var c;
44
- const [e, s] = n(!1);
45
- d(
44
+ `, I = ({ openedQuestion: t, closeQuestion: h, vote: a }) => {
45
+ var m;
46
+ const [e, c] = p(!1);
47
+ n(
46
48
  (r) => {
47
- s(r);
49
+ c(r);
48
50
  },
49
- [s]
51
+ [c]
50
52
  );
51
- const i = a(
53
+ const i = s(
52
54
  () => t == null ? void 0 : t.answers.find((r) => r.youVoted === !0),
53
55
  [t]
54
- ), l = a(
56
+ ), l = s(
55
57
  () => !!(t != null && t.answers.find((r) => r.correct === !0)),
56
58
  [t]
57
59
  );
58
60
  return t ? /* @__PURE__ */ o(y, { children: /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(
59
- p,
61
+ d,
60
62
  {
61
63
  title: t.subject,
62
- feedbackMessages: (c = t.options) == null ? void 0 : c.options.value,
64
+ feedbackMessages: (m = t.options) == null ? void 0 : m.options.value,
63
65
  questionType: t.type,
64
66
  questionId: t.id,
65
- questionAnswered: !!i,
66
- questionAnsweredCorrectly: i == null ? void 0 : i.correct,
67
+ questionVoted: !!i,
68
+ questionVotedCorrectly: i == null ? void 0 : i.correct,
67
69
  options: t.answers.map((r) => ({
68
70
  id: r.id,
69
71
  title: r.text,
@@ -73,14 +75,14 @@ const y = f.div`
73
75
  percentage: r.percentage,
74
76
  answered: r.youVoted,
75
77
  disabled: !!i || t.marketClosed || e,
76
- questionAnswered: !!i,
78
+ questionVoted: !!i,
77
79
  hasCorrectAnswer: l,
78
80
  points: r.points,
79
- onVote: m
81
+ onVote: a
80
82
  }))
81
83
  }
82
84
  ) }) }) }) : null;
83
85
  };
84
86
  export {
85
- M as Question
87
+ I as Question
86
88
  };
@@ -1,10 +1,10 @@
1
- import { UserSummary as $ } from "./UserSummary.js";
2
- import { QuestionsList as or } from "./QuestionsList.js";
3
- import { Question as mr } from "./Question.js";
4
- import { Onboarding as ir } from "../../gamification/onboarding/index.js";
5
- import { Insights as sr } from "./Insights.js";
6
- import { Insight as xr } from "./Insight.js";
7
- import { Leaderboard as ar } from "./Leaderboard.js";
1
+ import { UserSummary as mr } from "./UserSummary.js";
2
+ import { QuestionsList as ir } from "./QuestionsList.js";
3
+ import { Question as sr } from "./Question.js";
4
+ import { Onboarding as xr } from "../../gamification/onboarding/index.js";
5
+ import { Insights as ar } from "./Insights.js";
6
+ import { Insight as gr } from "./Insight.js";
7
+ import { Leaderboard as br } from "./Leaderboard.js";
8
8
  import "react/jsx-runtime";
9
9
  import "@nanostores/react";
10
10
  import "../../gamification/user-statistics/index.js";
@@ -26,9 +26,11 @@ import "../../icons/index.js";
26
26
  import "react";
27
27
  import "../../gamification/question/list/styles.js";
28
28
  import "../../gamification/vote/index.js";
29
- import "../../../index-7f3361f2.js";
30
- import "../../gamification/vote/vote-option/styles.js";
29
+ import "../../gamification/vote/feedback/index.js";
30
+ import "../../gamification/vote/feedback/styles.js";
31
31
  import "../../gamification/vote/styles.js";
32
+ import "../../gamification/vote/vote-option/index.js";
33
+ import "../../gamification/vote/vote-option/styles.js";
32
34
  import "../../gamification/vote/win-bar/index.js";
33
35
  import "../../timer/index.js";
34
36
  import "react-countdown-circle-timer";
@@ -53,15 +55,17 @@ import "../../gamification/detailed-insight/styles.js";
53
55
  import "../../gamification/leaderboard-item-detail/index.js";
54
56
  import "../../gamification/leaderboard-item-detail/styles.js";
55
57
  import "../../gamification/leaderboard-list/index.js";
58
+ import "react-virtualized-auto-sizer";
59
+ import "react-window";
60
+ import "react-window-infinite-loader";
56
61
  import "../../gamification/leaderboard-item/index.js";
57
62
  import "../../gamification/leaderboard-item/styles.js";
58
- import "../../gamification/leaderboard-list/styles.js";
59
63
  export {
60
- xr as Insight,
61
- sr as Insights,
62
- ar as Leaderboard,
63
- ir as Onboarding,
64
- mr as Question,
65
- or as QuestionsList,
66
- $ as UserSummary
64
+ gr as Insight,
65
+ ar as Insights,
66
+ br as Leaderboard,
67
+ xr as Onboarding,
68
+ sr as Question,
69
+ ir as QuestionsList,
70
+ mr as UserSummary
67
71
  };
@@ -45,9 +45,11 @@ import "../icons/index.js";
45
45
  import "../gamification/question/list/styles.js";
46
46
  import "./components/Question.js";
47
47
  import "../gamification/vote/index.js";
48
- import "../../index-7f3361f2.js";
49
- import "../gamification/vote/vote-option/styles.js";
48
+ import "../gamification/vote/feedback/index.js";
49
+ import "../gamification/vote/feedback/styles.js";
50
50
  import "../gamification/vote/styles.js";
51
+ import "../gamification/vote/vote-option/index.js";
52
+ import "../gamification/vote/vote-option/styles.js";
51
53
  import "../gamification/vote/win-bar/index.js";
52
54
  import "../timer/index.js";
53
55
  import "react-countdown-circle-timer";
@@ -70,9 +72,11 @@ import "../gamification/leaderboard-item-detail/index.js";
70
72
  import "../gamification/common-header/index.js";
71
73
  import "../gamification/leaderboard-item-detail/styles.js";
72
74
  import "../gamification/leaderboard-list/index.js";
75
+ import "react-virtualized-auto-sizer";
76
+ import "react-window";
77
+ import "react-window-infinite-loader";
73
78
  import "../gamification/leaderboard-item/index.js";
74
79
  import "../gamification/leaderboard-item/styles.js";
75
- import "../gamification/leaderboard-list/styles.js";
76
80
  import "./components/Insights.js";
77
81
  import "../gamification/insight-list/index.js";
78
82
  import "../gamification/insight/index.js";
@@ -165,7 +169,7 @@ const R = ({ activeFeature: o, sdk: r }) => {
165
169
  ] }),
166
170
  h
167
171
  ] });
168
- }, lr = ({ sdk: o }) => {
172
+ }, gr = ({ sdk: o }) => {
169
173
  const r = f(o.organizationStore()), t = f(o.getUserStore()), a = f(o.getActiveFeature());
170
174
  return r.loading ? /* @__PURE__ */ e("div", { children: "authentication..." }) : r.data ? t.loading ? /* @__PURE__ */ e("div", { children: "authentication..." }) : t.data ? /* @__PURE__ */ l(T, { children: [
171
175
  /* @__PURE__ */ e(x, { notificationsStore: o.getNotificationsStore() }),
@@ -173,5 +177,5 @@ const R = ({ activeFeature: o, sdk: r }) => {
173
177
  ] }) : /* @__PURE__ */ e(H, { sdk: o }) : /* @__PURE__ */ e("div", { children: "wrong sdk key..." });
174
178
  };
175
179
  export {
176
- lr as Demo
180
+ gr as Demo
177
181
  };
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const Sponsor: React.FC<{
3
+ sponsorLogo?: string;
4
+ }>;
@@ -0,0 +1,14 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { styled as p } from "@linaria/react";
3
+ const r = p.div`
4
+ width: 100%;
5
+ height: 53px;
6
+ display: flex;
7
+ padding: 16px 0px;
8
+ justify-content: center;
9
+ `, i = p.img`
10
+ max-width: 20px;
11
+ `, d = ({ sponsorLogo: o }) => o && /* @__PURE__ */ t(r, { children: /* @__PURE__ */ t(i, { alt: "sponsor-logo", src: o }) });
12
+ export {
13
+ d as Sponsor
14
+ };
@@ -3,5 +3,6 @@ import type { LeaderboardItem as ILeaderboardItem } from '@streamlayer/sdk-web-t
3
3
  export type LeaderboardItemProps = Partial<ILeaderboardItem> & {
4
4
  userId: string;
5
5
  openItemDetail: () => void;
6
+ style?: React.CSSProperties;
6
7
  };
7
8
  export declare const LeaderboardItem: React.FC<LeaderboardItemProps>;
@@ -1,18 +1,25 @@
1
1
  import { jsxs as e, jsx as r } from "react/jsx-runtime";
2
- import { abbreviate as d } from "../../../utils/common.js";
3
- import { Container as l, RankPosition as c, Avatar as m, AvatarPlaceholder as h, Content as s, NameWrap as p, Name as b, Rank as f, Units as k } from "./styles.js";
2
+ import { abbreviate as l } from "../../../utils/common.js";
3
+ import { Container as c, RankPosition as m, Avatar as h, AvatarPlaceholder as s, Content as p, NameWrap as b, Name as f, Rank as k, Units as v } from "./styles.js";
4
4
  import "@linaria/react";
5
- const j = ({ rank: t, avatar: i, name: n, points: a, openItemDetail: o }) => /* @__PURE__ */ e(l, { onClick: o, children: [
6
- /* @__PURE__ */ r(c, { children: t || 0 }),
7
- i ? /* @__PURE__ */ r(m, { alt: "leaderboard-item-avatar", src: i }) : /* @__PURE__ */ r(h, { children: d(n || "") }),
8
- /* @__PURE__ */ e(s, { children: [
9
- /* @__PURE__ */ r(p, { children: /* @__PURE__ */ r(b, { children: n || "" }) }),
10
- /* @__PURE__ */ e(f, { children: [
11
- /* @__PURE__ */ r(k, { children: "PTS" }),
5
+ const A = ({
6
+ rank: t,
7
+ avatar: i,
8
+ name: n,
9
+ points: a,
10
+ openItemDetail: o,
11
+ style: d
12
+ }) => /* @__PURE__ */ e(c, { onClick: o, style: d, children: [
13
+ /* @__PURE__ */ r(m, { children: t || 0 }),
14
+ i ? /* @__PURE__ */ r(h, { alt: "leaderboard-item-avatar", src: i }) : /* @__PURE__ */ r(s, { children: l(n || "") }),
15
+ /* @__PURE__ */ e(p, { children: [
16
+ /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(f, { children: n || "" }) }),
17
+ /* @__PURE__ */ e(k, { children: [
18
+ /* @__PURE__ */ r(v, { children: "PTS" }),
12
19
  a || 0
13
20
  ] })
14
21
  ] })
15
22
  ] });
16
23
  export {
17
- j as LeaderboardItem
24
+ A as LeaderboardItem
18
25
  };
@@ -8,13 +8,13 @@ const t = e.div`
8
8
  width: 100%;
9
9
  min-height: 50px;
10
10
  max-height: 50px;
11
- background-color: var(--color-bg-transparent-item-vote);
12
- color: var(--color-white);
11
+ background-color: #fff;
12
+ color: #000;
13
13
  font-size: 14px;
14
14
  font-weight: 600;
15
15
  overflow: hidden;
16
16
  cursor: pointer;
17
- `, r = e.div`
17
+ `, n = e.div`
18
18
  width: 28px;
19
19
  max-width: 28px;
20
20
  display: flex;
@@ -22,7 +22,7 @@ const t = e.div`
22
22
  justify-content: center;
23
23
  margin-right: 4px;
24
24
  overflow: hidden;
25
- `, n = e.img`
25
+ `, r = e.img`
26
26
  width: 32px;
27
27
  height: 32px;
28
28
  border-radius: 50%;
@@ -36,7 +36,6 @@ const t = e.div`
36
36
  display: flex;
37
37
  align-items: center;
38
38
  justify-content: center;
39
- color: var(--color-white);
40
39
  font-size: 12px;
41
40
  flex-shrink: 0;
42
41
  `, a = e.div`
@@ -62,19 +61,18 @@ const t = e.div`
62
61
  display: flex;
63
62
  align-items: center;
64
63
  max-width: 75px;
65
- `, l = e.span`
64
+ `, x = e.span`
66
65
  font-size: 10px;
67
- color: var(--color-leaderboard-unit);
68
66
  margin-right: 4px;
69
67
  `;
70
68
  export {
71
- n as Avatar,
69
+ r as Avatar,
72
70
  o as AvatarPlaceholder,
73
71
  t as Container,
74
72
  a as Content,
75
73
  d as Name,
76
74
  p as NameWrap,
77
75
  s as Rank,
78
- r as RankPosition,
79
- l as Units
76
+ n as RankPosition,
77
+ x as Units
80
78
  };
@@ -3,6 +3,7 @@ import { LeaderboardItemProps } from '../../gamification/leaderboard-item';
3
3
  type LeaderboardListProps = {
4
4
  items: Omit<LeaderboardItemProps, 'openItemDetail'>[];
5
5
  openItemDetail: (id: string) => void;
6
+ fetchMore: () => void;
6
7
  };
7
8
  export declare const LeaderboardList: React.FC<LeaderboardListProps>;
8
9
  export {};
@@ -1,10 +1,39 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { LeaderboardItem as m } from "../leaderboard-item/index.js";
3
- import { Container as p } from "./styles.js";
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import l from "react-virtualized-auto-sizer";
3
+ import { FixedSizeList as u } from "react-window";
4
+ import I from "react-window-infinite-loader";
5
+ import { LeaderboardItem as f } from "../leaderboard-item/index.js";
4
6
  import "../../../utils/common.js";
5
7
  import "../leaderboard-item/styles.js";
6
8
  import "@linaria/react";
7
- const f = ({ items: e, openItemDetail: t }) => /* @__PURE__ */ o(p, { children: e.map((r) => /* @__PURE__ */ o(m, { ...r, openItemDetail: () => t(r.userId) }, r.userId)) });
9
+ const C = ({ items: r, openItemDetail: i, fetchMore: m }) => /* @__PURE__ */ e(l, { children: ({ width: d, height: n }) => /* @__PURE__ */ e(
10
+ I,
11
+ {
12
+ isItemLoaded: (o) => o < r.length,
13
+ itemCount: r.length + 1,
14
+ loadMoreItems: m,
15
+ children: ({ onItemsRendered: o, ref: p }) => /* @__PURE__ */ e(
16
+ u,
17
+ {
18
+ itemSize: 58,
19
+ onItemsRendered: o,
20
+ ref: p,
21
+ itemCount: r.length,
22
+ width: d,
23
+ height: n,
24
+ children: ({ index: t, style: a }) => /* @__PURE__ */ e(
25
+ f,
26
+ {
27
+ style: a,
28
+ ...r[t],
29
+ openItemDetail: () => i(r[t].userId)
30
+ },
31
+ r[t].userId
32
+ )
33
+ }
34
+ )
35
+ }
36
+ ) });
8
37
  export {
9
- f as LeaderboardList
38
+ C as LeaderboardList
10
39
  };
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { QuestionType } from '@streamlayer/sdk-web-types';
3
+ interface FeedbackProps {
4
+ feedbackMessages: Partial<Record<'correctFeedback' | 'incorrectFeedback', {
5
+ description: string;
6
+ title: string;
7
+ }>>;
8
+ questionType: QuestionType;
9
+ questionVoted?: boolean;
10
+ questionVotedCorrectly?: boolean;
11
+ hasCorrectAnswer: boolean;
12
+ }
13
+ export declare const Feedback: React.FC<FeedbackProps>;
14
+ export {};
@@ -0,0 +1,33 @@
1
+ import { jsxs as r, Fragment as m, jsx as e } from "react/jsx-runtime";
2
+ import { QuestionType as n } from "@streamlayer/sdk-web-types";
3
+ import { SvgIcon as b } from "../../../icons/index.js";
4
+ import { Container as h, IconPrediction as k, FeedbackDescription as l, FeedbackIconWrap as I, FeedbackHeader as T, FeedbackTitle as f } from "./styles.js";
5
+ import "@linaria/react";
6
+ import "react";
7
+ const R = ({
8
+ feedbackMessages: t,
9
+ questionVotedCorrectly: o,
10
+ questionVoted: F,
11
+ questionType: i,
12
+ hasCorrectAnswer: a
13
+ }) => {
14
+ if (!(F && (i === n.TRIVIA || i === n.PREDICTION)))
15
+ return null;
16
+ const p = i === n.PREDICTION && !a, d = o ? "correct" : "incorrect", c = o ? t.correctFeedback : t.incorrectFeedback;
17
+ return /* @__PURE__ */ r(h, { "data-isPrediction": p, children: [
18
+ p && /* @__PURE__ */ r(m, { children: [
19
+ /* @__PURE__ */ e(k, { name: "icon-prediction" }),
20
+ /* @__PURE__ */ e(l, { children: "Stay tuned to see if your prediction was correct." })
21
+ ] }),
22
+ a && /* @__PURE__ */ r(m, { children: [
23
+ /* @__PURE__ */ e(I, { "data-feedbackType": d, children: /* @__PURE__ */ e(b, { name: d }) }),
24
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ r(T, { children: [
25
+ /* @__PURE__ */ e(f, { "data-feedbackType": d, children: c == null ? void 0 : c.title }),
26
+ /* @__PURE__ */ e(l, { children: c == null ? void 0 : c.description })
27
+ ] }) })
28
+ ] })
29
+ ] });
30
+ };
31
+ export {
32
+ R as Feedback
33
+ };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export declare const Container: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
3
+ export declare const IconPrediction: any;
4
+ export declare const FeedbackIconWrap: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
5
+ export declare const FeedbackHeader: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
6
+ export declare const FeedbackTitle: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
7
+ export declare const FeedbackDescription: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
8
+ export declare const FeedbackText: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
@@ -0,0 +1,70 @@
1
+ import { styled as r } from "@linaria/react";
2
+ import { SvgIcon as e } from "../../../icons/index.js";
3
+ import "react/jsx-runtime";
4
+ import "react";
5
+ const c = r.div`
6
+ width: 100%;
7
+ padding: 8px 0px;
8
+ display: flex;
9
+ align-items: center;
10
+ margin-bottom: 16px;
11
+ font-size: 14px;
12
+
13
+ &[data-isPrediction='true'] {
14
+ align-items: flex-start;
15
+ }
16
+ `, n = r(e)`
17
+ min-width: 24px;
18
+ width: 24px;
19
+ height: 24px;
20
+ margin-right: 14px;
21
+ margin-left: 12px;
22
+
23
+ g > path {
24
+ fill: var(--color-primary-green1);
25
+ fill-opacity: 1;
26
+ }
27
+ `, d = r.div`
28
+ min-width: 32px;
29
+ width: 32px;
30
+ height: 32px;
31
+ border-radius: 50%;
32
+ display: flex;
33
+ align-items: center;
34
+ justify-content: center;
35
+ margin-right: 16px;
36
+
37
+ &[data-feedbackType='correct'] {
38
+ background-color: var(--color-primary-green1);
39
+ }
40
+
41
+ &[data-feedbackType='incorrect'] {
42
+ background-color: var(--color-secondary-red1);
43
+ }
44
+ `, p = r.div`
45
+ font-weight: var(--font-weight-default);
46
+ `, l = r.span`
47
+ margin-right: 5px;
48
+
49
+ &[data-feedbackType='correct'] {
50
+ color: var(--color-primary-green1);
51
+ }
52
+
53
+ &[data-feedbackType='incorrect'] {
54
+ color: var(--color-secondary-red1);
55
+ }
56
+ `, g = r.span`
57
+ color: var(--color-neutrals-gray9);
58
+ `, s = r.div`
59
+ font-weight: 400;
60
+ margin-top: 10px;
61
+ `;
62
+ export {
63
+ c as Container,
64
+ g as FeedbackDescription,
65
+ p as FeedbackHeader,
66
+ d as FeedbackIconWrap,
67
+ s as FeedbackText,
68
+ l as FeedbackTitle,
69
+ n as IconPrediction
70
+ };
@@ -1,13 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { QuestionType } from '@streamlayer/sdk-web-types';
2
+ import { ExtendedQuestion } from '@streamlayer/sdk-web-types';
3
3
  interface VoteProps {
4
- title: string;
5
- questionId: string;
6
- options: any[];
7
- questionType: QuestionType;
8
- feedbackMessages: any;
9
- questionAnswered: boolean;
10
- questionAnsweredCorrectly?: boolean;
4
+ openedQuestion: ExtendedQuestion;
5
+ vote: (questionId: string, answerId: string) => void;
11
6
  }
12
7
  export declare const Vote: React.FC<VoteProps>;
13
8
  export {};