import React from 'react'; import PropTypes from 'prop-types'; import { Navigate, useLocation } from 'react-router-dom'; // v6 route guard for public-only pages (login/signup/auth): rendered as a route // `element` wrapping the real page. Redirects authenticated users to their // subscriptions, preserving any location state (e.g. a pending new-zone flow). const Public = ({ authenticated, children }) => { const location = useLocation(); return authenticated ? : children; }; Public.propTypes = { authenticated: PropTypes.bool.isRequired, children: PropTypes.node.isRequired }; export default Public;