@ape.swap/bonds-sdk 1.0.78-2.test.22 → 1.0.78-2.test.24
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.
- package/dist/components/AccordionText/index.d.ts +9 -0
- package/dist/components/AccordionText/index.js +17 -0
- package/dist/scss/AccordionText.scss +11 -0
- package/dist/scss/BondModal.scss +6 -0
- package/dist/views/BondModal/BondModal.d.ts +3 -0
- package/dist/views/BondModal/BondModal.js +14 -13
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "theme-ui/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
4
|
+
import { Flex, Svg } from '../uikit-sdk';
|
|
5
|
+
import '../../scss/AccordionText.scss';
|
|
6
|
+
var AccordionText = function (_a) {
|
|
7
|
+
var title = _a.title, body = _a.body, _b = _a.isVisible, isVisible = _b === void 0 ? false : _b;
|
|
8
|
+
var _c = useState(false), isDropdownExpanded = _c[0], setIsDropdownExpanded = _c[1];
|
|
9
|
+
var toggleDropdown = function () {
|
|
10
|
+
setIsDropdownExpanded(!isDropdownExpanded);
|
|
11
|
+
};
|
|
12
|
+
if (!isVisible) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Flex, { className: "accordion-header", onClick: toggleDropdown, children: [_jsx(Flex, { className: "accordion-title", children: title }), _jsx(Flex, { className: "accordion-icon", children: _jsx(Svg, { icon: "caret", direction: isDropdownExpanded ? 'down' : 'up' }) })] }), _jsx(AnimatePresence, { children: isDropdownExpanded && (_jsx(motion.div, { initial: { height: 0 }, animate: { height: 'fit-content' }, transition: { opacity: { duration: 0.2 } }, exit: { height: 0 }, sx: { overflow: 'hidden', width: '100%' }, children: _jsx(Flex, { className: "accordion-body", children: body }) })) })] }));
|
|
16
|
+
};
|
|
17
|
+
export default AccordionText;
|
package/dist/scss/BondModal.scss
CHANGED
|
@@ -8,6 +8,9 @@ export interface BondModalProps {
|
|
|
8
8
|
onClose: () => void;
|
|
9
9
|
bondAddress: string | null;
|
|
10
10
|
accountChainId: number;
|
|
11
|
+
accordionTitle?: string;
|
|
12
|
+
accordionBody?: string;
|
|
13
|
+
accordionVisible?: boolean;
|
|
11
14
|
}
|
|
12
15
|
declare const BondModal: React.FC<BondModalProps>;
|
|
13
16
|
export default BondModal;
|
|
@@ -56,25 +56,26 @@ import '../../scss/BondModal.scss';
|
|
|
56
56
|
import { useChainId, useSwitchChain, useWaitForTransactionReceipt, useWriteContract } from "wagmi";
|
|
57
57
|
import { PUBLIC_RPC_URLS } from "../../config/constants/networks";
|
|
58
58
|
import useModal from "../../hooks/useModal";
|
|
59
|
+
import AccordionText from '../../components/AccordionText';
|
|
59
60
|
var BondModal = function (_a) {
|
|
60
|
-
var account = _a.account, isActive = _a.isActive, isOpen = _a.isOpen, accountChainId = _a.accountChainId, onClose = _a.onClose, bondAddress = _a.bondAddress;
|
|
61
|
+
var account = _a.account, isActive = _a.isActive, isOpen = _a.isOpen, accountChainId = _a.accountChainId, onClose = _a.onClose, bondAddress = _a.bondAddress, _b = _a.accordionTitle, accordionTitle = _b === void 0 ? "What are Bonds?" : _b, _c = _a.accordionBody, accordionBody = _c === void 0 ? "Body" : _c, _d = _a.accordionVisible, accordionVisible = _d === void 0 ? false : _d;
|
|
61
62
|
if (!isOpen)
|
|
62
63
|
return null;
|
|
63
64
|
var chainId = useChainId();
|
|
64
|
-
var
|
|
65
|
-
var
|
|
66
|
-
var
|
|
67
|
-
var
|
|
65
|
+
var _e = useSwitchChain(), chains = _e.chains, switchChain = _e.switchChain;
|
|
66
|
+
var _f = useState([]), bondData = _f[0], setBondData = _f[1];
|
|
67
|
+
var _g = useWriteContract(), hash = _g.data, isPending = _g.isPending, writeContract = _g.writeContract, writeContractAsync = _g.writeContractAsync;
|
|
68
|
+
var _h = useWaitForTransactionReceipt({
|
|
68
69
|
confirmations: 4,
|
|
69
70
|
chainId: chainId !== null && chainId !== void 0 ? chainId : accountChainId,
|
|
70
71
|
hash: hash,
|
|
71
|
-
}), isConfirming =
|
|
72
|
-
var
|
|
73
|
-
var
|
|
74
|
-
var
|
|
75
|
-
var
|
|
76
|
-
var
|
|
77
|
-
var
|
|
72
|
+
}), isConfirming = _h.isLoading, isConfirmed = _h.isSuccess;
|
|
73
|
+
var _j = useState(null), approveTx = _j[0], setApproveTx = _j[1];
|
|
74
|
+
var _k = useState(null), toastMessage = _k[0], setToastMessage = _k[1];
|
|
75
|
+
var _l = useState(null), buyTx = _l[0], setBuyTx = _l[1];
|
|
76
|
+
var _m = useState(null), tokenBalance = _m[0], setTokenBalance = _m[1];
|
|
77
|
+
var _o = useState(null), tokenDecimals = _o[0], setTokenDecimals = _o[1];
|
|
78
|
+
var _p = useState(''), inputValue = _p[0], setInputValue = _p[1];
|
|
78
79
|
var handleInputChange = function (event) {
|
|
79
80
|
setInputValue(event.target.value);
|
|
80
81
|
};
|
|
@@ -288,7 +289,7 @@ var BondModal = function (_a) {
|
|
|
288
289
|
approveTx != null && isConfirmed ?
|
|
289
290
|
_jsx(Button, { className: "action-button", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut) || !account, onClick: handleBuy, children: getActionButtonText(bond) })
|
|
290
291
|
:
|
|
291
|
-
_jsx(Button, { className: "action-button", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut) || !account, onClick: handleApprove, children: getActionButtonText(bond) }) })] })] })] }) }) }, bond.billAddress));
|
|
292
|
+
_jsx(Button, { className: "action-button", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut) || !account, onClick: handleApprove, children: getActionButtonText(bond) }) })] }), _jsx(Flex, { className: "modaltable-container accordion-container", children: _jsx(AccordionText, { title: accordionTitle, body: accordionBody, isVisible: accordionVisible }) })] })] }) }) }, bond.billAddress));
|
|
292
293
|
}) }));
|
|
293
294
|
};
|
|
294
295
|
export default BondModal;
|