import { type MouseEvent } from 'react';
import { useNavigate } from 'react-router-dom';

import { settingsRoutes } from '../routes';

const useNavigateToSettings = () => {
  const navigate = useNavigate();

  return (event: MouseEvent<HTMLAnchorElement>) => {
    if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
      return;
    }
    event.preventDefault();
    navigate(settingsRoutes.base());
  };
};

export default useNavigateToSettings;
