Snippets Collections
#include<stdio.h>
// this code is for the recursive implementation of ternary search 
int ternarysearch(int l, int r, int key,int ar[])
{
    if(r >= 1){
        int mid1 = l + (r-1)/3;
        int mid2 = r - (r-1)/3;
        
        if (ar[mid1] == key){
            return mid1;
        }
        if (ar[mid2] == key){
            return mid2;
        }
        if(key < ar[mid1]){
            return ternarysearch(1, mid1-1,key,ar);
        }
        else if(key > ar[mid2]){
            return ternarysearch(mid2+1, mid2-1,key,ar);
        }
    }

    return -1;    

}

int main()
{
    int l,r,p,key;
//sort the array if the array is not sorted
    int ar[] = {1,2,3,4,5,6,7,8,9,10};

    l=0;

    r=9;

    key= 5;

    p= ternarysearch(l, r,key,ar);

    printf("index of %d is%d\n", key,p);

    key = 50;

    p= ternarysearch(l, r, key, ar);

    printf("index of %d is %d",key , p);
}
Certainly! The animation property in CSS is used to apply animations to elements on a webpage. Here is a basic example of how to use it:




.element {
  animation-name: slide-in;
  animation-duration: 2s;
  animation-delay: 1s;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

@keyframes slide-in {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(0);
  }
}




In the above example, we define an animation called slide-in using the @keyframes rule. We then apply this animation to the .element class using the animation-name property. The animation-duration property specifies how long the animation should take, the animation-delay property adds a delay before the animation starts, the animation-iteration-count property specifies how many times the animation should repeat, and the animation-direction property specifies the direction of the animation.

Within the @keyframes rule, we define the different stages of the animation using percentage values. In this example, we start with the element translated to the left by 100% (transform: translateX(-100%)) and end with the element at its original position (transform: translateX(0)).

You can customize the animation by adjusting these properties and the @keyframes rule to achieve different effects.


https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4454200103.html#Related-Topics
f"""
                            <html>
                            <head>
                                <style>
                                    table {{
                                        width: 100%;
                                        border-collapse: collapse;
                                        font-family: Arial, sans-serif;
                                    }}

                                    th, td {{
                                        padding: 12px;
                                        text-align: left;
                                        border-bottom: 1px solid #ddd;
                                    }}

                                    th {{
                                        background-color: #f2f2f2;
                                    }}

                                    tr:hover {{
                                        background-color: #f5f5f5;
                                    }}
                                </style>
                            </head>
                            <body>
                                <table>
                                    <thead>
                                        <tr>
                                            <th>Tag Name</th>
                                            <th>Tag Comment</th>
                                            <th>Tag Value</th>
                                            <th>Unit</th>
                                            <th>Time Stamp</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>Tag 1</td>
                                            <td>Comment 1</td>
                                            <td>Value 1</td>
                                            <td>Unit 1</td>
                                            <td>2023-12-19 10:00:00</td>
                                        </tr>
                                        <tr>
                                            <td>Tag 2</td>
                                            <td>Comment 2</td>
                                            <td>Value 2</td>
                                            <td>Unit 2</td>
                                            <td>2023-12-19 10:15:00</td>
                                        </tr>
                                        <tr>
                                            <td>Tag 3</td>
                                            <td>Comment 3</td>
                                            <td>Value 3</td>
                                            <td>Unit 3</td>
                                            <td>2023-12-19 10:30:00</td>
                                        </tr>
                                        <!-- Add more rows as needed -->
                                    </tbody>
                                </table>
                            </body>
                            </html>
                            """
#include<stdio.h>
int sentilinearsearch(int arr[], int size, int target)
{
    int last = arr[size-1];
    arr[size - 1] = target;
    int i=0;
    while(arr[i] !=target){
        i++;
    }
    arr[size-1] = last;
    if(i < size-1 || arr[size - 1]== target){
        return i;
    }
    else{
        return -1;
    }
}
int main()
{
    int arr[] = {3,5,1,8,2};
    int size = sizeof(arr)/sizeof(arr[0]);
    int target = 8;

    int result = sentilinearsearch(arr , size, target);

    if (result != -1){
        printf("element %d is found at index%d\n", target,result);
    }
    else{
        printf("element %d is not fopund", target);
    }
    return 0 ;
}
function woodmart_post_date( $args ) {
	$has_title = get_the_title() != '';
	$attr      = '';
	if ( ! $has_title && ! is_single() ) {
		$url  = get_the_permalink();
		$attr = 'window.location=\'' . $url . '\';';
	}
	$classes  = '';
	$classes .= ' ' . $args['style'];
	$classes .= woodmart_get_old_classes( ' woodmart-post-date' );
	?>
		<div class="post-date wd-post-date<?php echo esc_attr( $classes ); ?>" onclick="<?php echo esc_attr( $attr ); ?>">
			<span class="post-date-day">
				<?php echo get_the_time( 'd' ); ?>
			</span>
			<span class="post-date-month">
				<?php echo get_the_time( 'M' ); ?>
			</span>
			<span class="post-date-year">
				<?php echo get_the_time( 'Y' ); ?>
			</span>
		</div>
	<?php
}
/* eslint-disable func-names */
/* eslint-disable no-param-reassign */
/* eslint-disable no-return-assign */
/* eslint-disable no-alert */
/* eslint-disable no-unreachable-loop */
/* eslint-disable no-restricted-syntax */
/* eslint-disable no-dupe-else-if */
/* eslint-disable @typescript-eslint/no-use-before-define */
/* eslint-disable no-confusing-arrow */
/* eslint-disable no-nested-ternary */
/* eslint-disable no-fallthrough */
/* eslint-disable consistent-return */
/* eslint-disable @typescript-eslint/no-shadow */
/* eslint-disable @typescript-eslint/no-unused-expressions */
/* eslint-disable react/no-unstable-nested-components */
/* eslint-disable @typescript-eslint/comma-spacing */
/* eslint-disable array-callback-return */
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable react/no-unstable-nested-components */
/* eslint-disable react/prop-types */
/* eslint-disable max-len */
/* eslint-disable react/no-array-index-key */
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable react/destructuring-assignment */
import * as React from 'react';
import './styles.scss';
// MUI imports
import { styled } from '@mui/material/styles';
import Stack from '@mui/material/Stack';
import Stepper from '@mui/material/Stepper';
import Step from '@mui/material/Step';
import StepLabel from '@mui/material/StepLabel';
import StepDoneIcon from '@mui/icons-material/Done';
import StepConnector, {
  stepConnectorClasses,
} from '@mui/material/StepConnector';
import { StepIconProps } from '@mui/material/StepIcon';
// import Button from '@mui/material/Button';
// import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';

// Package imports
import {
  useParams, useNavigate, useLocation, Navigate,
} from 'react-router';
import { useSelector, useDispatch } from 'react-redux';
import { Modal, Button } from 'react-bootstrap';
import { trackPromise } from 'react-promise-tracker';

// Redux Reducers import
import {
  WillStepState,
  fetchWillStepList,
  willStepSelector,
} from '@redux/slices/wills-steps-list';
import {
  WillBeneficiaryShareStateaftersave,
  fetchWillBeneficiaryShareStateaftersave,
  willBeneficiaryShareListSelector,
} from '@redux/slices/wills-getbeneficiary-sharelist';
import {
  WillBeneficiaryState,
  fetchWillBeneficiaryState,
  willBeneficiaryListSelector,
} from '@redux/slices/wills-shares-estate';
import {
  WillBeneficiaryShareState,
  fetchGetAllPropertyDetailsDetailsByProfileID,
  willBeneficiaryListShareSelector,
  fetchGetBeneficiaryShareList,
} from '@redux/slices/wills-specific-estate';
import {
  fetchPersonalInformationByGuid,
  getServiceId,
  resetErrorState,
  setErrorInfo,
  setIsSpouseSelected,
  setShowSpouseDetails,
  setTestatorName,
  willPersonalInformationSelector,
} from '@redux/slices/will-personal-information';
import {
  WillBookState,
  fetchWillBookState,
  willBookSelector,
} from '@redux/slices/wills-book-appointment';

import {
  WillSubstituteBeneficiaryState,
  fetchWillSubsitituteBeneficiaryState,
  willSubstituteBeneficiaryListSelector,
} from '@redux/slices/will-substitute-beneficiarylist';

import {
  checkMirrorWillSelected,
  checkSingleWillSelected,
  checkVirtualSelected,
  clearSelectedDistribution,
  clearSelectedWillType,
  disableNavigation,
  fetchIncompleteSteps,
  getIncompleteSteps,
  getNewActiveStep,
  setCompletedStepList,
  setCompletedSteps,
  setHighlightedSteps,
  setHusbandCompletedSteps,
  setIsChangeService,
  setIsCompleteWillInfo,
  setIsTestatorStepsCompleted,
  setIsUpgradeWill,
  setNavigationIndex,
  setShowIncompleteStepsModal,
  setSpouseCompletedSteps,
  setStepFlow,
  setWillPreviewCompleted,
  setWillTypeID,
  storeActiveStep,
  willsValidatorSelector,
} from '@redux/slices/willsValidator';
import {
  setPropertyAdded,
  willRealEstateSelector,
} from '@redux/slices/will-realEstate';
import { setBeneficiaryAdded, willBeneficiaryDataSelector } from '@redux/slices/wills-beneficiary-details';
import { clearState } from '@redux/reducers/actions';

import {
  fetchActiveServices,
  fetchLawyerDraftWills,
  setIsModifyWill,
  setModifyAppointment,
  willActiveServiceSelector,
} from '@redux/slices/will-active-service';
import {
  setFromWillPreview,
  willPreviewSelector,
} from '@redux/slices/will-preview';
import {
  setFromUploadDocs,
  willDocumentUploadSelector,
} from '@redux/slices/will-documents-upload';
import { willAccountInformationSelector } from '@redux/slices/wills-financial-Accounts';
import { willCompanyShareInformationSelector } from '@redux/slices/will-company-share-information';

// Assets Import
import tickIcon from '@assets/tick.svg';
import closeIcon from '@assets/Group 151.svg';
import sticker from '@assets/Rectangle 786.png';

