mirror of
https://github.com/soconnor0919/hristudio.git
synced 2025-12-11 22:54:45 -05:00
fix: update user fields to match schema
- Replace firstName/lastName with name field in users API route - Update user formatting in UsersTab component - Add email fallback when name is not available
This commit is contained in:
@@ -4,19 +4,18 @@ import { useEffect, useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "~/components/ui/card";
|
||||
import { Button } from "~/components/ui/button";
|
||||
import { Users, BookOpen, Settings2 } from "lucide-react";
|
||||
import { BookOpen, Settings2 } from "lucide-react";
|
||||
import { useToast } from "~/hooks/use-toast";
|
||||
import { Breadcrumb } from "~/components/breadcrumb";
|
||||
|
||||
interface DashboardStats {
|
||||
studyCount: number;
|
||||
participantCount: number;
|
||||
activeInvitationCount: number;
|
||||
}
|
||||
|
||||
export default function Dashboard() {
|
||||
const [stats, setStats] = useState<DashboardStats>({
|
||||
studyCount: 0,
|
||||
participantCount: 0,
|
||||
activeInvitationCount: 0,
|
||||
});
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -34,8 +33,7 @@ export default function Dashboard() {
|
||||
|
||||
// For now, just show study count
|
||||
setStats({
|
||||
studyCount: studies.length,
|
||||
participantCount: 0,
|
||||
studyCount: studies.data.length,
|
||||
activeInvitationCount: 0,
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -59,35 +57,26 @@ export default function Dashboard() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="container py-6 space-y-6">
|
||||
<div className="space-y-6">
|
||||
<Breadcrumb />
|
||||
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold">Dashboard</h1>
|
||||
<p className="text-muted-foreground">Overview of your research studies</p>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4 md:grid-cols-3">
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<Card>
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-sm font-medium">Total Studies</CardTitle>
|
||||
<BookOpen className="h-4 w-4 text-muted-foreground" />
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="text-2xl font-bold">{stats.studyCount ? stats.studyCount : 0}</div>
|
||||
<div className="text-2xl font-bold">{stats.studyCount}</div>
|
||||
<p className="text-xs text-muted-foreground">Active research studies</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-sm font-medium">Total Participants</CardTitle>
|
||||
<Users className="h-4 w-4 text-muted-foreground" />
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="text-2xl font-bold">{stats.participantCount}</div>
|
||||
<p className="text-xs text-muted-foreground">Across all studies</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-sm font-medium">Pending Invitations</CardTitle>
|
||||
@@ -115,14 +104,6 @@ export default function Dashboard() {
|
||||
<BookOpen className="mr-2 h-4 w-4" />
|
||||
Manage Studies
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
className="w-full justify-start"
|
||||
onClick={() => router.push('/dashboard/participants')}
|
||||
>
|
||||
<Users className="mr-2 h-4 w-4" />
|
||||
Manage Participants
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -139,7 +120,7 @@ export default function Dashboard() {
|
||||
• Invite collaborators using study settings
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
• Add participants to begin collecting data
|
||||
• Configure study parameters and forms
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user