import React, { useCallback, useState } from "react"; import { Center, IStackProps, VStack } from "native-base"; import { useWizard } from "react-use-wizard"; import { TransButton, TransTitle } from "../../../core/layout"; import { Image } from "../../../core/images"; import { SegmentationRow, typeLabelsDispute as typeLabels } from "../components"; import { SegmentationProps } from "../wizards"; import { withTheme } from "../../../theme/hoc/withTheme"; import RoboBilly from "../../../assets/images/robo-billy.png"; export const SegmentationDispute = withTheme({ name: "SegmentationDispute" })( ({ certificateSubjects, onDispute, styles, ...props }: IStackProps & { certificateSubjects: SegmentationProps["certificateSubjects"]; onDispute: (disputedValues: string[]) => Promise; styles?: any; }) => { const { nextStep } = useWizard(); const [disputed, setDisputed] = useState([]); const { buttonContainer } = styles ?? {}; const handleCheckChange = (typeName: string, checked: boolean) => { setDisputed(prev => (checked ? [...prev, typeName] : prev.filter(item => item !== typeName))); }; const handleNext = useCallback(async () => { await onDispute(disputed); void nextStep(); }, [disputed]); return ( {Object.entries(typeLabels).map(([key]) => ( handleCheckChange(key, checked)} /> ))}
); } );