// Components Import
import WillTypeSelection from '@components/WillTypeSelection';
import WillPayment from '@components/WillPayment';
import WillRealEstateDetail from '@components/WillRealEstateDetail';
import WillBookAppointment from '@components/WillBookAppointment';
import CompanyShareInfo from '@components/CompanyShareInfo';
import RegistrationStepper from '@components/RegistrationStepper';
import WillBeneficiaryDetail from '@components/WillBeneficiaryDetail';
import WillsMinorChildren from '@components/WillsMinorChildern';
import WillExecutorDetail from '@components/WillExecutorDetail';
import WillRealEstateDistribution from '@components/WillRealEstateDistribution';
import WillBySpecificRealEstate from '@components/WillBySpecificRealEstate';
import WillBySpecificRealEstateBusinessOwners from '@components/WillBySpecificRealEstateBusinessOwners';
import WillBySpecificRealEstateFinancialAssets from '@components/WillBySpecificRealEstateFinancialAssets';
import WillBySharesOfEstate from '@components/WillBySharesOfEstate';
import DocumentManager from '@components/DocumentManager';
import WillPersonalInformation from '@components/WillPersonalInformation';
import WillDraftDetail from '@components/WillDraftDetail';
import WillWitnessDetails from '@components/WillWitnessDetails';
import WillInterimGuardianDetail from '@components/WillInterimGuardianDetail';
import WillGuardianDetail from '@components/WillGuardianDetail';
import WillGuardianInformation from '@components/WillGuardianInformation';
import AccountsInformation from '@components/AccountsInformation';
import MovableAndImmovableProperty from '@components/MovableAndImmovableProperty';
import WillLocationTypeSelection from '@components/WillLocationTypeSelection';
import WillPreview from '@components/WillPreview';
import ScaffoldingIcons from '@components/ScaffoldingIcons';
import QuickBookingWarningModal from '@components/QuickBookingWarningModal';
import { dropDownSelector } from '@redux/slices/dropDowns';
import { willPaymentDetailSelector } from '@redux/slices/will-payment-detail';
import {
  BUISINESS_OWNERS_WILL, FINANCIAL_ASSETS_WILL, FULL_WILL, GUARDIANSHIP_WILL, PROPERTY_WILL, TEMPLATED_FULL_WILL,
} from '@utils/config';
import useWillsIncompleteSteps from '@utils/hooks/useWillsIncompleteSteps';
import getIncompleteStepsList from '@utils/getIncompleteSteps';
import getThirdStepName from '@utils/getThirdStepName';
import useHandleReload from '@utils/hooks/useHandleReload';
import useWillsCompletedSteps from '@utils/hooks/useWillsCompletedSteps';
import { loginSelector } from '@redux/slices/login-flow';
import IncompleteStepsModal from './incompleteStepsModal';
// API
import api from '../../api';

// import DeleteConfirmationModal from '@components/DeleteConfirmationModal';
const DeleteConfirmationModal = React.lazy(
  () => import('@components/DeleteConfirmationModal'),
);

const ColorlibConnector = styled(StepConnector)(({ theme }) => ({
  [`&.${stepConnectorClasses.alternativeLabel}`]: {
    top: 22,
  },
  [`&.${stepConnectorClasses.active}`]: {
    [`& .${stepConnectorClasses.line}`]: {
      height: 3,
      border: 0,
      backgroundColor:
        theme.palette.mode === 'dark' ? theme.palette.grey[800] : '#eaeaf0',
      borderRadius: 1,
    },
  },
  [`&.${stepConnectorClasses.completed}`]: {
    [`& .${stepConnectorClasses.line}`]: {
      height: 3,
      border: 0,
      backgroundColor:
        theme.palette.mode === 'dark' ? theme.palette.grey[800] : '#eaeaf0',
      borderRadius: 1,
    },
  },
  [`& .${stepConnectorClasses.line}`]: {
    height: 3,
    border: 0,
    backgroundColor:
      theme.palette.mode === 'dark' ? theme.palette.grey[800] : '#eaeaf0',
    borderRadius: 1,
  },
}));

const ColorlibStepIconRoot = styled('div')<{
  ownerState: { completed?: boolean; active?: boolean };
}>(({ theme, ownerState }) => ({
  backgroundColor:
    theme.palette.mode === 'dark' ? theme.palette.grey[700] : '#1B202D',
  zIndex: 1,
  color: '#fff',
  width: 60,
  height: 60,
  display: 'flex',
  borderRadius: '50%',
  justifyContent: 'center',
  alignItems: 'center',
  // marginRight: (ownerState.completed || ownerState.active) ? 327 : 0,
  ...(ownerState.active && {
    backgroundColor: '#023979',
    boxShadow: '0 4px 10px 0 rgba(0,0,0,.25)',
  }),
  ...(ownerState.completed && {
    backgroundColor: '#3ECDAB',
  }),
}));

function ColorlibStepIcon(
  props: StepIconProps & {
    stepNumber: Array<number>;
    currentIndex: number;
    data: Array<string>;
  },
) {
  // , data: Array<string>, currentIndex: number
  const {
    active, completed, className, currentIndex, stepNumber, icon, data,
  } = props;
  // console.log('props',props);
  const { currentStep } = useSelector(willsValidatorSelector);

  const selectedNum = currentIndex - 1;

  // console.log('currentIndex', currentIndex);
  // console.log('stepNumber', stepNumber);

  // console.log('currentStep from selector in custom comp', currentStep);

  const icons: { [index: string]: React.ReactElement | any } = {
    1: completed ? <StepDoneIcon /> : null,
    2: completed ? <StepDoneIcon /> : null,
    3: completed ? <StepDoneIcon /> : null,
    4: completed ? <StepDoneIcon /> : null,
    5: completed ? <StepDoneIcon /> : null,
    6: completed ? <StepDoneIcon /> : null,
    7: completed ? <StepDoneIcon /> : null,
    8: completed ? <StepDoneIcon /> : null,
    9: completed ? <StepDoneIcon /> : null,
    10: completed ? <StepDoneIcon /> : null,
    11: completed ? <StepDoneIcon /> : null,
    12: completed ? <StepDoneIcon /> : null,
    13: completed ? <StepDoneIcon /> : null,
    14: completed ? <StepDoneIcon /> : null,
    15: completed ? <StepDoneIcon /> : null,
    16: completed ? <StepDoneIcon /> : null,
  };

  return (
    <ColorlibStepIconRoot
      ownerState={{ completed, active }}
      className={className}
    >
      {icons[String(props.icon)] ? icons[String(icon)] : icon}
    </ColorlibStepIconRoot>
  );
}
export interface CustomizedSteppersProps {
  data: Array<string>;
  currentIndex: number;
  setCurrentIndex: React.Dispatch<React.SetStateAction<number>>;
}

