tahamajs/IE / Projects /front /src /components /gap-analysis /HypothesisGenerator.tsx
tahamajs's picture
download
raw
5.5 kB
// src/components/gap-analysis/HypothesisGenerator.tsx
import { useState } from "react";
import type { GeneratedHypothesis } from "@/types/gap-analysis";
import {
Sparkles, Lightbulb, Beaker, ChevronDown, ChevronUp,
Target, ArrowRight, FlaskConical, BookOpen, ExternalLink,
} from "lucide-react";
interface HypothesisGeneratorProps {
hypotheses: GeneratedHypothesis[];
onExport?: () => void;
}
export function HypothesisGenerator({ hypotheses, onExport }: HypothesisGeneratorProps) {
const [expandedId, setExpandedId] = useState<string | null>(null);
return (
<div className="bg-white dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 h-full flex flex-col">
<div className="p-4 border-b border-gray-100 dark:border-gray-700 flex items-center justify-between">
<h3 className="font-bold text-lg flex items-center gap-2">
<FlaskConical className="w-5 h-5 text-violet-500" />
Generated Hypotheses
<span className="text-sm font-normal text-gray-400 ml-1">
({hypotheses.length})
</span>
</h3>
</div>
<div className="flex-1 overflow-y-auto p-3 space-y-3">
{hypotheses.length === 0 ? (
<div className="flex flex-col items-center justify-center py-12 text-gray-400">
<FlaskConical className="w-10 h-10 mb-3 opacity-30" />
<p className="text-sm">Run analysis or click "Generate Hypothesis" on a gap</p>
</div>
) : (
hypotheses.map((hyp) => (
<div
key={hyp.id}
className="border border-violet-200 dark:border-violet-800 rounded-xl bg-violet-50/30 dark:bg-violet-900/10 overflow-hidden"
>
<button
onClick={() => setExpandedId(expandedId === hyp.id ? null : hyp.id)}
className="w-full text-left p-4"
>
<div className="flex items-start gap-3">
<div className="w-8 h-8 rounded-lg bg-violet-500/10 flex items-center justify-center shrink-0">
<Lightbulb className="w-4 h-4 text-violet-600" />
</div>
<div className="flex-1 min-w-0">
<h4 className="font-semibold text-sm text-gray-900 dark:text-gray-100">
{hyp.title}
</h4>
<p className="text-sm text-gray-600 dark:text-gray-400 mt-1 line-clamp-2">
{hyp.statement}
</p>
<div className="flex items-center gap-2 mt-2">
<span className="text-[10px] px-2 py-0.5 rounded-full bg-violet-100 dark:bg-violet-900/30 text-violet-700 dark:text-violet-400">
Novelty: {hyp.novelty}/100
</span>
<span className="text-[10px] px-2 py-0.5 rounded-full bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400">
Testable: {hyp.testability}/100
</span>
</div>
</div>
{expandedId === hyp.id ? (
<ChevronUp className="w-4 h-4 text-gray-400 shrink-0" />
) : (
<ChevronDown className="w-4 h-4 text-gray-400 shrink-0" />
)}
</div>
</button>
{expandedId === hyp.id && (
<div className="px-4 pb-4 border-t border-violet-100 dark:border-violet-800/50 pt-3 space-y-3">
<div className="grid grid-cols-3 gap-2">
<div className="bg-white dark:bg-gray-800 rounded-lg p-3 text-center border">
<p className="text-[10px] text-gray-500 uppercase">Independent</p>
<p className="text-sm font-semibold mt-0.5">{hyp.variables.independent}</p>
</div>
<div className="bg-white dark:bg-gray-800 rounded-lg p-3 text-center border">
<p className="text-[10px] text-gray-500 uppercase">Dependent</p>
<p className="text-sm font-semibold mt-0.5">{hyp.variables.dependent}</p>
</div>
{hyp.variables.moderating && (
<div className="bg-white dark:bg-gray-800 rounded-lg p-3 text-center border">
<p className="text-[10px] text-gray-500 uppercase">Moderating</p>
<p className="text-sm font-semibold mt-0.5">{hyp.variables.moderating}</p>
</div>
)}
</div>
<div>
<h5 className="text-xs font-semibold text-gray-500 uppercase mb-1 flex items-center gap-1">
<BookOpen className="w-3 h-3" /> Grounded In
</h5>
<div className="flex flex-wrap gap-1">
{hyp.groundedIn.map((paperId, i) => (
<span
key={i}
className="text-[10px] bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-2 py-0.5 rounded-full"
>
Paper #{paperId}
</span>
))}
</div>
</div>
</div>
)}
</div>
))
)}
</div>
</div>
);
}

Xet Storage Details

Size:
5.5 kB
·
Xet hash:
1a3d5965fbc2b6048d03e38685085207dae8b4c713b5af22ecc9d71b514c3186

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.