@streamlayer/react-ui 0.84.0 → 0.85.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/index-39a0b9b6.js +1168 -0
- package/lib/index-ba93b6b2.js +19529 -0
- package/lib/styles_hxnaic-4ed993c7.js +1 -0
- package/lib/ui/app/Features/Gamification/Leaderboard.d.ts +3 -1
- package/lib/ui/app/Features/Gamification/Leaderboard.js +18 -21
- package/lib/ui/app/Features/Gamification/Tabs.d.ts +4 -0
- package/lib/ui/app/Features/Gamification/Tabs.js +40 -78
- package/lib/ui/app/Features/Gamification/gamification-feature.js +7 -5
- package/lib/ui/app/Features/Gamification/index.d.ts +4 -0
- package/lib/ui/app/Features/Gamification/index.js +44 -40
- package/lib/ui/app/Features/index.d.ts +4 -0
- package/lib/ui/app/Features/index.js +19 -14
- package/lib/ui/app/Navigation/MastersNavigation/index.js +1 -1
- package/lib/ui/app/Notifications/index.d.ts +4 -0
- package/lib/ui/app/Notifications/index.js +105 -53
- package/lib/ui/app/Notifications/styles.d.ts +1 -0
- package/lib/ui/app/Notifications/styles.js +17 -8
- package/lib/ui/app/masters.js +60 -47
- package/lib/ui/app/useMastersApp.js +1 -1
- package/lib/ui/app/useSdkScroll.d.ts +9 -0
- package/lib/ui/app/useSdkScroll.js +93 -0
- package/lib/ui/gamification/leaderboard/index.d.ts +1 -1
- package/lib/ui/gamification/leaderboard/index.js +24 -20
- package/lib/ui/gamification/leaderboard/static.d.ts +14 -0
- package/lib/ui/gamification/leaderboard/static.js +36 -0
- package/lib/ui/gamification/leaderboard/styles.js +3 -2
- package/lib/ui/gamification/question/notification/pill/index.d.ts +2 -0
- package/lib/ui/gamification/question/notification/pill/index.js +7 -7
- package/lib/ui/gamification/question/notification/prediction-result/index.d.ts +1 -1
- package/lib/ui/gamification/vote/index.js +22 -22
- package/lib/ui/gamification/vote/vote-option/index.js +18 -18
- package/lib/ui/gamification/vote/vote-option/styles.js +2 -2
- package/lib/ui/gamification/vote/win-bar/index.js +19 -19
- package/lib/ui/gamification/vote/win-bar/styles.js +6 -6
- package/lib/ui/navigation/masters.js +1 -1
- package/lib/ui/show-in/index.js +2 -2
- package/lib/ui/theme/theme.js +19 -18
- package/package.json +8 -6
- /package/lib/{masters_k70xsy-4ed993c7.js → masters_1wv7w2k-4ed993c7.js} +0 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useStore as
|
|
3
|
-
import { useState as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { jsxs as h, Fragment as S, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useStore as b } from "@nanostores/react";
|
|
3
|
+
import { useState as a, useMemo as T, useEffect as d, useRef as x, useCallback as v } from "react";
|
|
4
|
+
import { r as D } from "../../../index-ba93b6b2.js";
|
|
5
|
+
import { NotificationType as c } from "@streamlayer/sdk-web-notifications";
|
|
6
|
+
import { QuestionTypeData as E } from "../../gamification/constants.js";
|
|
7
|
+
import { Notification as O } from "../../gamification/question/notification/index.js";
|
|
8
|
+
import { PredictionResult as P } from "../../gamification/question/notification/prediction-result/index.js";
|
|
9
|
+
import { Onboarding as C } from "./Onboarding/index.js";
|
|
10
|
+
import { Pill as I, InnerContainer as R, Container as q, NotificationRefreshing as B } from "./styles.js";
|
|
11
|
+
import "../../../index-39a0b9b6.js";
|
|
9
12
|
import "@streamlayer/sdk-web-types";
|
|
10
|
-
import "../../gamification/constants.js";
|
|
11
13
|
import "../../gamification/question/notification/insight/index.js";
|
|
12
14
|
import "../../video-player/index.js";
|
|
13
15
|
import "../../icons/index.js";
|
|
@@ -39,57 +41,107 @@ import "../../button/index.js";
|
|
|
39
41
|
import "../../button/styles.js";
|
|
40
42
|
import "./Onboarding/Notification/index.js";
|
|
41
43
|
import "./Onboarding/Notification/styles.js";
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
import "../../gamification/question/notification/pill/index.js";
|
|
45
|
+
import "../../gamification/question/notification/pill/styles.js";
|
|
46
|
+
const w = (s) => {
|
|
47
|
+
const [t, n] = a(0), i = x(null), m = v((e) => {
|
|
48
|
+
i.current = e;
|
|
45
49
|
}, []);
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
}, [
|
|
51
|
-
const
|
|
52
|
-
|
|
50
|
+
d(() => {
|
|
51
|
+
var p;
|
|
52
|
+
const e = (p = i.current) == null ? void 0 : p.getBoundingClientRect();
|
|
53
|
+
e && n(e.height);
|
|
54
|
+
}, [s]);
|
|
55
|
+
const r = v((e) => {
|
|
56
|
+
n(e);
|
|
53
57
|
}, []);
|
|
54
|
-
return [
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
return [m, t, r];
|
|
59
|
+
}, H = ({
|
|
60
|
+
sdk: s,
|
|
61
|
+
notification: t
|
|
62
|
+
}) => {
|
|
63
|
+
var r, e;
|
|
64
|
+
const [n, i, m] = w(t.id);
|
|
65
|
+
return t.type === c.QUESTION ? /* @__PURE__ */ h(S, {
|
|
66
|
+
children: [/* @__PURE__ */ o(R, {
|
|
67
|
+
ref: n,
|
|
68
|
+
style: {
|
|
69
|
+
position: "absolute",
|
|
70
|
+
visibility: "hidden"
|
|
71
|
+
},
|
|
72
|
+
children: /* @__PURE__ */ o(O, {
|
|
73
|
+
...t
|
|
74
|
+
})
|
|
75
|
+
}), /* @__PURE__ */ h(q, {
|
|
76
|
+
style: {
|
|
77
|
+
height: t.hiding ? 0 : i
|
|
78
|
+
},
|
|
70
79
|
hiding: t.hiding,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
children: [/* @__PURE__ */ o(R, {
|
|
81
|
+
style: {
|
|
82
|
+
height: "100%"
|
|
83
|
+
},
|
|
84
|
+
children: /* @__PURE__ */ o(O, {
|
|
85
|
+
...t
|
|
86
|
+
})
|
|
87
|
+
}), /* @__PURE__ */ o(B, {}, t.id)]
|
|
88
|
+
})]
|
|
89
|
+
}) : t.type === c.QUESTION_RESOLVED && ((e = (r = t.data) == null ? void 0 : r.question) != null && e.predictionResult) ? /* @__PURE__ */ o(P, {
|
|
90
|
+
style: {
|
|
91
|
+
height: t.hiding ? 0 : i
|
|
92
|
+
},
|
|
93
|
+
saveHeight: m,
|
|
94
|
+
close: t.close,
|
|
95
|
+
hiding: t.hiding,
|
|
96
|
+
...t.data.question
|
|
97
|
+
}) : t.type === c.ONBOARDING ? /* @__PURE__ */ o(C, {
|
|
98
|
+
style: {
|
|
99
|
+
height: t.hiding ? 0 : i
|
|
100
|
+
},
|
|
101
|
+
saveHeight: m,
|
|
102
|
+
sdk: s,
|
|
103
|
+
notification: t
|
|
104
|
+
}) : null;
|
|
105
|
+
}, Dt = ({
|
|
106
|
+
sdk: s,
|
|
107
|
+
scrollNode: t,
|
|
108
|
+
appNode: n,
|
|
109
|
+
scrollStore: i
|
|
110
|
+
}) => {
|
|
111
|
+
var f, y;
|
|
112
|
+
const [m] = a(s.getNotificationsStore()), r = b(m), {
|
|
113
|
+
tabsShown: e
|
|
114
|
+
} = b(i, {
|
|
115
|
+
keys: ["tabsShown"]
|
|
116
|
+
}), [p, g] = a(null), l = T(() => {
|
|
84
117
|
if (!(r != null && r.size))
|
|
85
118
|
return null;
|
|
86
|
-
for (const
|
|
87
|
-
if (
|
|
88
|
-
return
|
|
119
|
+
for (const N of r.values())
|
|
120
|
+
if (N.type === c.ONBOARDING)
|
|
121
|
+
return N;
|
|
89
122
|
return r.values().next().value;
|
|
90
123
|
}, [r]);
|
|
91
|
-
return
|
|
124
|
+
return d(() => {
|
|
125
|
+
l && i.get().scrollPosition > 0 && g(l);
|
|
126
|
+
}, [l, i]), d(() => i.listen((u) => {
|
|
127
|
+
u.scrollPosition === 0 && g(null);
|
|
128
|
+
}), [i]), /* @__PURE__ */ h(S, {
|
|
129
|
+
children: [!p && l && /* @__PURE__ */ o(H, {
|
|
130
|
+
sdk: s,
|
|
131
|
+
notification: l
|
|
132
|
+
}), p && n.current && D.createPortal(/* @__PURE__ */ o(I, {
|
|
133
|
+
title: `New ${((y = E[(f = p.data) == null ? void 0 : f.questionType]) == null ? void 0 : y.label) || "notification"}`,
|
|
134
|
+
onClick: () => {
|
|
135
|
+
var u;
|
|
136
|
+
(u = t.current) == null || u.scrollTo({
|
|
137
|
+
top: 0,
|
|
138
|
+
behavior: "smooth"
|
|
139
|
+
});
|
|
140
|
+
},
|
|
141
|
+
className: e ? "c1d7yse1" : void 0
|
|
142
|
+
}), n.current)]
|
|
143
|
+
});
|
|
92
144
|
};
|
|
93
145
|
export {
|
|
94
|
-
|
|
146
|
+
Dt as SDKNotifications
|
|
95
147
|
};
|
|
@@ -2,3 +2,4 @@
|
|
|
2
2
|
export declare const Container: any;
|
|
3
3
|
export declare const InnerContainer: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
4
4
|
export declare const NotificationRefreshing: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
5
|
+
export declare const Pill: any;
|
|
@@ -1,22 +1,31 @@
|
|
|
1
|
-
import { styled as
|
|
2
|
-
import {
|
|
1
|
+
import { styled as s } from "@linaria/react";
|
|
2
|
+
import { Pill as o } from "../../gamification/question/notification/pill/index.js";
|
|
3
|
+
import { ShowIn as n } from "../../show-in/index.js";
|
|
3
4
|
import "react/jsx-runtime";
|
|
5
|
+
import "../../icons/index.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import "../../gamification/question/notification/pill/styles.js";
|
|
4
8
|
import "@linaria/core";
|
|
5
|
-
const
|
|
9
|
+
const r = () => n, I = /* @__PURE__ */ s(r())({
|
|
6
10
|
name: "Container",
|
|
7
11
|
class: "ctckejh",
|
|
8
12
|
propsAsIs: !0
|
|
9
|
-
}),
|
|
13
|
+
}), h = /* @__PURE__ */ s("div")({
|
|
10
14
|
name: "InnerContainer",
|
|
11
15
|
class: "i1ri7tzr",
|
|
12
16
|
propsAsIs: !1
|
|
13
|
-
}),
|
|
17
|
+
}), A = /* @__PURE__ */ s("div")({
|
|
14
18
|
name: "NotificationRefreshing",
|
|
15
19
|
class: "n1ng1qh5",
|
|
16
20
|
propsAsIs: !1
|
|
21
|
+
}), t = () => o, C = /* @__PURE__ */ s(t())({
|
|
22
|
+
name: "Pill",
|
|
23
|
+
class: "pruq6ik",
|
|
24
|
+
propsAsIs: !0
|
|
17
25
|
});
|
|
18
26
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
I as Container,
|
|
28
|
+
h as InnerContainer,
|
|
29
|
+
A as NotificationRefreshing,
|
|
30
|
+
C as Pill
|
|
22
31
|
};
|
package/lib/ui/app/masters.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import { resetCss as
|
|
4
|
-
import { ActiveFeature as
|
|
5
|
-
import { MastersNavigation as
|
|
6
|
-
import { SDKNotifications as
|
|
7
|
-
import { SDKContainer as
|
|
8
|
-
import { useMastersApp as
|
|
9
|
-
import { useSdkFeature as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
1
|
+
import { jsxs as c, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as g, useEffect as h } from "react";
|
|
3
|
+
import { resetCss as d } from "../theme/theme.js";
|
|
4
|
+
import { ActiveFeature as y } from "./Features/index.js";
|
|
5
|
+
import { MastersNavigation as N } from "./Navigation/MastersNavigation/index.js";
|
|
6
|
+
import { SDKNotifications as A } from "./Notifications/index.js";
|
|
7
|
+
import { SDKContainer as C, SDKScrollContainer as I } from "./styles.js";
|
|
8
|
+
import { useMastersApp as x } from "./useMastersApp.js";
|
|
9
|
+
import { useSdkFeature as B } from "./useSdkFeature.js";
|
|
10
|
+
import { useSdkScroll as F } from "./useSdkScroll.js";
|
|
11
|
+
import { ChannelsButtonId as j } from "../navigation/button/Channels.js";
|
|
12
|
+
import { LeaderBoardButtonId as D } from "../navigation/button/LeaderBoard.js";
|
|
13
|
+
import { FeaturedGroupsButtonId as E } from "../navigation/button/FeaturedGroups.js";
|
|
13
14
|
import "../theme/constants.js";
|
|
14
15
|
import "@streamlayer/sdk-web-types";
|
|
15
16
|
import "./Features/FeatureProvider.js";
|
|
@@ -19,10 +20,12 @@ import "../navigation/masters.js";
|
|
|
19
20
|
import "@linaria/react";
|
|
20
21
|
import "../navigation/index.js";
|
|
21
22
|
import "../../index_4nhkck-4ed993c7.js";
|
|
22
|
-
import "../../
|
|
23
|
+
import "../../masters_1wv7w2k-4ed993c7.js";
|
|
24
|
+
import "../../index-ba93b6b2.js";
|
|
25
|
+
import "../../index-39a0b9b6.js";
|
|
23
26
|
import "@streamlayer/sdk-web-notifications";
|
|
24
|
-
import "../gamification/question/notification/index.js";
|
|
25
27
|
import "../gamification/constants.js";
|
|
28
|
+
import "../gamification/question/notification/index.js";
|
|
26
29
|
import "../gamification/question/notification/insight/index.js";
|
|
27
30
|
import "../video-player/index.js";
|
|
28
31
|
import "../icons/index.js";
|
|
@@ -56,47 +59,57 @@ import "../button/styles.js";
|
|
|
56
59
|
import "./Notifications/Onboarding/Notification/index.js";
|
|
57
60
|
import "./Notifications/Onboarding/Notification/styles.js";
|
|
58
61
|
import "./Notifications/styles.js";
|
|
62
|
+
import "../gamification/question/notification/pill/index.js";
|
|
63
|
+
import "../gamification/question/notification/pill/styles.js";
|
|
59
64
|
import "../navigation/button/styles.js";
|
|
60
65
|
import "../../LeaderBoard_16p26hz-4ed993c7.js";
|
|
61
66
|
import "../navigation/button/index.js";
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
import "lodash.throttle";
|
|
68
|
+
const K = ({ sdk: t, className: p, scrollStore: e, appNode: r, scrollNode: a }) => {
|
|
69
|
+
const [, o] = B(t);
|
|
70
|
+
return /* @__PURE__ */ m(
|
|
71
|
+
y,
|
|
72
|
+
{
|
|
73
|
+
className: p,
|
|
74
|
+
scrollNode: a,
|
|
75
|
+
appNode: r,
|
|
76
|
+
scrollStore: e,
|
|
77
|
+
feature: o,
|
|
78
|
+
sdk: t
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}, Jt = ({ sdk: t, overlays: p, children: e }) => {
|
|
82
|
+
const [r, a] = F(), o = g(null), { sdkEnabled: s, sdkReady: n, activeOverlay: i, activateAndLoadOverlay: l, activateEventWithId: f, deactivate: u, isLogged: v } = x(t);
|
|
83
|
+
return h(() => {
|
|
68
84
|
import("./Features/Gamification/gamification-feature.js");
|
|
69
|
-
}, []), /* @__PURE__ */
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
{
|
|
73
|
-
sdkReady: e,
|
|
74
|
-
activeOverlay: o,
|
|
75
|
-
className: a,
|
|
76
|
-
setActiveOverlay: (u) => d("", u)
|
|
77
|
-
}
|
|
78
|
-
),
|
|
79
|
-
e && /* @__PURE__ */ t(S, { sdk: r }),
|
|
80
|
-
/* @__PURE__ */ t(
|
|
81
|
-
n,
|
|
82
|
-
{
|
|
83
|
-
"data-nav": p.toString(),
|
|
84
|
-
style: { display: !p || o === x ? "block" : "none" },
|
|
85
|
-
children: m && m({ activateEventWithId: c, deactivate: l })
|
|
86
|
-
}
|
|
87
|
-
),
|
|
88
|
-
/* @__PURE__ */ t(
|
|
89
|
-
n,
|
|
85
|
+
}, []), /* @__PURE__ */ c(C, { ref: o, children: [
|
|
86
|
+
s && /* @__PURE__ */ m(
|
|
87
|
+
N,
|
|
90
88
|
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
sdkReady: n,
|
|
90
|
+
activeOverlay: i,
|
|
91
|
+
className: d,
|
|
92
|
+
setActiveOverlay: (S) => l("", S)
|
|
94
93
|
}
|
|
95
94
|
),
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
/* @__PURE__ */ c(I, { ref: r, "data-nav": s.toString(), children: [
|
|
96
|
+
n && /* @__PURE__ */ m(A, { sdk: t, scrollNode: r, appNode: o, scrollStore: a }),
|
|
97
|
+
(!s || i === j) && e && e({ activateEventWithId: f, deactivate: u }),
|
|
98
|
+
p && i === D && p[i],
|
|
99
|
+
n && i === E && /* @__PURE__ */ m(
|
|
100
|
+
K,
|
|
101
|
+
{
|
|
102
|
+
scrollStore: a,
|
|
103
|
+
scrollNode: r,
|
|
104
|
+
appNode: o,
|
|
105
|
+
className: d,
|
|
106
|
+
sdk: t
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
] }),
|
|
110
|
+
!v && /* @__PURE__ */ m("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "100%" }, children: "You are not logged in." })
|
|
98
111
|
] });
|
|
99
112
|
};
|
|
100
113
|
export {
|
|
101
|
-
|
|
114
|
+
Jt as MastersApp
|
|
102
115
|
};
|
|
@@ -9,7 +9,7 @@ import "../icons/index.js";
|
|
|
9
9
|
import "../navigation/button/styles.js";
|
|
10
10
|
import "../../LeaderBoard_16p26hz-4ed993c7.js";
|
|
11
11
|
import "../../index_4nhkck-4ed993c7.js";
|
|
12
|
-
import "../../
|
|
12
|
+
import "../../masters_1wv7w2k-4ed993c7.js";
|
|
13
13
|
import "../navigation/button/index.js";
|
|
14
14
|
const U = (t) => {
|
|
15
15
|
const a = h(""), [f, l] = d(!1), A = m(t.status), r = m(t.userId()), i = A === "ready", [s, u] = d(n), p = F(
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MapStore } from 'nanostores';
|
|
2
|
+
type ScrollData = {
|
|
3
|
+
scrollPosition: number;
|
|
4
|
+
tabsShown?: boolean;
|
|
5
|
+
scrollDirection: 'forward' | 'backward';
|
|
6
|
+
};
|
|
7
|
+
export type ScrollStore = MapStore<ScrollData>;
|
|
8
|
+
export declare const useSdkScroll: () => [React.MutableRefObject<HTMLDivElement | null>, ScrollStore];
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import a from "lodash.throttle";
|
|
2
|
+
import { useRef as f, useState as v, useCallback as d, useEffect as p } from "react";
|
|
3
|
+
import { d as m } from "../../index-39a0b9b6.js";
|
|
4
|
+
let h = Symbol("clean"), n = [], b = (i, r) => {
|
|
5
|
+
let l = [], e = {
|
|
6
|
+
get() {
|
|
7
|
+
return e.lc || e.listen(() => {
|
|
8
|
+
})(), e.value;
|
|
9
|
+
},
|
|
10
|
+
l: r || 0,
|
|
11
|
+
lc: 0,
|
|
12
|
+
listen(o, s) {
|
|
13
|
+
return e.lc = l.push(o, s || e.l) / 2, () => {
|
|
14
|
+
let t = l.indexOf(o);
|
|
15
|
+
~t && (l.splice(t, 2), --e.lc || e.off());
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
notify(o) {
|
|
19
|
+
let s = !n.length;
|
|
20
|
+
for (let t = 0; t < l.length; t += 2)
|
|
21
|
+
n.push(
|
|
22
|
+
l[t],
|
|
23
|
+
l[t + 1],
|
|
24
|
+
e.value,
|
|
25
|
+
o
|
|
26
|
+
);
|
|
27
|
+
if (s) {
|
|
28
|
+
for (let t = 0; t < n.length; t += 4) {
|
|
29
|
+
let c;
|
|
30
|
+
for (let u = t + 1; !c && (u += 4) < n.length; )
|
|
31
|
+
n[u] < n[t + 1] && (c = n.push(
|
|
32
|
+
n[t],
|
|
33
|
+
n[t + 1],
|
|
34
|
+
n[t + 2],
|
|
35
|
+
n[t + 3]
|
|
36
|
+
));
|
|
37
|
+
c || n[t](n[t + 2], n[t + 3]);
|
|
38
|
+
}
|
|
39
|
+
n.length = 0;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
off() {
|
|
43
|
+
},
|
|
44
|
+
/* It will be called on last listener unsubscribing.
|
|
45
|
+
We will redefine it in onMount and onStop. */
|
|
46
|
+
set(o) {
|
|
47
|
+
e.value !== o && (e.value = o, e.notify());
|
|
48
|
+
},
|
|
49
|
+
subscribe(o, s) {
|
|
50
|
+
let t = e.listen(o, s);
|
|
51
|
+
return o(e.value), t;
|
|
52
|
+
},
|
|
53
|
+
value: i
|
|
54
|
+
};
|
|
55
|
+
return m.process.env.NODE_ENV !== "production" && (e[h] = () => {
|
|
56
|
+
l = [], e.lc = 0, e.off();
|
|
57
|
+
}), e;
|
|
58
|
+
}, g = (i = {}) => {
|
|
59
|
+
let r = b(i);
|
|
60
|
+
return r.setKey = function(l, e) {
|
|
61
|
+
typeof e > "u" ? l in r.value && (r.value = { ...r.value }, delete r.value[l], r.notify(l)) : r.value[l] !== e && (r.value = {
|
|
62
|
+
...r.value,
|
|
63
|
+
[l]: e
|
|
64
|
+
}, r.notify(l));
|
|
65
|
+
}, r;
|
|
66
|
+
};
|
|
67
|
+
const w = () => {
|
|
68
|
+
const i = f(null), r = f(0), [l] = v(
|
|
69
|
+
g({
|
|
70
|
+
scrollPosition: 0,
|
|
71
|
+
scrollDirection: "forward"
|
|
72
|
+
})
|
|
73
|
+
), e = d(
|
|
74
|
+
a((o) => {
|
|
75
|
+
const s = o.target;
|
|
76
|
+
if (!s)
|
|
77
|
+
return;
|
|
78
|
+
const { scrollTop: t } = s, c = r.current < t ? "forward" : "backward";
|
|
79
|
+
r.current = t, l.set({ scrollPosition: t, scrollDirection: c, tabsShown: l.get().tabsShown });
|
|
80
|
+
}, 200),
|
|
81
|
+
[]
|
|
82
|
+
);
|
|
83
|
+
return p(() => {
|
|
84
|
+
const o = i.current;
|
|
85
|
+
return o ? (o.addEventListener("scroll", e), () => {
|
|
86
|
+
o.removeEventListener("scroll", e);
|
|
87
|
+
}) : () => {
|
|
88
|
+
};
|
|
89
|
+
}, [e]), [i, l];
|
|
90
|
+
};
|
|
91
|
+
export {
|
|
92
|
+
w as useSdkScroll
|
|
93
|
+
};
|
|
@@ -1,40 +1,43 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { FixedSizeList as
|
|
4
|
-
import
|
|
5
|
-
import { LeaderboardItem as
|
|
2
|
+
import h from "react-virtualized-auto-sizer";
|
|
3
|
+
import { FixedSizeList as u } from "react-window";
|
|
4
|
+
import L from "react-window-infinite-loader";
|
|
5
|
+
import { LeaderboardItem as I } from "./list-item/index.js";
|
|
6
6
|
import { ScrollContainer as c } from "./styles.js";
|
|
7
|
+
import { LeaderboardStaticList as v } from "./static.js";
|
|
7
8
|
import "../../../utils/common.js";
|
|
8
9
|
import "./list-item/styles.js";
|
|
9
10
|
import "@linaria/react";
|
|
10
11
|
import "../../icons/index.js";
|
|
11
12
|
import "react";
|
|
12
|
-
|
|
13
|
+
import "../../../styles_hxnaic-4ed993c7.js";
|
|
14
|
+
import "react-infinite-scroller";
|
|
15
|
+
const M = ({
|
|
13
16
|
items: r,
|
|
14
17
|
currentUserId: i,
|
|
15
18
|
openItemDetail: m,
|
|
16
|
-
fetchMore:
|
|
17
|
-
onScroll:
|
|
18
|
-
}) => /* @__PURE__ */ o(
|
|
19
|
-
|
|
19
|
+
fetchMore: p,
|
|
20
|
+
onScroll: d
|
|
21
|
+
}) => /* @__PURE__ */ o(h, { children: ({ width: n, height: a }) => /* @__PURE__ */ o(
|
|
22
|
+
L,
|
|
20
23
|
{
|
|
21
24
|
isItemLoaded: (e) => e < r.length,
|
|
22
25
|
itemCount: r.length + 1,
|
|
23
|
-
loadMoreItems:
|
|
24
|
-
children: ({ onItemsRendered: e, ref:
|
|
25
|
-
|
|
26
|
+
loadMoreItems: p,
|
|
27
|
+
children: ({ onItemsRendered: e, ref: l }) => /* @__PURE__ */ o(c, { children: /* @__PURE__ */ o(
|
|
28
|
+
u,
|
|
26
29
|
{
|
|
27
30
|
itemSize: 56,
|
|
28
|
-
onScroll:
|
|
31
|
+
onScroll: d,
|
|
29
32
|
onItemsRendered: e,
|
|
30
|
-
ref:
|
|
33
|
+
ref: l,
|
|
31
34
|
itemCount: r.length,
|
|
32
|
-
width:
|
|
33
|
-
height:
|
|
34
|
-
children: ({ index: t, style:
|
|
35
|
-
|
|
35
|
+
width: n,
|
|
36
|
+
height: a,
|
|
37
|
+
children: ({ index: t, style: f }) => /* @__PURE__ */ o(
|
|
38
|
+
I,
|
|
36
39
|
{
|
|
37
|
-
style: { ...
|
|
40
|
+
style: { ...f, maxHeight: 48 },
|
|
38
41
|
...r[t],
|
|
39
42
|
openItemDetail: () => m(r[t].userId),
|
|
40
43
|
isCurrentUser: !!i && i === r[t].userId
|
|
@@ -46,5 +49,6 @@ const F = ({
|
|
|
46
49
|
}
|
|
47
50
|
) });
|
|
48
51
|
export {
|
|
49
|
-
|
|
52
|
+
M as LeaderboardList,
|
|
53
|
+
v as LeaderboardStaticList
|
|
50
54
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ScrollStore } from '../../app/useSdkScroll';
|
|
3
|
+
import { LeaderboardItemProps } from '../../gamification/leaderboard/list-item';
|
|
4
|
+
type LeaderboardListProps = {
|
|
5
|
+
items: Omit<LeaderboardItemProps, 'openItemDetail'>[];
|
|
6
|
+
currentUserId?: string;
|
|
7
|
+
openItemDetail: (id: string) => void;
|
|
8
|
+
fetchMore: () => void;
|
|
9
|
+
scrollNode: React.MutableRefObject<HTMLDivElement | null>;
|
|
10
|
+
scrollStore: ScrollStore;
|
|
11
|
+
hasMore: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const LeaderboardStaticList: React.FC<LeaderboardListProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { styled as l } from "@linaria/react";
|
|
3
|
+
import p from "react-infinite-scroller";
|
|
4
|
+
import { LeaderboardItem as d } from "./list-item/index.js";
|
|
5
|
+
import "../../../utils/common.js";
|
|
6
|
+
import "./list-item/styles.js";
|
|
7
|
+
import "../../icons/index.js";
|
|
8
|
+
import "react";
|
|
9
|
+
const m = /* @__PURE__ */ l("div")({
|
|
10
|
+
name: "Container",
|
|
11
|
+
class: "c16btbfp",
|
|
12
|
+
propsAsIs: !1
|
|
13
|
+
}), h = ({
|
|
14
|
+
items: e,
|
|
15
|
+
currentUserId: t,
|
|
16
|
+
openItemDetail: i,
|
|
17
|
+
fetchMore: s,
|
|
18
|
+
scrollNode: a,
|
|
19
|
+
hasMore: n
|
|
20
|
+
}) => /* @__PURE__ */ o(p, {
|
|
21
|
+
loadMore: s,
|
|
22
|
+
initialLoad: !1,
|
|
23
|
+
hasMore: n,
|
|
24
|
+
useWindow: !1,
|
|
25
|
+
getScrollParent: () => a.current,
|
|
26
|
+
children: /* @__PURE__ */ o(m, {
|
|
27
|
+
children: e.map((r) => /* @__PURE__ */ o(d, {
|
|
28
|
+
...r,
|
|
29
|
+
openItemDetail: () => i(r.userId),
|
|
30
|
+
isCurrentUser: !!t && t === r.userId
|
|
31
|
+
}, r.userId))
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
h as LeaderboardStaticList
|
|
36
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { styled as
|
|
2
|
-
|
|
1
|
+
import { styled as o } from "@linaria/react";
|
|
2
|
+
import "../../../styles_hxnaic-4ed993c7.js";
|
|
3
|
+
const l = /* @__PURE__ */ o("div")({
|
|
3
4
|
name: "ScrollContainer",
|
|
4
5
|
class: "s13d8sg6",
|
|
5
6
|
propsAsIs: !1
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { SvgIcon as
|
|
3
|
-
import { Container as
|
|
1
|
+
import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { SvgIcon as e } from "../../../../icons/index.js";
|
|
3
|
+
import { Container as p, Content as c, Title as l } from "./styles.js";
|
|
4
4
|
import "@linaria/react";
|
|
5
5
|
import "react";
|
|
6
|
-
const
|
|
7
|
-
/* @__PURE__ */ r(
|
|
8
|
-
o && /* @__PURE__ */ r(
|
|
6
|
+
const a = ({ title: o, onClick: n, className: i, style: t }) => /* @__PURE__ */ r(p, { onClick: n, className: i, style: t, children: /* @__PURE__ */ m(c, { children: [
|
|
7
|
+
/* @__PURE__ */ r(e, { name: "iconUp" }),
|
|
8
|
+
o && /* @__PURE__ */ r(l, { children: o })
|
|
9
9
|
] }) });
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
a as Pill
|
|
12
12
|
};
|