// eslint-disable-next-line max-len, react/function-component-definition
const CustomizedSteppers: React.FC<CustomizedSteppersProps> = () => {
  const [activeStep, setActiveStep] = React.useState(0);
  const [skipped, setSkipped] = React.useState(new Set<number>());
  // const [completedSteps, setCompletedSteps] = React.useState([]);
  const [num1, setNum1] = React.useState(0);
  const [num2, setNum2] = React.useState(1);
  const [currentBtnStep, setCurrentBtnStep] = React.useState<number>();
  const [iconNum1, setIconNum1] = React.useState(0);
  const [iconNum2, setIconNum2] = React.useState(3);
  const [childData, setChildData] = React.useState('');
  const [childData1, setChildData1] = React.useState('');
  const [currentIndex, setCurrentIndex] = React.useState(0);
  const [data, setdata] = React.useState<string>();
  const [newCompletedSteps, setNewCompletedSteps] = React.useState([]);
  // const [incompleteSteps, setIncompleteSteps] = React.useState([]);
  const [isShowBookAppointment, setIsShowBookAppointment] = React.useState(false);
  const [currentSelectedStep, setCurrentSelectedStep] = React.useState<number>(null);
  // Will Preview Reached
  const [willPreviewReached, setWillPreviewReached] = React.useState<boolean>(false);
  // Skip to bookAppointment flag
  const [showSkipToAppointmentModal, setShowSkipToAppointmentModal] = React.useState<boolean>(false);
  const [stepLabel, setStepLabel] = React.useState([]);
  // Steps to map in the modal (incomplete steps)
  const [steps, setSteps] = React.useState<any>([]);
  const [spouseIncomplete, setSpouseIncomplete] = React.useState<any>([]);
  const [husbandIncomplete, setHusbandIncomplete] = React.useState<any>([]);
  const [show, setShow] = React.useState<boolean>(false);

  // Router Navigation
  const navigate = useNavigate();
  const { state } = useLocation();
  console.log('state', state);

  // Params
  const { parameterGuid } = useParams();
  // Will type ID (For identifying willTypes)
  // const willTypeID = Number(parameterGuid);

  // Dispatch actions using dispatch
  const dispatch = useDispatch();

  // Store Subscriptions
  const {
    mirrorWillCheck,
    singleWillCheck,
    currentStep,
    newActiveStep,
    navigationEnabled,
    navigationIndex,
    isQuickBooking,
    guardianShipWill,
    byShareCheck,
    bySpecificCheck,
    isVirtual,
    isInPerson,
    incompleteSteps,
    spouseCompletedSteps,
    husbandCompletedSteps,
    willPreviewCompleted,
    isCompleteWillInfo,
    isChangeService,
    willTypeID, // Will type ID (For identifying willTypes)
    isUpgradeWill,
    showIncompleteStepsModal,
    highlightedStep,
    distributionCompleted,
    isMirrorWill,
  } = useSelector(willsValidatorSelector);

  // Will Personal Informations
  const {
    profileGuid, isSpouseSelected, spouseGuid, serviceId,
  } = useSelector(
    willPersonalInformationSelector,
  );

  // User loggedIn Slice
  const { userData } = useSelector(loginSelector);

  const { lawyerDraftWills } = useSelector(willActiveServiceSelector);

  // Step List
  const { results, loading, hasErrors } = useSelector<unknown, WillStepState>(
    willStepSelector,
  );

  // States to handle incompleteSteps Modal
  const { fromWillPreview } = useSelector(willPreviewSelector);
  const { fromUploadDocs,isDocumentsChanged } = useSelector(willDocumentUploadSelector);

  // Active service
  const { activeService, isModifyWill, modifyAppointment } = useSelector(
    willActiveServiceSelector,
  );

  // Distribution of Shares Enabling conditions
  const { propertyAdded, propertyList, isPropertyChanged } = useSelector(
    willRealEstateSelector,
  );
  const { beneficiaryAdded, isBeneficiaryChanged,beneficiaryList } = useSelector(
    willBeneficiaryDataSelector,
  );

  const { accountList, isaddAccountInformation } = useSelector(
    willAccountInformationSelector,
  );
  const { companyShareInformationList, isCompanyShareInformationChanged } = useSelector(willCompanyShareInformationSelector);

  const { selectedEmiratesList } = useSelector(dropDownSelector);

  const { handleRedirectEvent } = useSelector(willPaymentDetailSelector);

  const willTypeNumber = localStorage.getItem('willTypeID');
  const willTypeId = Number(willTypeNumber);

  const handleChildData = (data: string) => {
    setChildData(data);
  };
  const handleDataFromChild = (data: string) => {
    setChildData1(data);
  };
  const [showModal, setShowModal] = React.useState(false);
  const [draftSActiveService, setDraftSActiveService] = React.useState<any>([]);

  console.log('draftSActiveService', draftSActiveService);

  React.useEffect(() => {
    switch (activeService?.length) {
      case 2:
        // There is a modify will service available in active services
        setDraftSActiveService(activeService[1]);
        break;
      case 1:
        // There is only one active service in active services API
        setDraftSActiveService(activeService[0]);
        break;
      default:
      // Do nothing
    }
  }, [activeService]);

  // Custom hook to handle Reload when on forms => Wills,Registrations,Cases etc
  useHandleReload(activeService,'/wills');

  /**
   * Handles showing the incomplete steps modal.
   *
   * @param {string} stepName - The name of the step.
   * @return {void} This function does not return anything.
   */
  const handleShowIncompleteStepsModal = (stepName?: string): void => {
    setShowModal(true);
  };

  /**
   * Handles closing of the incomplete steps modal.
   *
   * @return {void} This function does not return anything.
   */
  const handleCloseModal = (): void => {
    setShowModal(false);
    dispatch(setShowIncompleteStepsModal(false));
  };

  const isStepSkipped = (step: number) => skipped.has(step);

  /**
   * Retrieves the list of completed steps for a given user profile.
   *
   * @return {Promise<void>} This function does not return anything.
   */
  const getCompletedSteps = React.useCallback(async () => {
    const completedSteps = await trackPromise(
      api.getCompletedStepsListByGUID(
        isSpouseSelected ? spouseGuid : profileGuid,
      ),
    );
    const completedStepNumbers = completedSteps?.data?.Output;
    const steps = completedStepNumbers.map((stepNumber: any) => Number(stepNumber.stepNumber));
    setNewCompletedSteps(steps);
  }, [isSpouseSelected, spouseGuid, profileGuid]);

  React.useEffect(() => {
    const condition = willTypeID === TEMPLATED_FULL_WILL || willTypeID === FINANCIAL_ASSETS_WILL || willTypeID === PROPERTY_WILL || willTypeID === BUISINESS_OWNERS_WILL;
    if (condition) {
      if (newCompletedSteps.includes(3) && newCompletedSteps.includes(5)) {
        dispatch(setPropertyAdded(true));
        dispatch(setBeneficiaryAdded(true));
      } else {
        dispatch(setPropertyAdded(false));
        dispatch(setBeneficiaryAdded(false));
      }
    }
  },[newCompletedSteps,willTypeID]);

  // Clear all states here (global && local)
  // Page Mount LifeCycle
  React.useEffect(() => {
    dispatch<any>(fetchActiveServices());
    window.scrollTo(0, 0);
    dispatch(clearState());
    // dispatch(storeActiveStep(0));
    // Set activeStep (stepID) === 1(willTypeSelection) on initial page mount
    dispatch(getNewActiveStep(1));
    dispatch(clearSelectedWillType());
    // Set Default step as will type selection
    dispatch(storeActiveStep(0));
    // Set highlighted step to 1
    dispatch(setHighlightedSteps(1));
    dispatch(resetErrorState());
    setNewCompletedSteps([]);
    window.addEventListener('popstate', () => {
      window.location.reload();
    });

    return () => {
      window.removeEventListener('popstate', () => console.log('listner removed'));
      // setNewCompletedSteps([]);
    };
  }, []);

  // If user is a draftsman fetch draftsman details here
  React.useEffect(() => {
    if (userData.DraftsmanGuid) {
      dispatch<any>(fetchLawyerDraftWills());
    }
  },[userData]);

  //  if the selected lawyer from the Draftman list is mirrorWill then set the mirrorwill flag to true
  React.useEffect(() => {
    setTimeout(() => {
      if (isMirrorWill) {
        dispatch(checkMirrorWillSelected());
      }
    },100);
  },[]);

  // Redirect to wills page if the dummy url is entered by the user
  React.useEffect(() => {
    if (state === null) {
      navigate('/wills');
    }
  }, [state]);

  // Fetch completedSteps each time the switcher is changed or Beneficiary or (account/property/company) is added || removed && if document is uploaded or removed (in any case)
  const getCompletedStepsCallback = React.useCallback(() => getCompletedSteps(), [
    isSpouseSelected,
    isBeneficiaryChanged,
    isPropertyChanged,
    isCompanyShareInformationChanged,
    isaddAccountInformation,
    isDocumentsChanged,
  ]);

  React.useEffect(() => {
    getCompletedStepsCallback();
  }, [getCompletedStepsCallback]);

  // If accountList is present && propertyList is present && companyShareInformationList is present ==> enable condition to allow Distribution Of Shares/Accounts
  React.useEffect(() => {
    if (
      accountList?.length !== 0
      || propertyList?.length !== 0
      || companyShareInformationList?.length !== 0
      || selectedEmiratesList?.length !== 0
    ) {
      dispatch(setPropertyAdded(true));
    } else {
      dispatch(setPropertyAdded(false));
    }
  }, [accountList, propertyList, companyShareInformationList,selectedEmiratesList]);

  React.useEffect(() => {
    if (beneficiaryList.length > 0) {
      dispatch(setBeneficiaryAdded(true));
    } else {
      dispatch(setBeneficiaryAdded(false));
    }
  },[beneficiaryList]);

  // If stepNumber === 3 OR 5 is not present in completedSteps response && activeStep === Distribution Of Shares ==> TODO ==> Redirection to any other step ?
  React.useEffect(() => {
    if (
      (!newCompletedSteps.includes(3) || !newCompletedSteps.includes(5))
      && (newActiveStep === 18 || newActiveStep === 6)
    ) {
      setShow(true);
      // const result = window.confirm('Please complete accounts/property/company && beneficiary steps');
      // if (result) {
      //   // Navigate to step 4 for now ==> change later on
      //   dispatch(setHighlightedSteps(5));
      //   dispatch(setNavigationIndex(5));
      //   dispatch(getNewActiveStep(5));
      // } else {
      //   dispatch(setHighlightedSteps(5));
      //   dispatch(setNavigationIndex(5));
      //   dispatch(getNewActiveStep(5));
      // }
    }
  }, [newCompletedSteps, newActiveStep]);

  // If activeServices present && changeService is true && has willTypeID ==> set willTypeID from activeServices here
  React.useEffect(() => {
    if (isChangeService && draftSActiveService?.willTypeID) {
      dispatch(setWillTypeID(draftSActiveService?.willTypeID));
    }
  }, [activeService, isChangeService]);

  // Set willtypeID here if lawyerDetails have willtypeID and changeService is true ==>  to change dynamically
  // React.useEffect(() => {
  //   if (isChangeService && lawyerDraftWills[0]?.willTypeID) {
  //     dispatch(setWillTypeID(lawyerDraftWills[0]?.willTypeID));
  //   }
  // },[lawyerDraftWills]);

  /**
   * Handles Complete Will Info Functionality
   *
   * @return {Promise<void>} A promise that resolves when the function completes.
   */
  const handleCompleteWillInfo = async (): Promise<void> => {
    try {
      // Get Completed Steps list and enable tick mark condition in the stepper
      await getCompletedSteps();
      // dispatch(setShowSpouseDetails(false));

      const {
        stepID,stepNumber,steps,testatorSteps,spouseSteps,
      } = await getIncompleteStepsList(
        profileGuid,
        spouseGuid,
        isSpouseSelected ? spouseGuid : profileGuid,
        serviceId,
      );
      console.log('totalSteps',steps);
      console.log('spouseSteps',spouseSteps);
      console.log('testatorSteps',testatorSteps);
      // dispatch(setIsSpouseSelected(!!spouseSteps)); need clarity here

      const getStepID = () => testatorSteps.length > 0 ? testatorSteps[0].stepID : spouseSteps[0].stepID;

      const getStepNumber = () => testatorSteps.length > 0 ? Number(testatorSteps[0].stepNumber) : Number(spouseSteps[0].stepNumber);

      if (steps?.length === 0) {
        if (willTypeID === 1) {
          // Full Will
          dispatch(getNewActiveStep(9)); // Book Appointment
          dispatch(setHighlightedSteps(11));
          dispatch(setNavigationIndex(11));
        } else if (willTypeID === 2) {
          // GuardianShip Will
          dispatch(getNewActiveStep(9)); // Book Appointment
          dispatch(setHighlightedSteps(9));
          dispatch(setNavigationIndex(9));
        } else {
          // All other wills
          dispatch(getNewActiveStep(21)); // Will Preview
          dispatch(setHighlightedSteps(9));
          dispatch(setNavigationIndex(9));
        }
      } else {
        /* use this condition to check spouseGUID is present in activeServices Mirror Will
         * if Not ==> redirect all navigation to Personal Details step
         * else ==> redirect to first incomplete step as normal */
        const condition = draftSActiveService?.isMirrorWill
          && draftSActiveService?.spouseProfileGUID === null;
        console.log('draftSActiveServiceincompletewillinfo',draftSActiveService);

        if (singleWillCheck) {
          dispatch(getNewActiveStep(condition ? 2 : getStepID()));
          dispatch(setHighlightedSteps(condition ? 2 : getStepNumber()));
          dispatch(setNavigationIndex(condition ? 2 : getStepNumber()));
        } else if (mirrorWillCheck) {
          dispatch(setIsSpouseSelected(testatorSteps.length === 0));
          dispatch(getNewActiveStep(spouseGuid === null ? 2 : getStepID()));
          dispatch(setHighlightedSteps(spouseGuid === null ? 2 : getStepNumber()));
          dispatch(setNavigationIndex(spouseGuid === null ? 2 : getStepNumber()));
        }
      }
    } catch (error) {
      dispatch(resetErrorState());
      dispatch(setErrorInfo('Some Error occured !'));
    }
  };

  const handleChangeService = async () => {
    dispatch<any>(fetchActiveServices());
    dispatch(setIsCompleteWillInfo(false));
    dispatch(getNewActiveStep(2));
    dispatch(setHighlightedSteps(2));
    dispatch(setNavigationIndex(2));
    // Get Completed Steps list and enable tick mark condition in the stepper
    await getCompletedSteps();
  };

  const handleUpgradeWill = async () => {
    // dispatch(storeActiveStep(1));
    dispatch(setHighlightedSteps(2));
    dispatch(setNavigationIndex(2));
    // dispatch(getNewActiveStep(2));
    // Get Completed Steps list and enable tick mark condition in the stepper
    await getCompletedSteps();
  };

  const handleModifyAppointment = () => {
    if (willTypeID === FULL_WILL) {
      dispatch(getNewActiveStep(9));
      dispatch(setHighlightedSteps(11));
      dispatch(setNavigationIndex(11));
      dispatch(checkVirtualSelected());
    } else if (willTypeID === GUARDIANSHIP_WILL) {
      dispatch(getNewActiveStep(9));
      dispatch(setHighlightedSteps(9));
      dispatch(setNavigationIndex(9));
      dispatch(checkVirtualSelected());
    } else {
      dispatch(getNewActiveStep(9));
      dispatch(setHighlightedSteps(10));
      dispatch(setNavigationIndex(10));
      dispatch(checkVirtualSelected());
    }
  };

  const handleModifyWill = async () => {
    dispatch(storeActiveStep(1));
    dispatch(setHighlightedSteps(2));
    dispatch(setNavigationIndex(2));
    dispatch(getNewActiveStep(2));
  };

  // Complete Will Info Functionality Handled in this useEffect
  React.useEffect(() => {
    if (isCompleteWillInfo) {
      handleCompleteWillInfo();
    }
  }, [isCompleteWillInfo]);

  // If Active Service is present
  React.useEffect(() => {
    if (draftSActiveService?.isMirrorWill) {
      dispatch(checkMirrorWillSelected());
      dispatch(setIsSpouseSelected(false));
    } else {
      dispatch(checkSingleWillSelected());
    }
  }, [activeService, isChangeService]);

  // Change Service functionality
  React.useEffect(() => {
    if (isChangeService) {
      handleChangeService();
    }
  }, [isChangeService]);

  React.useEffect(() => {
    if (isUpgradeWill) {
      dispatch(setWillTypeID(1));
      // TODO ==> complete API integration for upgrade will and check for isUpgradeWill Flag in the response; Use the new profileGUID for fetching completed steps
      handleUpgradeWill();
    }
  }, [isUpgradeWill]);

  // Modify Appointment Functionality ==> Here ==> Navigates to Book Appointment step
  React.useEffect(() => {
    if (modifyAppointment) {
      handleModifyAppointment();
    }
  },[modifyAppointment]);

  // If modifyWill is selected ==> navigate to Personal Details
  /*
  if single will ==> navigate to Personal Details  ==> Done
  if mirror will
          ==> Testator ==> Yes ==> navigate to Personal Details
                       ==> No ==> navigate to Personal Details (change to Single Will)
          ==> Spouse ==> Yes ==> navigate to Personal Details (change to Single Will)
                     ==> Cancel ==> Do Nothing (Close Modal)
  */
  React.useEffect(() => {
    if (isModifyWill) {
      handleModifyWill();
    }
  },[isModifyWill]);

  // Check if property && beneficiary are added for navigation to Real Estate Distribution

  const dateSelected = childData;

  // Fetch all steps list
  React.useEffect(() => {
    dispatch<any>(fetchWillStepList(willTypeID || willTypeId)); // from LocalStorage && Redux
  }, [dispatch, willTypeID, dateSelected, isSpouseSelected,willTypeId]);

  // React.useEffect(() => {
  //   dispatch<any>(fetchWillBookState(dateSelected));
  // }, [dispatch, dateSelected]);

  // Map stepID(Number) to the array
  const stepNumber: any = results?.map((d: any) => d.stepID);
  // Map stepNumber(string) to the array
  const stepNumArray: any = results?.map((d: any) => Number(d.stepNumber));

  // Check draft and remaining will steps here---------------------------------
  const isDraft: boolean = false;

  // if (incompleteSteps.length > 0) {
  //   isDraft = true;
  // } else {
  //   isDraft = false;
  // }

  // test response steps
  const responseSteps = [8, 9];
  const finishedSteps: any = [];
  stepNumber.forEach((s: any) => {
    // Use incompletSteps array here
    if (!responseSteps.includes(s)) {
      finishedSteps.push(s);
    }
  });

  /**
   * Handle continue in incomplete steps modal
   *
   * @param {any} id - stepNumber ()
   * @param {number} number - stepId
   * @return {void} The function does not return anything.
   */
  const handleContinue = async (id: any, number: number): Promise<void> => {
    window.scrollTo(0, 0);
    dispatch(setShowIncompleteStepsModal(false));
    setShowModal(false);

    // Optimization
    if (singleWillCheck) { // TODO ==> Check Single will condition
      dispatch(setNavigationIndex(id));
      dispatch(setHighlightedSteps(id)); // PS:: This is stepNumber
      dispatch(getNewActiveStep(number)); // PS:: This is stepID
    } else if (mirrorWillCheck) {
      if (fromUploadDocs) {
        dispatch(setNavigationIndex(id));
        dispatch(setHighlightedSteps(id)); // PS:: This is stepNumber
        dispatch(getNewActiveStep(number)); // PS:: This is stepID
      }
      if (fromWillPreview) {
        await getCompletedSteps(); // Get completed Steps of the testator/spouse
        await dispatch(setIsSpouseSelected(!isSpouseSelected));
        dispatch(setNavigationIndex(id));
        dispatch(setHighlightedSteps(id)); // PS:: This is stepNumber
        dispatch(getNewActiveStep(number)); // PS:: This is stepID
      }

      // Handle continue case from Submit Button for ModifyAppointment
      // dispatch(setNavigationIndex(id));
      // dispatch(setHighlightedSteps(id)); // PS:: This is stepNumber
      // dispatch(getNewActiveStep(number)); // PS:: This is stepID
    }

    // Set states to initial state/false here after the function is executed
    dispatch(setFromUploadDocs(false));
    dispatch(setFromWillPreview(false));
  };

  const getIncompleteStepsByGuid = (step: any) => {
    const husbandIncompleteSteps = step?.filter(
      (s: any) => s?.bookedForProfileGuid === profileGuid,
    );
    const spouseIncompleteSteps = step?.filter(
      (s: any) => s?.bookedForProfileGuid === spouseGuid,
    );
    setSpouseIncomplete(spouseIncompleteSteps);
    setHusbandIncomplete(husbandIncompleteSteps);
    if (willPreviewCompleted) {
      setSteps(spouseIncompleteSteps);
    } else {
      setSteps(husbandIncompleteSteps);
    }
  };

  React.useEffect(() => {
    if (incompleteSteps?.length !== 0) {
      getIncompleteStepsByGuid(incompleteSteps);
    }
  }, [incompleteSteps]);

  console.log('isShowBookAppointment',isShowBookAppointment);

  // Get StepID when navigating from Beneficiary Details using next button
  const getStepIDFromBeneficiaryStep = (willType: number): number => {
    switch (willType) {
      case PROPERTY_WILL:
        return 6;
      case FINANCIAL_ASSETS_WILL:
      case BUISINESS_OWNERS_WILL:
      case TEMPLATED_FULL_WILL:
        return 18;
      case FULL_WILL:
        return 12;
      default:
        return 0;
    }
  };

  /**
   * Handles the next step in the process.
   *
   * @param {number} step - The current step number.
   * @param {any} stepName - The name of the current step.
   * @param {boolean} completed - Indicates if the step is completed.
   */
  const handleNext = async (
    step: number,
    stepName?: any,
    completed?: boolean,
  ) => {
    console.log('STEPNUMBER', step);
    console.log('COMPLETED', completed);
    window.scrollTo(0, 0);
    setCurrentSelectedStep(step);
    // Revert Active Service Funtionalities back to initial state on first handleNext Step
    dispatch(setIsChangeService(false));
    // dispatch(setIsCompleteWillInfo(false));
    dispatch(setModifyAppointment(false));
    // dispatch(setIsUpgradeWill(false));
    dispatch(setIsModifyWill(false));

    // Set upgradeWill flag to false if next clicked from Personal Details
    if (stepName === 'personal') {
      dispatch(setIsUpgradeWill(false));
    }

    // Show selection option in Real Estate Distribution for Property Will up on next from beneficiary Details
    if (step === 5) {
      dispatch(clearSelectedDistribution());
    }

    // If quick booking is enabled
    if (isQuickBooking && stepName !== 'willTypeSelection') {
      setActiveStep(8);
      if (stepName === 'bookAppointment') {
        setActiveStep((prev) => prev + 1);
      }
    } else if (!isQuickBooking && stepName !== 'willTypeSelection') {
      // setActiveStep(3);
    }

    if (stepName === 'personal' && isQuickBooking) {
      setShowSkipToAppointmentModal(true);
    }

    // If upload documents is active and Book appointment is visible
    if (stepName === 'upload' && !isShowBookAppointment) {
      // Incomplete steps API called here
      try {
        const response = await trackPromise(
          api.validateWillSteps(
            profileGuid,
            spouseGuid,
            isSpouseSelected ? spouseGuid : profileGuid,
            serviceId,
          ),
        );
        // Save incomplete steps list in store (redux)

        const incompletedSteps = response?.data?.Output;
        const testatorIncompleteSteps = incompletedSteps.filter((step:any) => step.bookedForProfileGuid === profileGuid);
        const spouseIncompleteSteps = incompletedSteps.filter((step:any) => step.bookedForProfileGuid === spouseGuid);
        console.log('testatorIncompleteSteps', testatorIncompleteSteps);
        console.log('spouseIncompleteSteps', spouseIncompleteSteps);

        dispatch(getIncompleteSteps(isSpouseSelected ? spouseIncompleteSteps : testatorIncompleteSteps));

        // Mirror Will && Testator
        if (mirrorWillCheck && !isSpouseSelected) {
          if (testatorIncompleteSteps.length !== 0) {
            handleShowIncompleteStepsModal();
          } else {
            // alert('go to next step');
            dispatch(setHighlightedSteps(9));
            dispatch(setNavigationIndex(9));
            dispatch(getNewActiveStep(13));
          }
        } else if (mirrorWillCheck && isSpouseSelected) { // Mirror Will && Spouse
          if (spouseIncompleteSteps.length !== 0) {
            handleShowIncompleteStepsModal();
          } else {
            dispatch(setHighlightedSteps(9));
            dispatch(setNavigationIndex(9));
            dispatch(getNewActiveStep(13));
          }
        }

        if (singleWillCheck) {
          // Show incomplete steps Modal only if the response is not empty
          if (incompletedSteps.length !== 0) {
            handleShowIncompleteStepsModal();
          } else {
          // Ask for confirmation on this functionality
            setIsShowBookAppointment(true);
            // Set View component, highlighted step in stepper and icon
            dispatch(setHighlightedSteps(9));
            dispatch(setNavigationIndex(9));
            dispatch(getNewActiveStep(21));
            setNewCompletedSteps((prev: any) => [...prev, 3, 4, 5, 6, 7, 8]);
          // dispatch(storeActiveStep(9));
          }
        }
      } catch (error) {
        console.log(error);
      }
    } else if (stepName === 'beneficiary-details' && willTypeID !== 1) {
      // Not needed for Full Will
      // If property and beneficiray is added then only we can navigate or go next to Real Estate Distribution
      if (propertyAdded && beneficiaryAdded) {
        dispatch(setHighlightedSteps(6));
        dispatch(getNewActiveStep(getStepIDFromBeneficiaryStep(willTypeID)));
        dispatch(setNavigationIndex(null));
        // // Highlighted step handled here
        // dispatch(setHighlightedSteps(step + 1));
        // // Set Current step number
        // dispatch(disableNavigation());
        // setCurrentSelectedStep(step);
        // // getWillStep(step);
        // const nextIndex = (currentIndex + 1) % stepNumber.length;
        // setCurrentIndex(nextIndex);

        // // setActiveStep((prevActiveStep) => prevActiveStep + 1);
        // // Need more testing here
        // setCurrentBtnStep(step + 1);
        // setActiveStep((prevActiveStep) => prevActiveStep + 1);
        // dispatch(storeActiveStep(step));
        // dispatch(getNewActiveStep(0));
        // dispatch(setNavigationIndex(null));
      } else {
        await dispatch<any>(resetErrorState());
        await dispatch<any>(setErrorInfo(`Please complete Beneficiary Details and ${getThirdStepName(willTypeID)}`));
      }
    } else {
      // ----------------------------------------------------------------
      // Highlighted step handled here
      // dispatch(setHighlightedSteps(step + 1));
      // // Test case
      // // getWillStep(step);
      // dispatch(disableNavigation());
      // const nextIndex = (currentIndex + 1) % stepNumber.length;
      // setCurrentIndex(nextIndex);
      // // dispatch(storeActiveStep(activeStep + 1));

      // // Get stepNumber list from the stepList array
      // const stepNumberList: any = results?.map((res) => Number(res?.stepNumber));

      // // // Handling ICONS navigation in handleNext()
      // if (step === 3) {
      //   setIconNum1(3);
      //   setIconNum2(6);
      // } else if (step === 6) {
      //   setIconNum1(6);
      //   setIconNum2(9);
      // } else if (step === 9) {
      //   if (willTypeID === 2) {
      //     // Guardianship Will
      //     setIconNum1(7);
      //     setIconNum2(10);
      //   } else {
      //     setIconNum1(8);
      //     setIconNum2(11);
      //   }
      // } else if (step > stepNumberList[stepNumberList.length - 2]) {
      //   // setIconNum1(8);
      //   // setIconNum2(11);
      //   navigate('/wills');
      // }

      // // Handle distribution of shares/Real estate distribution in ICONS
      // if (step === 7) {
      //   setIconNum1(6);
      //   setIconNum2(9);
      // }

      // // Set current step to pass as a prop to the further components to use
      // //  the handleNext method in those respective components
      // // NB:increment the step number by 1 to get correct list of completed steps
      // setCurrentBtnStep(step + 1);

      // let newSkipped = skipped;
      // if (isStepSkipped(activeStep)) {
      //   newSkipped = new Set(newSkipped.values());
      //   newSkipped.delete(activeStep);
      // }
      // // Increment activestep from state
      // setActiveStep((prevActiveStep) => prevActiveStep + 1);
      // // Increment currentStep from store state
      // dispatch(storeActiveStep(step));
      // dispatch(setStepFlow());
      // setSkipped(newSkipped);
      // dispatch(getNewActiveStep(0));
      // dispatch(setNavigationIndex(null));

      // if (navigationEnabled) {
      //   setNewCompletedSteps((prevSteps: any) => [
      //     ...prevSteps,
      //     completed ? navigationIndex : null,
      //   ]);
      //   dispatch(setCompletedStepList(completed ? navigationIndex : null));
      //   dispatch(storeActiveStep(navigationIndex));
      //   setActiveStep(navigationIndex);
      // } else {
      //   setNewCompletedSteps((prevStep: any) => [
      //     ...prevStep,
      //     completed ? step : null,
      //   ]);
      //   dispatch(setCompletedStepList(completed ? step : null));
      //   // setNewCompletedSteps((prevStep: any) => [...prevStep,step]);
      // }

      // ----------------------------------------------------------------

      // Stepper/Next Optimisations
      dispatch(setHighlightedSteps(step + 1));
      dispatch(storeActiveStep(step));
      dispatch(getNewActiveStep(0));
      dispatch(setNavigationIndex(step + 1));
      // dispatch(setNavigationIndex(null));

      setNewCompletedSteps((prev:any) => [...prev,completed ? step : null]);
    }
  };

  console.log('stepNumArray', stepNumArray);

  // Stepper Icons (scaffolding Icons) Optimisation
  React.useEffect(() => {
    if (highlightedStep !== 1) {
      if (stepNumArray.length === highlightedStep) {
        setIconNum1(highlightedStep - 3);
        setIconNum2(highlightedStep);
      } else {
        setIconNum1(highlightedStep - 2);
        setIconNum2(highlightedStep + 1);
      }
    }
  },[highlightedStep]);

  React.useEffect(() => {
    if (newActiveStep === 9 && isQuickBooking) {
      setIconNum1(8);
      setIconNum2(11);
    }
    if (willTypeID === 2 && guardianShipWill) {
      // Guardianship Will
      setIconNum1(navigationIndex === 2 ? 0 : 6);
      setIconNum2(navigationIndex === 2 ? 3 : 9);
    }
  }, [newActiveStep, isQuickBooking, guardianShipWill]);

  // Common function for enabling book appointment if all steps are completed
  const checkAllStepsCompleted = (completedSteps:number[],completedStepsList:number[]) => {
    const isAllStepsCompleted = completedSteps.every((step:number) => completedStepsList.includes(step));
    setIsShowBookAppointment(isAllStepsCompleted);
  };

  React.useEffect(() => {
    if (willTypeID === GUARDIANSHIP_WILL) {
      const completedSteps = [1,2,4,5,6];
      checkAllStepsCompleted(completedSteps,newCompletedSteps);
    } else if (willTypeID === FULL_WILL) {
      const completedSteps = [1,2,3,4,7,8];
      checkAllStepsCompleted(completedSteps,newCompletedSteps);
    } else {
      const completedSteps = [1,2,3,4,5,6,7,8];
      checkAllStepsCompleted(completedSteps,newCompletedSteps);
    }
  },[newCompletedSteps]);

  React.useEffect(() => {
    getCompletedSteps();
  },[isShowBookAppointment]);

  const handleBack = () => {
    const activeStepInBack = activeStep - 1;
    setActiveStep((prevActiveStep) => prevActiveStep - 1);
    setNum1((prevState) => prevState - 1);
    setNum2((prevState) => prevState - 1);
    if (
      activeStepInBack === 2
      || activeStepInBack === 5
      || activeStepInBack === 8
      || activeStepInBack === 11
    ) {
      setIconNum1((prevState) => prevState - 3);
      setIconNum2((prevState: any) => prevState - 3);
    }
  };

  const clearRealEstateShareOption = () => {
    dispatch(clearSelectedDistribution());
  };

  const getRealEstateOption = () => {
    if (willTypeID === 5 || willTypeID === 4) {
      // FAW && BOW
      return (
        <WillBySpecificRealEstate
          handleNext={handleNext}
          currentBtnStep={currentBtnStep}
          handleBack={clearRealEstateShareOption}
          // parameterGuid={parameterGuid}
          setNewCompletedSteps={setNewCompletedSteps}
          newCompletedSteps={newCompletedSteps}
        />
      );
    }

    if (willTypeID === 6) {
      // Templated Full Will
      return (
        <WillBySharesOfEstate
          handleNext={handleNext}
          currentBtnStep={currentBtnStep}
          handleBack={clearRealEstateShareOption}
          parameterGuid={parameterGuid}
          setNewCompletedSteps={setNewCompletedSteps}
          newCompletedSteps={newCompletedSteps}
        />
      );
    }

    if (!byShareCheck && !bySpecificCheck) {
      return (
        <WillRealEstateDistribution
          handleNext={handleNext}
          currentBtnStep={currentBtnStep}
          handleBack={handleBack}
          setNewCompletedSteps={setNewCompletedSteps}
          newCompletedSteps={newCompletedSteps}
        />
      );
    }
    if (byShareCheck) {
      return (
        <WillBySharesOfEstate
          handleNext={handleNext}
          currentBtnStep={currentBtnStep}
          handleBack={clearRealEstateShareOption}
          parameterGuid={parameterGuid}
          setNewCompletedSteps={setNewCompletedSteps}
          newCompletedSteps={newCompletedSteps}
        />
      );
    }
    if (bySpecificCheck) {
      return (
        <WillBySpecificRealEstate
          handleNext={handleNext}
          currentBtnStep={currentBtnStep}
          handleBack={clearRealEstateShareOption}
          // parameterGuid={parameterGuid}
          setNewCompletedSteps={setNewCompletedSteps}
          newCompletedSteps={newCompletedSteps}
        />
      );
    }
  };
  const getRealEstateOptionforfinancial = () => {
    if (willTypeID === 4) {
      // BOW
      return (
        <WillBySpecificRealEstateBusinessOwners
          handleNext={handleNext}
          currentBtnStep={currentBtnStep}
          handleBack={handleBack}
          parameterGuid={parameterGuid}
        />
      );
    }
    if (willTypeID === 5) {
      // FAW
      return (
        <WillBySpecificRealEstateFinancialAssets
          handleNext={handleNext}
          currentBtnStep={currentBtnStep}
          handleBack={handleBack}
          parameterGuid={parameterGuid}
        />
      );
    }
  };
  const getLocationType = () => {
    if (!isVirtual && !isInPerson) {
      return <WillLocationTypeSelection />;
    }
    if (isVirtual) {
      return (
        <WillBookAppointment
          handleNext={handleNext}
          currentBtnStep={currentBtnStep}
          handleBack={handleBack}
          willTypeID={willTypeID}
          setNewCompletedSteps={setNewCompletedSteps}
          newCompletedSteps={newCompletedSteps}
        />
      );
    }
  };

  React.useEffect(() => {
    getWillStep(currentStep);
    getRealEstateOption();
    getRealEstateOptionforfinancial();
  }, [byShareCheck, bySpecificCheck]);

  React.useEffect(() => {
    getWillStep(currentStep);
    getLocationType();
  }, [isVirtual, isInPerson]);
  const getWillStep = (step: number) => {
    let stepID;
    if (isDraft) {
      // Change responseSteps to incompleteSteps ahen using api
      stepID = responseSteps[step];
    } else {
      stepID = stepNumber[step];
    }
    // console.log('stepIndex', stepID);
    switch (newActiveStep !== 0 ? newActiveStep : stepID) {
      // switch (newActiveStep !== 0 ? newActiveStep : step + 1) {
      case 1:
        return <WillTypeSelection />;
      // return <WillLocationTypeSelection />;
      case 2:
        return (
          <WillPersonalInformation
            willTypeID={willTypeID}
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
          />
        );
      case 3:
        return (
          <WillRealEstateDetail
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
          />
          // <WillGuardianInformation
          //   handleNext={handleNext}
          //   currentBtnStep={currentBtnStep}
          //   handleBack={handleBack}
          // />
        );
      case 4:
        return (
          <WillExecutorDetail
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            willTypeID={willTypeID}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
            // setNewCompletedSteps={setNewCompletedSteps}
          />
        );
      case 5:
        return (
          <WillBeneficiaryDetail
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
            willTypeID={willTypeID}
          />
        );
      case 6:
        return getRealEstateOption();
      case 7:
        return (
          <WillWitnessDetails
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            willTypeID={willTypeID}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
          />
        );
      case 8:
        return (
          <DocumentManager
            willTypeID={willTypeID}
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
          />
        );
      case 9:
        return getLocationType();
      case 10:
        return (
          <WillPayment
            willTypeID={willTypeID}
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
          />
        );
      case 11:
        return (
          <WillGuardianInformation
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            // willTypeID={parameterGuid}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
          />
        );
      case 12:
        return (
          <WillsMinorChildren
            // willTypeGuid={parameterGuid}
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
          />
        );
      case 13:
        return (
          <WillDraftDetail
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            willTypeID={willTypeID}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
          />
        );
      case 15:
        return (
          <WillInterimGuardianDetail
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            // willTypeID={parameterGuid}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
          />
        );
      case 16:
        // Permanent Guardian Details
        return (
          <WillGuardianDetail
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            // willTypeID={parameterGuid}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
          />
        );

      case 17:
        return (
          <CompanyShareInfo
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
          />
        );
      case 18:
        return getRealEstateOption();
      case 19:
        return (
          <AccountsInformation
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
          />
        );
      case 20:
        return (
          <MovableAndImmovableProperty
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
          />
        );
      case 21:
        return (
          <WillPreview
            handleNext={handleNext}
            currentBtnStep={currentBtnStep}
            handleBack={handleBack}
            // parameterGuid={parameterGuid}
            handleShowIncompleteStepsModal={handleShowIncompleteStepsModal}
            handleCloseModal={handleCloseModal}
            setNewCompletedSteps={setNewCompletedSteps}
            newCompletedSteps={newCompletedSteps}
          />
        );

      default:
        break;
    }
  };

  // const recievedData = (single:any,mirror:any) => {
  //   console.log('data',single,mirror);
  // };

  return (
    <div className="main">
      <div className="case-details d-flex flex-column">
        <div className="row title-row ">
          <div className="col-lg-3 col-md-3 col-sm-12 col-xs-8 back-col-new">
            <RegistrationStepper
              activeStep={activeStep + 1}
              parameterGuid={parameterGuid}
              results={results}
              stepNumber={stepNumber}
              finishedSteps={finishedSteps}
              isDraft={isDraft}
              stepNumArray={stepNumArray}
              completedStepNumArray={newCompletedSteps.filter(
                (value, index, self) => self.indexOf(value) === index,
              )} // Remove Duplicates
              currentSelectedStep={currentSelectedStep}
              setCurrentSelectedStep={setCurrentSelectedStep}
              isShowBookAppointment={isShowBookAppointment}
              willTypeID={willTypeID}
              setNewCompletedSteps={setNewCompletedSteps}
            />
          </div>
          <div className="col-lg-9 col-md-9 col-sm-12 col-xs-12 title-col">
            <Stack sx={{ width: '100%' }} spacing={4}>
              <Stepper
                activeStep={activeStep}
                alternativeLabel
                connector={<ColorlibConnector />}
              >
                <div className="line" />
                <div className="scaffolding">
                  {results?.slice(iconNum1, iconNum2)?.map((label, index) => (
                    <ScaffoldingIcons
                      stepNumber={label?.stepNumber}
                      stepName={label?.stepName.toUpperCase()}
                      completed={newCompletedSteps.includes(
                        Number(label.stepNumber),
                      )}
                    />
                  ))}
                </div>
              </Stepper>
              {/* {getWillStep(newActiveStep !== 0 ? newActiveStep : currentStep)} */}
              <div className="stepsDiv">
                {(isUpgradeWill || isModifyWill)
                && (newActiveStep === 1 || newActiveStep === 0)
                  ? (
                    <WillPersonalInformation
                      willTypeID={willTypeID}
                      handleNext={handleNext}
                      currentBtnStep={currentBtnStep}
                      handleBack={handleBack}
                      setNewCompletedSteps={setNewCompletedSteps}
                      newCompletedSteps={newCompletedSteps}
                    />
                  ) : (
                    getWillStep(currentStep)
                  )}
              </div>
              {/* Revert back */}
              {newActiveStep === 1 && !isUpgradeWill && (
                <Box sx={{ display: 'flex', flexDirection: 'row', pt: 2 }}>
                  <button
                    type="button"
                    // Removed activeStep(state variable) from the parameter
                    onClick={() => handleNext(1, 'willTypeSelection', true)}
                    className={
                      !(mirrorWillCheck || singleWillCheck)
                        ? 'next-btn-disabled'
                        : 'next-btn'
                    }
                    disabled={!(mirrorWillCheck || singleWillCheck)}
                  >
                    Next Step
                  </button>
                </Box>
              )}
            </Stack>
          </div>
        </div>
      </div>
      {/* Modal for showing incomplete steps */}
      <IncompleteStepsModal
        showModal={showModal || showIncompleteStepsModal}
        handleCloseModal={handleCloseModal}
        steps={incompleteSteps}
        handleContinue={handleContinue}
      />

      {/* Modal if quickBooking is true */}
      <QuickBookingWarningModal
        showModal={showSkipToAppointmentModal}
        handleCloseModal={() => setShowSkipToAppointmentModal(false)}
      />

      <React.Suspense fallback={<div>Loading...</div>}>
        <DeleteConfirmationModal
          show={show}
          handleClose={() => {
            setShow(false);
            dispatch(setHighlightedSteps(5));
            dispatch(setNavigationIndex(5));
            dispatch(getNewActiveStep(5));
          }}
          handleContinue={() => {
            setShow(false);
            dispatch(setHighlightedSteps(5));
            dispatch(setNavigationIndex(5));
            dispatch(getNewActiveStep(5));
          }}
          type="Test"
          fromShares
        />
      </React.Suspense>
    </div>
  );
};

