import { type FunctionComponent } from 'react'; import { useDispatch } from 'react-redux'; import { Search } from 'icons'; import { selectAreResultsOutdated, selectSolveIsLoading, selectRack, solveSlice, useTranslate, useTypedSelector, } from 'state'; import { Button } from '../Button'; interface Props { className?: string; } export const SolveButton: FunctionComponent = ({ className }) => { const dispatch = useDispatch(); const translate = useTranslate(); const isLoading = useTypedSelector(selectSolveIsLoading); const rack = useTypedSelector(selectRack); const isOutdated = useTypedSelector(selectAreResultsOutdated); const hasTiles = rack.some((tile) => tile !== null); const handleClick = () => { dispatch(solveSlice.actions.submit()); }; return ( ); };