Girish Jeswani commited on
Commit
f97c4c9
·
1 Parent(s): 9f338b9

add code and props for canvas

Browse files
phd-advisor-frontend/src/App.js CHANGED
@@ -3,6 +3,7 @@ import { ThemeProvider } from './contexts/ThemeContext';
3
  import HomePage from './pages/HomePage';
4
  import ChatPage from './pages/ChatPage';
5
  import AuthPage from './pages/AuthPage';
 
6
  import './styles/components.css';
7
 
8
  function App() {
@@ -35,6 +36,16 @@ function App() {
35
  setCurrentView('auth');
36
  };
37
 
 
 
 
 
 
 
 
 
 
 
38
  const navigateToHome = () => {
39
  setCurrentView('home');
40
  setIsAuthenticated(false);
@@ -69,11 +80,20 @@ function App() {
69
  {currentView === 'auth' && (
70
  <AuthPage onAuthSuccess={handleAuthSuccess} />
71
  )}
 
 
 
 
 
 
 
 
72
  {currentView === 'chat' && isAuthenticated && (
73
  <ChatPage
74
  user={user}
75
  authToken={authToken}
76
  onNavigateToHome={navigateToHome}
 
77
  onSignOut={handleSignOut}
78
  />
79
  )}
 
3
  import HomePage from './pages/HomePage';
4
  import ChatPage from './pages/ChatPage';
5
  import AuthPage from './pages/AuthPage';
6
+ import CanvasPage from './pages/CanvasPage';
7
  import './styles/components.css';
8
 
9
  function App() {
 
36
  setCurrentView('auth');
37
  };
38
 
39
+ const navigateToCanvas = () => {
40
+ setCurrentView('canvas');
41
+ };
42
+
43
+ const navigateToChat = () => {
44
+ setCurrentView('chat');
45
+ };
46
+
47
+
48
+
49
  const navigateToHome = () => {
50
  setCurrentView('home');
51
  setIsAuthenticated(false);
 
80
  {currentView === 'auth' && (
81
  <AuthPage onAuthSuccess={handleAuthSuccess} />
82
  )}
83
+ {currentView === 'canvas' && isAuthenticated && (
84
+ <CanvasPage
85
+ user={user}
86
+ authToken={authToken}
87
+ onNavigateToChat={navigateToChat}
88
+ onSignOut={handleSignOut}
89
+ />
90
+ )}
91
  {currentView === 'chat' && isAuthenticated && (
92
  <ChatPage
93
  user={user}
94
  authToken={authToken}
95
  onNavigateToHome={navigateToHome}
96
+ onNavigateToCanvas={navigateToCanvas}
97
  onSignOut={handleSignOut}
98
  />
99
  )}
phd-advisor-frontend/src/components/Sidebar.js CHANGED
@@ -10,7 +10,8 @@ import {
10
  User,
11
  Settings,
12
  ChevronLeft,
13
- ChevronRight
 
14
  } from 'lucide-react';
15
  import '../styles/Sidebar.css';
16
 
@@ -23,7 +24,8 @@ const Sidebar = ({
23
  authToken,
24
  onSidebarToggle,
25
  isMobileOpen = false,
26
- onMobileToggle
 
27
  }) => {
28
  const [chatSessions, setChatSessions] = useState([]);
29
  const [searchTerm, setSearchTerm] = useState('');
@@ -242,6 +244,14 @@ const Sidebar = ({
242
  >
243
  <Plus size={20} />
244
  </button>
 
 
 
 
 
 
 
 
245
  </div>
246
  )}
247
  </div>
 
10
  User,
11
  Settings,
12
  ChevronLeft,
13
+ ChevronRight,
14
+ FileText
15
  } from 'lucide-react';
16
  import '../styles/Sidebar.css';
17
 
 
24
  authToken,
25
  onSidebarToggle,
26
  isMobileOpen = false,
27
+ onMobileToggle,
28
+ onNavigateToCanvas
29
  }) => {
30
  const [chatSessions, setChatSessions] = useState([]);
31
  const [searchTerm, setSearchTerm] = useState('');
 
244
  >
245
  <Plus size={20} />
246
  </button>
247
+ <button
248
+ className="sidebar-canvas-btn"
249
+ onClick={onNavigateToCanvas}
250
+ title="PhD Canvas"
251
+ >
252
+ <FileText size={20} />
253
+ {!isCollapsed && <span>PhD Canvas</span>}
254
+ </button>
255
  </div>
256
  )}
257
  </div>
phd-advisor-frontend/src/pages/ChatPage.js CHANGED
@@ -14,7 +14,7 @@ import '../styles/ChatPage.css';
14
  import '../styles/EnhancedChatInput.css';
15
  import AdvisorStatusDropdown from '../components/AdvisorStatusDropdown';
16
 
17
- const ChatPage = ({ user, authToken, onNavigateToHome, onSignOut }) => {
18
  const [messages, setMessages] = useState([]);
19
  const [isLoading, setIsLoading] = useState(false);
20
  const [thinkingAdvisors, setThinkingAdvisors] = useState([]);
@@ -696,6 +696,7 @@ const handleNewChat = async (sessionId = null) => {
696
  onSidebarToggle={handleSidebarToggle}
697
  isMobileOpen={isMobileMenuOpen}
698
  onMobileToggle={setIsMobileMenuOpen}
 
699
  />
700
 
701
  <div className={`main-chat-area ${isSidebarCollapsed ? 'sidebar-collapsed' : ''}`}>
 
14
  import '../styles/EnhancedChatInput.css';
15
  import AdvisorStatusDropdown from '../components/AdvisorStatusDropdown';
16
 
17
+ const ChatPage = ({ user, authToken, onNavigateToHome, onNavigateToCanvas, onSignOut }) => {
18
  const [messages, setMessages] = useState([]);
19
  const [isLoading, setIsLoading] = useState(false);
20
  const [thinkingAdvisors, setThinkingAdvisors] = useState([]);
 
696
  onSidebarToggle={handleSidebarToggle}
697
  isMobileOpen={isMobileMenuOpen}
698
  onMobileToggle={setIsMobileMenuOpen}
699
+ onNavigateToCanvas={onNavigateToCanvas}
700
  />
701
 
702
  <div className={`main-chat-area ${isSidebarCollapsed ? 'sidebar-collapsed' : ''}`}>
phd-advisor-frontend/src/styles/Sidebar.css CHANGED
@@ -636,6 +636,38 @@
636
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
637
  }
638
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
639
  /* Responsive Design */
640
  @media (max-width: 768px) {
641
  .sidebar {
 
636
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
637
  }
638
 
639
+ .sidebar-canvas-btn {
640
+ display: flex;
641
+ align-items: center;
642
+ gap: 12px;
643
+ width: 100%;
644
+ padding: 12px 16px;
645
+ background: var(--feature-bg);
646
+ border: 1px solid var(--accent-primary);
647
+ border-radius: 8px;
648
+ color: var(--accent-primary);
649
+ cursor: pointer;
650
+ transition: all 0.2s ease;
651
+ margin-bottom: 8px;
652
+ font-size: 14px;
653
+ font-weight: 500;
654
+ }
655
+
656
+ .sidebar-canvas-btn:hover {
657
+ background: var(--accent-primary);
658
+ color: white;
659
+ transform: translateY(-1px);
660
+ }
661
+
662
+ .sidebar.collapsed .sidebar-canvas-btn span {
663
+ display: none;
664
+ }
665
+
666
+ .sidebar.collapsed .sidebar-canvas-btn {
667
+ justify-content: center;
668
+ padding: 12px;
669
+ }
670
+
671
  /* Responsive Design */
672
  @media (max-width: 768px) {
673
  .sidebar {