build: 444813b5-5daf-49b2-bf1a-7e4caeab4e17

This commit is contained in:
AppCakes
2026-07-03 21:36:11 +00:00
commit ffc7af6fc7
149 changed files with 27775 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
import React from 'react';
import { Route, Redirect } from 'react-router-dom';
import { useAuth } from '../contexts/AuthContext';
import SplashPage from '../pages/SplashPage';
interface Props {
component: React.ComponentType<any>;
path: string | string[];
exact?: boolean;
}
const BYPASS_AUTH = false;
const ProtectedRouteLoader: React.FC = () => (
<SplashPage title="Opening Kumusha" />
);
const ProtectedRoute: React.FC<Props> = ({ component: Component, ...rest }) => {
const { user, profile, profileStatus } = useAuth();
return (
<Route
{...rest}
render={(props) => {
if (!user) {
return <Redirect to="/auth" />;
}
if (profileStatus === 'loading') {
return <ProtectedRouteLoader />;
}
if (profileStatus === 'missing') {
return <Redirect to="/setup-profile" />;
}
return <Component {...props} />;
}}
/>
);
};
export default ProtectedRoute;