decentraland-dapps 19.2.4 → 19.3.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.
|
@@ -1,38 +1,22 @@
|
|
|
1
|
-
import React, { useCallback, useEffect,
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { Navbar as NavbarComponent } from 'decentraland-ui/dist/components/Navbar/Navbar';
|
|
3
|
-
import { NotificationActiveTab } from 'decentraland-ui/dist/components/Notifications/types';
|
|
4
|
-
import { CURRENT_AVAILABLE_NOTIFICATIONS } from 'decentraland-ui/dist/components/Notifications/utils';
|
|
5
3
|
import { getChainName } from '@dcl/schemas/dist/dapps/chain-id';
|
|
6
4
|
import { ProviderType } from '@dcl/schemas';
|
|
7
5
|
import { getAnalytics } from '../../modules/analytics/utils';
|
|
8
6
|
import { t } from '../../modules/translation';
|
|
9
|
-
import { NotificationsAPI, checkIsOnboarding, setOnboardingDone } from '../../modules/notifications';
|
|
10
7
|
import UnsupportedNetworkModal from '../UnsupportedNetworkModal';
|
|
11
8
|
import { getAvailableChains } from '../../lib/chainConfiguration';
|
|
12
9
|
import { getConnectedProviderType } from '../../lib';
|
|
13
10
|
import { getBaseUrl } from '../../lib/utils';
|
|
14
11
|
import ChainProvider from '../ChainProvider';
|
|
15
12
|
import { DROPDOWN_MENU_BALANCE_CLICK_EVENT, DROPDOWN_MENU_DISPLAY_EVENT, DROPDOWN_MENU_SIGN_OUT_EVENT } from './constants';
|
|
16
|
-
import { NAVBAR_CLICK_EVENT
|
|
17
|
-
import
|
|
13
|
+
import { NAVBAR_CLICK_EVENT } from './constants';
|
|
14
|
+
import useNotifications from '../../hooks/useNotifications';
|
|
18
15
|
const BASE_URL = getBaseUrl();
|
|
19
16
|
const Navbar = ({ appChainId, isSwitchingNetwork, withNotifications, withChainSelector, identity, docsUrl = 'https://docs.decentraland.org', enablePartialSupportAlert = true, walletError, ...props }) => {
|
|
20
|
-
const [{ isLoading, notifications }, setUserNotifications] = useState({
|
|
21
|
-
isLoading: false,
|
|
22
|
-
notifications: []
|
|
23
|
-
});
|
|
24
|
-
const [notificationsState, setNotificationsState] = useState({
|
|
25
|
-
activeTab: NotificationActiveTab.NEWEST,
|
|
26
|
-
isOnboarding: checkIsOnboarding(),
|
|
27
|
-
isOpen: false
|
|
28
|
-
});
|
|
29
17
|
const expectedChainName = getChainName(appChainId);
|
|
30
18
|
const analytics = getAnalytics();
|
|
31
|
-
const
|
|
32
|
-
if (identity)
|
|
33
|
-
return new NotificationsAPI({ identity });
|
|
34
|
-
return null;
|
|
35
|
-
}, [identity]);
|
|
19
|
+
const { isModalOpen, isNotificationsOnboarding, modalActiveTab, isLoading, notifications, handleNotificationsOpen, handleOnBegin, handleOnChangeModalTab } = useNotifications(identity, withNotifications || false);
|
|
36
20
|
const handleSwitchNetwork = useCallback(() => {
|
|
37
21
|
props.onSwitchNetwork(appChainId);
|
|
38
22
|
}, []);
|
|
@@ -78,83 +62,20 @@ const Navbar = ({ appChainId, isSwitchingNetwork, withNotifications, withChainSe
|
|
|
78
62
|
props.onSignOut();
|
|
79
63
|
}, 300);
|
|
80
64
|
}, [analytics]);
|
|
81
|
-
const handleOnBegin = () => {
|
|
82
|
-
setOnboardingDone();
|
|
83
|
-
setNotificationsState(prevState => ({ ...prevState, isOnboarding: false }));
|
|
84
|
-
};
|
|
85
|
-
const handleNotificationsOpen = async () => {
|
|
86
|
-
const currentOpenState = notificationsState.isOpen;
|
|
87
|
-
setNotificationsState(prevState => {
|
|
88
|
-
return { ...prevState, isOpen: !prevState.isOpen };
|
|
89
|
-
});
|
|
90
|
-
if (!currentOpenState) {
|
|
91
|
-
const unreadNotifications = notifications
|
|
92
|
-
.filter(notification => !notification.read)
|
|
93
|
-
.map(({ id }) => id);
|
|
94
|
-
if (unreadNotifications.length) {
|
|
95
|
-
await client?.markNotificationsAsRead(unreadNotifications);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
// update state when closes the modal
|
|
100
|
-
const markNotificationAsReadInState = notifications.map(notification => {
|
|
101
|
-
if (notification.read)
|
|
102
|
-
return notification;
|
|
103
|
-
return {
|
|
104
|
-
...notification,
|
|
105
|
-
read: true
|
|
106
|
-
};
|
|
107
|
-
});
|
|
108
|
-
setUserNotifications({
|
|
109
|
-
isLoading,
|
|
110
|
-
notifications: markNotificationAsReadInState
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
const fetchNotificationsState = () => {
|
|
115
|
-
setUserNotifications({ notifications: [], isLoading: true });
|
|
116
|
-
client?.getNotifications().then(retrievedNotifications => {
|
|
117
|
-
setUserNotifications({
|
|
118
|
-
isLoading: false,
|
|
119
|
-
notifications: retrievedNotifications.filter(notification => CURRENT_AVAILABLE_NOTIFICATIONS.includes(notification.type))
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
const handleRenderProfile = useCallback((address) => {
|
|
124
|
-
return (React.createElement(Profile, { address: address, as: "a", href: `${getBaseUrl()}/profile/accounts/${address}`, style: { fontWeight: 500, color: 'white', textDecoration: 'none' }, target: "_blank" }));
|
|
125
|
-
}, []);
|
|
126
|
-
useEffect(() => {
|
|
127
|
-
if (identity && withNotifications) {
|
|
128
|
-
fetchNotificationsState();
|
|
129
|
-
const interval = setInterval(() => {
|
|
130
|
-
fetchNotificationsState();
|
|
131
|
-
}, NOTIFICATIONS_QUERY_INTERVAL);
|
|
132
|
-
return () => {
|
|
133
|
-
clearInterval(interval);
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
return () => { };
|
|
138
|
-
}
|
|
139
|
-
}, [identity]);
|
|
140
65
|
return (React.createElement(React.Fragment, null,
|
|
141
66
|
React.createElement(ChainProvider, null, ({ chainId, isUnsupported }) => (React.createElement(React.Fragment, null,
|
|
142
67
|
React.createElement(NavbarComponent, { ...props, notifications: withNotifications
|
|
143
68
|
? {
|
|
144
69
|
locale: props.locale,
|
|
145
70
|
isLoading,
|
|
146
|
-
isOnboarding:
|
|
147
|
-
isOpen:
|
|
71
|
+
isOnboarding: isNotificationsOnboarding,
|
|
72
|
+
isOpen: isModalOpen,
|
|
148
73
|
items: notifications,
|
|
149
|
-
activeTab:
|
|
74
|
+
activeTab: modalActiveTab,
|
|
150
75
|
onClick: handleNotificationsOpen,
|
|
151
76
|
onClose: handleNotificationsOpen,
|
|
152
77
|
onBegin: handleOnBegin,
|
|
153
|
-
onChangeTab: (_, tab) =>
|
|
154
|
-
...prevState,
|
|
155
|
-
activeTab: tab
|
|
156
|
-
})),
|
|
157
|
-
renderProfile: handleRenderProfile
|
|
78
|
+
onChangeTab: (_, tab) => handleOnChangeModalTab(tab)
|
|
158
79
|
}
|
|
159
80
|
: undefined, onClickBalance: handleClickBalance, onClickNavbarItem: handleClickNavbarItem, onClickUserMenuItem: handleClickUserMenuItem, onClickOpen: handleClickOpen, onClickSignIn: handleClickSignIn, onClickSignOut: handleClickSignOut, ...(withChainSelector && {
|
|
160
81
|
chains: getAvailableChains(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navbar.js","sourceRoot":"","sources":["../../../src/containers/Navbar/Navbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"Navbar.js","sourceRoot":"","sources":["../../../src/containers/Navbar/Navbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,+CAA+C,CAAA;AAEzF,OAAO,EAAW,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,E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sBAAsB,CAAC,GAAG,CAAC;qBACrD;oBACH,CAAC,CAAC,SAAS,EAEf,cAAc,EAAE,kBAAkB,EAClC,iBAAiB,EAAE,qBAAqB,EACxC,mBAAmB,EAAE,uBAAuB,EAC5C,WAAW,EAAE,eAAe,EAC5B,aAAa,EAAE,iBAAiB,EAChC,cAAc,EAAE,kBAAkB,KAC9B,CAAC,iBAAiB,IAAI;oBACxB,MAAM,EAAE,kBAAkB,EAAE;oBAC5B,aAAa,EAAE,OAAO,IAAI,SAAS;oBACnC,mBAAmB,EACjB,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;oBACvD,aAAa,EAAE,iBAAiB;oBAChC,iBAAiB,EAAE;wBACjB,KAAK,EAAE,CAAC,CAAC,6BAA6B,CAAC;wBACvC,SAAS,EAAE,CAAC,CAAC,iCAAiC,CAAC;wBAC/C,eAAe,EACb,wBAAwB,EAAE,KAAK,YAAY,CAAC,QAAQ,CAAC,0FAA0F;4BAC7I,CAAC,CAAC,CAAC,CAAC,yCAAyC,CAAC;4BAC9C,CAAC,CAAC,CAAC,CAAC,iCAAiC,CAAC;qBAC3C;iBACF,CAAC,GACF;YACD,aAAa,CAAC,CAAC,CAAC,CACf,oBAAC,uBAAuB,IACtB,SAAS,EAAE,YAAY,CAAC,OAAQ,CAAC,EACjC,iBAAiB,EAAE,iBAAkB,EACrC,kBAAkB,EAAE,kBAAkB,EACtC,eAAe,EAAE,mBAAmB,GACpC,CACH,CAAC,CAAC,CAAC,IAAI,CACP,CACJ,CACa,CACf,CACJ,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NotificationsAPI } from "../modules/notifications";
|
|
2
|
+
import { AuthIdentity } from "decentraland-crypto-fetch";
|
|
3
|
+
import { DCLNotification, NotificationActiveTab } from "decentraland-ui/dist/components/Notifications/types";
|
|
4
|
+
declare const useNotifications: (identity: AuthIdentity | undefined, isNotificationsEnabled: boolean) => {
|
|
5
|
+
notificationsClient: NotificationsAPI | null;
|
|
6
|
+
notifications: DCLNotification[];
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
isModalOpen: boolean;
|
|
9
|
+
modalActiveTab: NotificationActiveTab;
|
|
10
|
+
isNotificationsOnboarding: any;
|
|
11
|
+
handleOnBegin: () => void;
|
|
12
|
+
handleNotificationsOpen: () => Promise<void>;
|
|
13
|
+
handleOnChangeModalTab: (tab: NotificationActiveTab) => void;
|
|
14
|
+
};
|
|
15
|
+
export default useNotifications;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useMemo, useState, useEffect } from "react";
|
|
2
|
+
import { NotificationsAPI, checkIsOnboarding, setOnboardingDone } from "../modules/notifications";
|
|
3
|
+
import { NotificationActiveTab } from "decentraland-ui/dist/components/Notifications/types";
|
|
4
|
+
import { NOTIFICATIONS_QUERY_INTERVAL } from "../containers/Navbar/constants";
|
|
5
|
+
import { CURRENT_AVAILABLE_NOTIFICATIONS } from "decentraland-ui/dist/components/Notifications/utils";
|
|
6
|
+
const useNotifications = (identity, isNotificationsEnabled) => {
|
|
7
|
+
const [{ isLoading, notifications }, setUserNotifications] = useState({
|
|
8
|
+
isLoading: false,
|
|
9
|
+
notifications: []
|
|
10
|
+
});
|
|
11
|
+
const [{ activeTab, isOnboarding, isOpen }, setNotificationsState] = useState({
|
|
12
|
+
activeTab: NotificationActiveTab.NEWEST,
|
|
13
|
+
isOnboarding: checkIsOnboarding(),
|
|
14
|
+
isOpen: false
|
|
15
|
+
});
|
|
16
|
+
const notificationsClient = useMemo(() => {
|
|
17
|
+
if (identity)
|
|
18
|
+
return new NotificationsAPI({ identity });
|
|
19
|
+
return null;
|
|
20
|
+
}, [identity]);
|
|
21
|
+
const handleOnBegin = () => {
|
|
22
|
+
setOnboardingDone();
|
|
23
|
+
setNotificationsState(prevState => ({ ...prevState, isOnboarding: false }));
|
|
24
|
+
};
|
|
25
|
+
const handleNotificationsOpen = async () => {
|
|
26
|
+
const currentOpenState = isOpen;
|
|
27
|
+
setNotificationsState(prevState => {
|
|
28
|
+
return { ...prevState, isOpen: !prevState.isOpen };
|
|
29
|
+
});
|
|
30
|
+
if (!currentOpenState) {
|
|
31
|
+
const unreadNotifications = notifications
|
|
32
|
+
.filter(notification => !notification.read)
|
|
33
|
+
.map(({ id }) => id);
|
|
34
|
+
if (unreadNotifications.length) {
|
|
35
|
+
await notificationsClient?.markNotificationsAsRead(unreadNotifications);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// update state when closes the modal
|
|
40
|
+
const markNotificationAsReadInState = notifications.map(notification => {
|
|
41
|
+
if (notification.read)
|
|
42
|
+
return notification;
|
|
43
|
+
return {
|
|
44
|
+
...notification,
|
|
45
|
+
read: true
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
setUserNotifications({
|
|
49
|
+
isLoading,
|
|
50
|
+
notifications: markNotificationAsReadInState
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const handleOnChangeModalTab = (tab) => setNotificationsState(prevState => ({
|
|
55
|
+
...prevState,
|
|
56
|
+
activeTab: tab
|
|
57
|
+
}));
|
|
58
|
+
const fetchNotificationsState = () => {
|
|
59
|
+
setUserNotifications({ notifications: [], isLoading: true });
|
|
60
|
+
notificationsClient?.getNotifications().then(retrievedNotifications => {
|
|
61
|
+
setUserNotifications({
|
|
62
|
+
isLoading: false,
|
|
63
|
+
notifications: retrievedNotifications.filter(notification => CURRENT_AVAILABLE_NOTIFICATIONS.includes(notification.type))
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (identity && isNotificationsEnabled) {
|
|
69
|
+
fetchNotificationsState();
|
|
70
|
+
const interval = setInterval(() => {
|
|
71
|
+
fetchNotificationsState();
|
|
72
|
+
}, NOTIFICATIONS_QUERY_INTERVAL);
|
|
73
|
+
return () => {
|
|
74
|
+
clearInterval(interval);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return () => { };
|
|
78
|
+
}, [identity]);
|
|
79
|
+
return {
|
|
80
|
+
notificationsClient,
|
|
81
|
+
notifications,
|
|
82
|
+
isLoading,
|
|
83
|
+
isModalOpen: isOpen,
|
|
84
|
+
modalActiveTab: activeTab,
|
|
85
|
+
isNotificationsOnboarding: isOnboarding,
|
|
86
|
+
handleOnBegin,
|
|
87
|
+
handleNotificationsOpen,
|
|
88
|
+
handleOnChangeModalTab,
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export default useNotifications;
|
|
92
|
+
//# sourceMappingURL=useNotifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotifications.js","sourceRoot":"","sources":["../../src/hooks/useNotifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAEjG,OAAO,EAAmB,qBAAqB,EAAE,MAAM,qDAAqD,CAAA;AAC5G,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAA;AAErG,MAAM,gBAAgB,GAAG,CAAC,QAAkC,EAAE,sBAA+B,EAAE,EAAE;IAC/F,MAAM,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAGlE;QACD,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,EAAE;KAClB,CAAC,CAAA;IAEF,MAAM,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC;QAC5E,SAAS,EAAE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