export default CustomizedSteppers;

/**
 * If navigation is enabled then we need to call a different function instead of handleNext(say:handleNavigateNext)
 * else we use the normal handleNext function and complete the navigation
 *
 */
#include<stdio.h>
int search(int arr[],int N,int x)
{
    for(int i=0; i< N; i++)
    if(arr[i] == x)
    return i;
    return -1;
    }
    int main(void)
    {
        int arr[]={2,3,4,5,10,40};
        int x = 10;
        int N = sizeof(arr) / sizeof(arr[0]);

        int result = search(arr,N,x);
        (result == -1)
        ? printf("element is not present in array")
        :printf("element is present at index %d",result);
        return 0; 
    }
prompt='以下是普通话的句子'
result = model.transcribe(audioFile, task='translate',language='zh',verbose=True,initial_prompt=prompt)
Relationship seems tougher when it comes to one-side efforts, adjustments, miscommunication, or even non-communication with your partner. Sometimes lack of sufficient time and attention also causes a glass-break in love. This may lead to the distance in their bond. In such cases, Couple apps are lovers' ultimate companions because they contribute endless ideas to romanticize your partner, such as remaindering your partner’s favorite things to explore, notifying your special dates, and ideas to express your love and feel with your partner. The solution is there are plenty of apps out there, let me list out the top ten best apps for couples to implement. Check out and revamp your relationship! 
$("button").click(function(){
  $("div").animate({
    left: '250px',
    opacity: '0.5',
    height: '150px',
    width: '150px'
  });
}); 
 const handleOnInputChange = (reason?: string, id?: string | null) => {
    if (!id) {
      setPreviewUrl(null);
      setValue("type", 2);
      reset({ type: 2 });
      if (feeType === FeeType.sameFees) {
        const editCourtValueReset: FormProps = {
          ...getAllValues,
          name: "",
          gameId: "",
          courtId: "",
          midNight: "",
          morning: "",
          evening: "",
          night: "",
          image: "",
        };
        // setValue("midNight", "");
        // setValue("morning", "");
        // setValue("evening", "");
        // setValue("night", "");
        // setValue("courtId", "");

        reset(editCourtValueReset);
      } else {
        setValue("type", 2);
        const dayWiseValues = {
          ...getAllValues,
          name: "",
          // gameId: "",
          // courtId: "",
          midNight: "",
          morning: "",
          evening: "",
          night: "",
          image: "",
          // fees: DAYWISE_FEE,
          type: 2,
        };
        setFeeType(2);
        setDayWiseFeesData(DAYWISE_FEE);
        reset(dayWiseValues);
      }
    }
  };
