@weareconceptstudio/account 0.2.6 → 0.2.8
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/AccountButton/style.js +112 -41
- package/dist/components/AccountContainer/index.d.ts +9 -2
- package/dist/components/AccountContainer/index.js +3 -2
- package/dist/components/TotalCheckout/FreeShippingComp/index.d.ts +8 -0
- package/dist/components/TotalCheckout/FreeShippingComp/index.js +23 -0
- package/dist/components/TotalCheckout/FreeShippingComp/style.d.ts +2 -0
- package/dist/components/TotalCheckout/FreeShippingComp/style.js +101 -0
- package/dist/components/TotalCheckout/PromoCodeComp/index.d.ts +5 -0
- package/dist/components/TotalCheckout/PromoCodeComp/index.js +29 -0
- package/dist/components/TotalCheckout/PromoCodeComp/style.d.ts +2 -0
- package/dist/components/TotalCheckout/PromoCodeComp/style.js +127 -0
- package/dist/components/TotalCheckout/PromoCodeComp/utils.d.ts +10 -0
- package/dist/components/TotalCheckout/PromoCodeComp/utils.js +14 -0
- package/dist/components/TotalCheckout/index.js +10 -4
- package/dist/modules/account/AccountBalanceTemplate/HeroBalance/ProgressBalance/ProgressComponent/index.d.ts +12 -0
- package/dist/modules/account/AccountBalanceTemplate/HeroBalance/ProgressBalance/ProgressComponent/index.js +45 -0
- package/dist/modules/account/AccountBalanceTemplate/HeroBalance/ProgressBalance/ProgressComponent/style.d.ts +2 -0
- package/dist/modules/account/AccountBalanceTemplate/HeroBalance/ProgressBalance/ProgressComponent/style.js +54 -0
- package/dist/modules/account/AccountBalanceTemplate/HeroBalance/ProgressBalance/index.d.ts +9 -0
- package/dist/modules/account/AccountBalanceTemplate/HeroBalance/ProgressBalance/index.js +27 -0
- package/dist/modules/account/AccountBalanceTemplate/HeroBalance/ProgressBalance/style.d.ts +2 -0
- package/dist/modules/account/AccountBalanceTemplate/HeroBalance/ProgressBalance/style.js +83 -0
- package/dist/modules/account/AccountBalanceTemplate/HeroBalance/index.d.ts +13 -0
- package/dist/modules/account/AccountBalanceTemplate/HeroBalance/index.js +35 -0
- package/dist/modules/account/AccountBalanceTemplate/HeroBalance/style.d.ts +2 -0
- package/dist/modules/account/AccountBalanceTemplate/HeroBalance/style.js +118 -0
- package/dist/modules/account/AccountBalanceTemplate/HistoryBalance/ItemHistory/index.d.ts +8 -0
- package/dist/modules/account/AccountBalanceTemplate/HistoryBalance/ItemHistory/index.js +42 -0
- package/dist/modules/account/AccountBalanceTemplate/HistoryBalance/ItemHistory/style.d.ts +2 -0
- package/dist/modules/account/AccountBalanceTemplate/HistoryBalance/ItemHistory/style.js +144 -0
- package/dist/modules/account/AccountBalanceTemplate/HistoryBalance/index.d.ts +3 -0
- package/dist/modules/account/AccountBalanceTemplate/HistoryBalance/index.js +42 -0
- package/dist/modules/account/AccountBalanceTemplate/HistoryBalance/style.d.ts +2 -0
- package/dist/modules/account/AccountBalanceTemplate/HistoryBalance/style.js +90 -0
- package/dist/modules/account/AccountBalanceTemplate/StatusBalance/ItemStatus/index.d.ts +8 -0
- package/dist/modules/account/AccountBalanceTemplate/StatusBalance/ItemStatus/index.js +23 -0
- package/dist/modules/account/AccountBalanceTemplate/StatusBalance/index.d.ts +6 -0
- package/dist/modules/account/AccountBalanceTemplate/StatusBalance/index.js +77 -0
- package/dist/modules/account/AccountBalanceTemplate/StatusBalance/style.d.ts +2 -0
- package/dist/modules/account/AccountBalanceTemplate/StatusBalance/style.js +234 -0
- package/dist/modules/account/AccountBalanceTemplate/index.d.ts +7 -0
- package/dist/modules/account/AccountBalanceTemplate/index.js +31 -0
- package/dist/modules/account/AccountBalanceTemplate/style.d.ts +2 -0
- package/dist/modules/account/AccountBalanceTemplate/style.js +31 -0
- package/dist/modules/account/AccountTemplate/style.js +7 -5
- package/dist/modules/account/index.d.ts +1 -0
- package/dist/modules/account/index.js +1 -0
- package/dist/modules/auth/ForgotPasswordTemplate/index.js +62 -45
- package/dist/modules/auth/ForgotPasswordTemplate/style.js +17 -9
- package/dist/modules/auth/ResetPasswordTemplate/style.js +5 -3
- package/dist/modules/auth/SignInTemplate/style.js +10 -6
- package/dist/modules/auth/VerifyEmailAddressTemplate/style.js +5 -3
- package/dist/modules/cart/CartTemplate/index.js +2 -2
- package/dist/modules/cart/CartTemplate/style.js +7 -5
- package/dist/modules/cart/SimpleItems/Item/index.js +1 -1
- package/dist/modules/cart/SimpleItems/ItemMobile/index.js +1 -1
- package/dist/modules/cart/SimpleItems/style.js +36 -4
- package/dist/modules/checkout/CheckoutTemplate/index.js +2 -2
- package/dist/modules/order/OrderedItems/style.js +40 -28
- package/dist/styles/helperClass.js +8 -0
- package/dist/styles/theme.js +4 -0
- package/dist/styles/variables.js +5 -0
- package/dist/translations/en.d.ts +18 -0
- package/dist/translations/en.js +20 -0
- package/dist/translations/hy.d.ts +18 -0
- package/dist/translations/hy.js +20 -0
- package/dist/translations/index.d.ts +54 -0
- package/dist/translations/ru.d.ts +18 -0
- package/dist/translations/ru.js +20 -0
- package/package.json +1 -1
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
const ItemHistoryStyle = styled.div `
|
|
3
|
+
--account_min_item_distance_inner_category: var(--sp1x);
|
|
4
|
+
--account_activity_pad: var(--sp1x) var(--sp2x);
|
|
5
|
+
--account_radius_activity: var(--sp5x);
|
|
6
|
+
--account_distance_line: var(--sp4x) 0;
|
|
7
|
+
--account_mobile_distance_row_gap: var(--sp3x);
|
|
8
|
+
|
|
9
|
+
.inner-wrapper-info {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
|
|
13
|
+
> :nth-child(n) {
|
|
14
|
+
padding-right: var(--account_min_item_distance_inner_category);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
> :first-child {
|
|
18
|
+
text-align: left;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
> :last-child {
|
|
22
|
+
flex: 1;
|
|
23
|
+
text-align: right;
|
|
24
|
+
min-width: fit-content;
|
|
25
|
+
padding-right: 0px;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.line-info {
|
|
30
|
+
margin: var(--account_distance_line);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.activity-info-text {
|
|
34
|
+
background-color: var(--account_secondaryColor11);
|
|
35
|
+
padding: var(--account_activity_pad);
|
|
36
|
+
border-radius: var(--account_radius_activity);
|
|
37
|
+
width: fit-content;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.amount-info-text {
|
|
41
|
+
color: var(--account_secondaryColor12);
|
|
42
|
+
|
|
43
|
+
&.subtract {
|
|
44
|
+
color: var(--account_errorColor);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.mobile-amount-info-text,
|
|
49
|
+
.mobile-date-info-text {
|
|
50
|
+
display: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* //! 1920 */
|
|
54
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeL}) {
|
|
55
|
+
--account_activity_pad: var(--sp1x) var(--sp2x);
|
|
56
|
+
--account_radius_activity: var(--sp5x);
|
|
57
|
+
--account_distance_line: var(--sp3x) 0 var(--sp2-5x);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* //! 1510 */
|
|
61
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeM}) {
|
|
62
|
+
--account_activity_pad: var(--sp1x) var(--sp2x);
|
|
63
|
+
--account_radius_activity: var(--sp5x);
|
|
64
|
+
--account_distance_line: var(--sp3x) 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* //! 1440 */
|
|
68
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeMMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeS}) {
|
|
69
|
+
--account_activity_pad: var(--sp1x) var(--sp2x);
|
|
70
|
+
--account_radius_activity: var(--sp5x);
|
|
71
|
+
--account_distance_line: var(--sp2-5x) 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* //! 1280 */
|
|
75
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXS}) {
|
|
76
|
+
--account_activity_pad: var(--sp1x) var(--sp2x);
|
|
77
|
+
--account_radius_activity: var(--sp5x);
|
|
78
|
+
--account_distance_line: var(--sp2x) 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* //! 1024 */
|
|
82
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSize}) {
|
|
83
|
+
--account_activity_pad: var(--sp0-5x) var(--sp1-5x);
|
|
84
|
+
--account_radius_activity: var(--sp5x);
|
|
85
|
+
--account_distance_line: var(--sp2x) 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* //! 768 */
|
|
89
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeS}) {
|
|
90
|
+
--account_activity_pad: var(--sp0-5x) var(--sp1-5x);
|
|
91
|
+
--account_radius_activity: var(--sp5x);
|
|
92
|
+
--account_distance_line: var(--sp2x) 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* //! mobile */
|
|
96
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeSMin}) {
|
|
97
|
+
--account_activity_pad: var(--sp0-5x) var(--sp1x);
|
|
98
|
+
--account_radius_activity: var(--sp5x);
|
|
99
|
+
--account_distance_line: var(--sp2-5x) 0;
|
|
100
|
+
--account_min_item_distance_inner_category: var(--sp2x);
|
|
101
|
+
|
|
102
|
+
.mobile-amount-info-text,
|
|
103
|
+
.mobile-date-info-text {
|
|
104
|
+
display: inline-block;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.wrapper-activity-text {
|
|
108
|
+
display: flex;
|
|
109
|
+
justify-content: flex-end;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.inner-wrapper-info {
|
|
113
|
+
display: grid;
|
|
114
|
+
grid-template-columns: repeat(2, 0.5fr);
|
|
115
|
+
align-items: flex-start;
|
|
116
|
+
row-gap: var(--account_mobile_distance_row_gap);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.amount-info-text {
|
|
120
|
+
grid-area: 2/1/2/3;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.date-info-text {
|
|
124
|
+
font-weight: 400;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.inner-wrapper-info {
|
|
128
|
+
> :nth-child(n) {
|
|
129
|
+
padding-right: 0;
|
|
130
|
+
text-align: center;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
> :first-child {
|
|
134
|
+
text-align: left;
|
|
135
|
+
padding-right: var(--account_min_item_distance_inner_category);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
> :last-child {
|
|
139
|
+
text-align: left;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
`;
|
|
144
|
+
export default ItemHistoryStyle;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { api, Text, useTranslation } from '@weareconceptstudio/core';
|
|
3
|
+
//* Styles
|
|
4
|
+
import HistoryBalanceStyle from './style';
|
|
5
|
+
//* Component
|
|
6
|
+
import ItemHistory from './ItemHistory';
|
|
7
|
+
import { Pagination } from '../../../../components';
|
|
8
|
+
const dataCategoryName = ['balanceCategoryDate', 'balanceCategoryActivity', 'balanceCategoryAmount'];
|
|
9
|
+
const HistoryBalance = () => {
|
|
10
|
+
const { translate, selectedLang } = useTranslation();
|
|
11
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
12
|
+
const [pagination, setPagination] = useState({
|
|
13
|
+
total: 0,
|
|
14
|
+
pageSize: 0,
|
|
15
|
+
});
|
|
16
|
+
const [data, setData] = useState();
|
|
17
|
+
const [loading, setLoading] = useState(true);
|
|
18
|
+
const getHistory = useCallback((page) => {
|
|
19
|
+
api.get({ url: 'balance-history', params: { page }, lang: selectedLang }).then((res) => {
|
|
20
|
+
setData(res.histories);
|
|
21
|
+
setPagination(res.pagination);
|
|
22
|
+
setLoading(false);
|
|
23
|
+
});
|
|
24
|
+
}, []);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
getHistory(currentPage);
|
|
27
|
+
}, [currentPage]);
|
|
28
|
+
return data && data.length ? (React.createElement(HistoryBalanceStyle, null,
|
|
29
|
+
React.createElement("div", { className: 'wrapper-title-section-history' },
|
|
30
|
+
React.createElement(Text, { className: 'account-primary-color1 account-font-medium account-p account-p1 first-letter title-section-history', text: 'balanceRecentActivity' }),
|
|
31
|
+
React.createElement("div", { className: 'line-title' })),
|
|
32
|
+
React.createElement("div", { className: 'wrapper-history-container' },
|
|
33
|
+
React.createElement("div", { className: 'wrapper-history-category-title', id: 'history-category-title' }, dataCategoryName.map((item, i) => {
|
|
34
|
+
return (React.createElement(Text, { key: i, className: 'account-primary-color1 account-font-medium account-p account-p1 first-letter category-desktop-text' }, translate(item)));
|
|
35
|
+
})),
|
|
36
|
+
React.createElement("div", { className: 'wrapper-history-content' },
|
|
37
|
+
React.createElement("div", { className: 'line-info first-line' }),
|
|
38
|
+
data &&
|
|
39
|
+
data.map((item, i) => (React.createElement(ItemHistory, { key: i, ...item }))),
|
|
40
|
+
React.createElement(Pagination, { activePageState: currentPage, ...pagination, onChange: (page) => setCurrentPage(page) }))))) : null;
|
|
41
|
+
};
|
|
42
|
+
export default HistoryBalance;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export default HistoryBalanceStyle;
|
|
2
|
+
declare const HistoryBalanceStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
const HistoryBalanceStyle = styled.section `
|
|
3
|
+
--account_distance_line_history_marginTB: var(--sp4x) 0 var(--sp3x);
|
|
4
|
+
--account_first_line_category_distance: var(--sp4x) 0 var(--sp4x);
|
|
5
|
+
--account_distance_pagination: var(--sp5x);
|
|
6
|
+
|
|
7
|
+
.wrapper-title-section-history {
|
|
8
|
+
.line-title {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 2px;
|
|
11
|
+
background-color: var(--account_primaryColor1);
|
|
12
|
+
margin: var(--account_distance_line_history_marginTB);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.wrapper-history-category-title {
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.line-info {
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 1px;
|
|
24
|
+
background-color: var(--account_primaryColor5);
|
|
25
|
+
|
|
26
|
+
&.first-line {
|
|
27
|
+
margin: var(--account_first_line_category_distance);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.pg-container {
|
|
32
|
+
justify-content: flex-end;
|
|
33
|
+
margin-top: var(--account_distance_pagination);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* //! 1920 */
|
|
37
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeL}) {
|
|
38
|
+
--account_distance_line_history_marginTB: var(--sp3x) 0 var(--sp3x);
|
|
39
|
+
--account_first_line_category_distance: var(--sp3x) 0 var(--sp3x);
|
|
40
|
+
--account_distance_pagination: var(--sp5x);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* //! 1510 */
|
|
44
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeM}) {
|
|
45
|
+
--account_distance_line_history_marginTB: var(--sp3x) 0 var(--sp3x);
|
|
46
|
+
--account_first_line_category_distance: var(--sp3x) 0 var(--sp3x);
|
|
47
|
+
--account_distance_pagination: var(--sp3x);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* //! 1440 */
|
|
51
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeMMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeS}) {
|
|
52
|
+
--account_distance_line_history_marginTB: var(--sp3x) 0 var(--sp3x);
|
|
53
|
+
--account_first_line_category_distance: var(--sp3x) 0 var(--sp2-5x);
|
|
54
|
+
--account_distance_pagination: var(--sp4x);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* //! 1280 */
|
|
58
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXS}) {
|
|
59
|
+
--account_distance_line_history_marginTB: var(--sp3x) 0 var(--sp3x);
|
|
60
|
+
--account_first_line_category_distance: var(--sp3x) 0 var(--sp2x);
|
|
61
|
+
--account_distance_pagination: var(--sp3x);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* //! 1024 */
|
|
65
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSize}) {
|
|
66
|
+
--account_distance_line_history_marginTB: var(--sp3x) 0 var(--sp3x);
|
|
67
|
+
--account_first_line_category_distance: var(--sp3x) 0 var(--sp2x);
|
|
68
|
+
--account_distance_pagination: var(--sp3x);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* //! 768 */
|
|
72
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeS}) {
|
|
73
|
+
--account_distance_line_history_marginTB: var(--sp3x) 0 var(--sp3x);
|
|
74
|
+
--account_first_line_category_distance: var(--sp3x) 0 var(--sp2x);
|
|
75
|
+
--account_distance_pagination: var(--sp3x);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* //! mobile */
|
|
79
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeSMin}) {
|
|
80
|
+
--account_distance_line_history_marginTB: var(--sp2x) 0 var(--sp3x);
|
|
81
|
+
--account_first_line_category_distance: 0;
|
|
82
|
+
--account_distance_pagination: var(--sp4x);
|
|
83
|
+
|
|
84
|
+
.wrapper-history-category-title,
|
|
85
|
+
.first-line {
|
|
86
|
+
display: none;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
export default HistoryBalanceStyle;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Text, useTranslation } from '@weareconceptstudio/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
//* Helpers
|
|
4
|
+
import { handlePriceCheckFunc } from '../../../../../utils/_functions';
|
|
5
|
+
const ItemStatus = ({ title, cashback, value, className }) => {
|
|
6
|
+
const { translate } = useTranslation();
|
|
7
|
+
return (React.createElement("div", { className: `wrapper-item-status ${className}` },
|
|
8
|
+
React.createElement("div", { className: 'title' },
|
|
9
|
+
React.createElement(Text, { className: 'account-primary-color1 account-font-medium account-p account-p3 first-letter title-status-progress' }, title)),
|
|
10
|
+
React.createElement("div", { className: 'circle-line' },
|
|
11
|
+
React.createElement("div", { className: 'circle' })),
|
|
12
|
+
React.createElement("div", { className: 'cashback' },
|
|
13
|
+
React.createElement(Text, { className: 'account-primary-color1 account-p account-p4 first-letter text-progress-cashback' },
|
|
14
|
+
cashback + '%',
|
|
15
|
+
" ",
|
|
16
|
+
translate('balanceCashback'))),
|
|
17
|
+
React.createElement("div", { className: 'value' },
|
|
18
|
+
React.createElement(Text, { className: 'account-primary-color1 account-p account-p4 first-letter text-progress-value' }, value ? (React.createElement(React.Fragment, null,
|
|
19
|
+
translate('balanceStarting'),
|
|
20
|
+
" ",
|
|
21
|
+
handlePriceCheckFunc(value, translate('priceValue')))) : (translate('balanceFirstOrderStatus'))))));
|
|
22
|
+
};
|
|
23
|
+
export default ItemStatus;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Text, useUi } from '@weareconceptstudio/core';
|
|
3
|
+
//* Styles
|
|
4
|
+
import StatusBalanceStyle from './style';
|
|
5
|
+
//* Component
|
|
6
|
+
import ItemStatus from './ItemStatus';
|
|
7
|
+
const StatusBalance = ({ allItem, activeStatus }) => {
|
|
8
|
+
const { winWidth } = useUi();
|
|
9
|
+
//! Refs
|
|
10
|
+
const wrapperStatusRef = useRef();
|
|
11
|
+
const resizableRefs = useRef();
|
|
12
|
+
const resizeTimeoutRef = useRef();
|
|
13
|
+
const statusActiveItem = useRef(false);
|
|
14
|
+
const styleRef = useRef();
|
|
15
|
+
const contentRef = useRef();
|
|
16
|
+
const outsideContentRef = useRef();
|
|
17
|
+
//! State
|
|
18
|
+
const [sizeLine, setSizeLine] = useState();
|
|
19
|
+
const [resize, setResize] = useState();
|
|
20
|
+
//! Resize logic
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const bodyElement = document.querySelector('body');
|
|
23
|
+
resizableRefs.current = new ResizeObserver((entries) => {
|
|
24
|
+
if (resizeTimeoutRef.current) {
|
|
25
|
+
clearTimeout(resizeTimeoutRef.current);
|
|
26
|
+
}
|
|
27
|
+
resizeTimeoutRef.current = setTimeout(() => {
|
|
28
|
+
setResize(entries[0].contentRect.height);
|
|
29
|
+
}, 300);
|
|
30
|
+
});
|
|
31
|
+
resizableRefs.current.observe(bodyElement);
|
|
32
|
+
return () => {
|
|
33
|
+
if (resizableRefs.current) {
|
|
34
|
+
resizableRefs.current.disconnect();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}, [winWidth]);
|
|
38
|
+
//! Calculate size range
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (wrapperStatusRef.current && resize && styleRef.current) {
|
|
41
|
+
const allCircle = wrapperStatusRef.current.querySelectorAll('.circle-line');
|
|
42
|
+
const sizeCircleLeftRight = [...allCircle].map((item) => Math.floor(item.getBoundingClientRect().left));
|
|
43
|
+
const differences = sizeCircleLeftRight.slice(1).map((value, index) => Math.floor(value - (sizeCircleLeftRight[index] + allCircle[0].getBoundingClientRect().width)));
|
|
44
|
+
setSizeLine(differences);
|
|
45
|
+
if (parseInt(contentRef.current.style.width) < winWidth) {
|
|
46
|
+
contentRef.current.style.width = '100%';
|
|
47
|
+
}
|
|
48
|
+
//! dragging logic
|
|
49
|
+
const isLessThan253 = differences.some((number) => number < 253);
|
|
50
|
+
if (isLessThan253 && contentRef.current) {
|
|
51
|
+
contentRef.current.style.width = differences.length * 351 + 'px';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (allItem.length) {
|
|
55
|
+
statusActiveItem.current = allItem.findIndex((item) => item.name?.toLowerCase() === activeStatus?.toLowerCase());
|
|
56
|
+
}
|
|
57
|
+
}, [resize, winWidth]);
|
|
58
|
+
return (React.createElement(StatusBalanceStyle, { ref: styleRef, className: 'account-progress-status-wrapper' },
|
|
59
|
+
React.createElement("div", { className: 'wrapper-title-section' },
|
|
60
|
+
React.createElement(Text, { className: 'account-primary-color1 account-font-medium account-p account-p1 first-letter status-title-section-progress', text: 'balanceStatus' }),
|
|
61
|
+
React.createElement("div", { className: 'line-title' })),
|
|
62
|
+
React.createElement("div", { ref: outsideContentRef, className: 'outside-wrapper-content' },
|
|
63
|
+
React.createElement("div", { ref: contentRef, className: 'content-wrapper' },
|
|
64
|
+
React.createElement("div", { ref: wrapperStatusRef, className: 'wrapper-status' }, allItem.length &&
|
|
65
|
+
statusActiveItem.current !== false &&
|
|
66
|
+
allItem.map((item, i, arr) => {
|
|
67
|
+
return (React.createElement(ItemStatus, { className: `${i == 0 ? 'start-item' : i == arr.length - 1 ? 'end-item' : ''} ${i <= statusActiveItem.current ? 'active-status' : ''}`, key: i, title: item.name, cashback: item.cashback, value: item.value }));
|
|
68
|
+
})),
|
|
69
|
+
React.createElement("div", { className: 'wrapper-line-all' }, allItem.length &&
|
|
70
|
+
statusActiveItem.current !== false &&
|
|
71
|
+
sizeLine &&
|
|
72
|
+
allItem.map((_, i, arr) => {
|
|
73
|
+
return (i < arr.length - 1 && (React.createElement("div", { key: i, className: `line`, style: { width: sizeLine[i] + 'px' } },
|
|
74
|
+
React.createElement("div", { className: `inner-line-background ${i < statusActiveItem.current ? 'active-status' : ''}` }))));
|
|
75
|
+
}))))));
|
|
76
|
+
};
|
|
77
|
+
export default StatusBalance;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export default StatusBalanceStyle;
|
|
2
|
+
declare const StatusBalanceStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
const StatusBalanceStyle = styled.div `
|
|
3
|
+
--account_line_size: calc(var(--sp1x) - var(--sp0-5x) / 2);
|
|
4
|
+
--account_progress_sizeCircle: var(--sp3x);
|
|
5
|
+
--account_line_border_radius: var(--sp1-5x);
|
|
6
|
+
--account_distance_line_marginTB: var(--sp4x) 0;
|
|
7
|
+
--account_distance_circle_marginT: var(--sp3x);
|
|
8
|
+
--account_distance_circle_marginB: var(--sp3x);
|
|
9
|
+
--account_cashback_distance_bottom: var(--sp2x);
|
|
10
|
+
--account_font_size_status_progress: var(--account_p4);
|
|
11
|
+
--account_line_height_status_progress: var(--account_lineHeightS);
|
|
12
|
+
--account_progress_inner_circle_size_pad: var(--sp0-5x);
|
|
13
|
+
--sizeInnerCircleP: 2px;
|
|
14
|
+
--account_distance_section_status: var(--sp7x);
|
|
15
|
+
|
|
16
|
+
margin-bottom: var(--account_distance_section_status);
|
|
17
|
+
|
|
18
|
+
.outside-wrapper-content {
|
|
19
|
+
width: 100%;
|
|
20
|
+
overflow: auto;
|
|
21
|
+
scrollbar-width: none;
|
|
22
|
+
-ms-overflow-style: none;
|
|
23
|
+
|
|
24
|
+
&::-webkit-scrollbar {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.content-wrapper {
|
|
30
|
+
position: relative;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.wrapper-status {
|
|
34
|
+
display: flex;
|
|
35
|
+
justify-content: space-between;
|
|
36
|
+
|
|
37
|
+
.wrapper-item-status {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
align-items: center;
|
|
41
|
+
|
|
42
|
+
&.start-item {
|
|
43
|
+
align-items: flex-start;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&.end-item {
|
|
47
|
+
align-items: flex-end;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&.active-status {
|
|
51
|
+
.circle-line {
|
|
52
|
+
.circle {
|
|
53
|
+
&:before {
|
|
54
|
+
background-color: var(--account_secondaryColor9);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.circle-line {
|
|
63
|
+
background-color: var(--account_secondaryColor10);
|
|
64
|
+
width: var(--account_progress_sizeCircle);
|
|
65
|
+
height: var(--account_progress_sizeCircle);
|
|
66
|
+
border-radius: 100%;
|
|
67
|
+
padding: var(--account_progress_inner_circle_size_pad);
|
|
68
|
+
margin-top: var(--account_distance_circle_marginT);
|
|
69
|
+
margin-bottom: var(--account_distance_circle_marginB);
|
|
70
|
+
|
|
71
|
+
.circle {
|
|
72
|
+
background-color: var(--account_backgroundColor);
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: 100%;
|
|
75
|
+
border-radius: 100%;
|
|
76
|
+
position: relative;
|
|
77
|
+
|
|
78
|
+
&:before {
|
|
79
|
+
content: ' ';
|
|
80
|
+
position: absolute;
|
|
81
|
+
left: 50%;
|
|
82
|
+
top: 50%;
|
|
83
|
+
transform: translate(-50%, -50%);
|
|
84
|
+
width: calc(100% + var(--sizeInnerCircleP));
|
|
85
|
+
height: calc(100% + var(--sizeInnerCircleP));
|
|
86
|
+
border-radius: 100%;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.line {
|
|
92
|
+
height: var(--account_line_size);
|
|
93
|
+
background-color: transparent;
|
|
94
|
+
width: 100%;
|
|
95
|
+
padding: 0 var(--sp1x);
|
|
96
|
+
will-change: transform;
|
|
97
|
+
|
|
98
|
+
.inner-line-background {
|
|
99
|
+
background-color: var(--account_secondaryColor10);
|
|
100
|
+
width: 100%;
|
|
101
|
+
height: var(--account_line_size);
|
|
102
|
+
border-radius: var(--account_line_border_radius);
|
|
103
|
+
|
|
104
|
+
&.active-status {
|
|
105
|
+
background-color: var(--account_secondaryColor9);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.title-status-progress {
|
|
111
|
+
font-size: var(--account_font_size_status_progress);
|
|
112
|
+
line-height: var(--account_line_height_status_progress);
|
|
113
|
+
font-weight: 600;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.wrapper-line-all {
|
|
117
|
+
position: absolute;
|
|
118
|
+
top: calc(var(--account_font_size_status_progress) * var(--account_line_height_status_progress) + var(--account_progress_sizeCircle) / 2 - var(--account_line_size) / 2 + var(--account_distance_circle_marginT));
|
|
119
|
+
width: 100%;
|
|
120
|
+
display: flex;
|
|
121
|
+
justify-content: space-between;
|
|
122
|
+
padding: 0 calc(var(--account_progress_sizeCircle));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.wrapper-title-section {
|
|
126
|
+
.line-title {
|
|
127
|
+
width: 100%;
|
|
128
|
+
height: 2px;
|
|
129
|
+
background-color: var(--account_primaryColor1);
|
|
130
|
+
margin: var(--account_distance_line_marginTB);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.cashback {
|
|
135
|
+
margin-bottom: var(--account_cashback_distance_bottom);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.text-progress-value {
|
|
139
|
+
color: var(--account_primaryColor5);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* //! 1920 */
|
|
143
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeL}) {
|
|
144
|
+
--account_line_size: calc(var(--sp1x) - var(--sp0-5x) / 2);
|
|
145
|
+
--account_progress_sizeCircle: calc(var(--sp2x) + var(--sp0-5x) / 2);
|
|
146
|
+
--account_progress_inner_circle_size_pad: 4px;
|
|
147
|
+
--account_line_border_radius: var(--sp1-5x);
|
|
148
|
+
--account_distance_line_marginTB: var(--sp2-5x) 0 var(--sp4x);
|
|
149
|
+
--account_distance_circle_marginT: var(--sp1x);
|
|
150
|
+
--account_distance_circle_marginB: var(--sp1x);
|
|
151
|
+
--account_cashback_distance_bottom: var(--sp1x);
|
|
152
|
+
--account_distance_section_status: var(--sp10x);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* //! 1510 */
|
|
156
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeLMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeM}) {
|
|
157
|
+
--account_line_size: var(--sp0-5x);
|
|
158
|
+
--account_progress_sizeCircle: calc(var(--sp2x) + var(--sp0-5x) / 2);
|
|
159
|
+
--account_progress_inner_circle_size_pad: 4px;
|
|
160
|
+
--account_line_border_radius: calc(var(--sp1x) + var(--sp0-5x) / 2);
|
|
161
|
+
--account_distance_line_marginTB: var(--sp3x) 0 var(--sp3x);
|
|
162
|
+
--account_distance_circle_marginT: var(--sp1x);
|
|
163
|
+
--account_distance_circle_marginB: var(--sp1x);
|
|
164
|
+
--account_cashback_distance_bottom: var(--sp1x);
|
|
165
|
+
--account_distance_section_status: var(--sp7x);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* //! 1440 */
|
|
169
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeMMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeS}) {
|
|
170
|
+
--account_line_size: var(--sp0-5x);
|
|
171
|
+
--account_progress_sizeCircle: calc(var(--sp2x) + var(--sp0-5x) / 2);
|
|
172
|
+
--account_progress_inner_circle_size_pad: 4px;
|
|
173
|
+
--account_line_border_radius: calc(var(--sp1x) + var(--sp0-5x) / 2);
|
|
174
|
+
--account_distance_line_marginTB: var(--sp3x) 0 var(--sp3x);
|
|
175
|
+
--account_distance_circle_marginT: var(--sp2-5x);
|
|
176
|
+
--account_distance_circle_marginB: var(--sp1x);
|
|
177
|
+
--account_cashback_distance_bottom: var(--sp1x);
|
|
178
|
+
--account_distance_section_status: var(--sp7x);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* //! 1280 */
|
|
182
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXS}) {
|
|
183
|
+
--account_line_size: var(--sp0-5x);
|
|
184
|
+
--account_progress_sizeCircle: calc(var(--sp2x) + var(--sp0-5x) / 2);
|
|
185
|
+
--account_progress_inner_circle_size_pad: 4px;
|
|
186
|
+
--account_line_border_radius: calc(var(--sp1x) + var(--sp0-5x) / 2);
|
|
187
|
+
--account_distance_line_marginTB: var(--sp3x) 0 var(--sp3x);
|
|
188
|
+
--account_distance_circle_marginT: var(--sp2-5x);
|
|
189
|
+
--account_distance_circle_marginB: var(--sp1x);
|
|
190
|
+
--account_cashback_distance_bottom: var(--sp1x);
|
|
191
|
+
--account_distance_section_status: var(--sp6x);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* //! 1024 */
|
|
195
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_DesktopSizeXSMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSize}) {
|
|
196
|
+
--account_line_size: var(--sp0-5x);
|
|
197
|
+
--account_progress_sizeCircle: calc(var(--sp2x) + var(--sp0-5x) / 2);
|
|
198
|
+
--account_progress_inner_circle_size_pad: 4px;
|
|
199
|
+
--account_line_border_radius: calc(var(--sp1x) + var(--sp0-5x) / 2);
|
|
200
|
+
--account_distance_line_marginTB: var(--sp3x) 0 var(--sp3x);
|
|
201
|
+
--account_distance_circle_marginT: var(--sp2-5x);
|
|
202
|
+
--account_distance_circle_marginB: var(--sp1x);
|
|
203
|
+
--account_cashback_distance_bottom: var(--sp1x);
|
|
204
|
+
--account_distance_section_status: var(--sp8x);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* //! 768 */
|
|
208
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeMin}) and (min-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeS}) {
|
|
209
|
+
--account_line_size: var(--sp0-5x);
|
|
210
|
+
--account_progress_sizeCircle: calc(var(--sp2x) + var(--sp0-5x) / 2);
|
|
211
|
+
--account_progress_inner_circle_size_pad: 4px;
|
|
212
|
+
--account_line_border_radius: calc(var(--sp1x) + var(--sp0-5x) / 2);
|
|
213
|
+
--account_distance_line_marginTB: var(--sp3x) 0 var(--sp3x);
|
|
214
|
+
--account_distance_circle_marginT: var(--sp2-5x);
|
|
215
|
+
--account_distance_circle_marginB: var(--sp1x);
|
|
216
|
+
--account_cashback_distance_bottom: var(--sp1x);
|
|
217
|
+
--account_distance_section_status: var(--sp8x);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/* //! mobile */
|
|
221
|
+
@media only screen and (max-width: ${(props) => props.theme.account.mediaQuery.account_TabletSizeSMin}) {
|
|
222
|
+
--account_line_size: calc(var(--sp0-5x) / 2);
|
|
223
|
+
--account_progress_sizeCircle: var(--sp2x);
|
|
224
|
+
--account_progress_inner_circle_size_pad: 2px;
|
|
225
|
+
--account_line_border_radius: calc(var(--sp1x) + var(--sp0-5x) / 2);
|
|
226
|
+
--account_distance_line_marginTB: var(--sp2x) 0 var(--sp1-5x);
|
|
227
|
+
--account_distance_circle_marginT: var(--sp2x);
|
|
228
|
+
--account_distance_circle_marginB: var(--sp1x);
|
|
229
|
+
--account_cashback_distance_bottom: var(--sp1x);
|
|
230
|
+
--sizeInnerCircleP: 0px;
|
|
231
|
+
--account_distance_section_status: var(--sp6x);
|
|
232
|
+
}
|
|
233
|
+
`;
|
|
234
|
+
export default StatusBalanceStyle;
|