From 11e72ebeec59d8e8d02a4b91efa969cad03d8fa8 Mon Sep 17 00:00:00 2001 From: Zac Gaetano Date: Sat, 4 Apr 2026 22:51:39 -0400 Subject: [PATCH] Update frontend/src/App.jsx --- frontend/src/App.jsx | 81 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 1eee111..8574678 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -15,6 +15,7 @@ const App = () => { }); const [systemInfo, setSystemInfo] = useState(null); const [usageStats, setUsageStats] = useState(null); + const [authStatus, setAuthStatus] = useState(null); const [loading, setLoading] = useState(false); const [activeView, setActiveView] = useState('tasks'); // 'tasks' | 'dashboard' @@ -23,10 +24,12 @@ const App = () => { fetchTasks(); fetchSystemInfo(); fetchUsageStats(); + fetchAuthStatus(); const interval = setInterval(() => { fetchTasks(); fetchSystemInfo(); fetchUsageStats(); + fetchAuthStatus(); }, 10000); return () => clearInterval(interval); }, []); @@ -61,6 +64,38 @@ const App = () => { } }; + const fetchAuthStatus = async () => { + try { + const response = await fetch('/api/auth/status'); + const data = await response.json(); + setAuthStatus(data); + } catch (error) { + console.error('Error fetching auth status:', error); + } + }; + + const handleLogin = async () => { + try { + const response = await fetch('/api/auth/login', { method: 'POST' }); + const data = await response.json(); + setAuthStatus(prev => ({ ...prev, ...data })); + if (data.auth_url) { + window.open(data.auth_url, '_blank'); + } + } catch (error) { + console.error('Error initiating login:', error); + } + }; + + const handleLogout = async () => { + try { + await fetch('/api/auth/logout', { method: 'POST' }); + fetchAuthStatus(); + } catch (error) { + console.error('Error logging out:', error); + } + }; + const handleCreateTask = async (e) => { e.preventDefault(); setLoading(true); @@ -137,6 +172,15 @@ const App = () => { +
+ {authStatus?.status === 'logged_in' ? ( + ● {authStatus.account || 'Logged in'} + ) : authStatus?.status === 'pending' ? ( + ⏳ Awaiting login… + ) : ( + + )} +
{systemInfo && (
@@ -187,6 +231,43 @@ const App = () => { )}
+
+

Claude Authentication

+
+ {authStatus?.status === 'logged_in' ? ( +
+ +
+
Connected to Claude Max
+
{authStatus.account}
+
+ +
+ ) : authStatus?.status === 'pending' ? ( +
+ +
+
Waiting for browser login…
+ {authStatus.auth_url && ( + + Open login page → + + )} +
+
+ ) : ( +
+ 🔐 +
+
Not logged in
+
Log in with your Claude Max account to run tasks
+
+ +
+ )} +
+
+

Claude API Usage