@ape.swap/bonds-sdk 1.0.532 → 1.0.534
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.
|
@@ -23,11 +23,6 @@ var BondMenu = function (_a) {
|
|
|
23
23
|
var handleFilterSelection = useCallback(function (newOption) {
|
|
24
24
|
setChainFilterOption(['All Chains']);
|
|
25
25
|
setFilterOption(newOption);
|
|
26
|
-
// Update the URL without reloading the page
|
|
27
|
-
var urlParams = new URLSearchParams(window.location.search);
|
|
28
|
-
urlParams.set('filter', newOption);
|
|
29
|
-
var newUrl = "".concat(window.location.pathname, "?").concat(urlParams.toString());
|
|
30
|
-
window.history.replaceState(null, '', newUrl);
|
|
31
26
|
}, [setChainFilterOption, setFilterOption]);
|
|
32
27
|
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
28
|
display: ['none', 'none', 'none', 'flex'],
|
|
@@ -3,10 +3,12 @@ import React from 'react';
|
|
|
3
3
|
import '../../scss/BondRowHeader.scss';
|
|
4
4
|
interface BondRowHeaderProps {
|
|
5
5
|
inputValue: string;
|
|
6
|
+
setChainFilterOption: (newValue: string[]) => void;
|
|
7
|
+
chainFilterOption: string[];
|
|
6
8
|
filterOptions: string[];
|
|
7
9
|
filterOption: string;
|
|
8
10
|
setFilterOption: (newOption: string) => void;
|
|
9
|
-
|
|
11
|
+
onHandleQueryChange: (value: string) => void;
|
|
10
12
|
onSort: (key: 'discount' | 'arr' | 'terms' | 'tokensRemaining') => void;
|
|
11
13
|
}
|
|
12
14
|
declare const BondRowHeader: React.FC<BondRowHeaderProps>;
|
|
@@ -1,33 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
2
|
-
/** @jsxImportSource theme-ui */
|
|
3
|
-
import { useCallback, useState } from 'react';
|
|
4
2
|
import { Flex } from 'theme-ui';
|
|
5
3
|
import { Input } from '../uikit-sdk/Input';
|
|
6
4
|
import { Svg, TooltipBubble } from '../uikit-sdk';
|
|
7
5
|
import { TooltipText } from '../../enum/tooltips';
|
|
8
6
|
import '../../scss/BondRowHeader.scss';
|
|
9
7
|
import BondMenu from '../BondMenu/BondMenu';
|
|
10
|
-
import useChainFilterOption from '../BondMenu/useChainFilterOption';
|
|
11
8
|
var BondRowHeader = function (_a) {
|
|
12
|
-
var inputValue = _a.inputValue, filterOptions = _a.filterOptions, filterOption = _a.filterOption, setFilterOption = _a.setFilterOption,
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
label: filter.charAt(0).toUpperCase() + filter.slice(1).toLowerCase(),
|
|
16
|
-
value: filter,
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
var _b = useChainFilterOption(), chainFilterOption = _b.data, setChainFilterOption = _b.setChainFilterOption;
|
|
20
|
-
var handleChangeFilterOption = useCallback(function (newOption) {
|
|
21
|
-
setFilterOption(newOption);
|
|
22
|
-
}, []);
|
|
23
|
-
var handleChangeChainFilterOption = useCallback(function (newOptions) {
|
|
24
|
-
setChainFilterOption(newOptions);
|
|
25
|
-
}, [setChainFilterOption]);
|
|
26
|
-
var _c = useState(''), searchQuery = _c[0], setSearchQuery = _c[1];
|
|
27
|
-
var handleChangeQuery = useCallback(function (event) {
|
|
28
|
-
setSearchQuery(event.target.value);
|
|
29
|
-
setFilterOption('ALL');
|
|
30
|
-
}, []);
|
|
31
|
-
return (_jsxs(Flex, { className: "header-container", children: [_jsx(Flex, { className: "header-container filters", children: _jsx(BondMenu, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: handleChangeChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleChangeFilterOption, onHandleQueryChange: setSearchQuery }) }), _jsxs(Flex, { className: "header-container rows", children: [_jsxs(Flex, { className: "column column-tokens", children: [_jsx(Flex, { className: "column column-search", sx: { width: '100%', maxWidth: ['200px', '200px', '200px', '340px'] }, children: _jsx(Input, { value: inputValue, onChange: onInputChange, variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) }), _jsx(Flex, { className: "column column-tokenicons" })] }), _jsxs(Flex, { className: "column column-bondinfo", children: [_jsxs(Flex, { className: "column column-discount", children: [_jsx(Flex, { className: "column tooltip", children: _jsxs(TooltipBubble, { body: _jsx(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(18%, -4%)", children: ["DISCOUNT", _jsx(Flex, { className: "column header-icon", children: _jsx(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) })] }) }), _jsx(Flex, { className: "column header-icon", onClick: function () { return onSort('discount'); }, children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), _jsxs(Flex, { className: "column column-arr", children: [_jsx(Flex, { className: "column tooltip", children: _jsxs(TooltipBubble, { body: _jsx(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(8%, -5%)", children: ["ARR", _jsx(Flex, { className: "column header-icon", children: _jsx(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) })] }) }), _jsx(Flex, { className: "column header-icon", onClick: function () { return onSort('arr'); }, children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), _jsxs(Flex, { className: "column column-terms", children: [_jsx(Flex, { className: "column tooltip", children: _jsxs(TooltipBubble, { body: _jsx(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomRight", transformTip: "translate(11%, -5%)", children: ["TERMS", _jsx(Flex, { className: "column header-icon", children: _jsx(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) })] }) }), _jsx(Flex, { className: "column header-icon", onClick: function () { return onSort('terms'); }, children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), _jsxs(Flex, { className: "column column-tokensremaining", children: [_jsx(Flex, { className: "column tooltip", children: _jsxs(TooltipBubble, { body: _jsx(Flex, { children: TooltipText.TokensRemaining }), width: "230px", placement: "bottomRight", transformTip: "translate(12%, -4%)", children: ["TOKENS REMAINING", _jsx(Flex, { className: "column header-icon", children: _jsx(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) })] }) }), _jsx(Flex, { className: "column header-icon", onClick: function () { return onSort('tokensRemaining'); }, children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), _jsx(Flex, { className: "column column-hotbond" })] })] })] }));
|
|
9
|
+
var inputValue = _a.inputValue, setChainFilterOption = _a.setChainFilterOption, chainFilterOption = _a.chainFilterOption, filterOptions = _a.filterOptions, filterOption = _a.filterOption, setFilterOption = _a.setFilterOption, onHandleQueryChange = _a.onHandleQueryChange, onSort = _a.onSort;
|
|
10
|
+
return (_jsxs(Flex, { className: "header-container", children: [_jsx(Flex, { className: "header-container filters", children: _jsx(BondMenu, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: setFilterOption, onHandleQueryChange: onHandleQueryChange }) }), _jsxs(Flex, { className: "header-container rows", children: [_jsxs(Flex, { className: "column column-tokens", children: [_jsx(Flex, { className: "column column-search", sx: { width: '100%', maxWidth: ['200px', '200px', '200px', '340px'] }, children: _jsx(Input, { value: inputValue, onChange: onHandleQueryChange, variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) }), _jsx(Flex, { className: "column column-tokenicons" })] }), _jsxs(Flex, { className: "column column-bondinfo", children: [_jsxs(Flex, { className: "column column-discount", children: [_jsx(Flex, { className: "column tooltip", children: _jsxs(TooltipBubble, { body: _jsx(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(18%, -4%)", children: ["DISCOUNT", _jsx(Flex, { className: "column header-icon", children: _jsx(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) })] }) }), _jsx(Flex, { className: "column header-icon", onClick: function () { return onSort('discount'); }, children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), _jsxs(Flex, { className: "column column-arr", children: [_jsx(Flex, { className: "column tooltip", children: _jsxs(TooltipBubble, { body: _jsx(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(8%, -5%)", children: ["ARR", _jsx(Flex, { className: "column header-icon", children: _jsx(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) })] }) }), _jsx(Flex, { className: "column header-icon", onClick: function () { return onSort('arr'); }, children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), _jsxs(Flex, { className: "column column-terms", children: [_jsx(Flex, { className: "column tooltip", children: _jsxs(TooltipBubble, { body: _jsx(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomRight", transformTip: "translate(11%, -5%)", children: ["TERMS", _jsx(Flex, { className: "column header-icon", children: _jsx(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) })] }) }), _jsx(Flex, { className: "column header-icon", onClick: function () { return onSort('terms'); }, children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), _jsxs(Flex, { className: "column column-tokensremaining", children: [_jsx(Flex, { className: "column tooltip", children: _jsxs(TooltipBubble, { body: _jsx(Flex, { children: TooltipText.TokensRemaining }), width: "230px", placement: "bottomRight", transformTip: "translate(12%, -4%)", children: ["TOKENS REMAINING", _jsx(Flex, { className: "column header-icon", children: _jsx(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) })] }) }), _jsx(Flex, { className: "column header-icon", onClick: function () { return onSort('tokensRemaining'); }, children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), _jsx(Flex, { className: "column column-hotbond" })] })] })] }));
|
|
32
11
|
};
|
|
33
12
|
export default BondRowHeader;
|
|
@@ -58,6 +58,7 @@ import '../../scss/Bonds.scss';
|
|
|
58
58
|
import BondRowHeader from '../../components/BondRows/BondRowHeader';
|
|
59
59
|
import BondRowsByChain from '../../components/BondRows/BondRowsByChain';
|
|
60
60
|
import { useTopTags } from '../../hooks/useTopThreeTags';
|
|
61
|
+
import useChainFilterOption from '../../components/BondMenu/useChainFilterOption';
|
|
61
62
|
var Bonds = function (_a) {
|
|
62
63
|
var account = _a.account, accountChainId = _a.accountChainId, isActive = _a.isActive;
|
|
63
64
|
//const { account, isActive } = useWeb3React();
|
|
@@ -215,15 +216,14 @@ var Bonds = function (_a) {
|
|
|
215
216
|
};
|
|
216
217
|
// Search logic
|
|
217
218
|
var _j = useState(''), inputValue = _j[0], setInputValue = _j[1];
|
|
218
|
-
var
|
|
219
|
+
var handleChangeQuery = useCallback(function (event) {
|
|
219
220
|
setInputValue(event.target.value);
|
|
220
|
-
|
|
221
|
+
setFilterOption('ALL');
|
|
222
|
+
}, []);
|
|
221
223
|
var topTags = useTopTags(sortedBonds);
|
|
222
224
|
var filterOptions = __spreadArray(__spreadArray(['ALL'], topTags, true), ['SOLD OUT'], false);
|
|
223
225
|
var _k = useState(filterOptions[0]), filterOption = _k[0], setFilterOption = _k[1];
|
|
224
|
-
var
|
|
225
|
-
setFilterOption(newOption);
|
|
226
|
-
}, []);
|
|
226
|
+
var _l = useChainFilterOption(), chainFilterOption = _l.data, setChainFilterOption = _l.setChainFilterOption;
|
|
227
227
|
var billstoRender = useMemo(function () {
|
|
228
228
|
var billsToReturn = sortedBonds !== null && sortedBonds !== void 0 ? sortedBonds : [];
|
|
229
229
|
if (inputValue) {
|
|
@@ -235,19 +235,28 @@ var Bonds = function (_a) {
|
|
|
235
235
|
if (topTags.includes(filterOption)) {
|
|
236
236
|
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter(function (bill) { var _a; return (_a = bill === null || bill === void 0 ? void 0 : bill.tags) === null || _a === void 0 ? void 0 : _a.includes(filterOption); });
|
|
237
237
|
}
|
|
238
|
+
if (!(chainFilterOption === null || chainFilterOption === void 0 ? void 0 : chainFilterOption.includes('All Chains'))) {
|
|
239
|
+
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter(function (bill) { return chainFilterOption === null || chainFilterOption === void 0 ? void 0 : chainFilterOption.includes(bill.chainId.toString()); });
|
|
240
|
+
}
|
|
238
241
|
// if (filterOption === 'FAVORITES') {
|
|
239
242
|
// billsToReturn = billsToReturn?.filter((bill) => favTokens.includes(bill.payoutTokenName.toLowerCase()))
|
|
240
243
|
// }
|
|
241
244
|
return billsToReturn;
|
|
242
245
|
//return sortBills(billsToReturn, sortOption)
|
|
243
|
-
}, [filterOption, bondData, inputValue, topTags]);
|
|
246
|
+
}, [filterOption, bondData, inputValue, chainFilterOption, topTags]);
|
|
247
|
+
var handleChangeFilterOption = useCallback(function (newOption) {
|
|
248
|
+
setFilterOption(newOption);
|
|
249
|
+
}, []);
|
|
250
|
+
var handleChangeChainFilterOption = useCallback(function (newOptions) {
|
|
251
|
+
setChainFilterOption(newOptions);
|
|
252
|
+
}, [setChainFilterOption]);
|
|
244
253
|
// Page render logic
|
|
245
|
-
var
|
|
254
|
+
var _m = useState(false), bondsRendered = _m[0], setBondsRendered = _m[1];
|
|
246
255
|
useEffect(function () {
|
|
247
256
|
if (billstoRender.length > 0) {
|
|
248
257
|
setBondsRendered(true);
|
|
249
258
|
}
|
|
250
259
|
}, [billstoRender]);
|
|
251
|
-
return (_jsxs(ThemeUIProvider, { theme: defaultTheme, children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", { onClick: handleApprove, children: "Approve USDT" }), _jsxs(Flex, { className: "container table-container", children: [_jsx(BondRowHeader, { inputValue: inputValue, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleChangeFilterOption,
|
|
260
|
+
return (_jsxs(ThemeUIProvider, { theme: defaultTheme, children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", { onClick: handleApprove, children: "Approve USDT" }), _jsxs(Flex, { className: "container table-container", children: [_jsx(BondRowHeader, { inputValue: inputValue, setChainFilterOption: handleChangeChainFilterOption, chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleChangeFilterOption, onHandleQueryChange: setInputValue, onSort: handleSort }), bondsRendered && (_jsx(BondRowsByChain, { bonds: billstoRender, hotBonds: hotBonds, hideTitles: inputValue !== '', rowClick: rowClick }))] })] }));
|
|
252
261
|
};
|
|
253
262
|
export default Bonds;
|
package/dist/scss/BondMenu.scss
CHANGED