diff --git a/services/onboarding-status-web/app/api/participants/route.ts b/services/onboarding-status-web/app/api/participants/route.ts index 04dfc38..19732eb 100644 --- a/services/onboarding-status-web/app/api/participants/route.ts +++ b/services/onboarding-status-web/app/api/participants/route.ts @@ -1,5 +1,5 @@ import { Firestore } from '@google-cloud/firestore'; -import { NextResponse } from 'next/server'; +import { NextRequest, NextResponse } from 'next/server'; // Initialize Firestore client const getFirestoreClient = () => { @@ -21,8 +21,12 @@ interface ParticipantData { last_name?: string; } -export async function GET() { +export async function GET(request: NextRequest) { try { + // Get role filter from query params, default to 'participants' + const searchParams = request.nextUrl.searchParams; + const role = searchParams.get('role') || 'participants'; + const db = getFirestoreClient(); const participantsRef = db.collection('participants'); const snapshot = await participantsRef.get(); @@ -33,16 +37,31 @@ export async function GET() { const data = doc.data(); const teamName = data.team_name || 'N/A'; - // Filter out example-team - if (teamName !== 'example-team') { - participants.push({ - github_handle: doc.id, - team_name: teamName, - onboarded: data.onboarded || false, - onboarded_at: data.onboarded_at, - first_name: data.first_name || '', - last_name: data.last_name || '', - }); + // Filter based on role parameter + if (role === 'facilitators') { + // Show only facilitators + if (teamName === 'facilitators') { + participants.push({ + github_handle: doc.id, + team_name: teamName, + onboarded: data.onboarded || false, + onboarded_at: data.onboarded_at, + first_name: data.first_name || '', + last_name: data.last_name || '', + }); + } + } else { + // Default: show only participants (exclude facilitators) + if (teamName !== 'facilitators') { + participants.push({ + github_handle: doc.id, + team_name: teamName, + onboarded: data.onboarded || false, + onboarded_at: data.onboarded_at, + first_name: data.first_name || '', + last_name: data.last_name || '', + }); + } } }); diff --git a/services/onboarding-status-web/app/page.tsx b/services/onboarding-status-web/app/page.tsx index f24a360..3650966 100644 --- a/services/onboarding-status-web/app/page.tsx +++ b/services/onboarding-status-web/app/page.tsx @@ -29,11 +29,12 @@ export default function Home() { const [error, setError] = useState(null); const [lastUpdated, setLastUpdated] = useState(null); const [statusFilter, setStatusFilter] = useState<'all' | 'onboarded' | 'not_onboarded'>('all'); + const [roleFilter, setRoleFilter] = useState<'participants' | 'facilitators'>('participants'); const fetchData = async () => { try { setError(null); - const response = await fetch('/onboarding/api/participants', { + const response = await fetch(`/onboarding/api/participants?role=${roleFilter}`, { cache: 'no-store' }); @@ -59,7 +60,7 @@ export default function Home() { const interval = setInterval(fetchData, 30000); return () => clearInterval(interval); - }, []); + }, [roleFilter]); if (loading) { return ( @@ -147,10 +148,10 @@ export default function Home() { {/* Header */}

- Participant Onboarding Status + Onboarding Status

- Track participant onboarding progress in real-time + Track technical onboarding progress in real-time

{lastUpdated && (

@@ -218,6 +219,34 @@ export default function Home() { {/* Filter and Export Controls */}

+
+ +
+
+ + + +
+ +
+
+