tek-wallet 0.0.443 → 0.0.444
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.
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
4
|
if (k2 === undefined) k2 = k;
|
|
16
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -59,14 +48,11 @@ var SwiperControlled_1 = __importDefault(require("../SwiperControlled"));
|
|
|
59
48
|
var useActivities_1 = __importDefault(require("../../../hooks/useActivities"));
|
|
60
49
|
var material_1 = require("@mui/material");
|
|
61
50
|
var react_2 = require("swiper/react");
|
|
62
|
-
var
|
|
63
|
-
var EmptyData_1 = __importDefault(require("../EmptyData"));
|
|
64
|
-
var getIcon_1 = __importDefault(require("../../../utils/getIcon"));
|
|
65
|
-
var prefix = "activities_";
|
|
51
|
+
var ActivitiesTypeSlice_1 = __importDefault(require("../ActivitiesTypeSlice"));
|
|
66
52
|
var Activities = (0, react_1.forwardRef)(function (props, ref) {
|
|
67
53
|
var drawerRef = (0, react_1.useRef)(null);
|
|
68
54
|
var theme = (0, material_1.useTheme)();
|
|
69
|
-
var
|
|
55
|
+
var activityTypes = (0, useActivities_1.default)().activityTypes;
|
|
70
56
|
var open = function () {
|
|
71
57
|
var _a;
|
|
72
58
|
(_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
@@ -92,7 +78,7 @@ var Activities = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
92
78
|
spaceBetween: 40,
|
|
93
79
|
}, tabs: activityTypes === null || activityTypes === void 0 ? void 0 : activityTypes.map(function (type, index) {
|
|
94
80
|
return ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: type.name, value: index, "data-index": index, sx: {
|
|
95
|
-
padding: "
|
|
81
|
+
padding: "".concat(theme.mixins.customPadding.p16, " ").concat(theme.mixins.customPadding.p8),
|
|
96
82
|
minHeight: "unset",
|
|
97
83
|
minWidth: "unset",
|
|
98
84
|
textTransform: "capitalize",
|
|
@@ -108,17 +94,9 @@ var Activities = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
108
94
|
}, swiperStyle: {
|
|
109
95
|
flex: 1,
|
|
110
96
|
}, children: activityTypes === null || activityTypes === void 0 ? void 0 : activityTypes.map(function (type, index) {
|
|
111
|
-
|
|
112
|
-
var activitiesByType = activities === null || activities === void 0 ? void 0 : activities[type.slug];
|
|
113
|
-
var isEmpty = !(activitiesByType === null || activitiesByType === void 0 ? void 0 : activitiesByType.length);
|
|
114
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.SwiperSlide, { style: {
|
|
97
|
+
return ((0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { style: {
|
|
115
98
|
display: "flex",
|
|
116
|
-
}, children:
|
|
117
|
-
if (!activity)
|
|
118
|
-
return null;
|
|
119
|
-
var dataAsJson = JSON.stringify(activity);
|
|
120
|
-
return (0, jsx_runtime_1.jsx)(ActivityItem_1.default, { data: dataAsJson }, index);
|
|
121
|
-
}) }))] }, index));
|
|
99
|
+
}, children: (0, jsx_runtime_1.jsx)(ActivitiesTypeSlice_1.default, { type: type, isActive: true }) }, index));
|
|
122
100
|
}) }) }) }) }) }));
|
|
123
101
|
});
|
|
124
102
|
Activities.displayName = "Activities";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TransactionType } from "../../../services/axios/get-activities-service/type";
|
|
2
|
+
export interface ActivitiesTypeSlicePropsType {
|
|
3
|
+
type: TransactionType;
|
|
4
|
+
isActive?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare enum Status {
|
|
7
|
+
Loading = "loading",
|
|
8
|
+
Empty = "empty",
|
|
9
|
+
Filled = "filled"
|
|
10
|
+
}
|
|
11
|
+
declare function ActivitiesTypeSlice(props: ActivitiesTypeSlicePropsType): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default ActivitiesTypeSlice;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Status = void 0;
|
|
18
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
var material_1 = require("@mui/material");
|
|
20
|
+
var getIcon_1 = __importDefault(require("../../../utils/getIcon"));
|
|
21
|
+
var EmptyData_1 = __importDefault(require("../EmptyData"));
|
|
22
|
+
var ActivityItem_1 = __importDefault(require("../ActivityItem"));
|
|
23
|
+
var useActivities_1 = __importDefault(require("../../../hooks/useActivities"));
|
|
24
|
+
var react_1 = require("react");
|
|
25
|
+
var Status;
|
|
26
|
+
(function (Status) {
|
|
27
|
+
Status["Loading"] = "loading";
|
|
28
|
+
Status["Empty"] = "empty";
|
|
29
|
+
Status["Filled"] = "filled";
|
|
30
|
+
})(Status || (exports.Status = Status = {}));
|
|
31
|
+
var prefix = "activities_";
|
|
32
|
+
function ActivitiesTypeSlice(props) {
|
|
33
|
+
var _a;
|
|
34
|
+
var theme = (0, material_1.useTheme)();
|
|
35
|
+
var _b = (0, useActivities_1.default)(), activities = _b.activities, updateActivities = _b.updateActivities;
|
|
36
|
+
var type = props.type, isActive = props.isActive;
|
|
37
|
+
var activitiesByType = (0, react_1.useMemo)(function () {
|
|
38
|
+
if (!(type === null || type === void 0 ? void 0 : type.slug))
|
|
39
|
+
return undefined;
|
|
40
|
+
return activities === null || activities === void 0 ? void 0 : activities[type.slug];
|
|
41
|
+
}, [type, activities]);
|
|
42
|
+
var status = (0, react_1.useMemo)(function () {
|
|
43
|
+
if (!(type === null || type === void 0 ? void 0 : type.slug) || !activitiesByType)
|
|
44
|
+
return Status.Loading;
|
|
45
|
+
if (!!(activitiesByType === null || activitiesByType === void 0 ? void 0 : activitiesByType.length))
|
|
46
|
+
return Status.Filled;
|
|
47
|
+
return Status.Empty;
|
|
48
|
+
}, [type, activitiesByType]);
|
|
49
|
+
(0, react_1.useEffect)(function () {
|
|
50
|
+
if (!isActive || !type)
|
|
51
|
+
return;
|
|
52
|
+
if (!!activitiesByType)
|
|
53
|
+
return;
|
|
54
|
+
updateActivities({
|
|
55
|
+
transaction_type: type.slug,
|
|
56
|
+
page: 1,
|
|
57
|
+
take: 10,
|
|
58
|
+
});
|
|
59
|
+
}, [isActive, type, activitiesByType, updateActivities]);
|
|
60
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [status === Status.Empty && ((0, jsx_runtime_1.jsx)(EmptyData_1.default, { icon: (0, getIcon_1.default)(prefix + "empty_" + type.slug), description: "No ".concat((_a = type.name) === null || _a === void 0 ? void 0 : _a.toLowerCase(), " activity") })), status === Status.Filled && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, paddingTop: theme.mixins.customPadding.p16 }), children: activitiesByType === null || activitiesByType === void 0 ? void 0 : activitiesByType.map(function (activity, index) {
|
|
61
|
+
if (!activity)
|
|
62
|
+
return null;
|
|
63
|
+
var dataAsJson = JSON.stringify(activity);
|
|
64
|
+
return (0, jsx_runtime_1.jsx)(ActivityItem_1.default, { data: dataAsJson }, index);
|
|
65
|
+
}) }))] }));
|
|
66
|
+
}
|
|
67
|
+
exports.default = ActivitiesTypeSlice;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Transaction, TransactionSlug, TransactionType } from "../../services/axios/get-activities-service/type";
|
|
1
|
+
import { GetActivitiesServiceQuery, Transaction, TransactionSlug, TransactionType } from "../../services/axios/get-activities-service/type";
|
|
2
2
|
export interface ActivitiesProviderDataType {
|
|
3
3
|
isLoadingActivities: boolean;
|
|
4
4
|
activities: Activities | undefined;
|
|
5
|
-
updateActivities: () => void;
|
|
5
|
+
updateActivities: (query?: GetActivitiesServiceQuery) => void;
|
|
6
6
|
activityTypes: ActivityTypes[] | undefined;
|
|
7
7
|
page: number;
|
|
8
8
|
gotoPage: (page: number) => void;
|