@homefile/components-v2 2.14.30 → 2.14.31

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.
Files changed (39) hide show
  1. package/dist/components/appBar/TourButton.js +8 -1
  2. package/dist/components/homeAssistant/HomeAssistantSteps.js +6 -14
  3. package/dist/components/homeAssistant/HomeMonitorSteps.js +3 -12
  4. package/dist/components/homeAssistant/panel/HomeAssistantPanel.d.ts +1 -1
  5. package/dist/components/homeAssistant/panel/HomeAssistantPanel.js +25 -11
  6. package/dist/components/homeBoard/HomeBoard.js +1 -1
  7. package/dist/components/tour/BubbleArrow.js +1 -1
  8. package/dist/components/tour/HomeBoardTour.js +13 -5
  9. package/dist/components/tour/LaunchpadTour.js +14 -6
  10. package/dist/components/tour/RoomsBoardTour.js +7 -3
  11. package/dist/helpers/tour/Highlights.helper.d.ts +1 -0
  12. package/dist/helpers/tour/Highlights.helper.js +42 -0
  13. package/dist/helpers/tour/index.d.ts +1 -0
  14. package/dist/helpers/tour/index.js +1 -0
  15. package/dist/hooks/forms/useSimpleDynamicForm.js +1 -1
  16. package/dist/hooks/homeBoard/useHomeBoard.js +1 -0
  17. package/dist/hooks/useComponentStyles.d.ts +2 -3
  18. package/dist/hooks/useComponentStyles.js +7 -3
  19. package/dist/proxies/homes/homeAssistant.proxy.d.ts +8 -0
  20. package/dist/proxies/homes/homeAssistant.proxy.js +9 -0
  21. package/dist/proxies/homes/index.d.ts +1 -0
  22. package/dist/proxies/homes/index.js +1 -0
  23. package/package.json +1 -1
  24. package/src/components/appBar/TourButton.tsx +8 -1
  25. package/src/components/homeAssistant/HomeAssistantSteps.tsx +6 -14
  26. package/src/components/homeAssistant/HomeMonitorSteps.tsx +4 -12
  27. package/src/components/homeAssistant/panel/HomeAssistantPanel.tsx +34 -13
  28. package/src/components/homeBoard/HomeBoard.tsx +15 -13
  29. package/src/components/tour/BubbleArrow.tsx +4 -0
  30. package/src/components/tour/HomeBoardTour.tsx +14 -9
  31. package/src/components/tour/LaunchpadTour.tsx +15 -10
  32. package/src/components/tour/RoomsBoardTour.tsx +7 -7
  33. package/src/helpers/tour/Highlights.helper.ts +44 -0
  34. package/src/helpers/tour/index.ts +2 -1
  35. package/src/hooks/forms/useSimpleDynamicForm.ts +1 -1
  36. package/src/hooks/homeBoard/useHomeBoard.ts +1 -0
  37. package/src/hooks/useComponentStyles.ts +11 -7
  38. package/src/proxies/homes/homeAssistant.proxy.ts +18 -0
  39. package/src/proxies/homes/index.ts +1 -0
@@ -2,6 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { t } from 'i18next';
3
3
  import { Box, Flex, Image } from '@chakra-ui/react';
4
4
  import { Flag } from '../../assets/images';
5
+ import { useComponentStyles } from '../../hooks';
6
+ import { homeAssistantProxy } from '../../proxies';
5
7
  export const TourButton = ({ label, onClick }) => {
6
- return (_jsx(Box, { "data-testid": "tour-button", as: "button", boxShadow: "none", borderRadius: "full", bg: "lightGreen.5", fontFamily: "secondary", transition: "all 0.2s ease-in-out", _hover: { bg: 'lightGreen.4' }, onClick: onClick, flexShrink: 0, overflow: "hidden", children: _jsxs(Flex, { align: "center", pr: "base", py: "1", children: [_jsx(Image, { src: Flag, w: "40px", h: "auto", alt: "tour", position: "relative", bottom: "-4px" }), label !== null && label !== void 0 ? label : t('help.buttonTour')] }) }));
8
+ const { setHighlight } = homeAssistantProxy;
9
+ useComponentStyles({});
10
+ return (_jsx(Box, { "data-testid": "tour-button", as: "button", boxShadow: "none", borderRadius: "full", bg: "lightGreen.5", fontFamily: "secondary", transition: "all 0.2s ease-in-out", _hover: { bg: 'lightGreen.4' }, onClick: () => {
11
+ setHighlight(true);
12
+ onClick === null || onClick === void 0 ? void 0 : onClick();
13
+ }, flexShrink: 0, overflow: "hidden", children: _jsxs(Flex, { align: "center", pr: "base", py: "1", children: [_jsx(Image, { src: Flag, w: "40px", h: "auto", alt: "tour", position: "relative", bottom: "-4px" }), label !== null && label !== void 0 ? label : t('help.buttonTour')] }) }));
7
14
  };
@@ -2,21 +2,13 @@ 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 { useComponentStyles } from '../../hooks';
5
+ import { homeAssistantProxy } from '../../proxies';
6
6
  export const HomeAssistantSteps = ({ currentStep, onStepClick, currentPanel, }) => {
7
- const stepId = `homeAssistantButton-${currentPanel}`;
8
- const componentIds = currentPanel
9
- ? [
10
- 'homeAssistantButton-1',
11
- 'homeAssistantButton-2',
12
- 'homeAssistantButton-3',
13
- 'homeAssistantButton-4',
14
- 'homeAssistantButton-5',
15
- 'homeAssistantButton-6',
16
- ]
17
- : [];
18
- useComponentStyles({ ids: componentIds, selectedId: stepId, zIndex: '2' });
19
- 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))) })] }));
7
+ const { setSelectedId } = homeAssistantProxy;
8
+ 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: (step) => {
9
+ onStepClick(step);
10
+ setSelectedId(`homeAssistantButton-${index + 1}`);
11
+ }, status: getStatus(index + 1, currentStep), step: step }) }, step.title))) })] }));
20
12
  };
21
13
  const getStatus = (index, currentStep) => {
22
14
  if (index === currentStep)
@@ -1,21 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment } from 'react';
2
3
  import { Box, Flex } from '@chakra-ui/react';
3
4
  import { HomeMonitorButton, IconMenu, MoreHorizontal } from '..';
4
5
  import { homeAssistantSteps } from '../../helpers';
