import { useAtomValue } from 'jotai';
import { FC } from 'react';
import { Navigate } from 'react-router-dom';
import { CurrentPatternAtom } from '../context/Patterns';

const PatternNavigator: FC = () => {
  const currentPattern = useAtomValue(CurrentPatternAtom);

  return currentPattern === null ? <Navigate to="new" /> : <Navigate to="edit" />;
};

export default PatternNavigator;