int lowestCommonAncestor(TreeNode<int> *root, 
int x, int y)
{
	if(!root)
    return -1;
    if(root->data==x or root->data==y)
    return root->data;
    int lefti=lowestCommonAncestor(root->left,x,y);
    int righti=lowestCommonAncestor(root->right,x,y);
    if(lefti==-1)
    return righti;
    if(righti==-1)
    return lefti;
    return root->data;
}
  // Get husband information
  const getHusbandInformationByGuid = useCallback(async () => {
    const res = await trackPromise(api.getPersonalInformationByGuid(profileGuid));
    console.log('Profile information', res);
    setHusbandData(res?.data?.Output);
  }, [profileGuid, trackPromise, api, setHusbandData]);

  // Get spouse information
  const getSpouseInformationByGuid = useCallback(async () => {
    const res = await trackPromise(api.getPersonalInformationByGuid(spouseGuid));
    console.log('Spouse information', res);
    setSpouseData(res?.data?.Output);
  }, [spouseGuid, trackPromise, api, setSpouseData]);

  // Revert back to previous values after testing
  React.useEffect(() => {
    // if (spouseGuid && profileGuid) {
    if (profileGuid) getHusbandInformationByGuid();
    if (spouseGuid) getSpouseInformationByGuid();
    // }
  }, [profileGuid, spouseGuid]);