5
- import { useComponentStyles } from '../../hooks';
6
- import { Fragment, useState } from 'react';
6
+ import { homeAssistantProxy } from '../../proxies';
7
7
  export const HomeMonitorSteps = ({ menuItems = [], onStepClick, stepsWithAlerts, }) => {
8
- const ids = [
9
- 'homeMonitorButton-1',
10
- 'homeMonitorButton-2',
11
- 'homeMonitorButton-3',
12
- 'homeMonitorButton-4',
13
- 'homeMonitorButton-5',
14
- 'homeMonitorButton-6',
15
- ];
16
- const [selectedId, setSelectedId] = useState('');
8
+ const { setSelectedId } = homeAssistantProxy;
17
9
  const isDisabled = menuItems.length === 0;
18
- useComponentStyles({ ids, selectedId, zIndex: '2' });
19
10
  const handleStepClick = (step) => onStepClick(step);
20
11
  return (_jsx(Flex, { gap: "base", justify: "center", children: homeAssistantSteps.map((step, index) => (_jsx(Box, { position: "relative", flex: "1", children: _jsxs(Fragment, { children: [_jsx(HomeMonitorButton, { currentStep: index + 1, onStepClick: handleStepClick, status: getStatus(index + 1, stepsWithAlerts), step: step }), _jsx(Box, { position: "absolute", top: "-2px", right: "4px", zIndex: "1400", children: _jsx(IconMenu, { zIndex: "2", icon: _jsx(MoreHorizontal, { size: 26 }), itemForm: index + 1, menuItems: menuItems, disabled: isDisabled, onClick: () => setSelectedId(`homeMonitorButton-${index + 1}`) }) })] }) }, step === null || step === void 0 ? void 0 : step.title))) }));
21
12
  };
@@ -1,3 +1,3 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { HomeAssistantPanelI } from '../../../interfaces';
3
- export declare const HomeAssistantPanel: ({ children, currentForm, currentStep, onApplianceClick, onBack, onClose, onNext, onSave, backDisabled, nextDisabled, hasCompleted, isLoading }: PropsWithChildren<HomeAssistantPanelI>) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const HomeAssistantPanel: ({ children, currentForm, currentStep, onApplianceClick, onBack, onClose, onNext, onSave, backDisabled, nextDisabled, hasCompleted, isLoading, }: PropsWithChildren<HomeAssistantPanelI>) => import("react/jsx-runtime").JSX.Element;
@@ -4,17 +4,20 @@ import { FormProvider } from 'react-hook-form';
4
4
  import { t } from 'i18next';
5
5
  import { DrawerHeader, DrawerBody, Stack, Text, DrawerFooter, } from '@chakra-ui/react';
6
6
  import { IA } from '../../../assets/images';
7
- import { ApplianceSteps, SimpleDynamicForm, FooterButtons, HomeAssistantPanelStep, PanelHeader, Loading } from '../..';
7
+ import { ApplianceSteps, SimpleDynamicForm, FooterButtons, HomeAssistantPanelStep, PanelHeader, Loading, } from '../..';
8
8
  import { homeAssistantSteps } from '../../../helpers';
9
9
  import { useSimpleDynamicForm } from '../../../hooks';
10
- export const HomeAssistantPanel = ({ children, currentForm, currentStep, onApplianceClick, onBack, onClose, onNext, onSave, backDisabled, nextDisabled, hasCompleted, isLoading }) => {
10
+ import { homeAssistantProxy } from '../../../proxies';
11
+ export const HomeAssistantPanel = ({ children, currentForm, currentStep, onApplianceClick, onBack, onClose, onNext, onSave, backDisabled, nextDisabled, hasCompleted, isLoading, }) => {
11
12
  var _a, _b;
12
13
  const [addedAppliances, updateAddedAppliances] = useState([]);
13
- const title = (_b = (_a = homeAssistantSteps === null || homeAssistantSteps === void 0 ? void 0 : homeAssistantSteps[currentStep - 1]) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : "";
14
+ const title = (_b = (_a = homeAssistantSteps === null || homeAssistantSteps === void 0 ? void 0 : homeAssistantSteps[currentStep - 1]) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : '';
14
15
  const text = `${t('homeAssistant.details')} ${title.toLowerCase()}:`;
15
16
  const isAppliances = currentStep === 4;
17
+ const { setHighlight } = homeAssistantProxy;
16
18
  useEffect(() => {
17
19
  var _a;
20
+ setHighlight(true);
18
21
  if (isAppliances) {
19
22
  const targetAppliances = (_a = currentForm.find((field) => {
20
23
  var _a;
@@ -23,25 +26,36 @@ export const HomeAssistantPanel = ({ children, currentForm, currentStep, onAppli
23
26
  })) === null || _a === void 0 ? void 0 : _a.value;
24
27
  updateAddedAppliances(targetAppliances);
25
28
  }
29
+ return () => {
30
+ setHighlight(false);
31
+ };
26
32
  }, [currentForm, isAppliances]);
27
33
  const { form, updatedFields } = useSimpleDynamicForm({
28
34
  fields: currentForm,
29
35
  });
36
+ const handleClose = () => {
37
+ onClose();
38
+ setHighlight(false);
39
+ };
30
40
  if (isLoading)
31
41
  return _jsx(Loading, {});
32
- return (_jsxs(_Fragment, { children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: onClose, title: t('homeAssistant.title'), icon: IA }) }), _jsxs(DrawerBody, { p: "0", children: [_jsx(HomeAssistantPanelStep, { currentStep: currentStep }), children, isAppliances && (_jsx(ApplianceSteps, { onClick: onApplianceClick, addedAppliances: addedAppliances })), _jsxs(Stack, { spacing: "base", p: "base", children: [_jsx(Text, { fontFamily: "secondary", fontSize: "sm", children: text }), _jsx(FormProvider, Object.assign({}, form, { children: _jsx(SimpleDynamicForm, { fields: currentForm }) }))] })] }), _jsx(DrawerFooter, { px: "0", py: "6", bg: "neutral.white", children: _jsx(FooterButtons, { button1: {
42
+ return (_jsxs(_Fragment, { children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: handleClose, title: t('homeAssistant.title'), icon: IA }) }), _jsxs(DrawerBody, { p: "0", children: [_jsx(HomeAssistantPanelStep, { currentStep: currentStep }), children, isAppliances && (_jsx(ApplianceSteps, { onClick: onApplianceClick, addedAppliances: addedAppliances })), _jsxs(Stack, { spacing: "base", p: "base", children: [_jsx(Text, { fontFamily: "secondary", fontSize: "sm", children: text }), _jsx(FormProvider, Object.assign({}, form, { children: _jsx(SimpleDynamicForm, { fields: currentForm }) }))] })] }), _jsx(DrawerFooter, { px: "0", py: "6", bg: "neutral.white", children: _jsx(FooterButtons, { button1: {
33
43
  buttonStyle: 'secondaryFooter',
34
44
  label: t('buttons.back'),
35
45
  onClick: onBack,
36
46
  isDisabled: backDisabled,
37
47
  }, button2: {
38
48
  buttonStyle: 'primaryFooter',
39
- label: !hasCompleted && currentStep === 6 ? t('buttons.finish') : t('buttons.saveStep'),
49
+ label: !hasCompleted && currentStep === 6
50
+ ? t('buttons.finish')
51
+ : t('buttons.saveStep'),
40
52
  onClick: () => onSave(updatedFields),
41
- }, button3: (!hasCompleted && currentStep === 6) ? undefined : {
42
- buttonStyle: 'primaryFooter',
43
- label: t('buttons.next'),
44
- onClick: onNext,
45
- isDisabled: nextDisabled,
46
- } }) })] }));
53
+ }, button3: !hasCompleted && currentStep === 6
54
+ ? undefined
55
+ : {
56
+ buttonStyle: 'primaryFooter',
57
+ label: t('buttons.next'),
58
+ onClick: onNext,
59
+ isDisabled: nextDisabled,
60
+ } }) })] }));
47
61
  };
