mirror of
https://github.com/soconnor0919/hristudio.git
synced 2026-03-24 03:37:51 -04:00
chore: clean diagnostics and prepare for designer structural refactor (stub legacy useActiveStudy)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import { BlockDesigner } from "~/components/experiments/designer/BlockDesigner";
|
||||
import { DesignerShell } from "~/components/experiments/designer/DesignerShell";
|
||||
import type { ExperimentStep } from "~/lib/experiment-designer/types";
|
||||
import { api } from "~/trpc/server";
|
||||
|
||||
@@ -44,7 +44,7 @@ export default async function ExperimentDesignerPage({
|
||||
: undefined;
|
||||
|
||||
return (
|
||||
<BlockDesigner
|
||||
<DesignerShell
|
||||
experimentId={experiment.id}
|
||||
initialDesign={initialDesign}
|
||||
/>
|
||||
|
||||
@@ -35,8 +35,12 @@ export default async function DashboardLayout({
|
||||
const cookieStore = await cookies();
|
||||
const defaultOpen = cookieStore.get("sidebar_state")?.value === "true";
|
||||
|
||||
// Pre-seed selected study from cookie (SSR) to avoid client flash
|
||||
const selectedStudyCookie =
|
||||
cookieStore.get("hristudio_selected_study")?.value ?? null;
|
||||
|
||||
return (
|
||||
<StudyProvider>
|
||||
<StudyProvider initialStudyId={selectedStudyCookie}>
|
||||
<BreadcrumbProvider>
|
||||
<SidebarProvider defaultOpen={defaultOpen}>
|
||||
<AppSidebar userRole={userRole} />
|
||||
|
||||
@@ -4,19 +4,21 @@ import { useParams } from "next/navigation";
|
||||
import { Suspense, useEffect } from "react";
|
||||
import { ParticipantsTable } from "~/components/participants/ParticipantsTable";
|
||||
import { ManagementPageLayout } from "~/components/ui/page-layout";
|
||||
import { useActiveStudy } from "~/hooks/useActiveStudy";
|
||||
import { useStudyContext } from "~/lib/study-context";
|
||||
import { useSelectedStudyDetails } from "~/hooks/useSelectedStudyDetails";
|
||||
|
||||
export default function StudyParticipantsPage() {
|
||||
const params = useParams();
|
||||
const studyId: string = typeof params.id === "string" ? params.id : "";
|
||||
const { setActiveStudy, activeStudy } = useActiveStudy();
|
||||
const { setSelectedStudyId, selectedStudyId } = useStudyContext();
|
||||
const { study } = useSelectedStudyDetails();
|
||||
|
||||
// Set the active study if it doesn't match the current route
|
||||
// Sync selected study (unified study-context)
|
||||
useEffect(() => {
|
||||
if (studyId && activeStudy?.id !== studyId) {
|
||||
setActiveStudy(studyId);
|
||||
if (studyId && selectedStudyId !== studyId) {
|
||||
setSelectedStudyId(studyId);
|
||||
}
|
||||
}, [studyId, activeStudy?.id, setActiveStudy]);
|
||||
}, [studyId, selectedStudyId, setSelectedStudyId]);
|
||||
|
||||
return (
|
||||
<ManagementPageLayout
|
||||
@@ -25,7 +27,7 @@ export default function StudyParticipantsPage() {
|
||||
breadcrumb={[
|
||||
{ label: "Dashboard", href: "/dashboard" },
|
||||
{ label: "Studies", href: "/studies" },
|
||||
{ label: activeStudy?.title ?? "Study", href: `/studies/${studyId}` },
|
||||
{ label: study?.name ?? "Study", href: `/studies/${studyId}` },
|
||||
{ label: "Participants" },
|
||||
]}
|
||||
createButton={{
|
||||
|
||||
@@ -4,19 +4,21 @@ import { useParams } from "next/navigation";
|
||||
import { Suspense, useEffect } from "react";
|
||||
import { TrialsTable } from "~/components/trials/TrialsTable";
|
||||
import { ManagementPageLayout } from "~/components/ui/page-layout";
|
||||
import { useActiveStudy } from "~/hooks/useActiveStudy";
|
||||
import { useStudyContext } from "~/lib/study-context";
|
||||
import { useSelectedStudyDetails } from "~/hooks/useSelectedStudyDetails";
|
||||
|
||||
export default function StudyTrialsPage() {
|
||||
const params = useParams();
|
||||
const studyId: string = typeof params.id === "string" ? params.id : "";
|
||||
const { setActiveStudy, activeStudy } = useActiveStudy();
|
||||
const { setSelectedStudyId, selectedStudyId } = useStudyContext();
|
||||
const { study } = useSelectedStudyDetails();
|
||||
|
||||
// Set the active study if it doesn't match the current route
|
||||
useEffect(() => {
|
||||
if (studyId && activeStudy?.id !== studyId) {
|
||||
setActiveStudy(studyId);
|
||||
if (studyId && selectedStudyId !== studyId) {
|
||||
setSelectedStudyId(studyId);
|
||||
}
|
||||
}, [studyId, activeStudy?.id, setActiveStudy]);
|
||||
}, [studyId, selectedStudyId, setSelectedStudyId]);
|
||||
|
||||
return (
|
||||
<ManagementPageLayout
|
||||
@@ -25,7 +27,7 @@ export default function StudyTrialsPage() {
|
||||
breadcrumb={[
|
||||
{ label: "Dashboard", href: "/dashboard" },
|
||||
{ label: "Studies", href: "/studies" },
|
||||
{ label: activeStudy?.title ?? "Study", href: `/studies/${studyId}` },
|
||||
{ label: study?.name ?? "Study", href: `/studies/${studyId}` },
|
||||
{ label: "Trials" },
|
||||
]}
|
||||
createButton={{
|
||||
|
||||
Reference in New Issue
Block a user