diff --git a/src/App.js b/src/App.js index ee6e42b..b417149 100644 --- a/src/App.js +++ b/src/App.js @@ -1,5 +1,6 @@ -import React, { useState} from 'react'; -import { Routes, Route, Navigate } from 'react-router-dom'; +// App.js +import React, { useState } from 'react'; +import { Routes, Route, Navigate, useNavigate, useLocation } from 'react-router-dom'; import SessionExpiredHandler from './components/SessionExpiredHandler.js'; import GettingStarted from './components/GettingStarted.js'; import SignIn from './components/SignIn.js'; @@ -9,27 +10,39 @@ import Dashboard from './components/Dashboard.js'; import UserProfile from './components/UserProfile.js'; import FinancialProfileForm from './components/FinancialProfileForm.js'; import MilestoneTracker from "./components/MilestoneTracker.js"; +import Paywall from "./components/Paywall.js"; import './App.css'; function App() { - console.log("App rendered"); + const navigate = useNavigate(); + const location = useLocation(); - const [isAuthenticated, setIsAuthenticated] = useState(() => { - return !!localStorage.getItem('token'); // Check localStorage - }); + const [isAuthenticated, setIsAuthenticated] = useState(() => !!localStorage.getItem('token')); + + const premiumPaths = ['/milestone-tracker', '/paywall', '/financial-profile']; + + const showPremiumCTA = !premiumPaths.includes(location.pathname); return (
-

AptivaAI - Career Guidance Platform (beta)

- - {/* Redirect root to /signin */} - } /> +
+

AptivaAI - Career Guidance Platform (beta)

+ {showPremiumCTA && ( + + )} +
- {/* Public routes */} + + } /> } /> } /> + } /> - {/* Protected routes */} {isAuthenticated && ( <> } /> @@ -41,7 +54,6 @@ function App() { )} - {/* Catch-all for unknown routes */} } /> diff --git a/src/components/Dashboard.js b/src/components/Dashboard.js index b00a5fe..b0fc0a7 100644 --- a/src/components/Dashboard.js +++ b/src/components/Dashboard.js @@ -384,6 +384,7 @@ function Dashboard() { )}
+
Loading Chatbot...

)}
- + + +