@@ -48,7 +48,7 @@ export const HomeBoard = () => {
48
48
  ], onShareContacts: () => null, onDeleteContacts: () => null, handleLoadMore: () => null, showLoadMore: false, loadMoreDisabled: false })),
49
49
  PartnerCatalog: (_jsx(PartnerCatalogPanel, { onClose: onRightClose, onPartnerAdd: () => null, partners: partnerCatalogMock })),
50
50
  AddHouseholdItem: (_jsxs(DrawerContent, { bg: "lightBlue.1", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: handleClose, icon: Painting, title: "Add Household Item" }) }), _jsx(DrawerBody, { children: _jsx(DynamicForm, { form: formFieldsMock }) })] })),
51
- HomeAssistant: (_jsx(HomeAssistantPanel, { currentStep: homeAssistantCurrentStep, currentForm: currentHomeAssistantForm, onNext: handleHomeAssistantFormChange, onBack: handleHomeAssistantBack, onApplianceClick: () => null, onClose: onRightClose, onSave: () => { }, backDisabled: false, nextDisabled: false, hasCompleted: true, isLoading: false })),
51
+ HomeAssistant: (_jsx(DrawerContent, { children: _jsx(HomeAssistantPanel, { currentStep: homeAssistantCurrentStep, currentForm: currentHomeAssistantForm, onNext: handleHomeAssistantFormChange, onBack: handleHomeAssistantBack, onApplianceClick: () => null, onClose: onRightClose, onSave: () => { }, backDisabled: false, nextDisabled: false, hasCompleted: true, isLoading: false }) })),
52
52
  Notifications: (_jsx(NotificationsPanel, { notifications: notificationsMock, onClose: onRightClose, onDismiss: () => null })),
53
53
  };
54
54
  const panelSize = currentComponent === 'PartnerCatalog' ? 'lg' : 'md';
@@ -8,5 +8,5 @@ export const BubbleArrow = ({ arrowBottom = undefined, arrowLeft = undefined, ar
8
8
  const { posX: posXLeft, posY: posYLeft, rotation: rotationLeft, } = ArrowLocationMap[arrowLeft !== null && arrowLeft !== void 0 ? arrowLeft : 'left'];
9
9
  const { posX: posXRight, posY: posYRight, rotation: rotationRight, } = ArrowLocationMap[arrowRight !== null && arrowRight !== void 0 ? arrowRight : 'right'];
10
10
  const { posX: posXTop, posY: posYTop, rotation: rotationTop, } = ArrowLocationMap[arrowTop !== null && arrowTop !== void 0 ? arrowTop : 'top'];
11
- return (_jsxs(_Fragment, { children: [arrowBottom && (_jsx(Image, { src: Arrow, alt: t('tour.arrowAlt'), w: arrowSize, position: "absolute", left: posXBottom, top: posYBottom, transform: `rotate(${rotationBottom}deg)` })), arrowLeft && (_jsx(Image, { src: Arrow, alt: t('tour.arrowAlt'), w: arrowSize, position: "absolute", left: posXLeft, top: posYLeft, transform: `rotate(${rotationLeft}deg)` })), arrowRight && (_jsx(Image, { src: Arrow, alt: t('tour.arrowAlt'), w: arrowSize, position: "absolute", left: posXRight, top: posYRight, transform: `rotate(${rotationRight}deg)` })), arrowTop && (_jsx(Image, { src: Arrow, alt: t('tour.arrowAlt'), w: arrowSize, position: "absolute", left: posXTop, top: posYTop, transform: `rotate(${rotationTop}deg)` }))] }));
11
+ return (_jsxs(_Fragment, { children: [arrowBottom && (_jsx(Image, { src: Arrow, alt: t('tour.arrowAlt'), w: arrowSize, position: "absolute", left: posXBottom, top: posYBottom, transform: `rotate(${rotationBottom}deg)`, filter: "brightness(1.6) saturate(200%)" })), arrowLeft && (_jsx(Image, { src: Arrow, alt: t('tour.arrowAlt'), w: arrowSize, position: "absolute", left: posXLeft, top: posYLeft, transform: `rotate(${rotationLeft}deg)`, filter: "brightness(1.6) saturate(200%)" })), arrowRight && (_jsx(Image, { src: Arrow, alt: t('tour.arrowAlt'), w: arrowSize, position: "absolute", left: posXRight, top: posYRight, transform: `rotate(${rotationRight}deg)`, filter: "brightness(1.6) saturate(200%)" })), arrowTop && (_jsx(Image, { src: Arrow, alt: t('tour.arrowAlt'), w: arrowSize, position: "absolute", left: posXTop, top: posYTop, transform: `rotate(${rotationTop}deg)`, filter: "brightness(1.6) saturate(200%)" }))] }));
12
12
  };
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useState } from 'react';
2
+ import { useEffect, useState } from 'react';
3
3
  import { t } from 'i18next';
4
4
  import { Bubble, BubbleText, MeetStep } from '..';
5
- import { useComponentCoordinates, useComponentStyles, useWindowDimensions, } from '../../hooks';
5
+ import { useComponentCoordinates, useWindowDimensions } from '../../hooks';
6
6
  import { appBarHeight, arrowSize, distanceFromEdgeArrowToBorder, firstBubbleHeight, firstBubbleWidth, getDistanceFromArrow, getMiddleAnchorPosition, getXPosition, getYPosition, } from '../../utils';
