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).
82 lines
3.0 KiB
TypeScript
82 lines
3.0 KiB
TypeScript
import React, { useState, useEffect } from 'react';
|
|
import ImageModal from './ImageModal';
|
|
|
|
type ImageType = any; // Simple type definition to avoid errors
|
|
|
|
interface ImagesAlbumProps {
|
|
images: ImageType[];
|
|
}
|
|
|
|
export default function ImagesAlbum({ images }: ImagesAlbumProps) {
|
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
const [selectedImage, setSelectedImage] = useState(null);
|
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
const [validImages, setValidImages] = useState(images);
|
|
|
|
const openModal = (image: ImageType, index: number) => {
|
|
setSelectedImage(image);
|
|
setSelectedIndex(index);
|
|
setIsModalOpen(true);
|
|
};
|
|
|
|
const closeModal = () => {
|
|
setIsModalOpen(false);
|
|
setSelectedImage(null);
|
|
};
|
|
|
|
// Handle navigation in modal
|
|
const nextImage = () => {
|
|
setSelectedIndex((prevIndex) => (prevIndex + 1) % validImages.length);
|
|
setSelectedImage(validImages[(selectedIndex + 1) % validImages.length]);
|
|
};
|
|
|
|
const prevImage = () => {
|
|
setSelectedIndex((prevIndex) => (prevIndex - 1 + validImages.length) % validImages.length);
|
|
setSelectedImage(validImages[(selectedIndex - 1 + validImages.length) % validImages.length]);
|
|
};
|
|
|
|
// Handle broken images by filtering them out
|
|
const handleImageError = (brokenImage: ImageType) => {
|
|
setValidImages((prevImages) => prevImages.filter((img) => img !== brokenImage));
|
|
};
|
|
|
|
useEffect(() => {
|
|
const imagesToHide: ImageType[] = []
|
|
const filteredImages = images.filter((img) => !imagesToHide.includes(img));
|
|
setValidImages(filteredImages);
|
|
}, [images]);
|
|
|
|
if (validImages.length === 0) return null;
|
|
|
|
return (
|
|
<div className="w-full h-full min-h-[200px] max-h-[400px]">
|
|
<div className="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-4 gap-4 pb-4">
|
|
{validImages.map((image: ImageType, index: number) => (
|
|
<div
|
|
key={index}
|
|
className="relative aspect-square bg-gray-700 rounded-lg overflow-hidden hover:shadow-lg transition-shadow duration-300"
|
|
>
|
|
<img
|
|
src={image}
|
|
alt={`Image ${index + 1}`}
|
|
className="absolute inset-0 w-full h-full object-cover cursor-pointer hover:opacity-90 transition-opacity duration-300"
|
|
onClick={() => openModal(image, index)}
|
|
onError={() => handleImageError(image)}
|
|
loading="lazy"
|
|
/>
|
|
</div>
|
|
))}
|
|
</div>
|
|
|
|
{selectedImage && (
|
|
<ImageModal
|
|
imageSrc={selectedImage}
|
|
isOpen={isModalOpen}
|
|
onClose={closeModal}
|
|
onNext={nextImage}
|
|
onPrev={prevImage}
|
|
/>
|
|
)}
|
|
</div>
|
|
);
|
|
} |