@redneckz/wildless-cms-uni-blocks 0.14.660 → 0.14.661
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/bundle/api/RetailAPI/getTaskStatus.d.ts +3 -3
- package/bundle/bundle.umd.js +37 -21
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/CreditForm/CreditFormStatus.d.ts +1 -0
- package/bundle/components/CreditForm/PendingStatusContent.d.ts +3 -1
- package/bundle/ui-kit/FormField/validators.d.ts +1 -0
- package/bundle/ui-kit/TimerCircle/Timer.d.ts +1 -2
- package/bundle/ui-kit/TimerCircle/TimerCircle.d.ts +1 -0
- package/dist/api/RetailAPI/getTaskStatus.d.ts +3 -3
- package/dist/api/RetailAPI/getTaskStatus.js +3 -3
- package/dist/api/RetailAPI/getTaskStatus.js.map +1 -1
- package/dist/components/CreditCardForm/CreditCardFormStatusTracker.js +3 -3
- package/dist/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
- package/dist/components/CreditCardForm/calculateInputs.js +2 -0
- package/dist/components/CreditCardForm/calculateInputs.js.map +1 -1
- package/dist/components/CreditForm/CreditFormStatus.d.ts +1 -0
- package/dist/components/CreditForm/CreditFormStatus.js +7 -3
- package/dist/components/CreditForm/CreditFormStatus.js.map +1 -1
- package/dist/components/CreditForm/CreditFormStatusTracker.js +7 -6
- package/dist/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
- package/dist/components/CreditForm/PendingStatusContent.d.ts +3 -1
- package/dist/components/CreditForm/PendingStatusContent.js +2 -2
- package/dist/components/CreditForm/PendingStatusContent.js.map +1 -1
- package/dist/components/CreditForm/calculateInputs.js +2 -0
- package/dist/components/CreditForm/calculateInputs.js.map +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/dist/ui-kit/FormField/validators.d.ts +1 -0
- package/dist/ui-kit/FormField/validators.js +3 -1
- package/dist/ui-kit/FormField/validators.js.map +1 -1
- package/dist/ui-kit/TimerCircle/Timer.d.ts +1 -2
- package/dist/ui-kit/TimerCircle/TimerCircle.d.ts +1 -0
- package/dist/ui-kit/TimerCircle/TimerCircle.js +8 -2
- package/dist/ui-kit/TimerCircle/TimerCircle.js.map +1 -1
- package/lib/api/RetailAPI/getTaskStatus.d.ts +3 -3
- package/lib/api/RetailAPI/getTaskStatus.js +3 -3
- package/lib/api/RetailAPI/getTaskStatus.js.map +1 -1
- package/lib/components/CreditCardForm/CreditCardFormStatusTracker.js +3 -3
- package/lib/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
- package/lib/components/CreditCardForm/calculateInputs.js +2 -0
- package/lib/components/CreditCardForm/calculateInputs.js.map +1 -1
- package/lib/components/CreditForm/CreditFormStatus.d.ts +1 -0
- package/lib/components/CreditForm/CreditFormStatus.js +7 -3
- package/lib/components/CreditForm/CreditFormStatus.js.map +1 -1
- package/lib/components/CreditForm/CreditFormStatusTracker.js +7 -6
- package/lib/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
- package/lib/components/CreditForm/PendingStatusContent.d.ts +3 -1
- package/lib/components/CreditForm/PendingStatusContent.js +2 -2
- package/lib/components/CreditForm/PendingStatusContent.js.map +1 -1
- package/lib/components/CreditForm/calculateInputs.js +2 -0
- package/lib/components/CreditForm/calculateInputs.js.map +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js +2 -2
- package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/lib/ui-kit/FormField/validators.d.ts +1 -0
- package/lib/ui-kit/FormField/validators.js +1 -0
- package/lib/ui-kit/FormField/validators.js.map +1 -1
- package/lib/ui-kit/TimerCircle/Timer.d.ts +1 -2
- package/lib/ui-kit/TimerCircle/TimerCircle.d.ts +1 -0
- package/lib/ui-kit/TimerCircle/TimerCircle.js +8 -2
- package/lib/ui-kit/TimerCircle/TimerCircle.js.map +1 -1
- package/mobile/bundle/api/RetailAPI/getTaskStatus.d.ts +3 -3
- package/mobile/bundle/bundle.umd.js +37 -21
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/CreditForm/CreditFormStatus.d.ts +1 -0
- package/mobile/bundle/components/CreditForm/PendingStatusContent.d.ts +3 -1
- package/mobile/bundle/ui-kit/FormField/validators.d.ts +1 -0
- package/mobile/bundle/ui-kit/TimerCircle/Timer.d.ts +1 -2
- package/mobile/bundle/ui-kit/TimerCircle/TimerCircle.d.ts +1 -0
- package/mobile/dist/api/RetailAPI/getTaskStatus.d.ts +3 -3
- package/mobile/dist/api/RetailAPI/getTaskStatus.js +3 -3
- package/mobile/dist/api/RetailAPI/getTaskStatus.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/CreditCardFormStatusTracker.js +3 -3
- package/mobile/dist/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/calculateInputs.js +2 -0
- package/mobile/dist/components/CreditCardForm/calculateInputs.js.map +1 -1
- package/mobile/dist/components/CreditForm/CreditFormStatus.d.ts +1 -0
- package/mobile/dist/components/CreditForm/CreditFormStatus.js +7 -3
- package/mobile/dist/components/CreditForm/CreditFormStatus.js.map +1 -1
- package/mobile/dist/components/CreditForm/CreditFormStatusTracker.js +7 -6
- package/mobile/dist/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
- package/mobile/dist/components/CreditForm/PendingStatusContent.d.ts +3 -1
- package/mobile/dist/components/CreditForm/PendingStatusContent.js +2 -2
- package/mobile/dist/components/CreditForm/PendingStatusContent.js.map +1 -1
- package/mobile/dist/components/CreditForm/calculateInputs.js +2 -0
- package/mobile/dist/components/CreditForm/calculateInputs.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/validators.d.ts +1 -0
- package/mobile/dist/ui-kit/FormField/validators.js +3 -1
- package/mobile/dist/ui-kit/FormField/validators.js.map +1 -1
- package/mobile/dist/ui-kit/TimerCircle/Timer.d.ts +1 -2
- package/mobile/dist/ui-kit/TimerCircle/TimerCircle.d.ts +1 -0
- package/mobile/dist/ui-kit/TimerCircle/TimerCircle.js +8 -2
- package/mobile/dist/ui-kit/TimerCircle/TimerCircle.js.map +1 -1
- package/mobile/lib/api/RetailAPI/getTaskStatus.d.ts +3 -3
- package/mobile/lib/api/RetailAPI/getTaskStatus.js +3 -3
- package/mobile/lib/api/RetailAPI/getTaskStatus.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/CreditCardFormStatusTracker.js +3 -3
- package/mobile/lib/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/calculateInputs.js +2 -0
- package/mobile/lib/components/CreditCardForm/calculateInputs.js.map +1 -1
- package/mobile/lib/components/CreditForm/CreditFormStatus.d.ts +1 -0
- package/mobile/lib/components/CreditForm/CreditFormStatus.js +7 -3
- package/mobile/lib/components/CreditForm/CreditFormStatus.js.map +1 -1
- package/mobile/lib/components/CreditForm/CreditFormStatusTracker.js +7 -6
- package/mobile/lib/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
- package/mobile/lib/components/CreditForm/PendingStatusContent.d.ts +3 -1
- package/mobile/lib/components/CreditForm/PendingStatusContent.js +2 -2
- package/mobile/lib/components/CreditForm/PendingStatusContent.js.map +1 -1
- package/mobile/lib/components/CreditForm/calculateInputs.js +2 -0
- package/mobile/lib/components/CreditForm/calculateInputs.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js +2 -2
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/validators.d.ts +1 -0
- package/mobile/lib/ui-kit/FormField/validators.js +1 -0
- package/mobile/lib/ui-kit/FormField/validators.js.map +1 -1
- package/mobile/lib/ui-kit/TimerCircle/Timer.d.ts +1 -2
- package/mobile/lib/ui-kit/TimerCircle/TimerCircle.d.ts +1 -0
- package/mobile/lib/ui-kit/TimerCircle/TimerCircle.js +8 -2
- package/mobile/lib/ui-kit/TimerCircle/TimerCircle.js.map +1 -1
- package/mobile/src/api/RetailAPI/getTaskStatus.ts +3 -3
- package/mobile/src/components/CreditCardForm/CreditCardFormStatusTracker.tsx +3 -3
- package/mobile/src/components/CreditCardForm/calculateInputs.ts +4 -0
- package/mobile/src/components/CreditForm/CreditFormStatus.tsx +42 -29
- package/mobile/src/components/CreditForm/CreditFormStatusTracker.tsx +8 -6
- package/mobile/src/components/CreditForm/PendingStatusContent.tsx +36 -33
- package/mobile/src/components/CreditForm/calculateInputs.ts +4 -0
- package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +2 -1
- package/mobile/src/ui-kit/FormField/validators.ts +6 -0
- package/mobile/src/ui-kit/TimerCircle/Timer.tsx +1 -1
- package/mobile/src/ui-kit/TimerCircle/TimerCircle.tsx +33 -23
- package/package.json +2 -2
- package/src/api/RetailAPI/getTaskStatus.ts +3 -3
- package/src/components/CreditCardForm/CreditCardFormStatusTracker.tsx +3 -3
- package/src/components/CreditCardForm/calculateInputs.ts +4 -0
- package/src/components/CreditForm/CreditForm.fixture.tsx +8 -4
- package/src/components/CreditForm/CreditFormStatus.tsx +42 -29
- package/src/components/CreditForm/CreditFormStatusTracker.tsx +8 -6
- package/src/components/CreditForm/PendingStatusContent.tsx +36 -33
- package/src/components/CreditForm/calculateInputs.ts +4 -0
- package/src/ui-kit/FormField/getObjectValidator.tsx +2 -1
- package/src/ui-kit/FormField/validators.ts +6 -0
- package/src/ui-kit/TimerCircle/Timer.tsx +1 -1
- package/src/ui-kit/TimerCircle/TimerCircle.tsx +33 -23
|
@@ -3,12 +3,16 @@ import { DialogManager } from '../../ui-kit/DialogManager/DialogManager';
|
|
|
3
3
|
import { PopupManager } from '../../ui-kit/PopupManager/PopupManager';
|
|
4
4
|
import { CreditForm } from './CreditForm';
|
|
5
5
|
|
|
6
|
-
const MOCK_TOKEN = '
|
|
6
|
+
const MOCK_TOKEN = 'mock-key';
|
|
7
7
|
const MOCK_TASK_ID = '111111';
|
|
8
8
|
|
|
9
|
-
globalThis.sessionStorage?.
|
|
10
|
-
globalThis.sessionStorage?.
|
|
11
|
-
globalThis.localStorage.
|
|
9
|
+
const refreshToken = globalThis.sessionStorage?.getItem('refreshToken');
|
|
10
|
+
const accessToken = globalThis.sessionStorage?.getItem('accessToken');
|
|
11
|
+
const taskId = globalThis.localStorage.getItem('taskId');
|
|
12
|
+
|
|
13
|
+
!refreshToken && globalThis.sessionStorage?.setItem('refreshToken', MOCK_TOKEN);
|
|
14
|
+
!accessToken && globalThis.sessionStorage?.setItem('accessToken', MOCK_TOKEN);
|
|
15
|
+
!taskId && globalThis.localStorage.setItem('taskId', MOCK_TASK_ID);
|
|
12
16
|
|
|
13
17
|
export default {
|
|
14
18
|
default: (
|
|
@@ -15,6 +15,7 @@ type CreditFormStatusProps = UniBlockProps & {
|
|
|
15
15
|
title?: string;
|
|
16
16
|
description?: string;
|
|
17
17
|
interval?: number;
|
|
18
|
+
intervalExpireAction?: () => void;
|
|
18
19
|
sectionInfoTitle?: string;
|
|
19
20
|
sectionInfo?: (LabelProps & DescriptionProps)[];
|
|
20
21
|
sectionAdditionalTitle?: string;
|
|
@@ -34,36 +35,48 @@ export const CreditFormStatus = JSX<CreditFormStatusProps>(
|
|
|
34
35
|
sectionInfoAdditional,
|
|
35
36
|
buttonText,
|
|
36
37
|
interval,
|
|
38
|
+
intervalExpireAction = () => {
|
|
39
|
+
return;
|
|
40
|
+
},
|
|
37
41
|
...props
|
|
38
|
-
}) =>
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
42
|
+
}) => {
|
|
43
|
+
return (
|
|
44
|
+
<BlockWrapper {...props}>
|
|
45
|
+
<div className="flex flex-col md:flex-row items-center">
|
|
46
|
+
<Headline
|
|
47
|
+
headlineVersion="M"
|
|
48
|
+
title={title}
|
|
49
|
+
description={dsc}
|
|
50
|
+
align="text-left"
|
|
51
|
+
padding="p-xl"
|
|
52
|
+
className="w-full"
|
|
53
|
+
/>
|
|
54
|
+
{interval ? (
|
|
55
|
+
<TimerCircle interval={interval} intervalExpireAction={intervalExpireAction} />
|
|
56
|
+
) : null}
|
|
57
|
+
</div>
|
|
58
|
+
<SectionInfo title={sectionInfoTitle} items={sectionInfo} />
|
|
59
|
+
<SectionInfo title={sectionAdditionalTitle} items={sectionInfoAdditional} countColumns />
|
|
60
|
+
{infoCard?.__html ? (
|
|
61
|
+
<InfoCard
|
|
62
|
+
__html={infoCard?.__html}
|
|
63
|
+
icon={infoCard?.icon}
|
|
64
|
+
link={{
|
|
65
|
+
text: infoCard?.link?.text,
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
) : null}
|
|
69
|
+
{buttonText ? (
|
|
70
|
+
<LinkButton
|
|
71
|
+
href="/natural"
|
|
72
|
+
text={buttonText}
|
|
73
|
+
version="primary"
|
|
74
|
+
className="w-full mt-lg"
|
|
75
|
+
/>
|
|
76
|
+
) : null}
|
|
77
|
+
</BlockWrapper>
|
|
78
|
+
);
|
|
79
|
+
},
|
|
67
80
|
);
|
|
68
81
|
|
|
69
82
|
const SectionInfo = ({
|
|
@@ -36,15 +36,17 @@ export const CreditFormStatusTracker = JSX(() => {
|
|
|
36
36
|
return () => clearInterval(pullingInterval);
|
|
37
37
|
}, []);
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
const handleExpire = () => setStatus(STATUS_TYPE.rework);
|
|
40
|
+
|
|
41
|
+
return renderStatus(status, handleExpire);
|
|
40
42
|
});
|
|
41
43
|
|
|
42
|
-
const renderStatus = (status: STATUS_TYPE) => {
|
|
44
|
+
const renderStatus = (status: STATUS_TYPE, handleExpire: () => void) => {
|
|
43
45
|
const statusesMap: Record<STATUS_TYPE, JSX.Element> = {
|
|
44
|
-
IN_PROCESS: <PendingStatusContent />,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
IN_PROCESS: <PendingStatusContent handleExpireTimer={handleExpire} />,
|
|
47
|
+
CANCELLED: <FailedStatusContent />,
|
|
48
|
+
APPROVED: <SuccessStatusContent />,
|
|
49
|
+
REVISION: <ReworkStatusContent />,
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
return statusesMap[status] || null;
|
|
@@ -2,37 +2,40 @@ import { JSX } from '@redneckz/uni-jsx';
|
|
|
2
2
|
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
3
3
|
import { CreditFormStatus } from './CreditFormStatus';
|
|
4
4
|
|
|
5
|
-
export const PendingStatusContent = JSX(
|
|
6
|
-
|
|
5
|
+
export const PendingStatusContent = JSX(
|
|
6
|
+
({ handleExpireTimer }: { handleExpireTimer: () => void }) => {
|
|
7
|
+
const [leadForm] = useLocalStorage<Record<string, any>>('leadForm');
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
9
|
+
return (
|
|
10
|
+
<CreditFormStatus
|
|
11
|
+
interval={300}
|
|
12
|
+
intervalExpireAction={handleExpireTimer}
|
|
13
|
+
title="Заявка успешно отправлена"
|
|
14
|
+
description="Не закрывайте окно, скоро сообщим результат"
|
|
15
|
+
sectionInfoTitle="Заявленные условия по кредиту"
|
|
16
|
+
sectionInfo={[
|
|
17
|
+
{
|
|
18
|
+
label: 'Название продукта',
|
|
19
|
+
description: 'Кредит на любые цели',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: 'Цель кредита',
|
|
23
|
+
description: 'На любые цели',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: 'Сумма',
|
|
27
|
+
description: leadForm?.moneyValue?.toLocaleString() + ' ₽',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: 'Срок кредита',
|
|
31
|
+
description: leadForm?.monthsValue + ' мес',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: 'Тип платежа',
|
|
35
|
+
description: leadForm?.isAnnuity ? 'Аннуитетный' : 'Дифференцированный',
|
|
36
|
+
},
|
|
37
|
+
]}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
);
|
|
@@ -14,6 +14,7 @@ export const calculateInputs = (getValue: GetValue) => (inputs: FieldDef[], step
|
|
|
14
14
|
checkBusinessOwner(_, getValue),
|
|
15
15
|
checkConsentPfrFlg(_, getValue),
|
|
16
16
|
checkAddressFillFromESIA(_, getValue),
|
|
17
|
+
checkAddressFact(_, getValue),
|
|
17
18
|
checkCondition(_, getValue),
|
|
18
19
|
].some(Boolean)
|
|
19
20
|
) {
|
|
@@ -35,6 +36,9 @@ const checkConsentPfrFlg = ({ name }: FieldDef, getValue: GetValue) =>
|
|
|
35
36
|
const checkAddressFillFromESIA = ({ name, filledByEsia }: FieldDef, getValue: GetValue) =>
|
|
36
37
|
name?.startsWith('address') && getValue('esiaAccountTypeCd')?.key && filledByEsia;
|
|
37
38
|
|
|
39
|
+
const checkAddressFact = ({ name }: FieldDef, getValue: GetValue) =>
|
|
40
|
+
name === 'addressFact' && getValue('addressMatch');
|
|
41
|
+
|
|
38
42
|
export const checkCondition = ({ condition }: FieldDef, getValue: GetValue) =>
|
|
39
43
|
condition?.name &&
|
|
40
44
|
condition?.values?.some((_) => {
|
|
@@ -3,6 +3,7 @@ import { type Validator } from '../../validation/validator';
|
|
|
3
3
|
import { getNamesFromInput } from './getNamesFromInput';
|
|
4
4
|
import {
|
|
5
5
|
addressDaDataValidator,
|
|
6
|
+
addressOrganizationValidator,
|
|
6
7
|
agreementValidator,
|
|
7
8
|
codeWordValidator,
|
|
8
9
|
defaultSelectValidator,
|
|
@@ -83,7 +84,7 @@ export const validatorObj: Record<string, Validator> = {
|
|
|
83
84
|
armyIdFlg: agreementValidator,
|
|
84
85
|
sex: defaultValidator('Укажите свой пол'),
|
|
85
86
|
addressRegistration: addressDaDataValidator(),
|
|
86
|
-
organizationAddress:
|
|
87
|
+
organizationAddress: addressOrganizationValidator(),
|
|
87
88
|
participantDateRegistration: defaultValidator('Укажите дату регистрации'),
|
|
88
89
|
retirementIncome: defaultValidator(),
|
|
89
90
|
otherIncome: defaultValidator(),
|
|
@@ -71,6 +71,12 @@ const addressDaDataValidate = (address: Address) =>
|
|
|
71
71
|
|
|
72
72
|
export const addressDaDataValidator = () =>
|
|
73
73
|
validator(addressDaDataValidate)('Укажите регион, город/населенный пункт, улицу, дом, квартиру');
|
|
74
|
+
|
|
75
|
+
export const addressOrganizationValidator = () =>
|
|
76
|
+
validator((address: Address) => Boolean(address.fiasCode && address.city && address.house))(
|
|
77
|
+
'Укажите регион, город/населенный пункт, улицу, дом',
|
|
78
|
+
);
|
|
79
|
+
|
|
74
80
|
export const codeWordValidator = (errorMsg?: string) =>
|
|
75
81
|
validator(
|
|
76
82
|
(_) =>
|
|
@@ -7,36 +7,46 @@ import { Timer } from './Timer';
|
|
|
7
7
|
|
|
8
8
|
interface TimerCircleProps {
|
|
9
9
|
interval?: number;
|
|
10
|
+
intervalExpireAction?: () => void | null;
|
|
10
11
|
title?: string;
|
|
11
12
|
__html?: string;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
export const TimerCircle = JSX<TimerCircleProps>(
|
|
15
|
-
|
|
15
|
+
export const TimerCircle = JSX<TimerCircleProps>(
|
|
16
|
+
({ interval = 0, intervalExpireAction = () => null, title, __html }) => {
|
|
17
|
+
const [time, setTime] = useState(interval);
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
const setTimeWithHandleExpire = (value: number) => {
|
|
20
|
+
if (value === 0) {
|
|
21
|
+
intervalExpireAction();
|
|
22
|
+
}
|
|
23
|
+
setTime(value);
|
|
24
|
+
};
|
|
18
25
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<div
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
`relative flex items-center justify-center w-24 h-24 rounded-full bg-gray text-transparent mb-5`,
|
|
26
|
-
)}
|
|
27
|
-
>
|
|
26
|
+
const gradientPercentage = 100 - ((interval - time) / interval) * 100;
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div>
|
|
30
|
+
{title ? <Headline title={title} headlineVersion="S" /> : null}
|
|
31
|
+
<div className="flex justify-center items-center flex-col">
|
|
28
32
|
<div
|
|
29
|
-
className=
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
className={style(
|
|
34
|
+
`relative flex items-center justify-center w-24 h-24 rounded-full bg-gray text-transparent mb-5`,
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
37
|
+
<div
|
|
38
|
+
className="absolute inset-0 rounded-full"
|
|
39
|
+
style={{
|
|
40
|
+
background: `conic-gradient(rgb(66, 171, 68) ${gradientPercentage}%, rgb(125, 126, 127) 0deg)`,
|
|
41
|
+
}}
|
|
42
|
+
/>
|
|
43
|
+
<div className="z-10 flex items-center justify-center px-4 py-2 rounded-full w-20 h-20 bg-white text-primary-text text-m">
|
|
44
|
+
<Timer interval={interval} time={time} setTime={setTimeWithHandleExpire} />
|
|
45
|
+
</div>
|
|
36
46
|
</div>
|
|
47
|
+
{__html ? <RichText __html={__html} /> : null}
|
|
37
48
|
</div>
|
|
38
|
-
{__html ? <RichText __html={__html} /> : null}
|
|
39
49
|
</div>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
);
|
|
51
|
+
},
|
|
52
|
+
);
|