7
+ import { homeAssistantProxy } from '../../proxies';
7
8
  export const HomeBoardTour = ({ currentStep = 'homeboard', bubbleWidth = '300px', handleClose, handleStep, meetStepUrl, isActive = false, }) => {
8
9
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
9
10
  const [counter, setCounter] = useState(0);
@@ -22,12 +23,19 @@ export const HomeBoardTour = ({ currentStep = 'homeboard', bubbleWidth = '300px'
22
23
  'addCatalog',
23
24
  ];
24
25
  const { coordinates } = useComponentCoordinates(componentIds);
25
- useComponentStyles({ ids: componentIds, selectedId: currentStep });
26
+ const { setSelectedId, setHighlight } = homeAssistantProxy;
27
+ useEffect(() => {
28
+ setSelectedId(currentStep);
29
+ }, [currentStep]);
26
30
  const { windowDimensions: { width, height }, } = useWindowDimensions();
27
31
  const parsedBubbleWidth = Number(bubbleWidth.replace('px', ''));
28
32
  const panelBubbleArrowSize = 500 + parsedBubbleWidth + arrowSize;
29
33
  const halfBubbleWidth = parsedBubbleWidth / 2;
30
34
  const bubbleArrowWidth = parsedBubbleWidth + arrowSize + 10;
35
+ const handleCloseAndHighlight = () => {
36
+ handleClose();
37
+ setHighlight(false);
38
+ };
31
39
  const steps = {
32
40
  homeboard: {
33
41
  arrowBottom: 'bottom',
@@ -38,7 +46,7 @@ export const HomeBoardTour = ({ currentStep = 'homeboard', bubbleWidth = '300px'
38
46
  topRef: getMiddleAnchorPosition(height, firstBubbleHeight),
39
47
  hideFooter: true,
40
48
  hideHeader: true,
41
- component: (_jsx(MeetStep, { description: t('tour.steps.meet.homeboardDescription'), nextButtonLabel: t('tour.steps.meet.homeboardLabel'), onClick: () => setCounter(counter + 1), onSkip: handleClose, title: t('tour.steps.meet.homeboardTitle'), tutorialUrl: meetStepUrl })),
49
+ component: (_jsx(MeetStep, { description: t('tour.steps.meet.homeboardDescription'), nextButtonLabel: t('tour.steps.meet.homeboardLabel'), onClick: () => setCounter(counter + 1), onSkip: handleCloseAndHighlight, title: t('tour.steps.meet.homeboardTitle'), tutorialUrl: meetStepUrl })),
42
50
  },
43
51
  // Reference component id -> HomeBoard/HomeCard
44
52
  editHomeIcon: {
@@ -154,5 +162,5 @@ export const HomeBoardTour = ({ currentStep = 'homeboard', bubbleWidth = '300px'
154
162
  };
155
163
  if (!isActive)
156
164
  return null;
157
- return (_jsx(Bubble, { counter: counter, handleClose: handleClose, handleStep: handleStep, setCounter: setCounter, steps: steps }));
165
+ return (_jsx(Bubble, { counter: counter, handleClose: handleCloseAndHighlight, handleStep: handleStep, setCounter: setCounter, steps: steps }));
158
166
  };
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useState } from 'react';
2
+ import { useEffect, useState } from 'react';
3
3
  import { t } from 'i18next';
4
4
  import { Bubble, BubbleText, HelpIconStep, MeetStep } from '..';
5
- import { useComponentCoordinates, useComponentStyles, useWindowDimensions, } from '../../hooks';
5
+ import { useComponentCoordinates, useWindowDimensions } from '../../hooks';
6
6
  import { appBarHeight, getDistanceFromArrow, getMiddleAnchorPosition, getXPosition, getYPosition, firstBubbleHeight, firstBubbleWidth, } from '../../utils';
7
+ import { homeAssistantProxy } from '../../proxies';
7
8
  export const LaunchpadTour = ({ currentStep = 'launchpad', handleStep, handleClose, meetStepUrl, isActive = false, }) => {
8
9
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
9
10
  const [counter, setCounter] = useState(0);
@@ -20,9 +21,16 @@ export const LaunchpadTour = ({ currentStep = 'launchpad', handleStep, handleClo
20
21
  'forwardReceipts',
21
22
  ];
22
23
  const { coordinates } = useComponentCoordinates(componentIds);
23
- useComponentStyles({ ids: componentIds, selectedId: currentStep });
24
+ const { setSelectedId, setHighlight } = homeAssistantProxy;
25
+ useEffect(() => {
26
+ setSelectedId(currentStep);
27
+ }, [currentStep]);
24
28
  const { windowDimensions: { width, height }, } = useWindowDimensions();
25
29
  const cardSize = 220;
30
+ const handleCloseAndHighlight = () => {
31
+ handleClose();
32
+ setHighlight(false);
33
+ };
26
34
  const steps = {
27
35
  launchpad: {
28
36
  arrowBottom: 'bottom',
@@ -33,7 +41,7 @@ export const LaunchpadTour = ({ currentStep = 'launchpad', handleStep, handleClo
33
41
  topRef: getMiddleAnchorPosition(height, firstBubbleHeight),
34
42
  hideFooter: true,
35
43
  hideHeader: true,
36
- component: (_jsx(MeetStep, { description: t('tour.steps.meet.launchpadDescription'), nextButtonLabel: t('tour.steps.meet.launchpadLabel'), onClick: () => setCounter(counter + 1), onSkip: handleClose, title: t('tour.steps.meet.launchpadTitle'), tutorialUrl: meetStepUrl })),
44
+ component: (_jsx(MeetStep, { description: t('tour.steps.meet.launchpadDescription'), nextButtonLabel: t('tour.steps.meet.launchpadLabel'), onClick: () => setCounter(counter + 1), onSkip: handleCloseAndHighlight, title: t('tour.steps.meet.launchpadTitle'), tutorialUrl: meetStepUrl })),
37
45
  },
38
46
  // Reference component id -> myHomes/headers/MyHomesHeader
39
47
  addHomeButton: {
@@ -103,12 +111,12 @@ export const LaunchpadTour = ({ currentStep = 'launchpad', handleStep, handleClo
103
111
  leftRef: ((_s = coordinates.feedback) === null || _s === void 0 ? void 0 : _s.x) - 225,
104
112
  topRef: ((_t = coordinates.feedback) === null || _t === void 0 ? void 0 : _t.y) + appBarHeight,
105
113
  component: (_jsx(HelpIconStep, { handleClose: () => {
106
- handleClose();
114
+ handleCloseAndHighlight();
107
115
  setCounter(0);
108
116
  } })),
109
117
  },
110
118
  };
111
119
  if (!isActive)
112
120
  return null;
113
- return (_jsx(Bubble, { counter: counter, handleClose: handleClose, handleStep: handleStep, setCounter: setCounter, steps: steps }));
121
+ return (_jsx(Bubble, { counter: counter, handleClose: handleCloseAndHighlight, handleStep: handleStep, setCounter: setCounter, steps: steps }));
114
122
  };
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useState } from 'react';
2
+ import { useEffect, useState } from 'react';
3
3
  import { t } from 'i18next';
4
4
  import { Bubble, BubbleText, MeetStep } from '..';
5
- import { useComponentCoordinates, useComponentStyles, useWindowDimensions, } from '../../hooks';
5
+ import { useComponentCoordinates, useWindowDimensions } from '../../hooks';
6
6
  import { getMiddleAnchorPosition, firstBubbleWidth, firstBubbleHeight, } from '../../utils';
7
+ import { homeAssistantProxy } from '../../proxies';
7
8
  export const RoomsBoardTour = ({ currentStep = 'addRooms', handleClose, handleStep, meetStepUrl, isActive = false, }) => {
8
9
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
9
10
  const [counter, setCounter] = useState(0);
@@ -16,7 +17,10 @@ export const RoomsBoardTour = ({ currentStep = 'addRooms', handleClose, handleSt
16
17
  'addingItems',
17
18
  ];
18
19
  const { coordinates } = useComponentCoordinates(componentIds);
19
- useComponentStyles({ ids: componentIds, selectedId: currentStep });
20
+ const { setSelectedId } = homeAssistantProxy;
21
+ useEffect(() => {
22
+ setSelectedId(currentStep);
23
+ }, [currentStep]);
20
24
  const { windowDimensions: { width, height }, } = useWindowDimensions();
21
25
  const steps = {
22
26
  addRooms: {
@@ -0,0 +1 @@
1
+ export declare const highlightIds: string[];
@@ -0,0 +1,42 @@
1
+ export const highlightIds = Array.from(new Set([
2
+ 'customizeRoomName',
3
+ 'trackRoomValue',
4
+ 'organizeByGroup',
5
+ 'trackGroupValue',
6
+ 'addItemToGroup',
7
+ 'addingItems',
8
+ 'addHomeButton',
9
+ 'assignReceipts',
10
+ 'homeCard',
11
+ 'feedback',
12
+ 'trackStorage',
13
+ 'role',
14
+ 'homePicture',
15
+ 'removeHome',
16
+ 'viewHome',
17
+ 'forwardReceipts',
18
+ 'backToLaunchpad',
19
+ 'editHomeIcon',
20
+ 'addFolders',
21
+ 'folder',
22
+ 'shareWithOthers',
23
+ 'viewContacts',
24
+ 'feedback',
25
+ 'storageUsed',
26
+ 'profile',
27
+ 'forwardReceipts',
28
+ 'viewReceipts',
29
+ 'addCatalog',
30
+ 'homeAssistantButton-1',
31
+ 'homeAssistantButton-2',
32
+ 'homeAssistantButton-3',
33
+ 'homeAssistantButton-4',
34
+ 'homeAssistantButton-5',
35
+ 'homeAssistantButton-6',
36
+ 'homeMonitorButton-1',
37
+ 'homeMonitorButton-2',
38
+ 'homeMonitorButton-3',
39
+ 'homeMonitorButton-4',
40
+ 'homeMonitorButton-5',
41
+ 'homeMonitorButton-6',
42
+ ]));
@@ -1 +1,2 @@
1
1
  export * from './ArrowLocations.helper';
2
+ export * from './Highlights.helper';
@@ -1 +1,2 @@
1
1
  export * from './ArrowLocations.helper';
2
+ export * from './Highlights.helper';
@@ -17,7 +17,7 @@ export const useSimpleDynamicForm = ({ fields }) => {
17
17
  const parsedValue = isCurrency ? parseCurrenyValue(value) : value;
18
18
  return Object.assign(Object.assign({}, field), { value: parsedValue, children: (_a = field === null || field === void 0 ? void 0 : field.children) === null || _a === void 0 ? void 0 : _a.map((child) => handleUpdateFields(child, fieldValues)) });
19
19
  };
20
- const updatedFields = fields.map((field) => {
20
+ const updatedFields = fields === null || fields === void 0 ? void 0 : fields.map((field) => {
21
21
  return handleUpdateFields(field, fieldValues);
22
22
  });
23
23
  const handleSetDefaultValues = (fields) => {
@@ -66,6 +66,7 @@ export const useHomeBoard = () => {
66
66
  isPanelStep ? onRightOpen() : onRightClose();
67
67
  };
68
68
  const handleClose = () => {
69
+ setShowOverlay(true);
69
70
  setActiveTour(false);
70
71
  };
71
72
  const [form, setForm] = useState({
@@ -1,7 +1,6 @@
1
1
  interface UseComponentStyles {
2
- ids: string[];
3
- selectedId: string;
2
+ ids?: string[];
4
3
  zIndex?: string;
5
4
  }
6
- export declare const useComponentStyles: ({ ids, selectedId, zIndex, }: UseComponentStyles) => void;
5
+ export declare const useComponentStyles: ({ ids, zIndex, }: UseComponentStyles) => void;
7
6
  export {};
@@ -1,5 +1,9 @@
1
- export const useComponentStyles = ({ ids, selectedId, zIndex = 'auto', }) => {
2
- if ((ids === null || ids === void 0 ? void 0 : ids.length) === 0)
1
+ import { highlightIds } from '../helpers/tour';
2
+ import { homeAssistantProxy } from '../proxies';
3
+ import { useSnapshot } from 'valtio';
4
+ export const useComponentStyles = ({ ids = highlightIds, zIndex = '2', }) => {
5
+ const { highlight, selectedId } = useSnapshot(homeAssistantProxy);
6
+ if ((ids === null || ids === void 0 ? void 0 : ids.length) === 0 || !selectedId)
3
7
  return;
4
8
  ids.forEach((id) => {
5
9
  const component = document.getElementById(id);
@@ -8,7 +12,7 @@ export const useComponentStyles = ({ ids, selectedId, zIndex = 'auto', }) => {
8
12
  }
9
13
  });
10
14
  const currentComponent = document.getElementById(selectedId);
11
- if (currentComponent) {
15
+ if (currentComponent && highlight) {
12
16
  currentComponent.style.zIndex = '1400';
13
17
  }
14
18
  };
@@ -0,0 +1,8 @@
1
+ interface HomeAssistantProxyI {
2
+ highlight: boolean;
3
+ selectedId: string;
4
+ setHighlight: (highlight: boolean) => void;
5
+ setSelectedId: (selectedId: string) => void;
6
+ }
7
+ export declare const homeAssistantProxy: HomeAssistantProxyI;
8
+ export {};
@@ -0,0 +1,9 @@
1
+ import { proxy } from 'valtio';
2
+ export const homeAssistantProxy = proxy({
3
+ highlight: false,
4
+ selectedId: '',
5
+ setHighlight: (highlight) => {
6
+ homeAssistantProxy.highlight = highlight;
7
+ },
8
+ setSelectedId: (selectedId) => (homeAssistantProxy.selectedId = selectedId),
9
+ });
@@ -1 +1,2 @@
1
+ export * from './homeAssistant.proxy';
1
2
  export * from './homeCard.proxy';
@@ -1 +1,2 @@
1
+ export * from './homeAssistant.proxy';
1
2
  export * from './homeCard.proxy';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.14.30",
3
+ "version": "2.14.31",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",
@@ -2,8 +2,12 @@ import { t } from 'i18next'
2
2
  import { Box, Flex, Image } from '@chakra-ui/react'
3
3
  import { TourButtonI } from '@/interfaces'
4
4
  import { Flag } from '@/assets/images'
5
+ import { useComponentStyles } from '@/hooks'
6
+ import { homeAssistantProxy } from '@/proxies'
5
7
 
6
8
  export const TourButton = ({ label, onClick }: TourButtonI) => {
9
+ const { setHighlight } = homeAssistantProxy
10
+ useComponentStyles({})
7
11
  return (
8
12
  <Box
9
13
  data-testid="tour-button"
@@ -14,7 +18,10 @@ export const TourButton = ({ label, onClick }: TourButtonI) => {
14
18
  fontFamily="secondary"
15
19
  transition="all 0.2s ease-in-out"
16
20
  _hover={{ bg: 'lightGreen.4' }}
17
- onClick={onClick}
21
+ onClick={() => {
22
+ setHighlight(true)
23
+ onClick?.()
24
+ }}
18
25
  flexShrink={0}
19
26
  overflow="hidden"
20
27
  >
@@ -2,26 +2,15 @@ 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 { useComponentStyles } from '@/hooks'
5
+ import { homeAssistantProxy } from '@/proxies'
6
6
 
7
7
  export const HomeAssistantSteps = ({
8
8
  currentStep,
9
9
  onStepClick,
10
10
  currentPanel,
11
11
  }: HomeAssistantStepsI) => {
12
- const stepId = `homeAssistantButton-${currentPanel}`
13
- const componentIds = currentPanel
14
- ? [
15
- 'homeAssistantButton-1',
16
- 'homeAssistantButton-2',
17
- 'homeAssistantButton-3',
18
- 'homeAssistantButton-4',
19
- 'homeAssistantButton-5',
20
- 'homeAssistantButton-6',
21
- ]
22
- : []
12
+ const { setSelectedId } = homeAssistantProxy
23
13
 
24
- useComponentStyles({ ids: componentIds, selectedId: stepId, zIndex: '2' })
25
14
  return (
26
15
  <Stack
27
16
  spacing="8"
@@ -35,7 +24,10 @@ export const HomeAssistantSteps = ({
35
24
  <Center key={step.title} w="100%">
36
25
  <HomeAssistantButton
37
26
  currentStep={index + 1}
38
- onStepClick={onStepClick}
27
+ onStepClick={(step) => {
28
+ onStepClick(step)
29
+ setSelectedId(`homeAssistantButton-${index + 1}`)
30
+ }}
39
31
  status={getStatus(index + 1, currentStep)}
40
32
  step={step}
41
33
  />
@@ -1,27 +1,19 @@
1
+ import { Fragment } from 'react'
1
2
  import { Box, Flex } from '@chakra-ui/react'
2
3
  import { HomeMonitortStepsI } from '@/interfaces'
3
4
  import { HomeMonitorButton, IconMenu, MoreHorizontal } from '@/components'
4
5
  import { homeAssistantSteps } from '@/helpers'
5
- import { useComponentStyles } from '@/hooks'
6
- import { Fragment, useState } from 'react'
6
+ import { homeAssistantProxy } from '@/proxies'
7
7
 
8
8
  export const HomeMonitorSteps = ({
9
9
  menuItems = [],
10
10
  onStepClick,
11
11
  stepsWithAlerts,
12
12
  }: HomeMonitortStepsI) => {
13
- const ids = [
14
- 'homeMonitorButton-1',
15
- 'homeMonitorButton-2',
16
- 'homeMonitorButton-3',
17
- 'homeMonitorButton-4',
18
- 'homeMonitorButton-5',
19
- 'homeMonitorButton-6',
20
- ]
21
- const [selectedId, setSelectedId] = useState<string>('')
13
+ const { setSelectedId } = homeAssistantProxy
14
+
22
15
  const isDisabled = menuItems.length === 0
23
16
 
24
- useComponentStyles({ ids, selectedId, zIndex: '2' })
25
17
  const handleStepClick = (step: number) => onStepClick(step)
26
18
  return (
27
19
  <Flex gap="base" justify="center">
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren, useState, useEffect } from 'react'
1
+ import { PropsWithChildren, useState, useEffect, use } from 'react'
2
2
  import { FormProvider } from 'react-hook-form'
3
3
  import { t } from 'i18next'
4
4
  import {
@@ -15,11 +15,12 @@ import {
15
15
  FooterButtons,
16
16
  HomeAssistantPanelStep,
17
17
  PanelHeader,
18
- Loading
18
+ Loading,
19
19
  } from '@/components'
20
20
  import { AppliancesType, HomeAssistantPanelI } from '@/interfaces'
21
21
  import { homeAssistantSteps } from '@/helpers'
22
22
  import { useSimpleDynamicForm } from '@/hooks'
23
+ import { homeAssistantProxy } from '@/proxies'
23
24
 
24
25
  export const HomeAssistantPanel = ({
25
26
  children,
@@ -33,14 +34,18 @@ export const HomeAssistantPanel = ({
33
34
  backDisabled,
34
35
  nextDisabled,
35
36
  hasCompleted,
36
- isLoading
37
+ isLoading,
37
38
  }: PropsWithChildren<HomeAssistantPanelI>) => {
38
- const [addedAppliances, updateAddedAppliances] = useState<AppliancesType[]>([])
39
- const title = homeAssistantSteps?.[currentStep - 1]?.title ?? "";
39
+ const [addedAppliances, updateAddedAppliances] = useState<AppliancesType[]>(
40
+ []
41
+ )
42
+ const title = homeAssistantSteps?.[currentStep - 1]?.title ?? ''
40
43
  const text = `${t('homeAssistant.details')} ${title.toLowerCase()}:`
41
44
  const isAppliances = currentStep === 4
45
+ const { setHighlight } = homeAssistantProxy
42
46
 
43
47
  useEffect(() => {
48
+ setHighlight(true)
44
49
  if (isAppliances) {
45
50
  const targetAppliances = currentForm.find(
46
51
  (field) =>
@@ -49,19 +54,28 @@ export const HomeAssistantPanel = ({
49
54
  )?.value as AppliancesType[]
50
55
  updateAddedAppliances(targetAppliances)
51
56
  }
57
+
58
+ return () => {
59
+ setHighlight(false)
60
+ }
52
61
  }, [currentForm, isAppliances])
53
62
 
54
63
  const { form, updatedFields } = useSimpleDynamicForm({
55
64
  fields: currentForm,
56
65
  })
57
66
 
67
+ const handleClose = () => {
68
+ onClose()
69
+ setHighlight(false)
70
+ }
71
+
58
72
  if (isLoading) return <Loading />
59
73
 
60
74
  return (
61
75
  <>
62
76
  <DrawerHeader p="0">
63
77
  <PanelHeader
64
- handleCloseButton={onClose}
78
+ handleCloseButton={handleClose}
65
79
  title={t('homeAssistant.title')}
66
80
  icon={IA}
67
81
  />
@@ -94,15 +108,22 @@ export const HomeAssistantPanel = ({
94
108
  }}
95
109
  button2={{
96
110
  buttonStyle: 'primaryFooter',
97
- label: !hasCompleted && currentStep === 6 ? t('buttons.finish') : t('buttons.saveStep'),
111
+ label:
112
+ !hasCompleted && currentStep === 6
113
+ ? t('buttons.finish')
114
+ : t('buttons.saveStep'),
98
115
  onClick: () => onSave(updatedFields),
99
116
  }}
100
- button3={(!hasCompleted && currentStep === 6) ? undefined : {
101
- buttonStyle: 'primaryFooter',
102
- label: t('buttons.next'),
103
- onClick: onNext,
104
- isDisabled: nextDisabled,
105
- }}
117
+ button3={
118
+ !hasCompleted && currentStep === 6
119
+ ? undefined
120
+ : {
121
+ buttonStyle: 'primaryFooter',
122
+ label: t('buttons.next'),
123
+ onClick: onNext,
124
+ isDisabled: nextDisabled,
125
+ }
126
+ }
106
127
  />
107
128
  </DrawerFooter>
108
129
  </>
@@ -271,19 +271,21 @@ export const HomeBoard = () => {
271
271
  </DrawerContent>
272
272
  ),
273
273
  HomeAssistant: (
274
- <HomeAssistantPanel
275
- currentStep={homeAssistantCurrentStep}
276
- currentForm={currentHomeAssistantForm}
277
- onNext={handleHomeAssistantFormChange}
278
- onBack={handleHomeAssistantBack}
279
- onApplianceClick={() => null}
280
- onClose={onRightClose}
281
- onSave={() => {}}
282
- backDisabled={false}
283
- nextDisabled={false}
284
- hasCompleted={true}
285
- isLoading={false}
286
- />
274
+ <DrawerContent>
275
+ <HomeAssistantPanel
276
+ currentStep={homeAssistantCurrentStep}
277
+ currentForm={currentHomeAssistantForm}
278
+ onNext={handleHomeAssistantFormChange}
279
+ onBack={handleHomeAssistantBack}
280
+ onApplianceClick={() => null}
281
+ onClose={onRightClose}
282
+ onSave={() => {}}
283
+ backDisabled={false}
284
+ nextDisabled={false}
285
+ hasCompleted={true}
286
+ isLoading={false}
287
+ />
288
+ </DrawerContent>
287
289
  ),
288
290
  Notifications: (
289
291
  <NotificationsPanel
@@ -42,6 +42,7 @@ export const BubbleArrow = ({
42
42
  left={posXBottom}
43
43
  top={posYBottom}
44
44
  transform={`rotate(${rotationBottom}deg)`}
45
+ filter="brightness(1.6) saturate(200%)"
45
46
  />
46
47
  )}
47
48
  {arrowLeft && (
@@ -53,6 +54,7 @@ export const BubbleArrow = ({
53
54
  left={posXLeft}
54
55
  top={posYLeft}
55
56
  transform={`rotate(${rotationLeft}deg)`}
57
+ filter="brightness(1.6) saturate(200%)"
56
58
  />
57
59
  )}
58
60
  {arrowRight && (
@@ -64,6 +66,7 @@ export const BubbleArrow = ({
64
66
  left={posXRight}
65
67
  top={posYRight}
66
68
  transform={`rotate(${rotationRight}deg)`}
69
+ filter="brightness(1.6) saturate(200%)"
67
70
  />
68
71
  )}
69
72
  {arrowTop && (
@@ -75,6 +78,7 @@ export const BubbleArrow = ({
75
78
  left={posXTop}
76
79
  top={posYTop}
77
80
  transform={`rotate(${rotationTop}deg)`}
81
+ filter="brightness(1.6) saturate(200%)"
78
82
  />
79
83
  )}
80
84
  </>
@@ -1,12 +1,8 @@
1
- import { useState } from 'react'
1
+ import { useEffect, useState } from 'react'
2
2
  import { t } from 'i18next'
3
3
  import { Bubble, BubbleText, MeetStep } from '@/components'
4
4
  import { StepI, TourI } from '@/interfaces'
5
- import {
6
- useComponentCoordinates,
7
- useComponentStyles,
8
- useWindowDimensions,
9
- } from '@/hooks'
5
+ import { useComponentCoordinates, useWindowDimensions } from '@/hooks'
10
6
  import {
11
7
  appBarHeight,
12
8
  arrowSize,
@@ -18,6 +14,7 @@ import {
18
14
  getXPosition,
19
15
  getYPosition,
20
16
  } from '@/utils'
17
+ import { homeAssistantProxy } from '@/proxies'
21
18
 
22
19
  export const HomeBoardTour = ({
23
20
  currentStep = 'homeboard',
@@ -45,8 +42,11 @@ export const HomeBoardTour = ({
45
42
  ]
46
43
 
47
44
  const { coordinates } = useComponentCoordinates(componentIds)
45
+ const { setSelectedId, setHighlight } = homeAssistantProxy
48
46
 
49
- useComponentStyles({ ids: componentIds, selectedId: currentStep })
47
+ useEffect(() => {
48
+ setSelectedId(currentStep)
49
+ }, [currentStep])
50
50
 
51
51
  const {
52
52
  windowDimensions: { width, height },
@@ -57,6 +57,11 @@ export const HomeBoardTour = ({
57
57
  const halfBubbleWidth = parsedBubbleWidth / 2
58
58
  const bubbleArrowWidth = parsedBubbleWidth + arrowSize + 10
59
59
 
60
+ const handleCloseAndHighlight = () => {
61
+ handleClose()
62
+ setHighlight(false)
63
+ }
64
+
60
65
  const steps: StepI = {
61
66
  homeboard: {
62
67
  arrowBottom: 'bottom',
@@ -72,7 +77,7 @@ export const HomeBoardTour = ({
72
77
  description={t('tour.steps.meet.homeboardDescription')}
73
78
  nextButtonLabel={t('tour.steps.meet.homeboardLabel')}
74
79
  onClick={() => setCounter(counter + 1)}
75
- onSkip={handleClose}
80
+ onSkip={handleCloseAndHighlight}
76
81
  title={t('tour.steps.meet.homeboardTitle')}
77
82
  tutorialUrl={meetStepUrl}
78
83
  />
@@ -291,7 +296,7 @@ export const HomeBoardTour = ({
291
296
  return (
292
297
  <Bubble
293
298
  counter={counter}
294
- handleClose={handleClose}
299
+ handleClose={handleCloseAndHighlight}
295
300
  handleStep={handleStep}
296
301
  setCounter={setCounter}
297
302
  steps={steps}
@@ -1,12 +1,8 @@
1
- import { useState } from 'react'
1
+ import { useEffect, useState } from 'react'
2
2
  import { t } from 'i18next'
3
3
  import { Bubble, BubbleText, HelpIconStep, MeetStep } from '@/components'
4
4
  import { StepI, TourI } from '@/interfaces'
5
- import {
6
- useComponentCoordinates,
7
- useComponentStyles,
8
- useWindowDimensions,
9
- } from '@/hooks'
5
+ import { useComponentCoordinates, useWindowDimensions } from '@/hooks'
10
6
  import {
11
7
  appBarHeight,
12
8
  getDistanceFromArrow,
@@ -16,6 +12,7 @@ import {
16
12
  firstBubbleHeight,
17
13
  firstBubbleWidth,
18
14
  } from '@/utils'
15
+ import { homeAssistantProxy } from '@/proxies'
19
16
 
20
17
  export const LaunchpadTour = ({
21
18
  currentStep = 'launchpad',
@@ -40,8 +37,11 @@ export const LaunchpadTour = ({
40
37
  ]
41
38
 
42
39
  const { coordinates } = useComponentCoordinates(componentIds)
40
+ const { setSelectedId, setHighlight } = homeAssistantProxy
43
41
 
44
- useComponentStyles({ ids: componentIds, selectedId: currentStep })
42
+ useEffect(() => {
43
+ setSelectedId(currentStep)
44
+ }, [currentStep])
45
45
 
46
46
  const {
47
47
  windowDimensions: { width, height },
@@ -49,6 +49,11 @@ export const LaunchpadTour = ({
49
49
 
50
50
  const cardSize = 220
51
51
 
52
+ const handleCloseAndHighlight = () => {
53
+ handleClose()
54
+ setHighlight(false)
55
+ }
56
+
52
57
  const steps: StepI = {
53
58
  launchpad: {
54
59
  arrowBottom: 'bottom',
@@ -64,7 +69,7 @@ export const LaunchpadTour = ({
64
69
  description={t('tour.steps.meet.launchpadDescription')}
65
70
  nextButtonLabel={t('tour.steps.meet.launchpadLabel')}
66
71
  onClick={() => setCounter(counter + 1)}
67
- onSkip={handleClose}
72
+ onSkip={handleCloseAndHighlight}
68
73
  title={t('tour.steps.meet.launchpadTitle')}
69
74
  tutorialUrl={meetStepUrl}
70
75
  />
@@ -185,7 +190,7 @@ export const LaunchpadTour = ({
185
190
  component: (
186
191
  <HelpIconStep
187
192
  handleClose={() => {
188
- handleClose()
193
+ handleCloseAndHighlight()
189
194
  setCounter(0)
190
195
  }}
191
196
  />
@@ -198,7 +203,7 @@ export const LaunchpadTour = ({
198
203
  return (
199
204
  <Bubble
200
205
  counter={counter}
201
- handleClose={handleClose}
206
+ handleClose={handleCloseAndHighlight}
202
207
  handleStep={handleStep}
203
208
  setCounter={setCounter}
204
209
  steps={steps}
@@ -1,17 +1,14 @@
1
- import { useState } from 'react'
1
+ import { useEffect, useState } from 'react'
2
2
  import { t } from 'i18next'
3
3
  import { Bubble, BubbleText, MeetStep } from '@/components'
4
4
  import { StepI, TourI } from '@/interfaces'
5
- import {
6
- useComponentCoordinates,
7
- useComponentStyles,
8
- useWindowDimensions,
9
- } from '@/hooks'
5
+ import { useComponentCoordinates, useWindowDimensions } from '@/hooks'
10
6
  import {
11
7
  getMiddleAnchorPosition,
12
8
  firstBubbleWidth,
13
9
  firstBubbleHeight,
14
10
  } from '@/utils'
11
+ import { homeAssistantProxy } from '@/proxies'
15
12
 
16
13
  export const RoomsBoardTour = ({
17
14
  currentStep = 'addRooms',
@@ -32,8 +29,11 @@ export const RoomsBoardTour = ({
32
29
  ]
33
30
 
34
31
  const { coordinates } = useComponentCoordinates(componentIds)
32
+ const { setSelectedId } = homeAssistantProxy
35
33
 
36
- useComponentStyles({ ids: componentIds, selectedId: currentStep })
34
+ useEffect(() => {
35
+ setSelectedId(currentStep)
36
+ }, [currentStep])
37
37
 
38
38
  const {
39
39
  windowDimensions: { width, height },
@@ -0,0 +1,44 @@
1
+ export const highlightIds = Array.from(
2
+ new Set([
3
+ 'customizeRoomName',
4
+ 'trackRoomValue',
5
+ 'organizeByGroup',
6
+ 'trackGroupValue',
7
+ 'addItemToGroup',
8
+ 'addingItems',
9
+ 'addHomeButton',
10
+ 'assignReceipts',
11
+ 'homeCard',
12
+ 'feedback',
13
+ 'trackStorage',
14
+ 'role',
15
+ 'homePicture',
16
+ 'removeHome',
17
+ 'viewHome',
18
+ 'forwardReceipts',
19
+ 'backToLaunchpad',
20
+ 'editHomeIcon',
21
+ 'addFolders',
22
+ 'folder',
23
+ 'shareWithOthers',
24
+ 'viewContacts',
25
+ 'feedback',
26
+ 'storageUsed',
27
+ 'profile',
28
+ 'forwardReceipts',
29
+ 'viewReceipts',
30
+ 'addCatalog',
31
+ 'homeAssistantButton-1',
32
+ 'homeAssistantButton-2',
33
+ 'homeAssistantButton-3',
34
+ 'homeAssistantButton-4',
35
+ 'homeAssistantButton-5',
36
+ 'homeAssistantButton-6',
37
+ 'homeMonitorButton-1',
38
+ 'homeMonitorButton-2',
39
+ 'homeMonitorButton-3',
40
+ 'homeMonitorButton-4',
41
+ 'homeMonitorButton-5',
42
+ 'homeMonitorButton-6',
43
+ ])
44
+ )
@@ -1 +1,2 @@
1
- export * from './ArrowLocations.helper'
1
+ export * from './ArrowLocations.helper'
2
+ export * from './Highlights.helper'
@@ -36,7 +36,7 @@ export const useSimpleDynamicForm = ({ fields }: UseDynamicFormI) => {
36
36
  ),
37
37
  }
38
38
  }
39
- const updatedFields = fields.map((field) => {
39
+ const updatedFields = fields?.map((field) => {
40
40
  return handleUpdateFields(field, fieldValues)
41
41
  })
42
42
 
@@ -75,6 +75,7 @@ export const useHomeBoard = () => {
75
75
  }
76
76
 
77
77
  const handleClose = () => {
78
+ setShowOverlay(true)
78
79
  setActiveTour(false)
79
80
  }
80
81
 
@@ -1,15 +1,19 @@
1
+ import { highlightIds } from '@/helpers/tour'
2
+ import { homeAssistantProxy } from '@/proxies'
3
+ import { useSnapshot } from 'valtio'
4
+
1
5
  interface UseComponentStyles {
2
- ids: string[]
3
- selectedId: string
6
+ ids?: string[]
4
7
  zIndex?: string
5
8
  }
6
9
 
7
10
  export const useComponentStyles = ({
8
- ids,
9
- selectedId,
10
- zIndex = 'auto',
11
+ ids = highlightIds,
12
+ zIndex = '2',
11
13
  }: UseComponentStyles) => {
12
- if (ids?.length === 0) return
14
+ const { highlight, selectedId } = useSnapshot(homeAssistantProxy)
15
+
16
+ if (ids?.length === 0 || !selectedId) return
13
17
 
14
18
  ids.forEach((id) => {
15
19
  const component = document.getElementById(id)
@@ -21,7 +25,7 @@ export const useComponentStyles = ({
21
25
 
22
26
  const currentComponent = document.getElementById(selectedId)
23
27
 
24
- if (currentComponent) {
28
+ if (currentComponent && highlight) {
25
29
  currentComponent.style.zIndex = '1400'
26
30
  }
27
31
  }
@@ -0,0 +1,18 @@
1
+ import { proxy } from 'valtio'
2
+
3
+ interface HomeAssistantProxyI {
4
+ highlight: boolean
5
+ selectedId: string
6
+ setHighlight: (highlight: boolean) => void
7
+ setSelectedId: (selectedId: string) => void
8
+ }
9
+
10
+ export const homeAssistantProxy = proxy<HomeAssistantProxyI>({
11
+ highlight: false,
12
+ selectedId: '',
13
+ setHighlight: (highlight: boolean) => {
14
+ homeAssistantProxy.highlight = highlight
15
+ },
16
+ setSelectedId: (selectedId: string) =>
17
+ (homeAssistantProxy.selectedId = selectedId),
18
+ })
@@ -1 +1,2 @@
1
+ export * from './homeAssistant.proxy'
1
2
  export * from './homeCard.proxy'