mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-07 19:50:20 +00:00
21 lines
590 B
JavaScript
21 lines
590 B
JavaScript
import { query } from '../../../lib/db';
|
|
import { useSession } from 'next-auth/react';
|
|
|
|
export default async function Progress() {
|
|
const { data: session } = useSession();
|
|
|
|
// Fetch progress from the database
|
|
const progress = await query(
|
|
'SELECT COUNT(*) as found FROM clues WHERE found = TRUE AND team_id = ?',
|
|
[session.user.teamId]
|
|
);
|
|
const remaining = 20 - progress.found;
|
|
|
|
return (
|
|
<div>
|
|
<h1>Progress</h1>
|
|
<p>Clues Found: {progress.found}</p>
|
|
<p>Clues Remaining: {remaining}</p>
|
|
</div>
|
|
);
|
|
} |