From 0e142d81cde658bda21332c48f3df8051e0f2ec2 Mon Sep 17 00:00:00 2001 From: Aiga115 Date: Mon, 26 Feb 2024 13:48:57 +0100 Subject: [PATCH] CDE-54 fix: fix eslint issues --- lib/CdeContextProvider.tsx | 2 +- lib/components/common/CheckBox.tsx | 2 +- lib/components/common/StyledCard.tsx | 2 +- lib/components/common/Tour.tsx | 31 +++++++--------------------- 4 files changed, 10 insertions(+), 27 deletions(-) diff --git a/lib/CdeContextProvider.tsx b/lib/CdeContextProvider.tsx index 2595efd..e4e16a9 100644 --- a/lib/CdeContextProvider.tsx +++ b/lib/CdeContextProvider.tsx @@ -35,7 +35,7 @@ export const CdeContextProvider = ({ const [loadingMessage, setLoadingMessage] = useState(null); const [errorMessage, setErrorMessage] = useState(null); - let checked = JSON.parse(localStorage.getItem('isCheckboxChecked') || 'false'); + const checked = JSON.parse(localStorage.getItem('isCheckboxChecked') || 'false'); const [isTourOpen, setIsTourOpen] = useState(!checked); // Defines the mapping of the mandatory columns in the dataset mapping file diff --git a/lib/components/common/CheckBox.tsx b/lib/components/common/CheckBox.tsx index 3538662..0f60d1c 100644 --- a/lib/components/common/CheckBox.tsx +++ b/lib/components/common/CheckBox.tsx @@ -7,7 +7,7 @@ interface ICheckbox { label: string; sx?: SxProps; checked?: boolean; - onChange?: (e: any) => void; + onChange?: (e: React.ChangeEvent) => void; } const Checkbox: React.FC = ({label = '', sx = {}, checked, onChange}) => { diff --git a/lib/components/common/StyledCard.tsx b/lib/components/common/StyledCard.tsx index 6a15862..6bf1910 100644 --- a/lib/components/common/StyledCard.tsx +++ b/lib/components/common/StyledCard.tsx @@ -20,7 +20,7 @@ interface StyledCardProps { handleTourNextStepClick: () => void; } -const StyledCard: React.FC = ({value, isSuggested, selectedValue, onChange, label, handleTourNextStepClick}) => { +const StyledCard: React.FC = ({value, isSuggested, selectedValue, onChange, handleTourNextStepClick}) => { const radioGroup = useRadioGroup(); let checked = false; diff --git a/lib/components/common/Tour.tsx b/lib/components/common/Tour.tsx index 67a0945..b122722 100644 --- a/lib/components/common/Tour.tsx +++ b/lib/components/common/Tour.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import Joyride, { ACTIONS, EVENTS, STATUS, CallBackProps, Step } from 'react-joyride'; +import Joyride, { ACTIONS, EVENTS, STATUS, CallBackProps, Step, TooltipRenderProps } from 'react-joyride'; import { Box, Typography, Button, IconButton } from '@mui/material'; import Checkbox from './CheckBox'; import { TutorialCloseIcon } from '../../icons'; @@ -8,19 +8,6 @@ import { useCdeContext } from '../../CdeContext'; const { baseWhite, gray300, gray500, gray600, primary600, primary700, tutorialOverlayColor, tooltipBoxShadow, gray100, gray900 } = vars; -interface TooltipProps { - continuous: boolean, - index: number - isLastStep: boolean - size: number - step: any - backProps: any - closeProps: any - primaryProps: any - skipProps: any - tooltipProps: any -}; - const Tooltip = ({ continuous, index, @@ -32,7 +19,7 @@ const Tooltip = ({ tooltipProps, skipProps, size -}: TooltipProps) => { +}: TooltipRenderProps) => { const { styles: { tooltip: tooltipStyle, @@ -40,14 +27,12 @@ const Tooltip = ({ tooltipContent, tooltipFooter }, - placement, - spotlightClicks, hideBackButton, hideCloseButton, hideFooter } = step; - let isChecked = JSON.parse(localStorage.getItem('isCheckboxChecked') || 'false'); + const isChecked = JSON.parse(localStorage.getItem('isCheckboxChecked') || 'false'); const [checked, setChecked] = useState(isChecked); const handleChange = (event: React.ChangeEvent) => { @@ -59,19 +44,17 @@ const Tooltip = ({ {step.title && ( - + {step.title} )} - + {step.content} - + {index + 1} of {size} {continuous && !hideFooter && (