Daniel McKnight NeonClary commited on
Commit
6f5db33
·
unverified ·
1 Parent(s): e9a757e

fix: correct home navigation logout and improve Home button (#11)

Browse files

Stop clearing auth state when navigating to Home so the Home button no longer logs the user out. Show Continue Conversation when already logged in.

Made-with: Cursor

Co-authored-by: NeonClary <askclary@gmail.com>

phd-advisor-frontend/src/App.js CHANGED
@@ -49,11 +49,6 @@ function App() {
49
 
50
  const navigateToHome = () => {
51
  setCurrentView('home');
52
- setIsAuthenticated(false);
53
- setUser(null);
54
- setAuthToken(null);
55
- localStorage.removeItem('authToken');
56
- localStorage.removeItem('user');
57
  };
58
 
59
  const handleAuthSuccess = (userData, token) => {
@@ -77,7 +72,10 @@ function App() {
77
  <ThemeProvider>
78
  <div className="App">
79
  {currentView === 'home' && (
80
- <HomePage onNavigateToChat={navigateToAuth} />
 
 
 
81
  )}
82
  {currentView === 'auth' && (
83
  <AuthPage onAuthSuccess={handleAuthSuccess} />
 
49
 
50
  const navigateToHome = () => {
51
  setCurrentView('home');
 
 
 
 
 
52
  };
53
 
54
  const handleAuthSuccess = (userData, token) => {
 
72
  <ThemeProvider>
73
  <div className="App">
74
  {currentView === 'home' && (
75
+ <HomePage
76
+ onNavigateToChat={isAuthenticated ? navigateToChat : navigateToAuth}
77
+ isAuthenticated={isAuthenticated}
78
+ />
79
  )}
80
  {currentView === 'auth' && (
81
  <AuthPage onAuthSuccess={handleAuthSuccess} />
phd-advisor-frontend/src/pages/HomePage.js CHANGED
@@ -4,7 +4,7 @@ import AdvisorCard from '../components/AdvisorCard';
4
  import ThemeToggle from '../components/ThemeToggle';
5
  import { useAppConfig } from '../contexts/AppConfigContext';
6
 
7
- const HomePage = ({ onNavigateToChat }) => {
8
  const { config, advisors, resolveIcon } = useAppConfig();
9
 
10
  const UsersIcon = resolveIcon('Users');
@@ -44,7 +44,7 @@ const HomePage = ({ onNavigateToChat }) => {
44
  className="cta-button"
45
  >
46
  <MessageCircle className="cta-icon" />
47
- <span>Start Conversation</span>
48
  <ArrowRight className="cta-arrow" />
49
  </button>
50
  </div>
 
4
  import ThemeToggle from '../components/ThemeToggle';
5
  import { useAppConfig } from '../contexts/AppConfigContext';
6
 
7
+ const HomePage = ({ onNavigateToChat, isAuthenticated }) => {
8
  const { config, advisors, resolveIcon } = useAppConfig();
9
 
10
  const UsersIcon = resolveIcon('Users');
 
44
  className="cta-button"
45
  >
46
  <MessageCircle className="cta-icon" />
47
+ <span>{isAuthenticated ? 'Continue Conversation' : 'Start Conversation'}</span>
48
  <ArrowRight className="cta-arrow" />
49
  </button>
50
  </div>