@ape.swap/bonds-sdk 1.0.478 → 1.0.480
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/BondRows/BondRowHeader.d.ts +3 -0
- package/dist/components/BondRows/BondRowHeader.js +9 -2
- package/dist/components/MenuSelect/MenuSelect.d.ts +4 -0
- package/dist/components/MenuSelect/MenuSelect.js +36 -0
- package/dist/components/MenuSelect/types.d.ts +22 -0
- package/dist/components/MenuSelect/types.js +1 -0
- package/dist/components/uikit-sdk/Select/Select.d.ts +4 -0
- package/dist/components/uikit-sdk/Select/Select.js +61 -0
- package/dist/components/uikit-sdk/Select/SelectItem.d.ts +4 -0
- package/dist/components/uikit-sdk/Select/SelectItem.js +40 -0
- package/dist/components/uikit-sdk/Select/index.d.ts +2 -0
- package/dist/components/uikit-sdk/Select/index.js +2 -0
- package/dist/components/uikit-sdk/Select/styles.d.ts +4 -0
- package/dist/components/uikit-sdk/Select/styles.js +50 -0
- package/dist/components/uikit-sdk/Select/types.d.ts +55 -0
- package/dist/components/uikit-sdk/Select/types.js +37 -0
- package/dist/components/uikit-sdk/index.d.ts +1 -0
- package/dist/components/uikit-sdk/index.js +1 -0
- package/dist/hooks/useTopThreeTags.d.ts +2 -0
- package/dist/hooks/useTopThreeTags.js +25 -0
- package/dist/pages/Bonds/Bonds.js +9 -2
- package/dist/pages/YourBonds/YourBonds.js +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,9 @@ import React from 'react';
|
|
|
3
3
|
import '../../scss/BondRowHeader.scss';
|
|
4
4
|
interface BondRowHeaderProps {
|
|
5
5
|
inputValue: string;
|
|
6
|
+
filterOptions: string[];
|
|
7
|
+
filterOption: string;
|
|
8
|
+
setFilterOption: (newOption: string) => void;
|
|
6
9
|
onInputChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
10
|
onSort: (key: 'discount' | 'arr' | 'terms' | 'tokensRemaining') => void;
|
|
8
11
|
}
|
|
@@ -15,8 +15,15 @@ import { Input } from '../uikit-sdk/Input';
|
|
|
15
15
|
import { Svg, TooltipBubble } from '../uikit-sdk';
|
|
16
16
|
import { TooltipText } from '../../enum/tooltips';
|
|
17
17
|
import '../../scss/BondRowHeader.scss';
|
|
18
|
+
import MenuSelect from '../MenuSelect/MenuSelect';
|
|
18
19
|
var BondRowHeader = function (_a) {
|
|
19
|
-
var inputValue = _a.inputValue, onInputChange = _a.onInputChange, onSort = _a.onSort;
|
|
20
|
-
|
|
20
|
+
var inputValue = _a.inputValue, filterOptions = _a.filterOptions, filterOption = _a.filterOption, setFilterOption = _a.setFilterOption, onInputChange = _a.onInputChange, onSort = _a.onSort;
|
|
21
|
+
var mappedFilters = filterOptions.map(function (filter) {
|
|
22
|
+
return {
|
|
23
|
+
label: filter.charAt(0).toUpperCase() + filter.slice(1).toLowerCase(),
|
|
24
|
+
value: filter,
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
return (_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsxs(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: onInputChange, variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) })), _jsx(Flex, __assign({ className: "column column-tokenicons" }, { children: _jsx(Flex, __assign({ sx: { display: ['flex', 'flex', 'flex', 'none'], width: '100%' } }, { children: _jsx(MenuSelect, { selectedOption: filterOption, setOption: setFilterOption, options: mappedFilters, sx: { background: 'white2' } }) })) }))] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-discount" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(18%, -4%)" }, { children: ["DISCOUNT", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('discount'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) }))] })), _jsxs(Flex, __assign({ className: "column column-arr" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(8%, -5%)" }, { children: ["ARR", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('arr'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) }))] })), _jsxs(Flex, __assign({ className: "column column-terms" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomRight", transformTip: "translate(11%, -5%)" }, { children: ["TERMS", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('terms'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) }))] })), _jsxs(Flex, __assign({ className: "column column-tokensremaining" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.TokensRemaining }), width: "230px", placement: "bottomRight", transformTip: "translate(12%, -4%)" }, { children: ["TOKENS REMAINING", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('tokensRemaining'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) }))] })), _jsx(Flex, { className: "column column-hotbond" })] }))] })));
|
|
21
28
|
};
|
|
22
29
|
export default BondRowHeader;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
24
|
+
import { Select, SelectItem, Text } from '../uikit-sdk';
|
|
25
|
+
var MenuSelect = function (_a) {
|
|
26
|
+
var selectedOption = _a.selectedOption, setOption = _a.setOption, options = _a.options, props = __rest(_a, ["selectedOption", "setOption", "options"]);
|
|
27
|
+
return (_jsx(Select, __assign({ size: "xsm", onChange: function (e) { return setOption(e.target.value); }, active: selectedOption, sx: {
|
|
28
|
+
height: '36px',
|
|
29
|
+
display: 'flex',
|
|
30
|
+
width: '100%',
|
|
31
|
+
paddingRight: '4px',
|
|
32
|
+
} }, props, { children: options === null || options === void 0 ? void 0 : options.map(function (option) {
|
|
33
|
+
return (_jsx(SelectItem, __assign({ size: "xsm", value: option.value }, { children: _jsx(Text, __assign({ sx: { fontWeight: 400, pl: '10px' } }, { children: option.label })) }), option.label));
|
|
34
|
+
}) })));
|
|
35
|
+
};
|
|
36
|
+
export default MenuSelect;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
export interface ListMenuProps {
|
|
3
|
+
onHandleQueryChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
4
|
+
setFilterOption?: Dispatch<SetStateAction<string>>;
|
|
5
|
+
setIsActive: Dispatch<SetStateAction<boolean>>;
|
|
6
|
+
filterOption?: string;
|
|
7
|
+
setSortOption: Dispatch<SetStateAction<string>>;
|
|
8
|
+
sortOption?: string;
|
|
9
|
+
query: string;
|
|
10
|
+
checkboxLabel: string;
|
|
11
|
+
showOnlyCheckbox: boolean;
|
|
12
|
+
setShowOnlyCheckbox: (value: boolean) => void;
|
|
13
|
+
toogleLabels: string[];
|
|
14
|
+
filterOptions?: Option[];
|
|
15
|
+
sortOptions?: Option[];
|
|
16
|
+
actionButton?: React.ReactNode;
|
|
17
|
+
showMonkeyImage?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export type Option = {
|
|
20
|
+
label: string;
|
|
21
|
+
value: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "theme-ui/jsx-runtime";
|
|
24
|
+
import React, { useRef, useState } from 'react';
|
|
25
|
+
import { Box, Flex } from 'theme-ui';
|
|
26
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
27
|
+
import { selectPadding, sizes, positions, selectedExtraPadding } from './types';
|
|
28
|
+
import Svg from '../Svg';
|
|
29
|
+
import styles from './styles';
|
|
30
|
+
var Select = function (_a) {
|
|
31
|
+
var children = _a.children, active = _a.active, _b = _a.width, width = _b === void 0 ? 'fit-content' : _b, _c = _a.size, size = _c === void 0 ? sizes.MEDIUM : _c, _d = _a.position, position = _d === void 0 ? positions.BOTTOM : _d, className = _a.className, label = _a.label, props = __rest(_a, ["children", "active", "width", "size", "position", "className", "label"]);
|
|
32
|
+
var inputRef = useRef(null);
|
|
33
|
+
var _e = useState(false), open = _e[0], setOpen = _e[1];
|
|
34
|
+
var handleClick = function () { return setOpen(function (prev) { return !prev; }); };
|
|
35
|
+
var setNativeInput = function (val) {
|
|
36
|
+
var _a, _b, _c;
|
|
37
|
+
var input = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current;
|
|
38
|
+
if (input) {
|
|
39
|
+
(_c = (_b = (_a = Object === null || Object === void 0 ? void 0 : Object.getOwnPropertyDescriptor) === null || _a === void 0 ? void 0 : _a.call(Object, window.HTMLInputElement.prototype, 'value')) === null || _b === void 0 ? void 0 : _b.set) === null || _c === void 0 ? void 0 : _c.call(input, val);
|
|
40
|
+
input.dispatchEvent(new Event('change', { bubbles: true }));
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Box, __assign({ sx: __assign(__assign({}, styles.container), { width: width }), onClick: handleClick, className: className }, { children: [_jsxs(Flex, __assign({ sx: {
|
|
44
|
+
padding: selectedExtraPadding[size],
|
|
45
|
+
pr: selectPadding[size],
|
|
46
|
+
columnGap: '10px',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
justifyContent: 'space-between',
|
|
49
|
+
width: '100%',
|
|
50
|
+
overflow: 'hidden',
|
|
51
|
+
} }, { children: [label ? (_jsx(Box, { children: label })) : (React.Children.map(children, function (child) {
|
|
52
|
+
var _a;
|
|
53
|
+
if (((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.value) !== active) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return React.cloneElement(child, __assign(__assign({}, child === null || child === void 0 ? void 0 : child.props), { active: true }));
|
|
57
|
+
})), _jsx(Flex, __assign({ sx: { minWidth: '10px' } }, { children: _jsx(Svg, { icon: "caret", direction: open ? 'up' : 'down' }) }))] })), _jsx(AnimatePresence, { children: open && (_jsx(motion.div, __assign({ initial: { opacity: 0, height: 0 }, animate: { opacity: 1, height: 'fit-content' }, transition: { opacity: { duration: 0.2 } }, exit: { opacity: 0, height: 0 }, sx: __assign(__assign({}, styles.ul), { zIndex: 10, top: position === positions.BOTTOM ? 'calc(100% + 5px)' : undefined, bottom: position === positions.TOP ? 'calc(100% + 5px)' : undefined }) }, { children: React.Children.map(children, function (child) {
|
|
58
|
+
return React.cloneElement(child, __assign(__assign({}, child === null || child === void 0 ? void 0 : child.props), { active: false, onClick: function () { var _a; return setNativeInput((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.value); } }));
|
|
59
|
+
}) }))) }), _jsx("input", __assign({ ref: inputRef, value: active || '', "aria-hidden": "true", tabIndex: -1 }, props, { sx: styles.input }))] })), open && _jsx("div", { "aria-hidden": "true", onClick: function () { return setOpen(false); }, sx: styles.backdrop })] }));
|
|
60
|
+
};
|
|
61
|
+
export default Select;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
24
|
+
import { selectItemPadding, sizes } from './types';
|
|
25
|
+
import { dynamicStyles } from './styles';
|
|
26
|
+
import Flex from '../Flex';
|
|
27
|
+
var SelectItem = function (_a) {
|
|
28
|
+
var onClick = _a.onClick, value = _a.value, active = _a.active, _b = _a.size, size = _b === void 0 ? sizes.MEDIUM : _b, children = _a.children, props = __rest(_a, ["onClick", "value", "active", "size", "children"]);
|
|
29
|
+
var style = dynamicStyles.dropdownItem({ size: size });
|
|
30
|
+
return (_jsx(Flex, __assign({ as: "li" }, props, { onClick: function () { return onClick === null || onClick === void 0 ? void 0 : onClick(value); }, sx: {
|
|
31
|
+
padding: selectItemPadding[size],
|
|
32
|
+
listStyleType: 'none',
|
|
33
|
+
cursor: 'pointer',
|
|
34
|
+
borderRadius: '10px',
|
|
35
|
+
'&:hover': {
|
|
36
|
+
backgroundColor: !active ? 'white3' : undefined,
|
|
37
|
+
},
|
|
38
|
+
} }, { children: _jsx(Flex, __assign({ sx: style }, { children: children })) })));
|
|
39
|
+
};
|
|
40
|
+
export default SelectItem;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { fontSizes } from './types';
|
|
2
|
+
var styles = {
|
|
3
|
+
container: {
|
|
4
|
+
background: 'white3',
|
|
5
|
+
borderRadius: '10px',
|
|
6
|
+
cursor: 'pointer',
|
|
7
|
+
width: 'fit-content',
|
|
8
|
+
height: 'fit-content',
|
|
9
|
+
position: 'relative',
|
|
10
|
+
},
|
|
11
|
+
ul: {
|
|
12
|
+
position: 'absolute',
|
|
13
|
+
background: 'white2',
|
|
14
|
+
borderRadius: '10px',
|
|
15
|
+
cursor: 'pointer',
|
|
16
|
+
minWidth: '100%',
|
|
17
|
+
width: 'max-content',
|
|
18
|
+
overflow: 'hidden',
|
|
19
|
+
boxShadow: 'rgba(0, 0, 0, 0.16) 0px 1px 4px',
|
|
20
|
+
},
|
|
21
|
+
backdrop: {
|
|
22
|
+
width: '98vw',
|
|
23
|
+
height: '100vh',
|
|
24
|
+
position: 'fixed',
|
|
25
|
+
background: 'transparent',
|
|
26
|
+
top: 0,
|
|
27
|
+
left: 0,
|
|
28
|
+
},
|
|
29
|
+
input: {
|
|
30
|
+
bottom: 0,
|
|
31
|
+
left: 0,
|
|
32
|
+
position: 'absolute',
|
|
33
|
+
opacity: 0,
|
|
34
|
+
pointerEvents: 'none',
|
|
35
|
+
width: '100%',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
export var dynamicStyles = {
|
|
39
|
+
dropdownItem: function (_a) {
|
|
40
|
+
var size = _a.size;
|
|
41
|
+
return ({
|
|
42
|
+
width: '100%',
|
|
43
|
+
fontSize: fontSizes[size],
|
|
44
|
+
'*': {
|
|
45
|
+
fontSize: fontSizes[size],
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
export default styles;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { InputHTMLAttributes } from 'react';
|
|
2
|
+
export declare enum positions {
|
|
3
|
+
TOP = "top",
|
|
4
|
+
BOTTOM = "bottom"
|
|
5
|
+
}
|
|
6
|
+
export declare enum sizes {
|
|
7
|
+
XSMALL = "xsm",
|
|
8
|
+
SMALL = "sm",
|
|
9
|
+
MEDIUM = "md",
|
|
10
|
+
LARGE = "lg"
|
|
11
|
+
}
|
|
12
|
+
export declare const fontSizes: {
|
|
13
|
+
xsm: number;
|
|
14
|
+
sm: number;
|
|
15
|
+
md: number;
|
|
16
|
+
lg: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const selectPadding: {
|
|
19
|
+
xsm: number;
|
|
20
|
+
sm: number;
|
|
21
|
+
md: number;
|
|
22
|
+
lg: number;
|
|
23
|
+
};
|
|
24
|
+
export declare const selectedExtraPadding: {
|
|
25
|
+
xsm: number;
|
|
26
|
+
sm: number;
|
|
27
|
+
md: number;
|
|
28
|
+
lg: number;
|
|
29
|
+
};
|
|
30
|
+
export declare const selectItemPadding: {
|
|
31
|
+
xsm: number;
|
|
32
|
+
sm: number;
|
|
33
|
+
md: number;
|
|
34
|
+
lg: number;
|
|
35
|
+
};
|
|
36
|
+
type sizeProps = `${sizes}`;
|
|
37
|
+
type positionProps = `${positions}`;
|
|
38
|
+
export interface SelectProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
39
|
+
active?: number | string;
|
|
40
|
+
size?: sizeProps;
|
|
41
|
+
width?: string | number;
|
|
42
|
+
label?: JSX.Element;
|
|
43
|
+
position?: positionProps;
|
|
44
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
45
|
+
}
|
|
46
|
+
export interface SelectItemProps {
|
|
47
|
+
children: React.ReactNode;
|
|
48
|
+
onClick?: (value: number | string) => void;
|
|
49
|
+
url?: string;
|
|
50
|
+
active?: boolean;
|
|
51
|
+
size?: sizeProps;
|
|
52
|
+
value: number | string;
|
|
53
|
+
sx?: any;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var _a, _b, _c, _d;
|
|
2
|
+
export var positions;
|
|
3
|
+
(function (positions) {
|
|
4
|
+
positions["TOP"] = "top";
|
|
5
|
+
positions["BOTTOM"] = "bottom";
|
|
6
|
+
})(positions || (positions = {}));
|
|
7
|
+
export var sizes;
|
|
8
|
+
(function (sizes) {
|
|
9
|
+
sizes["XSMALL"] = "xsm";
|
|
10
|
+
sizes["SMALL"] = "sm";
|
|
11
|
+
sizes["MEDIUM"] = "md";
|
|
12
|
+
sizes["LARGE"] = "lg";
|
|
13
|
+
})(sizes || (sizes = {}));
|
|
14
|
+
export var fontSizes = (_a = {},
|
|
15
|
+
_a[sizes.XSMALL] = 1,
|
|
16
|
+
_a[sizes.SMALL] = 1,
|
|
17
|
+
_a[sizes.MEDIUM] = 3,
|
|
18
|
+
_a[sizes.LARGE] = 6,
|
|
19
|
+
_a);
|
|
20
|
+
export var selectPadding = (_b = {},
|
|
21
|
+
_b[sizes.XSMALL] = 2,
|
|
22
|
+
_b[sizes.SMALL] = 4,
|
|
23
|
+
_b[sizes.MEDIUM] = 6,
|
|
24
|
+
_b[sizes.LARGE] = 8,
|
|
25
|
+
_b);
|
|
26
|
+
export var selectedExtraPadding = (_c = {},
|
|
27
|
+
_c[sizes.XSMALL] = 1,
|
|
28
|
+
_c[sizes.SMALL] = 0,
|
|
29
|
+
_c[sizes.MEDIUM] = 0,
|
|
30
|
+
_c[sizes.LARGE] = 0,
|
|
31
|
+
_c);
|
|
32
|
+
export var selectItemPadding = (_d = {},
|
|
33
|
+
_d[sizes.XSMALL] = 2,
|
|
34
|
+
_d[sizes.SMALL] = 4,
|
|
35
|
+
_d[sizes.MEDIUM] = 6,
|
|
36
|
+
_d[sizes.LARGE] = 8,
|
|
37
|
+
_d);
|
|
@@ -4,4 +4,5 @@ export { default as Text } from './Text';
|
|
|
4
4
|
export { default as Skeleton } from './Skeleton';
|
|
5
5
|
export { default as TooltipBubble } from './TooltipBubble';
|
|
6
6
|
export { Button, IconButton } from './Button';
|
|
7
|
+
export { Select, SelectItem } from './Select';
|
|
7
8
|
export { Tag, ListTag } from './Tag';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// This basically returns the 2 tags with the higher active bond count
|
|
2
|
+
export var useTopTags = function (initialBondList) {
|
|
3
|
+
var bonds = initialBondList;
|
|
4
|
+
var countTagsInBonds = function (bonds) {
|
|
5
|
+
var tagCount = {};
|
|
6
|
+
bonds === null || bonds === void 0 ? void 0 : bonds.forEach(function (bond) {
|
|
7
|
+
var _a;
|
|
8
|
+
if (bond.soldOut)
|
|
9
|
+
return;
|
|
10
|
+
(_a = bond.tags) === null || _a === void 0 ? void 0 : _a.forEach(function (tag) {
|
|
11
|
+
if (tag in tagCount) {
|
|
12
|
+
tagCount[tag] += 1;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
tagCount[tag] = 1;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
return tagCount;
|
|
20
|
+
};
|
|
21
|
+
var activeBonds = bonds.filter(function (bond) { return !bond.soldOut; });
|
|
22
|
+
var countedTags = countTagsInBonds(activeBonds);
|
|
23
|
+
var sortedTagsArray = Object.entries(countedTags).sort(function (a, b) { return b[1] - a[1]; });
|
|
24
|
+
return sortedTagsArray.slice(0, 2).map(function (tagCountArray) { return tagCountArray[0]; });
|
|
25
|
+
};
|
|
@@ -70,6 +70,7 @@ import { BLOCK_EXPLORER } from '../../config/constants/chains';
|
|
|
70
70
|
import '../../scss/Bonds.scss';
|
|
71
71
|
import BondRowHeader from '../../components/BondRows/BondRowHeader';
|
|
72
72
|
import BondRowsByChain from '../../components/BondRows/BondRowsByChain';
|
|
73
|
+
import { useTopTags } from '../../hooks/useTopThreeTags';
|
|
73
74
|
var Bonds = function (_a) {
|
|
74
75
|
var account = _a.account, accountChainId = _a.accountChainId, isActive = _a.isActive;
|
|
75
76
|
//const { account, isActive } = useWeb3React();
|
|
@@ -259,13 +260,19 @@ var Bonds = function (_a) {
|
|
|
259
260
|
var handleInputChange = function (event) {
|
|
260
261
|
setInputValue(event.target.value);
|
|
261
262
|
};
|
|
263
|
+
var topTags = useTopTags(filteredBonds);
|
|
264
|
+
var filterOptions = __spreadArray(__spreadArray(['ALL', 'FAVORITES'], topTags, true), ['SOLD OUT'], false);
|
|
265
|
+
var _l = useState(filterOptions[0]), filterOption = _l[0], setFilterOption = _l[1];
|
|
266
|
+
var handleChangeFilterOption = useCallback(function (newOption) {
|
|
267
|
+
setFilterOption(newOption);
|
|
268
|
+
}, []);
|
|
262
269
|
// Page render logic
|
|
263
|
-
var
|
|
270
|
+
var _m = useState(false), bondsRendered = _m[0], setBondsRendered = _m[1];
|
|
264
271
|
useEffect(function () {
|
|
265
272
|
if (filteredBonds.length > 0) {
|
|
266
273
|
setBondsRendered(true);
|
|
267
274
|
}
|
|
268
275
|
}, [filteredBonds]);
|
|
269
|
-
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: [_jsx(BondRowHeader, { inputValue: inputValue, onInputChange: handleInputChange, onSort: handleSort }), _jsx(BondRowsByChain, { bonds: filteredBonds, hotBonds: hotBonds, hideTitles: inputValue !== '', rowClick: rowClick })] })))] })));
|
|
276
|
+
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: [_jsx(BondRowHeader, { inputValue: inputValue, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleChangeFilterOption, onInputChange: handleInputChange, onSort: handleSort }), _jsx(BondRowsByChain, { bonds: filteredBonds, hotBonds: hotBonds, hideTitles: inputValue !== '', rowClick: rowClick })] })))] })));
|
|
270
277
|
};
|
|
271
278
|
export default Bonds;
|
|
@@ -78,9 +78,9 @@ import { fetchUserOwnedBillsDataAsync } from './fetchBillsUser';
|
|
|
78
78
|
import { Input } from '../../components/uikit-sdk/Input';
|
|
79
79
|
import useClaimBill from '../../hooks/useClaimBill';
|
|
80
80
|
var YourBonds = function (_a) {
|
|
81
|
-
var account = _a.account, accountChainId = _a.accountChainId, isActive = _a.isActive;
|
|
82
81
|
//const toastError = useToastError()
|
|
83
82
|
// const { onClaimBill } = useClaimBill(billAddress, billIds)
|
|
83
|
+
var account = _a.account, accountChainId = _a.accountChainId, isActive = _a.isActive;
|
|
84
84
|
var _b = useState(false), pendingTrx = _b[0], setPendingTrx = _b[1];
|
|
85
85
|
var handleClaim = function (billAddress, billIds, chainId, event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
86
|
var onClaimBill;
|