mirror of
https://github.com/soconnor0919/hristudio.git
synced 2025-12-13 23:54:44 -05:00
chore(deps): Update project dependencies and refactor authentication flow
- Upgrade Next.js to version 15.1.7 - Update Drizzle ORM and related dependencies - Add Nodemailer and related type definitions - Refactor authentication routes and components - Modify user schema to include first and last name - Update authentication configuration and session handling - Remove deprecated login and register pages - Restructure authentication-related components and routes
This commit is contained in:
86
src/app/dashboard/studies/[id]/page.tsx
Normal file
86
src/app/dashboard/studies/[id]/page.tsx
Normal file
@@ -0,0 +1,86 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { api } from "~/trpc/react";
|
||||
import { PageHeader } from "~/components/layout/page-header";
|
||||
import { PageContent } from "~/components/layout/page-content";
|
||||
import { Button } from "~/components/ui/button";
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from "~/components/ui/tabs";
|
||||
import { Pencil as PencilIcon } from "lucide-react";
|
||||
import { use } from "react";
|
||||
import { StudyOverview } from "~/components/studies/study-overview";
|
||||
import { StudyParticipants } from "~/components/studies/study-participants";
|
||||
import { StudyMembers } from "~/components/studies/study-members";
|
||||
import { StudyMetadata } from "~/components/studies/study-metadata";
|
||||
import { StudyActivity } from "~/components/studies/study-activity";
|
||||
|
||||
export default function StudyPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const resolvedParams = use(params);
|
||||
const id = Number(resolvedParams.id);
|
||||
const activeTab = searchParams.get("tab") ?? "overview";
|
||||
|
||||
const { data: study, isLoading: isLoadingStudy } = api.study.getById.useQuery({ id });
|
||||
|
||||
if (isLoadingStudy) {
|
||||
return <div>Loading...</div>;
|
||||
}
|
||||
|
||||
if (!study) {
|
||||
return <div>Study not found</div>;
|
||||
}
|
||||
|
||||
const canEdit = study.role === "admin";
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title={study.title}
|
||||
description={study.description ?? "No description provided"}
|
||||
>
|
||||
{canEdit && (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => router.push(`/dashboard/studies/${id}/edit`)}
|
||||
>
|
||||
<PencilIcon className="h-4 w-4 mr-2" />
|
||||
Edit Study
|
||||
</Button>
|
||||
)}
|
||||
</PageHeader>
|
||||
<PageContent>
|
||||
<Tabs defaultValue={activeTab} className="space-y-4">
|
||||
<TabsList>
|
||||
<TabsTrigger value="overview">Overview</TabsTrigger>
|
||||
<TabsTrigger value="participants">Participants</TabsTrigger>
|
||||
<TabsTrigger value="members">Members</TabsTrigger>
|
||||
<TabsTrigger value="metadata">Metadata</TabsTrigger>
|
||||
<TabsTrigger value="activity">Activity</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
<TabsContent value="overview" className="space-y-4">
|
||||
<StudyOverview study={study} />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="participants" className="space-y-4">
|
||||
<StudyParticipants studyId={id} role={study.role} />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="members" className="space-y-4">
|
||||
<StudyMembers studyId={id} role={study.role} />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="metadata" className="space-y-4">
|
||||
<StudyMetadata studyId={id} role={study.role} />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="activity" className="space-y-4">
|
||||
<StudyActivity studyId={id} role={study.role} />
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</PageContent>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user