#include <bits/stdc++.h> 
vector<vector<string>>
 getGroupedAnagrams(vector<string> &input, int n)
{
    unordered_map<string,vector<string>>mp;
    vector<vector<string>>ans;
    for(int i=0 ; i<n ; i++)
    {
       string str=input[i];
       string s=str;
       sort(s.begin(),s.end());
       mp[s].push_back(str);
    }
    for(auto it:mp)
    {
        ans.push_back(it.second);
    }
    return ans;
}
ALTER TABLE your_table_name
ADD COLUMN new_column_name INT;
$("button").click(function(){
  $("p").toggle();
});
$("button").click(function(){
  $("p").hide(1000);
});
$("*")	                Selects all elements
$(this)	                Selects the current HTML element
$("p.intro")	        Selects all <p> elements with class="intro"
$("p:first")	        Selects the first <p> element	Try it
$("ul li:first")	Selects the first <li> element of the first <ul>
$("ul li:first-child")	Selects the first <li> element of every <ul>
$("[href]")	        Selects all elements with an href attribute
$("a[target='_blank']")	Selects all <a> elements with a target attribute value equal to "_blank"	Try it
$("a[target!='_blank']")	Selects all <a> elements with a target attribute value NOT equal to "_blank"	Try it
$(":button")	Selects all <button> elements and <input> elements of type="button"	Try it
$("tr:even")	Selects all even <tr> elements	Try it
$("tr:odd")	Selects all odd <tr> elements
$(document).ready(function(){
  $("button").click(function(){
    $(".test").hide();
  });
});
$(document).ready(function(){
  $("button").click(function(){
    $("p").hide();
  });
});
YearWeekNo = 

