@ape.swap/bonds-sdk 1.0.424 → 1.0.425
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.
|
@@ -75,6 +75,7 @@ import useCurrentTime from '../../hooks/useTimer';
|
|
|
75
75
|
import { getPendingVesting } from '../../hooks/usePendingVesting';
|
|
76
76
|
import axios from 'axios';
|
|
77
77
|
import { fetchUserOwnedBillsDataAsync } from './fetchBillsUser';
|
|
78
|
+
import { Input } from '../uikit-sdk/Input';
|
|
78
79
|
var YourBonds = function (_a) {
|
|
79
80
|
var connectionString = _a.connectionString;
|
|
80
81
|
var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
|
|
@@ -119,7 +120,7 @@ var YourBonds = function (_a) {
|
|
|
119
120
|
}
|
|
120
121
|
});
|
|
121
122
|
}); };
|
|
122
|
-
// Fetch data
|
|
123
|
+
// Fetch data
|
|
123
124
|
var _d = useState([]), bondData = _d[0], setBondData = _d[1];
|
|
124
125
|
var _e = useState([]), mappedUserBills = _e[0], setMappedUserBills = _e[1];
|
|
125
126
|
useEffect(function () {
|
|
@@ -209,7 +210,7 @@ var YourBonds = function (_a) {
|
|
|
209
210
|
});
|
|
210
211
|
setSortedBonds(sorted);
|
|
211
212
|
}, [sortConfig, mappedUserBills]);
|
|
212
|
-
// Functions
|
|
213
|
+
// Functions for calculations
|
|
213
214
|
var chainId = useWeb3React().chainId;
|
|
214
215
|
var currentTime = useCurrentTime() / 1000;
|
|
215
216
|
var vestingTimeRemaining = function (userBill) {
|
|
@@ -235,19 +236,36 @@ var YourBonds = function (_a) {
|
|
|
235
236
|
setIsModalOpen(true);
|
|
236
237
|
navigate("/YourBonds/?bondAddress=".concat(bill.address, "&bondChain=").concat(bill.bond.chainId), { replace: true });
|
|
237
238
|
};
|
|
238
|
-
|
|
239
|
+
// Search logic
|
|
240
|
+
var _k = useState(''), inputValue = _k[0], setInputValue = _k[1];
|
|
241
|
+
var _l = useState(sortedBonds), filteredBonds = _l[0], setFilteredBonds = _l[1];
|
|
239
242
|
useEffect(function () {
|
|
240
|
-
if (
|
|
243
|
+
if (inputValue === '') {
|
|
244
|
+
setFilteredBonds(sortedBonds);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
setFilteredBonds(sortedBonds.filter(function (bond) {
|
|
248
|
+
return bond.bond.showcaseTokenName.toLowerCase().includes(inputValue.toLowerCase());
|
|
249
|
+
}));
|
|
250
|
+
}
|
|
251
|
+
}, [inputValue, sortedBonds]);
|
|
252
|
+
var handleInputChange = function (event) {
|
|
253
|
+
setInputValue(event.target.value);
|
|
254
|
+
};
|
|
255
|
+
// Page render logic
|
|
256
|
+
var _m = useState(false), bondsRendered = _m[0], setBondsRendered = _m[1];
|
|
257
|
+
useEffect(function () {
|
|
258
|
+
if (filteredBonds.length > 0) {
|
|
241
259
|
setBondsRendered(true);
|
|
242
260
|
}
|
|
243
|
-
}, [
|
|
244
|
-
return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })), bondsRendered && (_jsxs(Flex, __assign({ className: "container table-container" }, { children: [_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsx(Flex, __assign({ className: "column column-tokens" }, { children: _jsx(Flex, { className: "column column-
|
|
261
|
+
}, [filteredBonds]);
|
|
262
|
+
return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })), bondsRendered && (_jsxs(Flex, __assign({ className: "container table-container" }, { children: [_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsx(Flex, __assign({ className: "column column-tokens" }, { children: _jsx(Flex, __assign({ className: "column column-search", sx: { width: '100%', maxWidth: ['200px', '200px', '200px', '340px'] } }, { children: _jsx(Input, { value: inputValue, onChange: handleInputChange, variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px' }, width: '100%', placeholder: 'Search...' }) })) })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column header-claimable" }, { children: [_jsx(Text, __assign({ sx: { opacity: '0.6', fontSize: '12px' } }, { children: "Claimable" })), _jsx(Flex, __assign({ className: "column header-icon", sx: { opacity: '0.6' }, onClick: function () { return handleSort('claimable'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column header-pending" }, { children: [_jsx(Text, __assign({ sx: { opacity: '0.6', fontSize: '12px' } }, { children: "Pending" })), _jsx(Flex, __assign({ className: "column header-icon", sx: { opacity: '0.6' }, onClick: function () { return handleSort('pending'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column header-terms" }, { children: [_jsx(Text, __assign({ sx: { opacity: '0.6', fontSize: '12px' } }, { children: "Terms" })), _jsx(Flex, __assign({ className: "column header-icon", sx: { opacity: '0.6' }, onClick: function () { return handleSort('terms'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsx(Flex, __assign({ className: "column header-claimall" }, { children: _jsx(Button, __assign({ disabled: !account, sx: {
|
|
245
263
|
height: ['36px', '36px', '36px', '26px'],
|
|
246
264
|
lineHeight: '12px',
|
|
247
265
|
fontSize: '14px',
|
|
248
266
|
fontWeight: 600,
|
|
249
267
|
width: '100%',
|
|
250
|
-
} }, { children: "CLAIM ALL" })) }))] }))] })),
|
|
268
|
+
} }, { children: "CLAIM ALL" })) }))] }))] })), filteredBonds.map(function (bill) {
|
|
251
269
|
var _a, _b;
|
|
252
270
|
return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bill); } }, { children: [_jsx(Flex, __assign({ className: "column column-tokens" }, { children: _jsx(Flex, __assign({ className: "column column-tokeninfoname" }, { children: _jsx(TokenInfoAndName, { bill: bill.bond, vestEnds: "Ends in ".concat(getPendingVesting(bill.lastBlockTimestamp, bill.vesting)) }) })) })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-claimable" }, { children: [formatNumberSI(parseFloat(claimable(bill).toFixed(3)), 0), _jsx(Text, __assign({ sx: { opacity: '0.6', fontSize: '12px', paddingLeft: '5px' } }, { children: "($".concat((claimable(bill) * ((_a = parseFloat(earnTokenPrice(bill.bond))) !== null && _a !== void 0 ? _a : 0)).toFixed(2), ")") }))] })), _jsxs(Flex, __assign({ className: "column column-pending" }, { children: [formatNumberSI(parseFloat(totalPending(bill).toFixed(0)), 0), _jsx(Text, __assign({ sx: { opacity: '0.6', fontSize: '12px', paddingLeft: '5px' } }, { children: "($".concat((totalPending(bill) * ((_b = parseFloat(earnTokenPrice(bill.bond))) !== null && _b !== void 0 ? _b : 0)).toFixed(2), ")") }))] })), _jsx(Flex, __assign({ className: "column column-terms" }, { children: "".concat(vestingTimeRemaining(bill).days, "d, ").concat(vestingTimeRemaining(bill).hours, "h, ").concat(vestingTimeRemaining(bill).minutes, "m") })), _jsx(Flex, __assign({ className: "column column-claimall" }, { children: _jsx(Button, __assign({ disabled: !account, onClick: function (event) {
|
|
253
271
|
event.stopPropagation();
|
package/dist/scss/Bonds.scss
CHANGED
package/dist/scss/YourBonds.scss
CHANGED