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 (