@homefile/components-v2 2.36.24 → 2.36.26
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,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { t } from 'i18next';
|
|
3
|
-
import { useState } from 'react';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
4
|
import { Box, Button, Stack, Text } from '@chakra-ui/react';
|
|
5
5
|
import { MyHomesStepBody, MyHomesStepWrapper, PropertyCards, } from '../../../components';
|
|
6
6
|
export const ConfirmProperty = ({ handleAddress = () => { }, isFirstHome, isLoading, properties = [], isWizard = false, }) => {
|
|
@@ -18,8 +18,19 @@ export const ConfirmProperty = ({ handleAddress = () => { }, isFirstHome, isLoad
|
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
];
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if ((properties === null || properties === void 0 ? void 0 : properties.length) > 0) {
|
|
23
|
+
setCurrentProperty(properties[0].id);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
setCurrentProperty('none');
|
|
27
|
+
}
|
|
28
|
+
}, [properties]);
|
|
29
|
+
const handleContinue = () => {
|
|
30
|
+
handleAddress === null || handleAddress === void 0 ? void 0 : handleAddress(currentProperty);
|
|
31
|
+
};
|
|
21
32
|
if (isWizard) {
|
|
22
|
-
return (_jsxs(Stack, { children: [_jsxs(Stack, { align: "center", borderRadius: "sm", w: "100%", py: "4", children: [_jsx(PropertyCards, { properties: propertiesWithNoneOfTheAbove, currentProperty: currentProperty, onChange: setCurrentProperty }), _jsx(Box, { px: "6", children: _jsx(Text, { variant: "home", textAlign: "center", children: footerText }) })] }), _jsx(Button, { onClick:
|
|
33
|
+
return (_jsxs(Stack, { children: [_jsxs(Stack, { align: "center", borderRadius: "sm", w: "100%", py: "4", children: [_jsx(PropertyCards, { properties: propertiesWithNoneOfTheAbove, currentProperty: currentProperty, onChange: setCurrentProperty }), _jsx(Box, { px: "6", children: _jsx(Text, { variant: "home", textAlign: "center", children: footerText }) })] }), _jsx(Button, { onClick: handleContinue, disabled: isLoading, children: t('buttons.continue') })] }));
|
|
23
34
|
}
|
|
24
|
-
return (_jsx(MyHomesStepWrapper, { isFirstHome: isFirstHome, children: _jsxs(MyHomesStepBody, { fadeDelay: 0, title: t('myHomes.properties.title'), subtitle: t('myHomes.properties.subtitle'), children: [_jsxs(Stack, { align: "center", bg: "lightViolet.1", borderRadius: "sm", w: "100%", py: "6", children: [_jsx(PropertyCards, { properties: propertiesWithNoneOfTheAbove, currentProperty: currentProperty, onChange: setCurrentProperty }), _jsx(Box, { px: "6", children: _jsx(Text, { variant: "home", textAlign: "center", children: footerText }) })] }), _jsx(Button, { onClick:
|
|
35
|
+
return (_jsx(MyHomesStepWrapper, { isFirstHome: isFirstHome, children: _jsxs(MyHomesStepBody, { fadeDelay: 0, title: t('myHomes.properties.title'), subtitle: t('myHomes.properties.subtitle'), children: [_jsxs(Stack, { align: "center", bg: "lightViolet.1", borderRadius: "sm", w: "100%", py: "6", children: [_jsx(PropertyCards, { properties: propertiesWithNoneOfTheAbove, currentProperty: currentProperty, onChange: setCurrentProperty }), _jsx(Box, { px: "6", children: _jsx(Text, { variant: "home", textAlign: "center", children: footerText }) })] }), _jsx(Button, { onClick: handleContinue, disabled: isLoading, children: t('buttons.continue') })] }) }));
|
|
25
36
|
};
|
|
@@ -2,13 +2,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useRadioGroup, Stack, Text } from '@chakra-ui/react';
|
|
3
3
|
import { RadioCard } from '../../../components';
|
|
4
4
|
export const PropertyCards = ({ properties, currentProperty, onChange, }) => {
|
|
5
|
+
var _a;
|
|
5
6
|
const { getRootProps, getRadioProps } = useRadioGroup({
|
|
6
7
|
name: 'properties',
|
|
7
|
-
|
|
8
|
+
value: currentProperty,
|
|
8
9
|
onChange,
|
|
9
10
|
});
|
|
10
11
|
const group = getRootProps();
|
|
11
|
-
const hasProperties = (properties === null || properties === void 0 ? void 0 : properties.length)
|
|
12
|
+
const hasProperties = ((_a = properties === null || properties === void 0 ? void 0 : properties.length) !== null && _a !== void 0 ? _a : 0) > 0;
|
|
12
13
|
if (!hasProperties)
|
|
13
14
|
return null;
|
|
14
15
|
return (_jsx(Stack, Object.assign({}, group, { spacing: "base", p: "6", w: "100%", children: properties === null || properties === void 0 ? void 0 : properties.map(({ id, address: { address } }) => {
|