@streamlayer/react-ui 0.80.1 → 0.81.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/ui/app/Features/Gamification/Leaderboard.d.ts +1 -0
- package/lib/ui/app/Features/Gamification/Leaderboard.js +18 -11
- package/lib/ui/app/Features/Gamification/Tabs.js +65 -37
- package/lib/ui/app/Features/Gamification/gamification-feature.js +1 -0
- package/lib/ui/app/Features/Gamification/index.js +3 -2
- package/lib/ui/gamification/leaderboard/index.d.ts +2 -0
- package/lib/ui/gamification/leaderboard/index.js +20 -18
- package/package.json +9 -7
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useStore as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useStore as i } from "@nanostores/react";
|
|
3
|
+
import n from "lodash.throttle";
|
|
4
|
+
import { useRef as p, useCallback as c } from "react";
|
|
5
|
+
import { LeaderboardList as f } from "../../../gamification/leaderboard/index.js";
|
|
6
|
+
import { Friends as d } from "./Friends.js";
|
|
5
7
|
import "react-virtualized-auto-sizer";
|
|
6
8
|
import "react-window";
|
|
7
9
|
import "react-window-infinite-loader";
|
|
@@ -10,22 +12,27 @@ import "../../../../utils/common.js";
|
|
|
10
12
|
import "../../../gamification/leaderboard/list-item/styles.js";
|
|
11
13
|
import "@linaria/react";
|
|
12
14
|
import "../../../icons/index.js";
|
|
13
|
-
import "react";
|
|
14
15
|
import "../../../gamification/leaderboard/styles.js";
|
|
15
16
|
import "../../../gamification/onboarding/slides/onboarding-invite-card/index.js";
|
|
16
17
|
import "../../../gamification/onboarding/slides/onboarding-invite-card/styles.js";
|
|
17
|
-
const
|
|
18
|
-
const { data: e } =
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const F = ({ gamification: r, hideTabs: o }) => {
|
|
19
|
+
const { data: e } = i(r.leaderboardList.$store), s = p(0), m = c(
|
|
20
|
+
n((t) => {
|
|
21
|
+
Math.abs(s.current - t.scrollOffset) < 112 || (s.current = t.scrollOffset, o(t.scrollOffset !== 0 && t.scrollDirection === "forward"));
|
|
22
|
+
}, 200),
|
|
23
|
+
[o]
|
|
24
|
+
);
|
|
25
|
+
return e != null && e.length ? /* @__PURE__ */ l(
|
|
26
|
+
f,
|
|
21
27
|
{
|
|
22
28
|
fetchMore: r.leaderboardList.fetchMore,
|
|
23
29
|
items: e,
|
|
30
|
+
onScroll: m,
|
|
24
31
|
openItemDetail: r.openUser,
|
|
25
32
|
currentUserId: r.currentUserId.get()
|
|
26
33
|
}
|
|
27
|
-
) : /* @__PURE__ */
|
|
34
|
+
) : /* @__PURE__ */ l(d, { deepLink: r.deepLink });
|
|
28
35
|
};
|
|
29
36
|
export {
|
|
30
|
-
|
|
37
|
+
F as Leaderboard
|
|
31
38
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import S from "lodash.throttle";
|
|
3
|
+
import { useState as d, useRef as u, useTransition as E, useCallback as y, useEffect as C } from "react";
|
|
4
|
+
import { SDKWhiteContainer as f, SDKScrollContainer as D, SDKContentContainer as L } from "../../styles.js";
|
|
5
|
+
import { ActivePages as s, Tabs as A } from "../../../gamification/tabs/index.js";
|
|
6
|
+
import { Leaderboard as P } from "./Leaderboard.js";
|
|
7
|
+
import { QuestionsList as R } from "./QuestionsList.js";
|
|
8
|
+
import { UserSummary as w } from "./UserSummary.js";
|
|
8
9
|
import "@linaria/react";
|
|
9
10
|
import "../../../gamification/tabs/styles.js";
|
|
10
11
|
import "@nanostores/react";
|
|
@@ -46,49 +47,76 @@ import "../../../gamification/user-statistics/components/rank/styles.js";
|
|
|
46
47
|
import "../../../gamification/user-statistics/components/statistic/index.js";
|
|
47
48
|
import "../../../gamification/user-statistics/components/statistic/styles.js";
|
|
48
49
|
import "../../../gamification/user-statistics/styles.js";
|
|
49
|
-
const
|
|
50
|
-
gamification:
|
|
50
|
+
const Lr = ({
|
|
51
|
+
gamification: i
|
|
51
52
|
}) => {
|
|
52
|
-
const [o,
|
|
53
|
-
|
|
53
|
+
const [h, b] = d(!1), [o, T] = d(s.HOME), m = u(null), e = u(0), [g, l] = E(), v = (r) => {
|
|
54
|
+
l(() => T(r));
|
|
55
|
+
}, p = (r) => {
|
|
56
|
+
l(() => b(r));
|
|
57
|
+
}, c = y(S(() => {
|
|
58
|
+
const r = m.current;
|
|
59
|
+
if (!r)
|
|
60
|
+
return;
|
|
61
|
+
const {
|
|
62
|
+
scrollTop: n
|
|
63
|
+
} = r;
|
|
64
|
+
if (n === 0) {
|
|
65
|
+
e.current = 0, p(!1);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (Math.abs(e.current - n) < 112)
|
|
69
|
+
return;
|
|
70
|
+
const x = e.current < n ? "forward" : "backward";
|
|
71
|
+
e.current = n, p(x === "forward");
|
|
72
|
+
}, 200), []);
|
|
73
|
+
return C(() => {
|
|
74
|
+
const r = m.current;
|
|
75
|
+
return r ? (o === s.HOME && r.addEventListener("scroll", c), () => {
|
|
76
|
+
r.removeEventListener("scroll", c);
|
|
77
|
+
}) : () => {
|
|
78
|
+
};
|
|
79
|
+
}, [o, c]), /* @__PURE__ */ a("div", {
|
|
54
80
|
style: {
|
|
55
81
|
height: "100%",
|
|
56
82
|
display: "flex",
|
|
57
83
|
flexDirection: "column",
|
|
58
84
|
overflow: "hidden"
|
|
59
85
|
},
|
|
60
|
-
children: /* @__PURE__ */
|
|
61
|
-
|
|
86
|
+
children: [g, /* @__PURE__ */ t(f, {
|
|
87
|
+
style: {
|
|
88
|
+
paddingBottom: "4px",
|
|
89
|
+
transition: "margin-top 0.2s ease-in-out",
|
|
90
|
+
marginTop: h ? "-56px" : "0px"
|
|
91
|
+
},
|
|
92
|
+
children: /* @__PURE__ */ t(A, {
|
|
93
|
+
activePage: o,
|
|
94
|
+
toggleActivePage: v
|
|
95
|
+
})
|
|
96
|
+
}), o === s.HOME && /* @__PURE__ */ a(D, {
|
|
97
|
+
ref: m,
|
|
98
|
+
children: [/* @__PURE__ */ t(f, {
|
|
62
99
|
style: {
|
|
63
|
-
|
|
100
|
+
paddingTop: "12px"
|
|
64
101
|
},
|
|
65
|
-
children: /* @__PURE__ */
|
|
66
|
-
|
|
67
|
-
toggleActivePage: e
|
|
102
|
+
children: /* @__PURE__ */ t(w, {
|
|
103
|
+
userSummary: i.userSummary
|
|
68
104
|
})
|
|
69
|
-
}),
|
|
70
|
-
children:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
children: /* @__PURE__ */ r(u, {
|
|
75
|
-
userSummary: t.userSummary
|
|
76
|
-
})
|
|
77
|
-
}), /* @__PURE__ */ r(a, {
|
|
78
|
-
children: /* @__PURE__ */ r(h, {
|
|
79
|
-
openQuestion: t.openQuestion,
|
|
80
|
-
store: t.feedList.getStore()
|
|
81
|
-
})
|
|
82
|
-
})]
|
|
83
|
-
}), o === i.LEADERBOARD && /* @__PURE__ */ r("div", {
|
|
84
|
-
className: "c1bp9dj2",
|
|
85
|
-
children: /* @__PURE__ */ r(c, {
|
|
86
|
-
gamification: t
|
|
105
|
+
}), /* @__PURE__ */ t(L, {
|
|
106
|
+
children: /* @__PURE__ */ t(R, {
|
|
107
|
+
openQuestion: i.openQuestion,
|
|
108
|
+
store: i.feedList.getStore()
|
|
87
109
|
})
|
|
88
110
|
})]
|
|
89
|
-
})
|
|
111
|
+
}), o === s.LEADERBOARD && /* @__PURE__ */ t("div", {
|
|
112
|
+
className: "c1bp9dj2",
|
|
113
|
+
children: /* @__PURE__ */ t(P, {
|
|
114
|
+
gamification: i,
|
|
115
|
+
hideTabs: p
|
|
116
|
+
})
|
|
117
|
+
})]
|
|
90
118
|
});
|
|
91
119
|
};
|
|
92
120
|
export {
|
|
93
|
-
|
|
121
|
+
Lr as Tabs
|
|
94
122
|
};
|
|
@@ -48,6 +48,7 @@ import "../../../questions/twitter/account/styles.js";
|
|
|
48
48
|
import "../../../questions/twitter/styles.js";
|
|
49
49
|
import "../../../gamification/vote/twitter-details/styles.js";
|
|
50
50
|
import "./Tabs.js";
|
|
51
|
+
import "lodash.throttle";
|
|
51
52
|
import "../../../gamification/tabs/index.js";
|
|
52
53
|
import "../../../gamification/tabs/styles.js";
|
|
53
54
|
import "./Leaderboard.js";
|
|
@@ -47,6 +47,7 @@ import "../../../questions/twitter/account/index.js";
|
|
|
47
47
|
import "../../../questions/twitter/account/styles.js";
|
|
48
48
|
import "../../../questions/twitter/styles.js";
|
|
49
49
|
import "../../../gamification/vote/twitter-details/styles.js";
|
|
50
|
+
import "lodash.throttle";
|
|
50
51
|
import "../../../gamification/tabs/index.js";
|
|
51
52
|
import "../../../gamification/tabs/styles.js";
|
|
52
53
|
import "./Leaderboard.js";
|
|
@@ -86,7 +87,7 @@ const C = () => h, n = /* @__PURE__ */ s(C())({
|
|
|
86
87
|
}) => {
|
|
87
88
|
const i = r + t;
|
|
88
89
|
return i === 0 ? 0 : Math.round(r / i * 100);
|
|
89
|
-
},
|
|
90
|
+
}, Wr = ({
|
|
90
91
|
gamification: r,
|
|
91
92
|
className: t
|
|
92
93
|
}) => {
|
|
@@ -120,5 +121,5 @@ const C = () => h, n = /* @__PURE__ */ s(C())({
|
|
|
120
121
|
});
|
|
121
122
|
};
|
|
122
123
|
export {
|
|
123
|
-
|
|
124
|
+
Wr as GamificationOverlay
|
|
124
125
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ListProps } from 'react-window';
|
|
2
3
|
import { LeaderboardItemProps } from '../../gamification/leaderboard/list-item';
|
|
3
4
|
type LeaderboardListProps = {
|
|
4
5
|
items: Omit<LeaderboardItemProps, 'openItemDetail'>[];
|
|
5
6
|
currentUserId?: string;
|
|
6
7
|
openItemDetail: (id: string) => void;
|
|
7
8
|
fetchMore: () => void;
|
|
9
|
+
onScroll?: ListProps['onScroll'];
|
|
8
10
|
};
|
|
9
11
|
export declare const LeaderboardList: React.FC<LeaderboardListProps>;
|
|
10
12
|
export {};
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { FixedSizeList as
|
|
4
|
-
import
|
|
5
|
-
import { LeaderboardItem as
|
|
6
|
-
import { ScrollContainer as
|
|
2
|
+
import u from "react-virtualized-auto-sizer";
|
|
3
|
+
import { FixedSizeList as f } from "react-window";
|
|
4
|
+
import I from "react-window-infinite-loader";
|
|
5
|
+
import { LeaderboardItem as L } from "./list-item/index.js";
|
|
6
|
+
import { ScrollContainer as c } from "./styles.js";
|
|
7
7
|
import "../../../utils/common.js";
|
|
8
8
|
import "./list-item/styles.js";
|
|
9
9
|
import "@linaria/react";
|
|
10
10
|
import "../../icons/index.js";
|
|
11
11
|
import "react";
|
|
12
|
-
const
|
|
12
|
+
const F = ({
|
|
13
13
|
items: r,
|
|
14
14
|
currentUserId: i,
|
|
15
15
|
openItemDetail: m,
|
|
16
|
-
fetchMore: n
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
fetchMore: n,
|
|
17
|
+
onScroll: p
|
|
18
|
+
}) => /* @__PURE__ */ o(u, { children: ({ width: d, height: l }) => /* @__PURE__ */ o(
|
|
19
|
+
I,
|
|
19
20
|
{
|
|
20
21
|
isItemLoaded: (e) => e < r.length,
|
|
21
22
|
itemCount: r.length + 1,
|
|
22
23
|
loadMoreItems: n,
|
|
23
|
-
children: ({ onItemsRendered: e, ref:
|
|
24
|
-
|
|
24
|
+
children: ({ onItemsRendered: e, ref: a }) => /* @__PURE__ */ o(c, { children: /* @__PURE__ */ o(
|
|
25
|
+
f,
|
|
25
26
|
{
|
|
26
27
|
itemSize: 56,
|
|
28
|
+
onScroll: p,
|
|
27
29
|
onItemsRendered: e,
|
|
28
|
-
ref:
|
|
30
|
+
ref: a,
|
|
29
31
|
itemCount: r.length,
|
|
30
|
-
width:
|
|
31
|
-
height:
|
|
32
|
-
children: ({ index: t, style:
|
|
33
|
-
|
|
32
|
+
width: d,
|
|
33
|
+
height: l,
|
|
34
|
+
children: ({ index: t, style: h }) => /* @__PURE__ */ o(
|
|
35
|
+
L,
|
|
34
36
|
{
|
|
35
|
-
style: { ...
|
|
37
|
+
style: { ...h, maxHeight: 48 },
|
|
36
38
|
...r[t],
|
|
37
39
|
openItemDetail: () => m(r[t].userId),
|
|
38
40
|
isCurrentUser: !!i && i === r[t].userId
|
|
@@ -44,5 +46,5 @@ const D = ({
|
|
|
44
46
|
}
|
|
45
47
|
) });
|
|
46
48
|
export {
|
|
47
|
-
|
|
49
|
+
F as LeaderboardList
|
|
48
50
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/react-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.81.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -37,19 +37,21 @@
|
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@lottiefiles/react-lottie-player": "*",
|
|
39
39
|
"@streamlayer/sl-eslib": "^5.53.6",
|
|
40
|
+
"@types/lodash.throttle": "^4.1.9",
|
|
41
|
+
"lodash.throttle": "^4.1.1",
|
|
40
42
|
"react-virtualized-auto-sizer": "^1.0.20",
|
|
41
43
|
"react-window": "^1.8.9",
|
|
42
44
|
"react-window-infinite-loader": "^1.0.9",
|
|
43
|
-
"@streamlayer/feature-gamification": "^0.30.
|
|
45
|
+
"@streamlayer/feature-gamification": "^0.30.1",
|
|
44
46
|
"@streamlayer/sdk-web": "^0.29.5",
|
|
45
47
|
"@streamlayer/sdk-web-anonymous-auth": "^0.11.30",
|
|
46
48
|
"@streamlayer/sdk-web-api": "^0.1.0",
|
|
47
|
-
"@streamlayer/sdk-web-features": "^0.11.0",
|
|
48
49
|
"@streamlayer/sdk-web-core": "^0.1.0",
|
|
49
|
-
"@streamlayer/sdk-web-
|
|
50
|
-
"@streamlayer/sdk-web-
|
|
51
|
-
"@streamlayer/sdk-web-storage": "^0.0.4",
|
|
50
|
+
"@streamlayer/sdk-web-features": "^0.11.1",
|
|
51
|
+
"@streamlayer/sdk-web-interfaces": "^0.18.17",
|
|
52
52
|
"@streamlayer/sdk-web-logger": "^0.0.1",
|
|
53
|
+
"@streamlayer/sdk-web-notifications": "^0.0.1",
|
|
54
|
+
"@streamlayer/sdk-web-storage": "^0.0.4",
|
|
53
55
|
"@streamlayer/sdk-web-types": "^0.1.0"
|
|
54
56
|
},
|
|
55
57
|
"nx": {
|
|
@@ -90,6 +92,6 @@
|
|
|
90
92
|
"vite-plugin-svgr": "^4.1.0",
|
|
91
93
|
"vite-svg-loader": "^4.0.0",
|
|
92
94
|
"vite-tsconfig-paths": "^4.2.1",
|
|
93
|
-
"@streamlayer/react": "^0.
|
|
95
|
+
"@streamlayer/react": "^0.33.0"
|
|
94
96
|
}
|
|
95
97
|
}
|