Paywall navigation and button added

This commit is contained in:
Josh 2025-04-07 13:56:30 +00:00
parent 52f70cebfc
commit 12fba3e3f0
3 changed files with 29 additions and 14 deletions

View File

@ -1,5 +1,6 @@
import React, { useState} from 'react'; // App.js
import { Routes, Route, Navigate } from 'react-router-dom'; import React, { useState } from 'react';
import { Routes, Route, Navigate, useNavigate, useLocation } from 'react-router-dom';
import SessionExpiredHandler from './components/SessionExpiredHandler.js'; import SessionExpiredHandler from './components/SessionExpiredHandler.js';
import GettingStarted from './components/GettingStarted.js'; import GettingStarted from './components/GettingStarted.js';
import SignIn from './components/SignIn.js'; import SignIn from './components/SignIn.js';
@ -9,27 +10,39 @@ import Dashboard from './components/Dashboard.js';
import UserProfile from './components/UserProfile.js'; import UserProfile from './components/UserProfile.js';
import FinancialProfileForm from './components/FinancialProfileForm.js'; import FinancialProfileForm from './components/FinancialProfileForm.js';
import MilestoneTracker from "./components/MilestoneTracker.js"; import MilestoneTracker from "./components/MilestoneTracker.js";
import Paywall from "./components/Paywall.js";
import './App.css'; import './App.css';
function App() { function App() {
console.log("App rendered"); const navigate = useNavigate();
const location = useLocation();
const [isAuthenticated, setIsAuthenticated] = useState(() => { const [isAuthenticated, setIsAuthenticated] = useState(() => !!localStorage.getItem('token'));
return !!localStorage.getItem('token'); // Check localStorage
}); const premiumPaths = ['/milestone-tracker', '/paywall', '/financial-profile'];
const showPremiumCTA = !premiumPaths.includes(location.pathname);
return ( return (
<div className="App"> <div className="App">
<h1>AptivaAI - Career Guidance Platform (beta)</h1> <header className="app-header">
<Routes> <h1>AptivaAI - Career Guidance Platform (beta)</h1>
{/* Redirect root to /signin */} {showPremiumCTA && (
<Route path="/" element={<Navigate to="/signin" />} /> <button
className="premium-cta"
onClick={() => navigate('/paywall')}
>
Upgrade to Premium
</button>
)}
</header>
{/* Public routes */} <Routes>
<Route path="/" element={<Navigate to="/signin" />} />
<Route path="/signin" element={<SignIn setIsAuthenticated={setIsAuthenticated} />} /> <Route path="/signin" element={<SignIn setIsAuthenticated={setIsAuthenticated} />} />
<Route path="/signup" element={<SignUp />} /> <Route path="/signup" element={<SignUp />} />
<Route path="/paywall" element={<Paywall />} />
{/* Protected routes */}
{isAuthenticated && ( {isAuthenticated && (
<> <>
<Route path="/getting-started" element={<GettingStarted />} /> <Route path="/getting-started" element={<GettingStarted />} />
@ -41,7 +54,6 @@ function App() {
</> </>
)} )}
{/* Catch-all for unknown routes */}
<Route path="*" element={<Navigate to="/signin" />} /> <Route path="*" element={<Navigate to="/signin" />} />
</Routes> </Routes>
<SessionExpiredHandler /> <SessionExpiredHandler />

View File

@ -384,6 +384,7 @@ function Dashboard() {
)} )}
<div className="dashboard-content"> <div className="dashboard-content">
<div className="career-suggestions-container"> <div className="career-suggestions-container">
<div <div
className="career-suggestions-header" className="career-suggestions-header"
@ -460,7 +461,9 @@ function Dashboard() {
<p>Loading Chatbot...</p> <p>Loading Chatbot...</p>
)} )}
</div> </div>
<div <div
className="data-source-acknowledgment" className="data-source-acknowledgment"
style={{ style={{

Binary file not shown.