Builds PaperTrail from the base skeleton into a full evidence-verification platform for the "Built with Claude: Life Sciences" hackathon (Builder Track). New named-user features (Build Beyond the Bench): - Lab Notebook Companion — rough bench notes -> structured, searchable, grounded experiment records (lib/labNotebook, /console/lab-notebook, migration 0059) - Clinical Trial Matcher — de-identified patient notes -> ranked eligible ClinicalTrials.gov trials with per-criterion inclusion/exclusion reasoning (lib/trialMatcher, /console/trial-matcher, migrations 0060) Platform: - Deterministic verification moat (biostats recompute, exact-span grounding) - 11 biomedical evidence engines (FAERS, GWAS, Open Targets, ChEMBL, ClinVar, PharmGKB, PubTator, DDI, repurposing, biomarker, unified verifier) - Evidence Intelligence (KG, dossier, provenance/export, RWE) + enterprise governance (RBAC, /api/v1 gateway, metering, audit chain, retention) - 17 OSS projects assimilated into native TypeScript on our stack (backend/engines retained + credited in NOTICE) - Multi-format upload (PDF/DOCX/XLSX/CSV/MD/TXT), logo, marketing site - Next.js 16 upgrade, benchmark harness (honest smoke-test caveat) Licensing: Apache-2.0 (LICENSE + NOTICE).
116 lines
3.1 KiB
TypeScript
116 lines
3.1 KiB
TypeScript
import React, { useState, useEffect } from 'react';
|
|
import ResearchPageLayout from '@/components/layouts/ResearchPageLayout';
|
|
import CopilotLayout from '@/components/layouts/CopilotLayout';
|
|
import MobileLayout from '@/components/layouts/MobileLayout';
|
|
import { ChatBoxSettings } from '@/types/data';
|
|
|
|
interface LayoutProps {
|
|
children: React.ReactNode;
|
|
loading: boolean;
|
|
isStopped: boolean;
|
|
showResult: boolean;
|
|
onStop?: () => void;
|
|
onNewResearch?: () => void;
|
|
chatBoxSettings: ChatBoxSettings;
|
|
setChatBoxSettings: React.Dispatch<React.SetStateAction<ChatBoxSettings>>;
|
|
mainContentRef?: React.RefObject<HTMLDivElement>;
|
|
showScrollButton?: boolean;
|
|
onScrollToBottom?: () => void;
|
|
toastOptions?: Record<string, any>;
|
|
toggleSidebar?: () => void;
|
|
isProcessingChat?: boolean;
|
|
}
|
|
|
|
export const getAppropriateLayout = ({
|
|
children,
|
|
loading,
|
|
isStopped,
|
|
showResult,
|
|
onStop,
|
|
onNewResearch,
|
|
chatBoxSettings,
|
|
setChatBoxSettings,
|
|
mainContentRef,
|
|
showScrollButton = false,
|
|
onScrollToBottom,
|
|
toastOptions = {},
|
|
toggleSidebar,
|
|
isProcessingChat = false
|
|
}: LayoutProps) => {
|
|
const [isMobile, setIsMobile] = useState(false);
|
|
|
|
// Check if we're on mobile on client-side
|
|
useEffect(() => {
|
|
const checkIfMobile = () => {
|
|
setIsMobile(window.innerWidth < 768);
|
|
};
|
|
|
|
// Initial check
|
|
checkIfMobile();
|
|
|
|
// Add event listener for window resize
|
|
window.addEventListener('resize', checkIfMobile);
|
|
|
|
// Cleanup
|
|
return () => window.removeEventListener('resize', checkIfMobile);
|
|
}, []);
|
|
|
|
// If on mobile, use the mobile layout
|
|
if (isMobile) {
|
|
return (
|
|
<MobileLayout
|
|
loading={loading}
|
|
isStopped={isStopped}
|
|
showResult={showResult}
|
|
onStop={onStop}
|
|
onNewResearch={onNewResearch}
|
|
chatBoxSettings={chatBoxSettings}
|
|
setChatBoxSettings={setChatBoxSettings}
|
|
mainContentRef={mainContentRef}
|
|
toastOptions={toastOptions}
|
|
toggleSidebar={toggleSidebar}
|
|
>
|
|
{children}
|
|
</MobileLayout>
|
|
);
|
|
}
|
|
|
|
// For desktop, use either the copilot or research layout based on settings
|
|
if (chatBoxSettings.layoutType === 'copilot') {
|
|
return (
|
|
<CopilotLayout
|
|
loading={loading}
|
|
isStopped={isStopped}
|
|
showResult={showResult}
|
|
onStop={onStop}
|
|
onNewResearch={onNewResearch}
|
|
chatBoxSettings={chatBoxSettings}
|
|
setChatBoxSettings={setChatBoxSettings}
|
|
mainContentRef={mainContentRef}
|
|
toastOptions={toastOptions}
|
|
toggleSidebar={toggleSidebar}
|
|
>
|
|
{children}
|
|
</CopilotLayout>
|
|
);
|
|
}
|
|
|
|
// Default to ResearchPageLayout for desktop with standard layout
|
|
return (
|
|
<ResearchPageLayout
|
|
loading={loading}
|
|
isStopped={isStopped}
|
|
showResult={showResult}
|
|
onStop={onStop}
|
|
onNewResearch={onNewResearch || (() => {})}
|
|
chatBoxSettings={chatBoxSettings}
|
|
setChatBoxSettings={setChatBoxSettings}
|
|
mainContentRef={mainContentRef}
|
|
showScrollButton={showScrollButton}
|
|
onScrollToBottom={onScrollToBottom}
|
|
toastOptions={toastOptions}
|
|
>
|
|
{children}
|
|
</ResearchPageLayout>
|
|
);
|
|
};
|