@homefile/components-v2 1.0.10 → 1.0.12
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/homeAssistant/HomeAssistantStepper.js +1 -1
- package/dist/components/homeAssistant/HomeAssistantSteps.d.ts +1 -1
- package/dist/components/homeAssistant/HomeAssistantSteps.js +6 -12
- package/dist/components/homeAssistant/panel/ApplianceSteps.js +12 -11
- package/dist/components/homeBoard/HomeBoard.js +1 -1
- package/dist/components/tour/HomeBoardTour.js +1 -1
- package/dist/components/tour/LaunchpadTour.js +1 -1
- package/dist/components/tour/RoomsBoardTour.js +1 -1
- package/dist/hooks/useComponentStyles.d.ts +7 -1
- package/dist/hooks/useComponentStyles.js +3 -3
- package/dist/interfaces/homeAssistant/ApplianceSteps.interface.d.ts +1 -1
- package/dist/interfaces/homeAssistant/HomeAssistantPanel.interface.d.ts +1 -1
- package/dist/interfaces/homeAssistant/HomeAssistantSteps.interface.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/homeAssistant/HomeAssistantStepper.tsx +1 -1
- package/src/components/homeAssistant/HomeAssistantSteps.tsx +6 -14
- package/src/components/homeAssistant/panel/ApplianceSteps.tsx +19 -11
- package/src/components/homeBoard/HomeBoard.tsx +1 -1
- package/src/components/tour/HomeBoardTour.tsx +1 -1
- package/src/components/tour/LaunchpadTour.tsx +1 -1
- package/src/components/tour/RoomsBoardTour.tsx +1 -1
- package/src/hooks/useComponentStyles.ts +13 -3
- package/src/interfaces/homeAssistant/ApplianceSteps.interface.ts +1 -1
- package/src/interfaces/homeAssistant/HomeAssistantPanel.interface.ts +1 -1
- package/src/interfaces/homeAssistant/HomeAssistantSteps.interface.ts +1 -1
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { t } from 'i18next';
|
|
3
3
|
import { Box, Flex, Stack, Text } from '@chakra-ui/react';
|
|
4
4
|
export const HomeAssistantStepper = ({ currentStep, totalSteps, }) => {
|
|
5
|
-
return (_jsx(Flex, { gap: "1px", w: "100%", children: Array.from({ length: totalSteps }).map((_, index) => {
|
|
5
|
+
return (_jsx(Flex, { gap: "1px", w: "100%", zIndex: "2", children: Array.from({ length: totalSteps }).map((_, index) => {
|
|
6
6
|
return (_jsxs(Stack, { flex: "1", spacing: "1", children: [_jsx(Text, { fontFamily: "secondary", fontSize: "xs", textTransform: "uppercase", color: setTextColor(index + 1, currentStep), textAlign: "center", children: `${currentStep} ${t('addItemWizard.of')} ${totalSteps}` }), _jsx(Box, { h: "16px", bg: setBgColor(index + 1, currentStep) })] }, index));
|
|
7
7
|
}) }));
|
|
8
8
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { HomeAssistantStepsI } from '../../interfaces';
|
|
2
|
-
export declare const HomeAssistantSteps: ({ currentStep, onStepClick,
|
|
2
|
+
export declare const HomeAssistantSteps: ({ currentStep, onStepClick, currentPanel, }: HomeAssistantStepsI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,12 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Center, SimpleGrid, Stack } from '@chakra-ui/react';
|
|
3
3
|
import { HomeAssistantButton, HomeAssistantStepper } from '..';
|
|
4
4
|
import { homeAssistantSteps } from '../../helpers';
|
|
5
|
-
import { useState } from 'react';
|
|
6
5
|
import { useComponentStyles } from '../../hooks';
|
|
7
|
-
export const HomeAssistantSteps = ({ currentStep, onStepClick,
|
|
8
|
-
const
|
|
9
|
-
const stepId = `homeAssistantButton-${
|
|
10
|
-
const componentIds =
|
|
6
|
+
export const HomeAssistantSteps = ({ currentStep, onStepClick, currentPanel, }) => {
|
|
7
|
+
const wrapperZIndex = currentPanel ? undefined : '2';
|
|
8
|
+
const stepId = `homeAssistantButton-${currentPanel}`;
|
|
9
|
+
const componentIds = currentPanel
|
|
11
10
|
? [
|
|
12
11
|
'homeAssistantButton-1',
|
|
13
12
|
'homeAssistantButton-2',
|
|
@@ -17,13 +16,8 @@ export const HomeAssistantSteps = ({ currentStep, onStepClick, isPanelOpen, }) =
|
|
|
17
16
|
'homeAssistantButton-6',
|
|
18
17
|
]
|
|
19
18
|
: [];
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
setStep(step);
|
|
23
|
-
};
|
|
24
|
-
useComponentStyles(componentIds, stepId);
|
|
25
|
-
const wrapperZIndex = isPanelOpen ? undefined : '2';
|
|
26
|
-
return (_jsxs(Stack, { spacing: "8", w: "fit-content", position: "relative", top: ['-10px', '-30px'], zIndex: wrapperZIndex, children: [_jsx(HomeAssistantStepper, { currentStep: currentStep, totalSteps: 6 }), _jsx(SimpleGrid, { columns: [2, 3], spacing: "base", children: homeAssistantSteps.map((step, index) => (_jsx(Center, { w: "100%", children: _jsx(HomeAssistantButton, { currentStep: index + 1, onStepClick: handleStepClick, status: getStatus(index + 1, currentStep), step: step }) }, step.title))) })] }));
|
|
19
|
+
useComponentStyles({ ids: componentIds, selectedId: stepId, zIndex: '2' });
|
|
20
|
+
return (_jsxs(Stack, { spacing: "8", w: "fit-content", position: "relative", top: ['-10px', '-30px'], children: [_jsx(HomeAssistantStepper, { currentStep: currentStep, totalSteps: 6 }), _jsx(SimpleGrid, { columns: [2, 3], spacing: "base", children: homeAssistantSteps.map((step, index) => (_jsx(Center, { w: "100%", children: _jsx(HomeAssistantButton, { currentStep: index + 1, onStepClick: onStepClick, status: getStatus(index + 1, currentStep), step: step }) }, step.title))) })] }));
|
|
27
21
|
};
|
|
28
22
|
const getStatus = (index, currentStep) => {
|
|
29
23
|
if (index === currentStep)
|
|
@@ -3,68 +3,69 @@ import { t } from 'i18next';
|
|
|
3
3
|
import { Center, SimpleGrid, Stack, Text } from '@chakra-ui/react';
|
|
4
4
|
import { ApplianceButton } from '../..';
|
|
5
5
|
import { Fridge, Freezer, Washer, Dryer, Dishwasher, CookTop, Oven, Hood, Microwave, Range, } from '../../../assets/images';
|
|
6
|
+
import { useState } from 'react';
|
|
6
7
|
export const ApplianceSteps = ({ onClick }) => {
|
|
7
|
-
|
|
8
|
+
const [appliances, setAppliances] = useState([]);
|
|
9
|
+
const handleClick = (id) => {
|
|
10
|
+
if (appliances.includes(id)) {
|
|
11
|
+
const newAppliances = appliances.filter((appliance) => appliance !== id);
|
|
12
|
+
onClick(newAppliances);
|
|
13
|
+
return setAppliances(newAppliances);
|
|
14
|
+
}
|
|
15
|
+
setAppliances([...appliances, id]);
|
|
16
|
+
onClick([...appliances, id]);
|
|
17
|
+
};
|
|
18
|
+
return (_jsxs(Stack, { spacing: "base", bg: "lightBlue.2", p: "base", children: [_jsx(Text, { fontFamily: "secondary", fontSize: "sm", children: t('homeAssistant.selectAppliances') }), _jsx(SimpleGrid, { columns: [4, 5], spacing: "base", children: steps.map((step) => (_jsx(Center, { w: "100%", children: _jsx(ApplianceButton, { onClick: handleClick, step: Object.assign(Object.assign({}, step), { isCompleted: appliances.includes(step.id) }) }) }, step.id))) })] }));
|
|
8
19
|
};
|
|
9
20
|
export const steps = [
|
|
10
21
|
{
|
|
11
22
|
id: 'fridge',
|
|
12
23
|
title: 'fridge',
|
|
13
24
|
icon: Fridge,
|
|
14
|
-
isCompleted: true,
|
|
15
25
|
},
|
|
16
26
|
{
|
|
17
27
|
id: 'freezer',
|
|
18
28
|
title: 'freezer',
|
|
19
29
|
icon: Freezer,
|
|
20
|
-
isCompleted: false,
|
|
21
30
|
},
|
|
22
31
|
{
|
|
23
32
|
id: 'washer',
|
|
24
33
|
title: 'washer',
|
|
25
34
|
icon: Washer,
|
|
26
|
-
isCompleted: false,
|
|
27
35
|
},
|
|
28
36
|
{
|
|
29
37
|
id: 'dryer',
|
|
30
38
|
title: 'Dryer',
|
|
31
39
|
icon: Dryer,
|
|
32
|
-
isCompleted: false,
|
|
33
40
|
},
|
|
34
41
|
{
|
|
35
42
|
id: 'dish-washer',
|
|
36
43
|
title: 'Dish Washer',
|
|
37
44
|
icon: Dishwasher,
|
|
38
|
-
isCompleted: false,
|
|
39
45
|
},
|
|
40
46
|
{
|
|
41
47
|
id: 'cook-top',
|
|
42
48
|
title: 'Cook Top',
|
|
43
49
|
icon: CookTop,
|
|
44
|
-
isCompleted: false,
|
|
45
50
|
},
|
|
46
51
|
{
|
|
47
52
|
id: 'oven',
|
|
48
53
|
title: 'oven',
|
|
49
54
|
icon: Oven,
|
|
50
|
-
isCompleted: false,
|
|
51
55
|
},
|
|
52
56
|
{
|
|
53
57
|
id: 'range',
|
|
54
58
|
title: 'range',
|
|
55
59
|
icon: Range,
|
|
56
|
-
isCompleted: false,
|
|
57
60
|
},
|
|
58
61
|
{
|
|
59
62
|
id: 'hood',
|
|
60
63
|
title: 'hood',
|
|
61
64
|
icon: Hood,
|
|
62
|
-
isCompleted: false,
|
|
63
65
|
},
|
|
64
66
|
{
|
|
65
67
|
id: 'microwave',
|
|
66
68
|
title: 'microwave',
|
|
67
69
|
icon: Microwave,
|
|
68
|
-
isCompleted: false,
|
|
69
70
|
},
|
|
70
71
|
];
|
|
@@ -51,7 +51,7 @@ export const HomeBoard = () => {
|
|
|
51
51
|
HomeAssistant: (_jsx(HomeAssistantPanel, { currentStep: homeAssistantCurrentStep, currentForm: currentHomeAssistantForm, onNext: handleHomeAssistantFormChange, onBack: handleHomeAssistantBack, onApplianceClick: () => null, onClose: onRightClose })),
|
|
52
52
|
};
|
|
53
53
|
const panelSize = currentComponent === 'PartnerCatalog' ? 'lg' : 'md';
|
|
54
|
-
return (_jsxs(Box, { overflowX: "hidden", children: [_jsx(RightPanel, { overlay: showOverlay, isOpen: isRightOpen, onClose: onRightClose, size: panelSize, children: rightPanelComponents[currentComponent] }), _jsxs(Flex, { w: "full", minH: "100dvh", children: [_jsx(RoomsMenu, { activeRoom: "homeboard", handleAddRoom: (id) => __awaiter(void 0, void 0, void 0, function* () { return console.log(id); }), handleClick: () => null, handleHomeClick: () => null, rooms: RoomsList, roomsToAdd: RoomsToAdd }), _jsxs(Box, { w: "full", children: [_jsx(AppBarComponent, { setActiveTour: setActiveTour }), _jsxs(Stack, { spacing: "base", p: "base", children: [_jsx(HomeHeader, { buttonLabel: "Partner catalog", onBack: () => null, homeName: homeName, onAdd: () => null }), _jsxs(HomeBoardGrid, { children: [_jsx(HomeCardWithRecipent, { address: HomeCards[0].address, handleEdit: handleEditHomeClick, handleDeleteAccountType: (email) => email, handleSubmitAccountType: (form) => form, _id: HomeCards[0]._id, image: HomeCards[0].image, loading: false, name: HomeCards[0].name, menu: menuMock, addImage: () => null, recipients: recipientsDb, records: homeBoardRecorsMock }), _jsx(HomeAssistant, {
|
|
54
|
+
return (_jsxs(Box, { overflowX: "hidden", children: [_jsx(RightPanel, { overlay: showOverlay, isOpen: isRightOpen, onClose: onRightClose, size: panelSize, children: rightPanelComponents[currentComponent] }), _jsxs(Flex, { w: "full", minH: "100dvh", children: [_jsx(RoomsMenu, { activeRoom: "homeboard", handleAddRoom: (id) => __awaiter(void 0, void 0, void 0, function* () { return console.log(id); }), handleClick: () => null, handleHomeClick: () => null, rooms: RoomsList, roomsToAdd: RoomsToAdd }), _jsxs(Box, { w: "full", children: [_jsx(AppBarComponent, { setActiveTour: setActiveTour }), _jsxs(Stack, { spacing: "base", p: "base", children: [_jsx(HomeHeader, { buttonLabel: "Partner catalog", onBack: () => null, homeName: homeName, onAdd: () => null }), _jsxs(HomeBoardGrid, { children: [_jsx(HomeCardWithRecipent, { address: HomeCards[0].address, handleEdit: handleEditHomeClick, handleDeleteAccountType: (email) => email, handleSubmitAccountType: (form) => form, _id: HomeCards[0]._id, image: HomeCards[0].image, loading: false, name: HomeCards[0].name, menu: menuMock, addImage: () => null, recipients: recipientsDb, records: homeBoardRecorsMock }), _jsx(HomeAssistant, { currentPanel: homeAssistantCurrentStep, currentStep: 6, onStepClick: handleHomeAssistantClick }), _jsx(PropertyTaxes, { estimatedTaxValue: 1000, menuItems: menuMock, taxes: taxesMock, title: "Travis County Property Taxes" }), _jsxs(Stack, { spacing: "base", children: [_jsx(ReceiptAutofiler, { onClick: () => null, totalReceipts: 36, totalTitle: "Receipts Received", forwardTo: "reciepts@homefile.cloud", onFilter: () => null, children: _jsx(ReceiptsFiled, { incidentalItemsNumber: 0, incidentalSpent: 0, inventoryItemsNumber: 0, inventorySpent: 0, total: 0 }) }), _jsx(ValueMonitor, { menuItems: menuMock, balance: "+3%", totalValue: 323421, year: "2023", yearValue: 5684 })] }), _jsx(ShortPartnerTile, { _id: "1", buttonText: "Contact Audrey Scheck", description: "Full-service design firm focusing on residential remodels, furnishing, and styling.", onClick: () => null, socialLinks: socialLinksMock2, logo: "https://static.wixstatic.com/media/258105_8e04439070694f278e4787a310ea9f4b~mv2.png", partnerName: "Audrey Scheck", websiteUrl: "" }), _jsx(TrendingValue, { chartData: lineChartData, marketValue: 894000, menuItems: menuMock, mortgageBalance: 220532, purchasePrice: 220532, roi: "+234%" }), _jsx(ShortPartnerTile, { _id: "2", buttonText: "Contact Audrey Scheck", description: "Full-service design firm focusing on residential remodels, furnishing, and styling.", onClick: () => null, socialLinks: socialLinksMock2, logo: "https://static.wixstatic.com/media/258105_8e04439070694f278e4787a310ea9f4b~mv2.png", partnerName: "Audrey Scheck", websiteUrl: "" }), _jsx(FolderSharing, { folders: FoldersDB, handleAddNewFolder: handleNewFolder, handleFolderClick: handleFolderClick, handleSelect: () => null, initialSelectItem: selectOptions[0], menuItems: menuMock, selectItems: selectOptions }), _jsxs(Stack, { spacing: "base", children: [_jsx(AddHomeItem, { handleClick: () => null }), _jsx(SendCommunication, { documentList: [] })] }), _jsx(ShortPartnerTile, { _id: "3", buttonText: "Contact Audrey Scheck", description: "Full-service design firm focusing on residential remodels, furnishing, and styling.", onClick: () => null, socialLinks: socialLinksMock2, logo: "https://static.wixstatic.com/media/258105_8e04439070694f278e4787a310ea9f4b~mv2.png", partnerName: "Audrey Scheck", websiteUrl: "" })] })] })] })] }), _jsx(HomeBoardTour, { currentStep: currentStep, handleClose: handleClose, handleStep: handleStep, meetStepUrl: videoMock, isActive: activeTour })] }));
|
|
55
55
|
};
|
|
56
56
|
export const AppBarComponent = ({ setActiveTour = (value) => { } }) => {
|
|
57
57
|
const handleTour = () => {
|
|
@@ -22,7 +22,7 @@ export const HomeBoardTour = ({ currentStep = 'homeboard', bubbleWidth = '300px'
|
|
|
22
22
|
'addCatalog',
|
|
23
23
|
];
|
|
24
24
|
const { coordinates } = useComponentCoordinates(componentIds);
|
|
25
|
-
useComponentStyles(componentIds, currentStep);
|
|
25
|
+
useComponentStyles({ ids: componentIds, selectedId: currentStep });
|
|
26
26
|
const { windowDimensions: { width, height }, } = useWindowDimensions();
|
|
27
27
|
const parsedBubbleWidth = Number(bubbleWidth.replace('px', ''));
|
|
28
28
|
const panelBubbleArrowSize = 500 + parsedBubbleWidth + arrowSize;
|
|
@@ -20,7 +20,7 @@ export const LaunchpadTour = ({ currentStep = 'launchpad', handleStep, handleClo
|
|
|
20
20
|
'forwardReceipts',
|
|
21
21
|
];
|
|
22
22
|
const { coordinates } = useComponentCoordinates(componentIds);
|
|
23
|
-
useComponentStyles(componentIds, currentStep);
|
|
23
|
+
useComponentStyles({ ids: componentIds, selectedId: currentStep });
|
|
24
24
|
const { windowDimensions: { width, height }, } = useWindowDimensions();
|
|
25
25
|
const cardSize = 220;
|
|
26
26
|
const steps = {
|
|
@@ -16,7 +16,7 @@ export const RoomsBoardTour = ({ currentStep = 'addRooms', handleClose, handleSt
|
|
|
16
16
|
'addingItems',
|
|
17
17
|
];
|
|
18
18
|
const { coordinates } = useComponentCoordinates(componentIds);
|
|
19
|
-
useComponentStyles(componentIds, currentStep);
|
|
19
|
+
useComponentStyles({ ids: componentIds, selectedId: currentStep });
|
|
20
20
|
const { windowDimensions: { width, height }, } = useWindowDimensions();
|
|
21
21
|
const steps = {
|
|
22
22
|
addRooms: {
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
interface UseComponentStyles {
|
|
2
|
+
ids: string[];
|
|
3
|
+
selectedId: string;
|
|
4
|
+
zIndex?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const useComponentStyles: ({ ids, selectedId, zIndex, }: UseComponentStyles) => void;
|
|
7
|
+
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export const useComponentStyles = (ids, selectedId) => {
|
|
1
|
+
export const useComponentStyles = ({ ids, selectedId, zIndex = 'auto', }) => {
|
|
2
2
|
if ((ids === null || ids === void 0 ? void 0 : ids.length) === 0)
|
|
3
3
|
return;
|
|
4
4
|
ids.forEach((id) => {
|
|
5
5
|
const component = document.getElementById(id);
|
|
6
6
|
if (component) {
|
|
7
|
-
component.style.zIndex =
|
|
7
|
+
component.style.zIndex = zIndex;
|
|
8
8
|
}
|
|
9
9
|
});
|
|
10
10
|
const currentComponent = document.getElementById(selectedId);
|
|
11
11
|
if (currentComponent) {
|
|
12
|
-
currentComponent.style.zIndex = '
|
|
12
|
+
currentComponent.style.zIndex = '1400';
|
|
13
13
|
}
|
|
14
14
|
};
|
|
@@ -2,7 +2,7 @@ import { DynamicFormI } from '..';
|
|
|
2
2
|
export interface HomeAssistantPanelI {
|
|
3
3
|
currentForm: DynamicFormI['form'];
|
|
4
4
|
currentStep: number;
|
|
5
|
-
onApplianceClick: (
|
|
5
|
+
onApplianceClick: (selected: string[]) => void;
|
|
6
6
|
onBack: () => void;
|
|
7
7
|
onClose: () => void;
|
|
8
8
|
onNext: () => void;
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ export const HomeAssistantStepper = ({
|
|
|
7
7
|
totalSteps,
|
|
8
8
|
}: HomeAssistantStepperI) => {
|
|
9
9
|
return (
|
|
10
|
-
<Flex gap="1px" w="100%">
|
|
10
|
+
<Flex gap="1px" w="100%" zIndex="2">
|
|
11
11
|
{Array.from({ length: totalSteps }).map((_, index) => {
|
|
12
12
|
return (
|
|
13
13
|
<Stack key={index} flex="1" spacing="1">
|
|
@@ -2,17 +2,16 @@ import { Center, SimpleGrid, Stack } from '@chakra-ui/react'
|
|
|
2
2
|
import { HomeAssistantStepsI } from '@/interfaces'
|
|
3
3
|
import { HomeAssistantButton, HomeAssistantStepper } from '@/components'
|
|
4
4
|
import { homeAssistantSteps } from '@/helpers'
|
|
5
|
-
import { useState } from 'react'
|
|
6
5
|
import { useComponentStyles } from '@/hooks'
|
|
7
6
|
|
|
8
7
|
export const HomeAssistantSteps = ({
|
|
9
8
|
currentStep,
|
|
10
9
|
onStepClick,
|
|
11
|
-
|
|
10
|
+
currentPanel,
|
|
12
11
|
}: HomeAssistantStepsI) => {
|
|
13
|
-
const
|
|
14
|
-
const stepId = `homeAssistantButton-${
|
|
15
|
-
const componentIds =
|
|
12
|
+
const wrapperZIndex = currentPanel ? undefined : '2'
|
|
13
|
+
const stepId = `homeAssistantButton-${currentPanel}`
|
|
14
|
+
const componentIds = currentPanel
|
|
16
15
|
? [
|
|
17
16
|
'homeAssistantButton-1',
|
|
18
17
|
'homeAssistantButton-2',
|
|
@@ -23,20 +22,13 @@ export const HomeAssistantSteps = ({
|
|
|
23
22
|
]
|
|
24
23
|
: []
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
onStepClick(step)
|
|
28
|
-
setStep(step)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
useComponentStyles(componentIds, stepId)
|
|
32
|
-
const wrapperZIndex = isPanelOpen ? undefined : '2'
|
|
25
|
+
useComponentStyles({ ids: componentIds, selectedId: stepId, zIndex: '2' })
|
|
33
26
|
return (
|
|
34
27
|
<Stack
|
|
35
28
|
spacing="8"
|
|
36
29
|
w="fit-content"
|
|
37
30
|
position="relative"
|
|
38
31
|
top={['-10px', '-30px']}
|
|
39
|
-
zIndex={wrapperZIndex}
|
|
40
32
|
>
|
|
41
33
|
<HomeAssistantStepper currentStep={currentStep} totalSteps={6} />
|
|
42
34
|
<SimpleGrid columns={[2, 3]} spacing="base">
|
|
@@ -44,7 +36,7 @@ export const HomeAssistantSteps = ({
|
|
|
44
36
|
<Center key={step.title} w="100%">
|
|
45
37
|
<HomeAssistantButton
|
|
46
38
|
currentStep={index + 1}
|
|
47
|
-
onStepClick={
|
|
39
|
+
onStepClick={onStepClick}
|
|
48
40
|
status={getStatus(index + 1, currentStep)}
|
|
49
41
|
step={step}
|
|
50
42
|
/>
|
|
@@ -14,8 +14,20 @@ import {
|
|
|
14
14
|
Microwave,
|
|
15
15
|
Range,
|
|
16
16
|
} from '@/assets/images'
|
|
17
|
+
import { useState } from 'react'
|
|
17
18
|
|
|
18
19
|
export const ApplianceSteps = ({ onClick }: ApplianceStepsI) => {
|
|
20
|
+
const [appliances, setAppliances] = useState<string[]>([])
|
|
21
|
+
const handleClick = (id: string) => {
|
|
22
|
+
if (appliances.includes(id)) {
|
|
23
|
+
const newAppliances = appliances.filter((appliance) => appliance !== id)
|
|
24
|
+
onClick(newAppliances)
|
|
25
|
+
return setAppliances(newAppliances)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setAppliances([...appliances, id])
|
|
29
|
+
onClick([...appliances, id])
|
|
30
|
+
}
|
|
19
31
|
return (
|
|
20
32
|
<Stack spacing="base" bg="lightBlue.2" p="base">
|
|
21
33
|
<Text fontFamily="secondary" fontSize="sm">
|
|
@@ -24,7 +36,13 @@ export const ApplianceSteps = ({ onClick }: ApplianceStepsI) => {
|
|
|
24
36
|
<SimpleGrid columns={[4, 5]} spacing="base">
|
|
25
37
|
{steps.map((step) => (
|
|
26
38
|
<Center key={step.id} w="100%">
|
|
27
|
-
<ApplianceButton
|
|
39
|
+
<ApplianceButton
|
|
40
|
+
onClick={handleClick}
|
|
41
|
+
step={{
|
|
42
|
+
...step,
|
|
43
|
+
isCompleted: appliances.includes(step.id),
|
|
44
|
+
}}
|
|
45
|
+
/>
|
|
28
46
|
</Center>
|
|
29
47
|
))}
|
|
30
48
|
</SimpleGrid>
|
|
@@ -37,60 +55,50 @@ export const steps: ApplianceStepI[] = [
|
|
|
37
55
|
id: 'fridge',
|
|
38
56
|
title: 'fridge',
|
|
39
57
|
icon: Fridge,
|
|
40
|
-
isCompleted: true,
|
|
41
58
|
},
|
|
42
59
|
{
|
|
43
60
|
id: 'freezer',
|
|
44
61
|
title: 'freezer',
|
|
45
62
|
icon: Freezer,
|
|
46
|
-
isCompleted: false,
|
|
47
63
|
},
|
|
48
64
|
{
|
|
49
65
|
id: 'washer',
|
|
50
66
|
title: 'washer',
|
|
51
67
|
icon: Washer,
|
|
52
|
-
isCompleted: false,
|
|
53
68
|
},
|
|
54
69
|
{
|
|
55
70
|
id: 'dryer',
|
|
56
71
|
title: 'Dryer',
|
|
57
72
|
icon: Dryer,
|
|
58
|
-
isCompleted: false,
|
|
59
73
|
},
|
|
60
74
|
{
|
|
61
75
|
id: 'dish-washer',
|
|
62
76
|
title: 'Dish Washer',
|
|
63
77
|
icon: Dishwasher,
|
|
64
|
-
isCompleted: false,
|
|
65
78
|
},
|
|
66
79
|
{
|
|
67
80
|
id: 'cook-top',
|
|
68
81
|
title: 'Cook Top',
|
|
69
82
|
icon: CookTop,
|
|
70
|
-
isCompleted: false,
|
|
71
83
|
},
|
|
72
84
|
{
|
|
73
85
|
id: 'oven',
|
|
74
86
|
title: 'oven',
|
|
75
87
|
icon: Oven,
|
|
76
|
-
isCompleted: false,
|
|
77
88
|
},
|
|
78
89
|
{
|
|
79
90
|
id: 'range',
|
|
80
91
|
title: 'range',
|
|
81
92
|
icon: Range,
|
|
82
|
-
isCompleted: false,
|
|
83
93
|
},
|
|
84
94
|
{
|
|
85
95
|
id: 'hood',
|
|
86
96
|
title: 'hood',
|
|
87
97
|
icon: Hood,
|
|
88
|
-
isCompleted: false,
|
|
89
98
|
},
|
|
90
99
|
{
|
|
91
100
|
id: 'microwave',
|
|
92
101
|
title: 'microwave',
|
|
93
102
|
icon: Microwave,
|
|
94
|
-
isCompleted: false,
|
|
95
103
|
},
|
|
96
104
|
]
|
|
@@ -46,7 +46,7 @@ export const HomeBoardTour = ({
|
|
|
46
46
|
|
|
47
47
|
const { coordinates } = useComponentCoordinates(componentIds)
|
|
48
48
|
|
|
49
|
-
useComponentStyles(componentIds, currentStep)
|
|
49
|
+
useComponentStyles({ ids: componentIds, selectedId: currentStep })
|
|
50
50
|
|
|
51
51
|
const {
|
|
52
52
|
windowDimensions: { width, height },
|
|
@@ -41,7 +41,7 @@ export const LaunchpadTour = ({
|
|
|
41
41
|
|
|
42
42
|
const { coordinates } = useComponentCoordinates(componentIds)
|
|
43
43
|
|
|
44
|
-
useComponentStyles(componentIds, currentStep)
|
|
44
|
+
useComponentStyles({ ids: componentIds, selectedId: currentStep })
|
|
45
45
|
|
|
46
46
|
const {
|
|
47
47
|
windowDimensions: { width, height },
|
|
@@ -33,7 +33,7 @@ export const RoomsBoardTour = ({
|
|
|
33
33
|
|
|
34
34
|
const { coordinates } = useComponentCoordinates(componentIds)
|
|
35
35
|
|
|
36
|
-
useComponentStyles(componentIds, currentStep)
|
|
36
|
+
useComponentStyles({ ids: componentIds, selectedId: currentStep })
|
|
37
37
|
|
|
38
38
|
const {
|
|
39
39
|
windowDimensions: { width, height },
|
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
interface UseComponentStyles {
|
|
2
|
+
ids: string[]
|
|
3
|
+
selectedId: string
|
|
4
|
+
zIndex?: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const useComponentStyles = ({
|
|
8
|
+
ids,
|
|
9
|
+
selectedId,
|
|
10
|
+
zIndex = 'auto',
|
|
11
|
+
}: UseComponentStyles) => {
|
|
2
12
|
if (ids?.length === 0) return
|
|
3
13
|
|
|
4
14
|
ids.forEach((id) => {
|
|
5
15
|
const component = document.getElementById(id)
|
|
6
16
|
|
|
7
17
|
if (component) {
|
|
8
|
-
component.style.zIndex =
|
|
18
|
+
component.style.zIndex = zIndex
|
|
9
19
|
}
|
|
10
20
|
})
|
|
11
21
|
|
|
12
22
|
const currentComponent = document.getElementById(selectedId)
|
|
13
23
|
|
|
14
24
|
if (currentComponent) {
|
|
15
|
-
currentComponent.style.zIndex = '
|
|
25
|
+
currentComponent.style.zIndex = '1400'
|
|
16
26
|
}
|
|
17
27
|
}
|
|
@@ -3,7 +3,7 @@ import { DynamicFormI } from '@/interfaces'
|
|
|
3
3
|
export interface HomeAssistantPanelI {
|
|
4
4
|
currentForm: DynamicFormI['form']
|
|
5
5
|
currentStep: number
|
|
6
|
-
onApplianceClick: (
|
|
6
|
+
onApplianceClick: (selected: string[]) => void
|
|
7
7
|
onBack: () => void
|
|
8
8
|
onClose: () => void
|
|
9
9
|
onNext: () => void
|