tek-wallet 0.0.754 → 0.0.756
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/README.md +83 -32
- package/dist/components/TekWallet/components/ui/ActivitiesTypeSlice/index.d.ts +3 -0
- package/dist/components/TekWallet/components/ui/ActivitiesTypeSlice/index.js +7 -7
- package/dist/components/TekWallet/components/ui/ActivityDetail/index.js +5 -5
- package/dist/components/TekWallet/components/ui/ActivityItem/index.js +9 -4
- package/dist/components/TekWallet/components/ui/AmountGroupAndChart/index.js +103 -101
- package/dist/components/TekWallet/components/ui/AnalyticGroup/index.d.ts +2 -1
- package/dist/components/TekWallet/components/ui/AnalyticGroup/index.js +47 -32
- package/dist/components/TekWallet/components/ui/FiatDeposit/index.js +5 -3
- package/dist/components/TekWallet/components/ui/HistorySwap/index.js +1 -2
- package/dist/components/TekWallet/components/ui/NeonLineChart/index.d.ts +6 -5
- package/dist/components/TekWallet/components/ui/NeonLineChart/index.js +2 -2
- package/dist/components/TekWallet/components/ui/ReceiveHistory/index.js +1 -2
- package/dist/components/TekWallet/components/ui/SmartList/index.d.ts +0 -1
- package/dist/components/TekWallet/components/ui/SmartList/index.js +5 -4
- package/dist/components/TekWallet/components/ui/SvgPath/index.d.ts +1 -0
- package/dist/components/TekWallet/components/ui/SvgPath/index.js +3 -2
- package/dist/components/TekWallet/components/ui/SwapToken/index.js +0 -5
- package/dist/components/TekWallet/components/ui/SwapToken copy/index.d.ts +32 -0
- package/dist/components/TekWallet/components/ui/SwapToken copy/index.js +293 -0
- package/dist/components/TekWallet/components/ui/SwiperControlled/index.js +5 -1
- package/dist/components/TekWallet/components/ui/TimeFilter/index.d.ts +4 -3
- package/dist/components/TekWallet/components/ui/TimeFilter/index.js +27 -30
- package/dist/components/TekWallet/components/ui/TokenItem/index.js +11 -6
- package/dist/components/TekWallet/components/ui/TokensBoard/index.js +1 -3
- package/dist/components/TekWallet/components/views/ActivityView/index.d.ts +10 -0
- package/dist/components/TekWallet/components/views/ActivityView/index.js +64 -0
- package/dist/components/TekWallet/components/views/AssetView/index.js +69 -6
- package/dist/components/TekWallet/components/views/TekWalletView/index.js +1 -1
- package/dist/components/TekWallet/components/views/TekWalletView/routes.d.ts +5 -4
- package/dist/components/TekWallet/components/views/TekWalletView/routes.js +11 -5
- package/dist/components/TekWallet/const/app.config.d.ts +1 -0
- package/dist/components/TekWallet/const/app.config.js +4 -0
- package/dist/components/TekWallet/index.d.ts +1 -1
- package/dist/components/TekWallet/index.js +1 -1
- package/dist/components/TekWallet/providers/ActivitiesProvider/const.d.ts +1 -1
- package/dist/components/TekWallet/providers/ActivitiesProvider/const.js +1 -1
- package/dist/components/TekWallet/providers/ActivitiesProvider/functions/sortActivity.d.ts +3 -0
- package/dist/components/TekWallet/providers/ActivitiesProvider/functions/sortActivity.js +8 -0
- package/dist/components/TekWallet/providers/ActivitiesProvider/index.js +55 -51
- package/dist/components/TekWallet/providers/ActivitiesProvider/type.d.ts +1 -1
- package/dist/components/TekWallet/providers/WalletDataProvider/index.js +2 -0
- package/dist/components/TekWallet/providers/WalletDataProviderNoImport/index.js +41 -6
- package/dist/components/TekWallet/services/axios/get-activities-service/index.js +0 -3
- package/dist/components/TekWallet/services/axios/get-activities-service/type.d.ts +4 -4
- package/dist/components/TekWallet/services/axios/get-balance-analytic/index.d.ts +3 -0
- package/dist/components/TekWallet/services/axios/get-balance-analytic/index.js +56 -0
- package/dist/components/TekWallet/services/axios/get-balance-analytic/type.d.ts +18 -0
- package/dist/components/TekWallet/services/axios/get-balance-analytic/type.js +2 -0
- package/dist/components/TekWallet/store/balance/index.d.ts +15 -0
- package/dist/components/TekWallet/store/balance/index.js +24 -0
- package/dist/components/TekWallet/store/balance/type.d.ts +9 -0
- package/dist/components/TekWallet/store/balance/type.js +2 -0
- package/dist/components/TekWallet/store/createStorage.d.ts +3 -0
- package/dist/components/TekWallet/store/createStorage.js +17 -0
- package/dist/components/TekWallet/store/user/index.d.ts +15 -0
- package/dist/components/TekWallet/store/user/index.js +52 -0
- package/dist/components/TekWallet/store/user/type.d.ts +38 -0
- package/dist/components/TekWallet/store/user/type.js +9 -0
- package/dist/components/TekWallet/types/expose-type.d.ts +3 -0
- package/package.json +3 -2
- package/dist/components/TekWallet/components/ui/Activities/index.d.ts +0 -12
- package/dist/components/TekWallet/components/ui/Activities/index.js +0 -117
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
48
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
49
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
50
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
51
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
52
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
53
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
57
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
58
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
59
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
60
|
+
function step(op) {
|
|
61
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
62
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
63
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
64
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
65
|
+
switch (op[0]) {
|
|
66
|
+
case 0: case 1: t = op; break;
|
|
67
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
68
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
69
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
70
|
+
default:
|
|
71
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
72
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
73
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
74
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
75
|
+
if (t[2]) _.ops.pop();
|
|
76
|
+
_.trys.pop(); continue;
|
|
77
|
+
}
|
|
78
|
+
op = body.call(thisArg, _);
|
|
79
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
80
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
84
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
85
|
+
};
|
|
86
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
87
|
+
exports.SwapToken = exports.SwapTokenError = void 0;
|
|
88
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
89
|
+
var material_1 = require("@mui/material");
|
|
90
|
+
var ThemeProvider_1 = require("../../../providers/ThemeProvider");
|
|
91
|
+
var Button_1 = __importStar(require("../Button"));
|
|
92
|
+
var ConfirmLayout_1 = __importDefault(require("../ConfirmLayout"));
|
|
93
|
+
var LineValue_1 = __importDefault(require("../LineValue"));
|
|
94
|
+
var Formatter_1 = __importDefault(require("../Formatter"));
|
|
95
|
+
var ConfirmByPasscode_1 = __importDefault(require("../ConfirmByPasscode"));
|
|
96
|
+
var react_1 = require("react");
|
|
97
|
+
var Text_1 = __importDefault(require("../Text"));
|
|
98
|
+
var RequireConnect_1 = __importDefault(require("../RequireConnect"));
|
|
99
|
+
var useWalletData_1 = __importDefault(require("../../../hooks/useWalletData"));
|
|
100
|
+
var Fees_1 = __importDefault(require("../Fees"));
|
|
101
|
+
var get_est_fee_service_1 = __importDefault(require("../../../services/axios/get-est-fee-service"));
|
|
102
|
+
var type_1 = require("../../../services/axios/get-activities-service/type");
|
|
103
|
+
var useSwapData_1 = __importDefault(require("../../../hooks/useSwapData"));
|
|
104
|
+
var swap_service_1 = __importDefault(require("../../../services/axios/swap-service"));
|
|
105
|
+
var Icon_1 = __importDefault(require("../Icon"));
|
|
106
|
+
var roundToTwoSignificantDecimals_1 = __importDefault(require("../../../utils/roundToTwoSignificantDecimals"));
|
|
107
|
+
var getImage_1 = __importDefault(require("../../../utils/getImage"));
|
|
108
|
+
var getIcon_1 = __importDefault(require("../../../utils/getIcon"));
|
|
109
|
+
var SwapTokenError;
|
|
110
|
+
(function (SwapTokenError) {
|
|
111
|
+
SwapTokenError["TOKEN_NOT_FOUND"] = "Token not found";
|
|
112
|
+
SwapTokenError["NOT_ENOUGH_BALANCE"] = "Not enough balance";
|
|
113
|
+
SwapTokenError["MAX_AMOUNT"] = "Max amount";
|
|
114
|
+
SwapTokenError["MIN_AMOUNT"] = "Min amount";
|
|
115
|
+
SwapTokenError["FAILED"] = "Failed";
|
|
116
|
+
})(SwapTokenError || (exports.SwapTokenError = SwapTokenError = {}));
|
|
117
|
+
var transactionSlug = type_1.TransactionSlug.SWAP;
|
|
118
|
+
exports.SwapToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
119
|
+
var _a;
|
|
120
|
+
var theme = (0, ThemeProvider_1.useTheme)();
|
|
121
|
+
var _b = (0, useSwapData_1.default)(), fromTokens = _b.fromTokens, updateSwapTokens = _b.updateSwapTokens;
|
|
122
|
+
var isInitPasscode = (0, useWalletData_1.default)().isInitPasscode;
|
|
123
|
+
var confirmLayoutDrawerRef = (0, react_1.useRef)(null);
|
|
124
|
+
var _c = (0, react_1.useState)(undefined), error = _c[0], setError = _c[1];
|
|
125
|
+
var _d = (0, react_1.useState)(undefined), errorAmount = _d[0], setErrorAmount = _d[1];
|
|
126
|
+
var _e = (0, react_1.useState)(Button_1.BUTTON_STATUS.ENABLED), buttonStatus = _e[0], setButtonStatus = _e[1];
|
|
127
|
+
var _f = (0, react_1.useState)(props.initFeeData), estimateFee = _f[0], setEstimateFee = _f[1];
|
|
128
|
+
var _g = (0, react_1.useState)(false), isLoadingEstimateFee = _g[0], setIsLoadingEstimateFee = _g[1];
|
|
129
|
+
var amount = props.sendData.amount;
|
|
130
|
+
var fromTokenSlug = props.sendData.currency_slug;
|
|
131
|
+
var toTokenSlug = props.sendData.to_currency_slug;
|
|
132
|
+
var sx = props.sx, children = props.children, btnConfirm = props.btnConfirm, trigger = props.trigger, overrideHeader = props.overrideHeader;
|
|
133
|
+
var fromToken = (0, react_1.useMemo)(function () {
|
|
134
|
+
return fromTokens === null || fromTokens === void 0 ? void 0 : fromTokens.find(function (token) { return token.slug === fromTokenSlug; });
|
|
135
|
+
}, [fromTokenSlug, fromTokens]);
|
|
136
|
+
var toToken = (0, react_1.useMemo)(function () {
|
|
137
|
+
var _a;
|
|
138
|
+
if (!fromToken)
|
|
139
|
+
return undefined;
|
|
140
|
+
return (_a = fromToken.outputs) === null || _a === void 0 ? void 0 : _a.find(function (token) { return token.slug === toTokenSlug; });
|
|
141
|
+
}, [toTokenSlug, fromToken]);
|
|
142
|
+
var toAmount = (0, react_1.useMemo)(function () {
|
|
143
|
+
if (!toToken)
|
|
144
|
+
return undefined;
|
|
145
|
+
return +amount / +toToken.usd_rate;
|
|
146
|
+
}, [toToken, amount]);
|
|
147
|
+
var getEstimateFee = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
148
|
+
var response;
|
|
149
|
+
return __generator(this, function (_a) {
|
|
150
|
+
switch (_a.label) {
|
|
151
|
+
case 0:
|
|
152
|
+
if (!fromTokenSlug)
|
|
153
|
+
return [2 /*return*/];
|
|
154
|
+
setIsLoadingEstimateFee(true);
|
|
155
|
+
return [4 /*yield*/, (0, get_est_fee_service_1.default)({
|
|
156
|
+
amount: "".concat(amount),
|
|
157
|
+
transaction_type: transactionSlug,
|
|
158
|
+
currency: fromTokenSlug || "",
|
|
159
|
+
to_currency_slug: toTokenSlug || "",
|
|
160
|
+
})];
|
|
161
|
+
case 1:
|
|
162
|
+
response = _a.sent();
|
|
163
|
+
setIsLoadingEstimateFee(false);
|
|
164
|
+
setEstimateFee(response === null || response === void 0 ? void 0 : response.data);
|
|
165
|
+
return [2 /*return*/, true];
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}); }, [amount, fromTokenSlug]);
|
|
169
|
+
var token = (0, react_1.useMemo)(function () {
|
|
170
|
+
return fromTokens === null || fromTokens === void 0 ? void 0 : fromTokens.find(function (token) { return token.slug === fromTokenSlug; });
|
|
171
|
+
}, [fromTokenSlug, fromTokens]);
|
|
172
|
+
var validateAmount = (0, react_1.useCallback)(function () {
|
|
173
|
+
if (!token) {
|
|
174
|
+
setError(SwapTokenError.TOKEN_NOT_FOUND);
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
if (+amount > token.max_value) {
|
|
178
|
+
setError(SwapTokenError.MAX_AMOUNT);
|
|
179
|
+
setErrorAmount(token.max_value);
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
if (+amount < token.min_value) {
|
|
183
|
+
setError(SwapTokenError.MIN_AMOUNT);
|
|
184
|
+
setErrorAmount(token.min_value);
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
if (+amount > +token.balance) {
|
|
188
|
+
setError(SwapTokenError.NOT_ENOUGH_BALANCE);
|
|
189
|
+
setErrorAmount(token.balance);
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
setError(undefined);
|
|
193
|
+
setErrorAmount(undefined);
|
|
194
|
+
return true;
|
|
195
|
+
}, [amount, token]);
|
|
196
|
+
var validateAll = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
197
|
+
var isAmountValid;
|
|
198
|
+
return __generator(this, function (_a) {
|
|
199
|
+
isAmountValid = validateAmount();
|
|
200
|
+
if (!isAmountValid)
|
|
201
|
+
return [2 /*return*/, false];
|
|
202
|
+
getEstimateFee();
|
|
203
|
+
return [2 /*return*/];
|
|
204
|
+
});
|
|
205
|
+
}); }, [validateAmount, getEstimateFee]);
|
|
206
|
+
var handleSwapToken = function (passcode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
207
|
+
var response, err_1;
|
|
208
|
+
var _a, _b, _c, _d, _e;
|
|
209
|
+
return __generator(this, function (_f) {
|
|
210
|
+
switch (_f.label) {
|
|
211
|
+
case 0:
|
|
212
|
+
_f.trys.push([0, 2, 3, 4]);
|
|
213
|
+
(_a = props.onStart) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
214
|
+
setButtonStatus(Button_1.BUTTON_STATUS.LOADING);
|
|
215
|
+
return [4 /*yield*/, (0, swap_service_1.default)(__assign(__assign({}, props.sendData), { passcode: passcode }))];
|
|
216
|
+
case 1:
|
|
217
|
+
response = _f.sent();
|
|
218
|
+
if (response.success) {
|
|
219
|
+
(_b = confirmLayoutDrawerRef.current) === null || _b === void 0 ? void 0 : _b.close();
|
|
220
|
+
setButtonStatus(Button_1.BUTTON_STATUS.ENABLED);
|
|
221
|
+
(_c = props.onSuccess) === null || _c === void 0 ? void 0 : _c.call(props, response);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
throw new Error("Swap internal failed");
|
|
225
|
+
}
|
|
226
|
+
return [3 /*break*/, 4];
|
|
227
|
+
case 2:
|
|
228
|
+
err_1 = _f.sent();
|
|
229
|
+
(_d = props.onError) === null || _d === void 0 ? void 0 : _d.call(props, err_1);
|
|
230
|
+
setButtonStatus(Button_1.BUTTON_STATUS.ERROR);
|
|
231
|
+
setTimeout(function () {
|
|
232
|
+
setButtonStatus(Button_1.BUTTON_STATUS.ENABLED);
|
|
233
|
+
}, 1200);
|
|
234
|
+
return [3 /*break*/, 4];
|
|
235
|
+
case 3:
|
|
236
|
+
(_e = props.onFinish) === null || _e === void 0 ? void 0 : _e.call(props);
|
|
237
|
+
return [7 /*endfinally*/];
|
|
238
|
+
case 4: return [2 /*return*/];
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}); };
|
|
242
|
+
var handleOpen = function () {
|
|
243
|
+
var _a;
|
|
244
|
+
if (!isInitPasscode)
|
|
245
|
+
throw new Error("Please connect your wallet");
|
|
246
|
+
(_a = confirmLayoutDrawerRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
247
|
+
validateAll();
|
|
248
|
+
};
|
|
249
|
+
var handleClose = function () {
|
|
250
|
+
var _a;
|
|
251
|
+
if (!isInitPasscode)
|
|
252
|
+
throw new Error("Please connect your wallet");
|
|
253
|
+
(_a = confirmLayoutDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
254
|
+
};
|
|
255
|
+
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
256
|
+
open: handleOpen,
|
|
257
|
+
close: handleClose,
|
|
258
|
+
}); });
|
|
259
|
+
var estimateReceive = (0, react_1.useMemo)(function () {
|
|
260
|
+
if (!estimateFee || !amount || !(toToken === null || toToken === void 0 ? void 0 : toToken.usd_rate))
|
|
261
|
+
return undefined;
|
|
262
|
+
return (+amount - +(estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.fee_in_currency)) / +(toToken === null || toToken === void 0 ? void 0 : toToken.usd_rate);
|
|
263
|
+
}, [estimateFee, toToken, amount]);
|
|
264
|
+
(0, react_1.useEffect)(function () {
|
|
265
|
+
if (isInitPasscode && !fromTokens) {
|
|
266
|
+
updateSwapTokens();
|
|
267
|
+
}
|
|
268
|
+
}, [isInitPasscode, fromTokens]);
|
|
269
|
+
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { onOpen: validateAll, trigger: trigger, ref: confirmLayoutDrawerRef, action: transactionSlug, header: {
|
|
270
|
+
title: overrideHeader,
|
|
271
|
+
}, sx: sx, confirmAction: (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: transactionSlug, onConfirmSuccess: handleSwapToken, children: btnConfirm !== null && btnConfirm !== void 0 ? btnConfirm : ((0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee ? Button_1.BUTTON_STATUS.DISABLED : buttonStatus, sx: { width: "100%" }, children: "Swap" })) }), children: children !== null && children !== void 0 ? children : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!!fromToken && !!toToken && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: "flex", gap: theme.mixins.gaps.g12, flexDirection: "column" }, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { alignItems: "start", gap: theme.mixins.gaps.g12, backgroundColor: theme.palette.background.primary, backgroundImage: "url(".concat((0, getImage_1.default)("logo_transfer", "png"), ")"), backgroundPosition: "right", backgroundRepeat: "no-repeat", padding: theme.mixins.customPadding.p16, borderRadius: theme.mixins.customRadius.r16 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g16, width: "100%" }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: fromToken === null || fromToken === void 0 ? void 0 : fromToken.link, width: 20, height: 20, className: "rounded-full" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeight600, color: theme.palette.text.white }), children: fromToken === null || fromToken === void 0 ? void 0 : fromToken.name })] }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.bigValue), { ml: "auto", color: theme.palette.text.white }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount }) })] }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", gap: theme.mixins.gaps.g2, sx: {
|
|
272
|
+
width: "100%",
|
|
273
|
+
mt: theme.mixins.customMargin.m4,
|
|
274
|
+
mb: theme.mixins.customMargin.m4,
|
|
275
|
+
}, children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("swap_up"), width: 18, height: 18, color: theme.palette.text.primary }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
|
|
276
|
+
width: "95%",
|
|
277
|
+
borderStyle: "dashed",
|
|
278
|
+
borderColor: theme.palette.border.white16,
|
|
279
|
+
} })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g16, width: "100%" }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: toToken === null || toToken === void 0 ? void 0 : toToken.link, width: 20, height: 20, className: "rounded-full" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeight600, color: theme.palette.text.white }), children: toToken === null || toToken === void 0 ? void 0 : toToken.name })] }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.bigValue), { ml: "auto", color: theme.palette.text.white }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: toAmount }) })] })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { mt: theme.mixins.customMargin.m12 }), children: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
280
|
+
fontSize: theme.typography.fontSize18,
|
|
281
|
+
fontWeight: theme.typography.fontWeight700,
|
|
282
|
+
color: theme.palette.text.black,
|
|
283
|
+
}, children: "Transfer Summary" }) }), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.fee_detail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: estimateFee, amount: +amount, tokenSlug: fromTokenSlug })), !estimateFee && !!amount && isLoadingEstimateFee && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8, width: "100%" }), children: [(0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 16, sx: { color: theme.palette.text.white } }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: { color: "text.white" }, children: "Calculating fee" })] })), !!estimateReceive && !error && ((0, jsx_runtime_1.jsx)(LineValue_1.default, { value: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.mixins.row), theme.mixins.valueDescription), { width: "100%", justifyContent: "center", color: theme.palette.text.black, fontWeight: theme.typography.fontWeight500, gap: theme.mixins.gaps.g2 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("ellipse"), width: 12, height: 12 }), "1", " ", fromToken === null || fromToken === void 0 ? void 0 : fromToken.name, " =", (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g2 }), children: [(0, jsx_runtime_1.jsx)(Formatter_1.default, { value: 1 / +(toToken === null || toToken === void 0 ? void 0 : toToken.usd_rate) }), " ", toToken === null || toToken === void 0 ? void 0 : toToken.name] })] }), field: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
284
|
+
color: theme.palette.text.black,
|
|
285
|
+
fontWeight: theme.typography.fontWeight600,
|
|
286
|
+
}, children: "Best Price" }) })), !!estimateReceive && !error && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { width: "100%", gap: theme.mixins.gaps.g8, mt: theme.mixins.customMargin.m8 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("warning"), width: 18, height: 18 }), (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: {
|
|
287
|
+
color: theme.palette.text.primary,
|
|
288
|
+
fontWeight: theme.typography.fontWeight600,
|
|
289
|
+
fontSize: theme.typography.fontSize13,
|
|
290
|
+
}, children: ["You will receive at least ", "".concat(estimateReceive, " ").concat(toToken === null || toToken === void 0 ? void 0 : toToken.name), " ", "(~".concat((0, roundToTwoSignificantDecimals_1.default)(estimateReceive), ")"), " or the transaction will refunded"] })] })), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.customMargin.m6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] }))] }) })), (!fromToken || !toToken) && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.paper), { alignItems: "center", justifyContent: "center" }), children: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { fontSize: theme.typography.fontSize16 }), children: SwapTokenError.TOKEN_NOT_FOUND }) }))] })) }) }));
|
|
291
|
+
});
|
|
292
|
+
exports.SwapToken.displayName = "SwapToken";
|
|
293
|
+
exports.default = exports.SwapToken;
|
|
@@ -31,9 +31,11 @@ var navigation_1 = require("next/navigation");
|
|
|
31
31
|
var useCustomRouter_1 = __importDefault(require("../../../hooks/useCustomRouter"));
|
|
32
32
|
var navigation_2 = require("next/navigation");
|
|
33
33
|
var createDebounce_1 = __importDefault(require("../../../utils/createDebounce"));
|
|
34
|
+
var providers_1 = require("../../../providers");
|
|
34
35
|
var rememberTabDeBounce = (0, createDebounce_1.default)(1000);
|
|
35
36
|
var SwiperControlled = (0, react_2.forwardRef)(function (props, ref) {
|
|
36
37
|
var swiperRef = (0, react_2.useRef)(null);
|
|
38
|
+
var theme = (0, providers_1.useTheme)();
|
|
37
39
|
var router = (0, useCustomRouter_1.default)();
|
|
38
40
|
var pathname = (0, navigation_2.usePathname)();
|
|
39
41
|
var searchParams = (0, navigation_1.useSearchParams)();
|
|
@@ -90,7 +92,9 @@ var SwiperControlled = (0, react_2.forwardRef)(function (props, ref) {
|
|
|
90
92
|
};
|
|
91
93
|
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({ width: "100%", display: "flex", flexDirection: "column" }, props.sx), children: [props.tabs && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
92
94
|
maxWidth: "100%",
|
|
93
|
-
}, children: (0, jsx_runtime_1.jsxs)(material_1.Tabs, { value: activeTab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", sx: __assign({
|
|
95
|
+
}, children: (0, jsx_runtime_1.jsxs)(material_1.Tabs, { value: activeTab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", sx: __assign({ "& .MuiTabs-indicator": {
|
|
96
|
+
backgroundColor: theme.palette.background.primary,
|
|
97
|
+
}, minHeight: "unset" }, props.tabsSx), children: __spreadArray([], props.tabs, true) }) })), (0, jsx_runtime_1.jsx)(react_1.Swiper, __assign({ speed: 500 }, props.swiperProps, { onSlideChange: handleSlideChange, ref: swiperRef, initialSlide: activeTab, style: __assign({ width: "100%" }, props.swiperStyle), allowTouchMove: !props.disableSwipe, children: props.children }))] }));
|
|
94
98
|
});
|
|
95
99
|
SwiperControlled.displayName = "SwiperControlled";
|
|
96
100
|
exports.default = SwiperControlled;
|
|
@@ -2,9 +2,10 @@ import { GeneralProps } from "../../../types/ui";
|
|
|
2
2
|
export declare enum TimeFilterType {
|
|
3
3
|
ALL = "all",
|
|
4
4
|
TODAY = "today",
|
|
5
|
-
SEVEN_DAYS = "7
|
|
6
|
-
THIRTY_DAYS = "30
|
|
5
|
+
SEVEN_DAYS = "7",
|
|
6
|
+
THIRTY_DAYS = "30"
|
|
7
7
|
}
|
|
8
|
+
export declare const TIME_FILTER_LABEL: Record<TimeFilterType, string>;
|
|
8
9
|
export interface TimeFilterProps extends GeneralProps {
|
|
9
10
|
initialValue?: TimeFilterType;
|
|
10
11
|
onChange?: (value: TimeFilterData, event?: React.MouseEvent<HTMLElement>) => any;
|
|
@@ -15,5 +16,5 @@ export interface TimeFilterData {
|
|
|
15
16
|
startDate?: string;
|
|
16
17
|
endDate?: string;
|
|
17
18
|
}
|
|
18
|
-
declare const TimeFilter: ({ initialValue, onChange, hideAll }: TimeFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare const TimeFilter: ({ initialValue, onChange, hideAll, sx, }: TimeFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
export default TimeFilter;
|
|
@@ -13,8 +13,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
|
+
var _a;
|
|
16
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.TimeFilterType = void 0;
|
|
18
|
+
exports.TIME_FILTER_LABEL = exports.TimeFilterType = void 0;
|
|
18
19
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
20
|
var material_1 = require("@mui/material");
|
|
20
21
|
var ThemeProvider_1 = require("../../../providers/ThemeProvider");
|
|
@@ -23,17 +24,21 @@ var Text_1 = __importDefault(require("../Text"));
|
|
|
23
24
|
var date_fns_1 = require("date-fns");
|
|
24
25
|
var getMaxTime_1 = __importDefault(require("../../../utils/getMaxTime"));
|
|
25
26
|
var formatDate_1 = __importDefault(require("../../../utils/formatDate"));
|
|
26
|
-
var Icon_1 = __importDefault(require("../Icon"));
|
|
27
|
-
var getIcon_1 = __importDefault(require("../../../utils/getIcon"));
|
|
28
27
|
var TimeFilterType;
|
|
29
28
|
(function (TimeFilterType) {
|
|
30
29
|
TimeFilterType["ALL"] = "all";
|
|
31
30
|
TimeFilterType["TODAY"] = "today";
|
|
32
|
-
TimeFilterType["SEVEN_DAYS"] = "7
|
|
33
|
-
TimeFilterType["THIRTY_DAYS"] = "30
|
|
31
|
+
TimeFilterType["SEVEN_DAYS"] = "7";
|
|
32
|
+
TimeFilterType["THIRTY_DAYS"] = "30";
|
|
34
33
|
})(TimeFilterType || (exports.TimeFilterType = TimeFilterType = {}));
|
|
34
|
+
exports.TIME_FILTER_LABEL = (_a = {},
|
|
35
|
+
_a[TimeFilterType.ALL] = "All",
|
|
36
|
+
_a[TimeFilterType.TODAY] = "Today",
|
|
37
|
+
_a[TimeFilterType.SEVEN_DAYS] = "7 days",
|
|
38
|
+
_a[TimeFilterType.THIRTY_DAYS] = "30 days",
|
|
39
|
+
_a);
|
|
35
40
|
var TimeFilter = function (_a) {
|
|
36
|
-
var _b = _a.initialValue, initialValue = _b === void 0 ? TimeFilterType.ALL : _b, onChange = _a.onChange, hideAll = _a.hideAll;
|
|
41
|
+
var _b = _a.initialValue, initialValue = _b === void 0 ? TimeFilterType.ALL : _b, onChange = _a.onChange, hideAll = _a.hideAll, sx = _a.sx;
|
|
37
42
|
var theme = (0, ThemeProvider_1.useTheme)();
|
|
38
43
|
var _c = (0, react_1.useState)({
|
|
39
44
|
type: initialValue,
|
|
@@ -108,38 +113,30 @@ var TimeFilter = function (_a) {
|
|
|
108
113
|
setValue(newData);
|
|
109
114
|
onChange === null || onChange === void 0 ? void 0 : onChange(newData);
|
|
110
115
|
}, []);
|
|
111
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g6, alignItems: "flex-start" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
116
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g6, alignItems: "flex-start" }), sx), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
112
117
|
color: theme.palette.text.accent2,
|
|
113
118
|
fontWeight: theme.typography.fontWeight500,
|
|
114
119
|
fontSize: theme.typography.fontSize11,
|
|
115
120
|
}, children: getTimeFilterLabel(value) }), (0, jsx_runtime_1.jsx)(material_1.ToggleButtonGroup, { defaultValue: initialValue, onChange: handleChange, sx: { gap: theme.mixins.gaps.g8 }, children: Object.values(TimeFilterType).map(function (type) {
|
|
116
121
|
if (hideAll && type === TimeFilterType.ALL)
|
|
117
122
|
return null;
|
|
118
|
-
|
|
123
|
+
var isActive = (value === null || value === void 0 ? void 0 : value.type) === type;
|
|
124
|
+
return ((0, jsx_runtime_1.jsx)(material_1.ToggleButton, { "aria-label": type, value: type, sx: {
|
|
119
125
|
p: 0,
|
|
120
126
|
border: "none",
|
|
121
|
-
}, children:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
: theme.typography.fontWeight500,
|
|
135
|
-
transition: "background 0.2s, color 0.2s, border-color 0.2s",
|
|
136
|
-
overflow: "hidden",
|
|
137
|
-
} }), (value === null || value === void 0 ? void 0 : value.type) === type && ((0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("rectangle"), width: 22, height: 22, sx: {
|
|
138
|
-
position: "absolute",
|
|
139
|
-
right: 0,
|
|
140
|
-
borderTopRightRadius: theme.mixins.customRadius.r10,
|
|
141
|
-
top: 0,
|
|
142
|
-
} }))] }, type));
|
|
127
|
+
}, children: (0, jsx_runtime_1.jsx)(material_1.Chip, { label: "".concat(exports.TIME_FILTER_LABEL[type]), variant: "outlined", sx: {
|
|
128
|
+
position: "relative",
|
|
129
|
+
textTransform: "capitalize",
|
|
130
|
+
fontSize: theme.typography.fontSize11,
|
|
131
|
+
borderRadius: theme.mixins.customRadius.r10,
|
|
132
|
+
borderWidth: 1,
|
|
133
|
+
borderColor: isActive ? theme.palette.primary.main : theme.palette.border.accent3,
|
|
134
|
+
backgroundColor: isActive ? theme.palette.secondary.main : "transparent",
|
|
135
|
+
color: isActive ? theme.palette.primary.main : theme.palette.text.accent,
|
|
136
|
+
fontWeight: theme.typography.fontWeight600,
|
|
137
|
+
transition: "background 0.2s, color 0.2s, border-color 0.2s",
|
|
138
|
+
overflow: "hidden",
|
|
139
|
+
} }) }, type));
|
|
143
140
|
}) })] }));
|
|
144
141
|
};
|
|
145
142
|
exports.default = TimeFilter;
|
|
@@ -22,13 +22,18 @@ var Text_1 = __importDefault(require("../Text"));
|
|
|
22
22
|
var Formatter_1 = __importDefault(require("../Formatter"));
|
|
23
23
|
var material_1 = require("@mui/material");
|
|
24
24
|
var ThemeProvider_1 = require("../../../providers/ThemeProvider");
|
|
25
|
-
var
|
|
25
|
+
var user_1 = __importDefault(require("../../../store/user"));
|
|
26
26
|
var TokenItem = function (props) {
|
|
27
27
|
var theme = (0, ThemeProvider_1.useTheme)();
|
|
28
28
|
var tokenData = (0, react_1.useMemo)(function () { return JSON.parse(props.tokenData); }, [props.tokenData]);
|
|
29
29
|
var currency = (0, react_1.useMemo)(function () { return tokenData.currency; }, [tokenData]);
|
|
30
|
-
var
|
|
31
|
-
|
|
30
|
+
var isShowBalance = (0, user_1.default)(function (state) { return state.settings.balance.isShowBalance; });
|
|
31
|
+
var balance = (0, react_1.useMemo)(function () {
|
|
32
|
+
return +tokenData.current_value;
|
|
33
|
+
}, [tokenData.current_value]);
|
|
34
|
+
var balanceInUSD = (0, react_1.useMemo)(function () {
|
|
35
|
+
return tokenData.assets;
|
|
36
|
+
}, [tokenData.assets]);
|
|
32
37
|
var shouldHideSmallAsset = props.showSmallAssets && currency.name === "USD";
|
|
33
38
|
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
34
39
|
display: !shouldHideSmallAsset ? "grid" : "none",
|
|
@@ -37,15 +42,15 @@ var TokenItem = function (props) {
|
|
|
37
42
|
py: theme.mixins.customPadding.p8,
|
|
38
43
|
}, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { width: 20, sx: {
|
|
39
44
|
borderRadius: theme.mixins.customRadius.full,
|
|
40
|
-
}, src: currency.link }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { flex: 1 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: currency.name }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: currency.full_name })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g1, justifyContent: "center" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeight700 }), children:
|
|
45
|
+
}, src: currency.link }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { flex: 1 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: currency.name }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: currency.full_name })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g1, justifyContent: "center" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeight700 }), children: isShowBalance ? (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: balance }) : "****" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: isShowBalance ? (0, jsx_runtime_1.jsx)(Formatter_1.default, { start: "$", value: balanceInUSD }) : "****" })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g1, textAlign: "right" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { color: theme.palette.text.alertStatus, fontWeight: theme.typography.fontWeight700 }), children: isShowBalance ? ((0, jsx_runtime_1.jsx)(Formatter_1.default, { value: 70000 })) : ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
41
46
|
fontSize: theme.typography.fontSize14,
|
|
42
47
|
fontWeight: theme.typography.fontWeight600,
|
|
43
48
|
color: theme.palette.text.black,
|
|
44
|
-
}, children: "
|
|
49
|
+
}, children: "****" })) }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.valueDescription), { color: theme.palette.text.alertStatus }), children: isShowBalance ? ((0, jsx_runtime_1.jsx)(Formatter_1.default, { value: 3.72 })) : ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
45
50
|
fontSize: theme.typography.fontSize12,
|
|
46
51
|
fontWeight: theme.typography.fontWeight600,
|
|
47
52
|
color: theme.palette.text.accent2,
|
|
48
|
-
}, children: "
|
|
53
|
+
}, children: "****" })) })] })] }));
|
|
49
54
|
};
|
|
50
55
|
exports.TokenItem = TokenItem;
|
|
51
56
|
exports.default = exports.TokenItem;
|
|
@@ -76,8 +76,6 @@ var TokensBoard = function () {
|
|
|
76
76
|
}, children: "PnL" })] })), tokens === null || tokens === void 0 ? void 0 : tokens.map(function (item) {
|
|
77
77
|
var stringifiedTokenData = JSON.stringify(__assign({}, item));
|
|
78
78
|
return ((0, jsx_runtime_1.jsx)(TokenItem_1.default, { showSmallAssets: showSmallAssets, tokenData: stringifiedTokenData }, item.id));
|
|
79
|
-
}), !tokens && (0, jsx_runtime_1.jsx)(WaitingData_1.default, { sx: { margin: "auto" } })] })
|
|
80
|
-
borderColor: theme.palette.border.accent,
|
|
81
|
-
} })] }));
|
|
79
|
+
}), !tokens && (0, jsx_runtime_1.jsx)(WaitingData_1.default, { sx: { margin: "auto" } })] })] }));
|
|
82
80
|
};
|
|
83
81
|
exports.default = TokensBoard;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GeneralProps } from "../../../types/ui";
|
|
2
|
+
import { SxProps } from "@mui/material";
|
|
3
|
+
interface ActivityViewProps extends GeneralProps {
|
|
4
|
+
sx?: SxProps;
|
|
5
|
+
}
|
|
6
|
+
export declare const ActivityView: {
|
|
7
|
+
(props: ActivityViewProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
export default ActivityView;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ActivityView = void 0;
|
|
8
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
var react_1 = require("react");
|
|
10
|
+
var ChildPageLayout_1 = __importDefault(require("../../layouts/ChildPageLayout"));
|
|
11
|
+
var PageHeader_1 = __importDefault(require("../../ui/PageHeader"));
|
|
12
|
+
var SwiperControlled_1 = __importDefault(require("../../ui/SwiperControlled"));
|
|
13
|
+
var useActivities_1 = __importDefault(require("../../../hooks/useActivities"));
|
|
14
|
+
var material_1 = require("@mui/material");
|
|
15
|
+
var ThemeProvider_1 = require("../../../providers/ThemeProvider");
|
|
16
|
+
var react_2 = require("swiper/react");
|
|
17
|
+
var ActivitiesTypeSlice_1 = __importDefault(require("../../ui/ActivitiesTypeSlice"));
|
|
18
|
+
var ActivityView = function (props) {
|
|
19
|
+
var sx = props.sx;
|
|
20
|
+
var theme = (0, ThemeProvider_1.useTheme)();
|
|
21
|
+
var swiperRef = (0, react_1.useRef)(null);
|
|
22
|
+
var activityTypes = (0, useActivities_1.default)().activityTypes;
|
|
23
|
+
var _a = (0, react_1.useState)(0), activeTab = _a[0], setActiveTab = _a[1];
|
|
24
|
+
var handleSlideChange = function (index) {
|
|
25
|
+
setActiveTab(index);
|
|
26
|
+
};
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: "Activities" }), sx: sx, children: (0, jsx_runtime_1.jsx)(SwiperControlled_1.default, { ref: swiperRef,
|
|
28
|
+
// tabParamName="activity-tab"
|
|
29
|
+
swiperProps: {
|
|
30
|
+
slidesPerView: 1,
|
|
31
|
+
spaceBetween: 40,
|
|
32
|
+
}, onTabChange: handleSlideChange, tabs: activityTypes === null || activityTypes === void 0 ? void 0 : activityTypes.map(function (type, index) {
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: type.name, value: index, "data-index": index, sx: {
|
|
34
|
+
padding: "".concat(theme.mixins.customPadding.p8, " ").concat(theme.mixins.customPadding.p16),
|
|
35
|
+
minHeight: "unset",
|
|
36
|
+
minWidth: "unset",
|
|
37
|
+
textTransform: "capitalize",
|
|
38
|
+
color: theme.palette.text.accent2,
|
|
39
|
+
transition: "all 0.3s linear",
|
|
40
|
+
fontSize: theme.typography.fontSize12,
|
|
41
|
+
borderColor: "currentcolor",
|
|
42
|
+
"&.Mui-selected": {
|
|
43
|
+
color: theme.palette.text.primary,
|
|
44
|
+
},
|
|
45
|
+
"&.Mui-selected::after": {
|
|
46
|
+
content: "''",
|
|
47
|
+
position: "absolute",
|
|
48
|
+
bottom: 0,
|
|
49
|
+
left: 0,
|
|
50
|
+
},
|
|
51
|
+
} }, index));
|
|
52
|
+
}), sx: {
|
|
53
|
+
height: "100%",
|
|
54
|
+
}, swiperStyle: {
|
|
55
|
+
flex: 1,
|
|
56
|
+
}, children: activityTypes === null || activityTypes === void 0 ? void 0 : activityTypes.map(function (type, index) {
|
|
57
|
+
return ((0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { style: {
|
|
58
|
+
position: "relative",
|
|
59
|
+
}, children: (0, jsx_runtime_1.jsx)(ActivitiesTypeSlice_1.default, { type: type, isActive: activeTab === index }) }, index));
|
|
60
|
+
}) }) }));
|
|
61
|
+
};
|
|
62
|
+
exports.ActivityView = ActivityView;
|
|
63
|
+
exports.ActivityView.displayName = "Activities";
|
|
64
|
+
exports.default = exports.ActivityView;
|