Consolidate all study-dependent routes and UI

- Remove global experiments and plugins routes; redirect to study-scoped
  pages
- Update sidebar navigation to separate platform-level and study-level
  items
- Add study filter to dashboard and stats queries
- Refactor participants, trials, analytics pages to use new header and
  breadcrumbs
- Update documentation for new route architecture and migration guide
- Remove duplicate experiment creation route
- Upgrade Next.js to 15.5.4 in package.json and bun.lock
This commit is contained in:
2025-09-24 13:41:29 -04:00
parent e0679f726e
commit cd7c657d5f
18 changed files with 961 additions and 775 deletions

View File

@@ -2,8 +2,11 @@
import { useParams } from "next/navigation";
import { Suspense, useEffect } from "react";
import { TestTube, Plus } from "lucide-react";
import { TrialsTable } from "~/components/trials/TrialsTable";
import { ManagementPageLayout } from "~/components/ui/page-layout";
import { PageHeader } from "~/components/ui/page-header";
import { Button } from "~/components/ui/button";
import { useBreadcrumbsEffect } from "~/components/ui/breadcrumb-provider";
import { useStudyContext } from "~/lib/study-context";
import { useSelectedStudyDetails } from "~/hooks/useSelectedStudyDetails";
@@ -13,6 +16,14 @@ export default function StudyTrialsPage() {
const { setSelectedStudyId, selectedStudyId } = useStudyContext();
const { study } = useSelectedStudyDetails();
// Set breadcrumbs
useBreadcrumbsEffect([
{ label: "Dashboard", href: "/dashboard" },
{ label: "Studies", href: "/studies" },
{ label: study?.name ?? "Study", href: `/studies/${studyId}` },
{ label: "Trials" },
]);
// Set the active study if it doesn't match the current route
useEffect(() => {
if (studyId && selectedStudyId !== studyId) {
@@ -21,23 +32,24 @@ export default function StudyTrialsPage() {
}, [studyId, selectedStudyId, setSelectedStudyId]);
return (
<ManagementPageLayout
title="Trials"
description="Schedule, execute, and monitor HRI experiment trials with real-time wizard control for this study"
breadcrumb={[
{ label: "Dashboard", href: "/dashboard" },
{ label: "Studies", href: "/studies" },
{ label: study?.name ?? "Study", href: `/studies/${studyId}` },
{ label: "Trials" },
]}
createButton={{
label: "Schedule Trial",
href: `/studies/${studyId}/trials/new`,
}}
>
<div className="space-y-6">
<PageHeader
title="Trials"
description="Manage trial execution, scheduling, and data collection for this study"
icon={TestTube}
actions={
<Button asChild>
<a href={`/studies/${studyId}/trials/new`}>
<Plus className="mr-2 h-4 w-4" />
Schedule Trial
</a>
</Button>
}
/>
<Suspense fallback={<div>Loading trials...</div>}>
<TrialsTable studyId={studyId} />
</Suspense>
</ManagementPageLayout>
</div>
);
}