diff --git a/modern/frontend/src/App.jsx b/modern/frontend/src/App.jsx
index 5a26902..4c7e150 100644
--- a/modern/frontend/src/App.jsx
+++ b/modern/frontend/src/App.jsx
@@ -1,10 +1,12 @@
import React from 'react'
+import Integrations from './Integrations'
export default function App(){
return (
LifeRPG Modern
Welcome — frontend scaffold. Connect to backend at /api/v1.
+
)
}
diff --git a/modern/frontend/src/Integrations.jsx b/modern/frontend/src/Integrations.jsx
new file mode 100644
index 0000000..908fa29
--- /dev/null
+++ b/modern/frontend/src/Integrations.jsx
@@ -0,0 +1,39 @@
+import React, {useState, useEffect} from 'react'
+
+const API = (path) => fetch(path, {credentials: 'include'}).then(r => r.json())
+
+export default function Integrations(){
+ const [integrations, setIntegrations] = useState([])
+ const [events, setEvents] = useState(null)
+ const [userId] = useState(1)
+
+ useEffect(()=>{
+ API(`/api/v1/users/${userId}/integrations`).then(d=>setIntegrations(d)).catch(()=>setIntegrations([]))
+ }, [userId])
+
+ function startGoogle(){
+ // Open backend OAuth URL in new window so the redirect can complete
+ window.open(`/api/v1/oauth/google/login?user_id=${userId}`, '_blank')
+ }
+
+ function fetchEvents(integrationId){
+ API(`/api/v1/integrations/${integrationId}/google/events`).then(d=>setEvents(d)).catch(e=>setEvents({error: String(e)}))
+ }
+
+ return (
+
+
Integrations
+
+
Your Integrations
+
+ {integrations && integrations.length ? integrations.map(i=> (
+ -
+ {i.provider} — id: {i.id} — user: {i.user_id}
+
+ )): - No integrations
}
+
+
Events
+
{events? JSON.stringify(events, null, 2): 'No events fetched'}
+
+ )
+}