@ludo.ninja/components 2.1.26 → 2.1.28
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.
|
@@ -66,6 +66,11 @@ const Subscription = () => {
|
|
|
66
66
|
user: state.user,
|
|
67
67
|
}));
|
|
68
68
|
const userId = user?.userId || "";
|
|
69
|
+
const [readNotification] = api_1.notificationsSchema.useReadNotificationMutation({
|
|
70
|
+
context: {
|
|
71
|
+
uri: api_1.hosts.notificationsHost,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
69
74
|
(0, client_1.useSubscription)(api_1.notificationsSchema.OnNotificationDocument, {
|
|
70
75
|
variables: { authToken, notificationTypes: [api_1.notificationsSchema.INotificationType.Push] },
|
|
71
76
|
onData: (options) => {
|
|
@@ -131,6 +136,7 @@ const Subscription = () => {
|
|
|
131
136
|
},
|
|
132
137
|
});
|
|
133
138
|
}
|
|
139
|
+
readNotification({ variables: { notificationId: notification.notificationId } });
|
|
134
140
|
}
|
|
135
141
|
},
|
|
136
142
|
});
|
|
@@ -139,6 +145,16 @@ const Subscription = () => {
|
|
|
139
145
|
const SubscriberNotification = () => {
|
|
140
146
|
const isSignedIn = (0, store_1.useUserStore)((state) => state.isSignedIn);
|
|
141
147
|
const key = isSignedIn ? "all includes" : "only common";
|
|
142
|
-
|
|
148
|
+
const [isWindowVisible, setIsWindowVisible] = (0, react_1.useState)(true);
|
|
149
|
+
(0, react_1.useEffect)(() => {
|
|
150
|
+
const changeVisibility = () => {
|
|
151
|
+
setIsWindowVisible(!document.hidden);
|
|
152
|
+
};
|
|
153
|
+
document.addEventListener("visibilitychange", changeVisibility);
|
|
154
|
+
return () => {
|
|
155
|
+
document.removeEventListener("visibilitychange", changeVisibility);
|
|
156
|
+
};
|
|
157
|
+
}, []);
|
|
158
|
+
return ((0, jsx_runtime_1.jsx)(NoSSR_1.default, { children: isWindowVisible && (0, jsx_runtime_1.jsx)(Subscription, {}, key) }));
|
|
143
159
|
};
|
|
144
160
|
exports.SubscriberNotification = SubscriberNotification;
|
|
@@ -62,7 +62,7 @@ const ToTopBtnIconResize = () => {
|
|
|
62
62
|
};
|
|
63
63
|
const ToTopBtn = () => {
|
|
64
64
|
const [showBtn, setShowBtn] = (0, react_1.useState)(false);
|
|
65
|
-
let oldScrollY = document.documentElement.scrollTop;
|
|
65
|
+
// let oldScrollY = document.documentElement.scrollTop;
|
|
66
66
|
const offsetPixels = 600;
|
|
67
67
|
(0, react_1.useEffect)(() => {
|
|
68
68
|
window.addEventListener('scroll', handleScroll);
|
|
@@ -73,14 +73,14 @@ const ToTopBtn = () => {
|
|
|
73
73
|
};
|
|
74
74
|
const handleScroll = () => {
|
|
75
75
|
if ((0, ui_1.upBtnDistance)(document, offsetPixels)) {
|
|
76
|
-
if (oldScrollY > document.documentElement.scrollTop) {
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
oldScrollY = document.documentElement.scrollTop;
|
|
76
|
+
// if (oldScrollY > document.documentElement.scrollTop) {
|
|
77
|
+
setShowBtn(true);
|
|
78
|
+
// }
|
|
79
|
+
// oldScrollY = document.documentElement.scrollTop;
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
82
|
setShowBtn(false);
|
|
83
|
-
oldScrollY = offsetPixels;
|
|
83
|
+
// oldScrollY = offsetPixels;
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
if (!showBtn)
|
|
@@ -6,20 +6,20 @@ const react_1 = require("react");
|
|
|
6
6
|
const toTopBtn_1 = require("../../components/toTopBtn");
|
|
7
7
|
const useVirtuosoToTopBtnInitialize = () => {
|
|
8
8
|
const [isShowBtn, setIsShowBtn] = (0, react_1.useState)(false);
|
|
9
|
-
const oldScrollY =
|
|
9
|
+
// const oldScrollY = useRef(0);
|
|
10
10
|
const offsetPixels = 600;
|
|
11
11
|
return {
|
|
12
12
|
isShowBtn,
|
|
13
13
|
onScroll(scrollY) {
|
|
14
14
|
if (scrollY > offsetPixels) {
|
|
15
|
-
if (oldScrollY.current > scrollY) {
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
oldScrollY.current = scrollY;
|
|
15
|
+
// if (oldScrollY.current > scrollY) {
|
|
16
|
+
setIsShowBtn(true);
|
|
17
|
+
// }
|
|
18
|
+
// oldScrollY.current = scrollY;
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
21
|
setIsShowBtn(false);
|
|
22
|
-
oldScrollY.current = offsetPixels;
|
|
22
|
+
// oldScrollY.current = offsetPixels;
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
};
|
package/build/store/ui/index.js
CHANGED
|
@@ -25,9 +25,9 @@ exports.useUiStore = (0, traditional_1.createWithEqualityFn)()((setState) => ({
|
|
|
25
25
|
//notifications
|
|
26
26
|
notifications: [],
|
|
27
27
|
addNotification: async (content) => {
|
|
28
|
-
if (process.env.NODE_ENV === 'development') {
|
|
29
|
-
|
|
30
|
-
}
|
|
28
|
+
// if (process.env.NODE_ENV === 'development') {
|
|
29
|
+
// return;
|
|
30
|
+
// }
|
|
31
31
|
let isOpenNotification;
|
|
32
32
|
try {
|
|
33
33
|
const response = (await (0, utils_1.sendEventToExtension)(utils_1.eventsTypes.pingVersion));
|