@ape.swap/bonds-sdk 1.0.531 → 1.0.532
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.
|
@@ -29,7 +29,7 @@ var BondMenu = function (_a) {
|
|
|
29
29
|
var newUrl = "".concat(window.location.pathname, "?").concat(urlParams.toString());
|
|
30
30
|
window.history.replaceState(null, '', newUrl);
|
|
31
31
|
}, [setChainFilterOption, setFilterOption]);
|
|
32
|
-
return (_jsxs(Flex, { className: "menu-container filters", children: [_jsx(Flex, { className: "filters desktop-rec", sx: { display: ['none', 'none', 'none', 'flex'], mr: '20px' }, children: _jsx(RecommendationSelector, { options: filterOptions, activeOption: filterOption, setActiveOption: handleFilterSelection }) }), _jsx(Flex, { className: "filtesr mobile-rec", sx: { display: ['flex', 'flex', 'flex', 'none'], width: '100%' }, children: _jsx(MenuSelect, { selectedOption: filterOption, setOption: setFilterOption, options: mappedFilters, sx: { background: 'white2' } }) }), _jsx(Flex, { className: "filters network", sx: { width: ['49%', '49%', '49%', 'unset'], minWidth: '120px' }, children: _jsx(NetworkFilter, { chainFilterOption: chainFilterOption, setChainFilterOption: setChainFilterOption }) }), _jsxs(Flex, { sx: {
|
|
32
|
+
return (_jsxs(Flex, { className: "menu-container filters", children: [_jsx(Flex, { className: "filters desktop-rec", sx: { display: ['none', 'none', 'none', 'flex'], mr: '20px' }, children: _jsx(RecommendationSelector, { options: filterOptions, activeOption: filterOption, setActiveOption: handleFilterSelection }) }), _jsx(Flex, { className: "filtesr mobile-rec", sx: { display: ['flex', 'flex', 'flex', 'none'], width: '100%' }, children: _jsx(MenuSelect, { selectedOption: filterOption, setOption: setFilterOption, options: mappedFilters, sx: { background: 'white2' } }) }), _jsx(Flex, { className: "filters network", sx: { width: ['49%', '49%', '49%', 'unset'], minWidth: '120px' }, children: _jsx(NetworkFilter, { chainFilterOption: chainFilterOption, setChainFilterOption: setChainFilterOption }) }), _jsxs(Flex, { className: "filters clear-all", sx: {
|
|
33
33
|
display: ['none', 'none', 'none', 'flex'],
|
|
34
34
|
color: 'textDisabledButton',
|
|
35
35
|
fontSize: '14px',
|
|
@@ -2,6 +2,7 @@ import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
|
2
2
|
import { QUERY_KEYS } from '../../config/constants/queryKeys';
|
|
3
3
|
import useCookie from '../../hooks/useCookie';
|
|
4
4
|
import { useCallback } from 'react';
|
|
5
|
+
// import { useRouter } from 'next/router'
|
|
5
6
|
export default function useChainFilterOption() {
|
|
6
7
|
var _a;
|
|
7
8
|
var _b = useCookie(QUERY_KEYS.CHAIN_FILTER_OPTION, ['All Chains']), cookie = _b.cookie, updateCookie = _b.updateCookie;
|
|
@@ -10,17 +11,19 @@ export default function useChainFilterOption() {
|
|
|
10
11
|
queryFn: function () { return cookie; },
|
|
11
12
|
initialData: cookie,
|
|
12
13
|
}).data;
|
|
13
|
-
var
|
|
14
|
+
var asPath = window.location.href;
|
|
15
|
+
var query = new URLSearchParams(window.location.search);
|
|
16
|
+
var pathname = window.location.pathname;
|
|
17
|
+
var urlParams = typeof window !== 'undefined' ? new URLSearchParams(new URL(asPath).search) : null;
|
|
14
18
|
var urlChain = (_a = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('chain')) !== null && _a !== void 0 ? _a : '';
|
|
15
19
|
var queryClient = useQueryClient();
|
|
16
20
|
var removeURLChain = useCallback(function () {
|
|
17
21
|
if (urlChain) {
|
|
18
22
|
console.log('remove url');
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
window.history.replaceState(null, '', newUrl);
|
|
23
|
+
query.delete('chain');
|
|
24
|
+
window.history.replaceState(null, '', "".concat(pathname, "?").concat(query.toString()));
|
|
22
25
|
}
|
|
23
|
-
}, [urlChain,
|
|
26
|
+
}, [urlChain, pathname, query]);
|
|
24
27
|
var setChainFilterOption = useCallback(function (newValue) {
|
|
25
28
|
updateCookie(newValue);
|
|
26
29
|
queryClient.setQueryData(["".concat(QUERY_KEYS.CHAIN_FILTER_OPTION)], newValue);
|
package/dist/scss/BondMenu.scss
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
.filters.network {
|
|
10
10
|
display: flex;
|
|
11
|
-
width:
|
|
11
|
+
width: 20%;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.filters.desktop-rec {
|
|
@@ -21,4 +21,10 @@
|
|
|
21
21
|
display: flex;
|
|
22
22
|
width: 100%;
|
|
23
23
|
justify-content: end;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.filters.clear-all {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
width: 13%;
|
|
24
30
|
}
|