'Calendar'[Year]*100 + 'Calendar'[WeekNo]
Week Rank = 

RANKX(
    ALL( 'Calendar' ),
    'Calendar'[Week StartDate], , ASC, Dense)
Week StartDate = 

'Calendar'[Date] + -1*WEEKDAY( 'Calendar'[Date], 2 ) + 1
Week EndDate = 

'Calendar'[Date] + 7-1*WEEKDAY( 'Calendar'[Date], 2 )
openDatabase(
  // Name
  &#39;mydatabase&#39;,
  // Version
  1,
  // Display name
  &#39;mydatabase&#39;,
  // Estimated size
  5000000,
  // Creation callback
  function (db) {
    db.transaction(
      // Transaction callback
      function (tx) {
        // Execute SQL statement
        tx.executeSql(
          // SQL statement
          &#39;create table rainstorms (mood text, severity int)&#39;,
          // Arguments
          [],
          // Success callback
          function () {
            // Execute SQL statement
            tx.executeSql(
              // SQL statement
              &#39;insert into rainstorms values (?, ?)&#39;,
              // Arguments
              [&#39;somber&#39;, 6],
              // Success callback
              function () {
                // Execute SQL statement
                tx.executeSql(
                  // SQL statement
                  &#39;select * from rainstorms where mood = ?&#39;,
                  // Arguments
                  [&#39;somber&#39;],
                  // Success callback
                  function (tx, res) {
                    // Do something with the result
                    var row = res.rows.item(0);
                    console.log(
                      &#39;rainstorm severity: &#39; +
                        row.severity +
                        &#39;,  my mood: &#39; +
                        row.mood,
                    );
                  },
                );
              },
            );
          },
        );
      },
      // Error callback
      function (err) {
        console.log(&#39;Transaction failed!: &#39; + err);
      },
      // Success callback);
      function () {
        console.log(&#39;Transaction succeeded!&#39;);
      },
    );
  },
);

// User class component
class User extends React.Component {
  constructor(props) {
    super(props);

    // starting values for component's state
    this.state = {
      rating: 0,
    };
  }

  /*
   * event handlers: change the state
   */
  handleLike = () => {
    this.setState({ rating: 1 });
  };

  handleDislike = () => {
    this.setState({ rating: -1 });
  };

  // render the JSX structure
  render() {
    return (
      <div>
        <img
          src={`https://practicum-content.s3.us-west-1.amazonaws.com/web-code/react/moved_${this.props.id}.png`}
          width="75"
        />
        <p>{this.props.name}</p>
        <div className="rating">
          <button onClick={this.handleLike}>👍</button>
          {this.state.rating}
          <button onClick={this.handleDislike}>👎</button>
        </div>
      </div>
    );
  }
}

// the main app code
ReactDOM.render(
  <>
    <h2>My Imaginary Friends:</h2>
    <User id="1" name="Gregory" />
    <User id="2" name="James" />
    <User id="3" name="Allison" />
  </>,
  document.querySelector("#root")
); 
import React from 'react';

const GmailRedirectButton = () => {
  const redirectToGmail = () => {
    // Replace 'youremail@gmail.com' with the actual email address you want to open in Gmail
    const email = 'youremail@gmail.com';
    
    // Replace 'Your%20Subject' with the desired subject (URL-encoded)
    const subject = 'Your%20Subject';
    
    // Replace 'Your%20Body' with the desired body (URL-encoded)
    const body = 'Your%20Body';

    // Construct the Gmail URL with the email address, subject, and body
    const gmailUrl = `https://mail.google.com/mail/?view=cm&fs=1&to=${email}&su=${subject}&body=${body}`;

    // Open Gmail in a new blank page
    window.open(gmailUrl, '_blank');
  };

  return (
    <button onClick={redirectToGmail}>
      Redirect to Gmail
    </button>
  );
};

export default GmailRedirectButton;
//HTML

<div id="progress-bar"></div>



//CSS

#progress-bar {
  height: 5px;
  background-color: grey;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
}




//JS

const progressBar = document.getElementById('progress-bar');

window.addEventListener('scroll', function() {
  const scrollTop = window.scrollY;
  const documentHeight = document.documentElement.scrollHeight;
  const windowHeight = window.innerHeight;
  const progress = scrollTop / (documentHeight - windowHeight);
  progressBar.style.width = `${progress * 100}%`;
});

#include <stdio.h>
#include <stdlib.h>

typedef struct Node 
{
    char data;
    struct Node* left;
    struct Node* right;
} Node;

Node* createNode(char value)
{
    Node* newNode = (Node*)malloc(sizeof(Node*));
    newNode -> data = value;
    newNode -> left = NULL;
    newNode -> right = NULL;
    
    return newNode;
}

void preOrder(Node* root)
{
    if(root != NULL) {
        printf("%c ", root -> data);
        preOrder(root -> left);
        preOrder(root -> right);
    }
}

void inOrder(Node* root)
{
    if(root != NULL) {
        inOrder(root -> left);
        printf("%c ", root -> data);
        inOrder(root -> right);
    }
}

void postOrder(Node* root)
{
    if(root != NULL) {
        postOrder(root -> left);
        postOrder(root -> right);
        printf("%c ", root -> data);
    }
}
int main() {
   
   Node* root = createNode('A');
   root ->left = createNode('B');
   root -> right = createNode('C');
   root -> left -> left = createNode('D');
   root -> left -> right = createNode('E');
   root -> right -> left = createNode('F');
   root -> right -> right = createNode('G');
   
   printf("Pre-Order Traversal: ");
   printf("\n");
   preOrder(root);
   
   printf("\n\nIn-Order Traversal: ");
   printf("\n");
   inOrder(root);
   
   printf("\n\nPost-Order Traversal: ");
   printf("\n");
   postOrder(root);

    return 0;
}

//OUTPUT:

Pre-Order Traversal: 
A B D E C F G 

In-Order Traversal: 
D B E A F C G 

Post-Order Traversal: 
D E B F G C A 
import pandas as pd
df = pd.read_csv('your_data.csv')
int fib(int n)
{
    int a = 0, b = 1, c, i;
    if (n == 0)
        return a;
    for (i = 2; i <= n; i++) {
        c = a + b;
        a = b;
        b = c;
    }
    return b;
}


int fib(int n)
{
    if (n <= 1)
        return n;
    return fib(n - 1) + fib(n - 2);
}
// ParentComponent.js:


import React, { useState } from 'react';
import ChildComponent from './ChildComponent';

const ParentComponent = () => {
  const [parameterFromChild, setParameterFromChild] = useState('');

  // Callback function to receive the parameter from the child
  const handleChildParameter = (parameter) => {
    setParameterFromChild(parameter);
  };

  return (
    <div>
      <h1>Parent Component</h1>
      
      {/* Render ChildComponent and pass the callback function as a prop */}
      <ChildComponent onParameterChange={handleChildParameter} />

      {/* Display the parameter received from the child */}
      {parameterFromChild && (
        <p>Parameter received from child: {parameterFromChild}</p>
      )}
    </div>
  );
};

export default ParentComponent;




//ChildComponent.js:
import React, { useState } from 'react';

const ChildComponent = ({ onParameterChange }) => {
  const [childParameter, setChildParameter] = useState('');

  const handleButtonClick = () => {
    // Update the childParameter state
    setChildParameter('Hello from ChildComponent!');
    
    // Invoke the callback function in the parent with the parameter
    onParameterChange('Hello from ChildComponent!');
  };

  return (
    <div>
      <h2>Child Component</h2>

      <button onClick={handleButtonClick} className="bg-blue-500 text-white px-4 py-2">
        Click me
      </button>
    </div>
  );
};

export default ChildComponent;
<div class="page-width {{ section.settings.section_css_class }}">
  
  
  {

"type": "text",
    "id": "section_css_class",
    "label": {
      "en": "Section CSS Class"
    },
    "default": {
      "en": "Type your own CSS class"
    }
  },
# Best min size, in kB.
best_min_size = (32000 + 100000) * (1.073741824 * duration) / (8 * 1024)
star

Tue Dec 19 2023 13:05:26 GMT+0000 (Coordinated Universal Time)

@deba

star

Tue Dec 19 2023 11:49:55 GMT+0000 (Coordinated Universal Time) https://share.bito.ai/static/share?aid=370c4051-69fe-4987-84c0-5fe4dbb7cddb

@codeing #dotenv #css

star

Tue Dec 19 2023 11:08:01 GMT+0000 (Coordinated Universal Time)

@mdfaizi

star

Tue Dec 19 2023 10:42:21 GMT+0000 (Coordinated Universal Time) https://www.anchorgroup.tech/netsuite-advanced-pdf-source-code-mode

@mdfaizi

star

Tue Dec 19 2023 10:40:33 GMT+0000 (Coordinated Universal Time) https://github.com/Mosquid/react-form-wp-cf7/tree/master

@rstringa

star

Tue Dec 19 2023 10:36:08 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/headless-form-submission-with-the-wordpress-rest-api/

@rstringa #contactform7 #api #headless

star

Tue Dec 19 2023 07:11:28 GMT+0000 (Coordinated Universal Time)

@Utsav

star

Tue Dec 19 2023 06:57:59 GMT+0000 (Coordinated Universal Time)

@deba

star

Tue Dec 19 2023 05:29:57 GMT+0000 (Coordinated Universal Time) https://xtemos.com/forums/topic/add-year-in-post-date/

@deveseospace #php

star

Tue Dec 19 2023 04:45:44 GMT+0000 (Coordinated Universal Time)

@alfred555 #react.js

star

Mon Dec 18 2023 16:43:47 GMT+0000 (Coordinated Universal Time)

@deba

star

Mon Dec 18 2023 14:17:08 GMT+0000 (Coordinated Universal Time) https://github.com/openai/whisper/discussions/categories/show-and-tell?page

@jianglin998

star

Mon Dec 18 2023 14:07:37 GMT+0000 (Coordinated Universal Time) https://github.com/wikieden/Awesome-ChatGPT-Prompts-CN

@jianglin998

star

Mon Dec 18 2023 12:55:08 GMT+0000 (Coordinated Universal Time) https://maticz.com/apps-for-couples

@Floralucy #appsforcouples #coupleapps #bestappforcouples

star

Mon Dec 18 2023 09:07:37 GMT+0000 (Coordinated Universal Time) https://theonetechnologies.com/blog/post/how-to-integrate-restlet-api-of-netsuite-in-postman

@mdfaizi

star

Mon Dec 18 2023 08:32:38 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/jquery/jquery_animate.asp

@Sifat_H #animation #jqueryanimation #slidinganimation

star

Mon Dec 18 2023 08:10:50 GMT+0000 (Coordinated Universal Time) https://ceanatech.com/2019/07/02/using-postman-to-test-your-first-netsuite-restlet/

@mdfaizi

star

Mon Dec 18 2023 07:06:44 GMT+0000 (Coordinated Universal Time)

@chiragwebelight #reactj

star

Mon Dec 18 2023 06:33:06 GMT+0000 (Coordinated Universal Time) https://www.dappfort.com/

@dappfortglobal #swift #javascript #kotlin #mysql

star

Mon Dec 18 2023 05:27:43 GMT+0000 (Coordinated Universal Time)

@nistha_jnn #c++

star

Mon Dec 18 2023 05:06:53 GMT+0000 (Coordinated Universal Time) https://www.codingninjas.com/studio/problems/group-anagrams_800285?utm_source=youtube&utm_medium=affiliate&utm_campaign=parikh_youtube&leftPanelTabValue=PROBLEM

@nistha_jnn #c++

star

Mon Dec 18 2023 04:27:52 GMT+0000 (Coordinated Universal Time) https://chat.openai.com/

@Sifat_H #changecolumn #toadchangecolumn #oraclechangecolumn #toad #oracle #sql #sqlchange

star

Mon Dec 18 2023 04:25:51 GMT+0000 (Coordinated Universal Time)

@Sifat_H #addcolumn #sqladdcolumn #sql #add #oracle #toad

star

Mon Dec 18 2023 04:06:41 GMT+0000 (Coordinated Universal Time) https://chat.openai.com/

@Sifat_H #addcolumn #sqladdcolumn #sql #add #addcolumn

star

Mon Dec 18 2023 03:47:01 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/jquery/jquery_hide_show.asp

@Sifat_H #hide&show #hideelement #showelement

star

Mon Dec 18 2023 03:45:50 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/jquery/jquery_hide_show.asp

@Sifat_H #hide #animation #hideanimation

star

Mon Dec 18 2023 03:29:44 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/jquery/jquery_selectors.asp

@Sifat_H #selector #jqueryselector #selectelements

star

Mon Dec 18 2023 03:27:36 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/jquery/jquery_selectors.asp

@Sifat_H #hide #hideclass #hideelement #hideelement class

star

Mon Dec 18 2023 03:17:23 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/jquery/jquery_selectors.asp

@Sifat_H #jquery #selector #jqueryselector #documentready function #documentready #document.ready #jqueryonclick

star

Mon Dec 18 2023 02:38:12 GMT+0000 (Coordinated Universal Time)

@nikahafiz #ms.pbi #dax #calendar.table #week.no

star

Mon Dec 18 2023 02:37:06 GMT+0000 (Coordinated Universal Time)

@nikahafiz #ms.pbi #dax #calendar.table #dax.day

star

Mon Dec 18 2023 02:33:17 GMT+0000 (Coordinated Universal Time)

@nikahafiz #ms.pbi #dax #dax.weekday #calendar.table

star

Mon Dec 18 2023 02:30:50 GMT+0000 (Coordinated Universal Time)

@nikahafiz #ms.pbi #dax #calendar.table #dax.format #dax.calendar #format-ddd

star

Mon Dec 18 2023 02:25:30 GMT+0000 (Coordinated Universal Time)

@nikahafiz #ms.pbi #dax #calendar.table #dax.weeknum

star

Mon Dec 18 2023 02:22:15 GMT+0000 (Coordinated Universal Time)

@nikahafiz #ms.pbi #dax #calendar.table #dax.weekday

star

Mon Dec 18 2023 02:18:56 GMT+0000 (Coordinated Universal Time)

@nikahafiz #ms.pbi #dax #calendar.table #dax.quarter

star

Mon Dec 18 2023 01:07:48 GMT+0000 (Coordinated Universal Time) https://developer.chrome.com/blog/deprecating-web-sql/?bookmark

@Spsypg #javascript

star

Sun Dec 17 2023 23:26:42 GMT+0000 (Coordinated Universal Time) https://tripleten.com/trainer/web/lesson/5d974c2e-872d-4984-8c5a-33caa7fe0ef0/task/dbe4f951-423f-4c6e-893b-91d635827c2a/

@Marcelluki

star

Sun Dec 17 2023 22:16:16 GMT+0000 (Coordinated Universal Time) yI8As-juzTD-TCfsP-Dv2DC

@odesign

star

Sun Dec 17 2023 20:58:41 GMT+0000 (Coordinated Universal Time) https://chat.openai.com/c/d0b6b014-1122-44c9-9a57-b95422a27c9a

@eziokittu

star

Sun Dec 17 2023 19:43:23 GMT+0000 (Coordinated Universal Time) https://g.co/bard/share/1647430116d0

@Zohaib77 #html #css #javascript

star

Sun Dec 17 2023 17:54:28 GMT+0000 (Coordinated Universal Time)

@Mohamedshariif #java

star

Sun Dec 17 2023 17:40:39 GMT+0000 (Coordinated Universal Time)

@sathviksurineni

star

Sun Dec 17 2023 14:16:20 GMT+0000 (Coordinated Universal Time)

@nistha_jnn #c++

star

Sun Dec 17 2023 12:05:06 GMT+0000 (Coordinated Universal Time) https://chat.openai.com/c/9c689a90-e565-43b2-b16e-e4e64203e782

@eziokittu #react.js #javascript #css

star

Sun Dec 17 2023 11:19:50 GMT+0000 (Coordinated Universal Time) https://www.ecommercethesis.com/how-to-add-css-class-to-a-section-in-shopify/

@mubashir_aziz

star

Sun Dec 17 2023 06:32:48 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/64430805/how-to-compress-video-to-target-size-by-python

@chook100 #python

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension