diff --git a/src/components/tiles/ProjectsTile.tsx b/src/components/tiles/ProjectsTile.tsx index 01c860b..c07a009 100644 --- a/src/components/tiles/ProjectsTile.tsx +++ b/src/components/tiles/ProjectsTile.tsx @@ -1,12 +1,9 @@ -import React, { useState, useCallback } from 'react' -import { AnimatePresence, motion } from 'framer-motion' -import { ExternalLink } from 'lucide-react' +import React, { useCallback } from 'react' import { investigations } from '@/data/investigations' import { Card, CardHeader } from '../Card' +import { useDetailPanel } from '@/contexts/DetailPanelContext' import type { Investigation } from '@/types/pmr' -const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches - const statusColorMap: Record = { Complete: '#059669', Ongoing: '#0D6E6E', @@ -15,11 +12,10 @@ const statusColorMap: Record = { interface ProjectItemProps { project: Investigation - isExpanded: boolean - onToggle: () => void + onClick: () => void } -function ProjectItem({ project, isExpanded, onToggle }: ProjectItemProps) { +function ProjectItem({ project, onClick }: ProjectItemProps) { const dotColor = statusColorMap[project.status] || '#0D6E6E' const isLive = project.status === 'Live' @@ -27,21 +23,17 @@ function ProjectItem({ project, isExpanded, onToggle }: ProjectItemProps) { (e: React.KeyboardEvent) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault() - onToggle() - } else if (e.key === 'Escape' && isExpanded) { - e.preventDefault() - onToggle() + onClick() } }, - [isExpanded, onToggle], + [onClick], ) return (
{ e.currentTarget.style.borderColor = 'var(--accent-border)' + e.currentTarget.style.boxShadow = '0 2px 8px rgba(26,43,42,0.08)' }} onMouseLeave={(e) => { - if (!isExpanded) { - e.currentTarget.style.borderColor = 'var(--border-light)' - } + e.currentTarget.style.borderColor = 'var(--border-light)' + e.currentTarget.style.boxShadow = 'none' }} > - {/* Item header row */} + {/* Row: status dot + name + year */}
- {/* Expanded content */} - - {isExpanded && ( - -
0 && ( +
+ {project.techStack.map((tech) => ( + - {/* Methodology */} - {project.methodology && ( -

- {project.methodology} -

- )} - - {/* Tech stack tags */} - {project.techStack && project.techStack.length > 0 && ( -
- {project.techStack.map((tech) => ( - - {tech} - - ))} -
- )} - - {/* Results */} - {project.results && project.results.length > 0 && ( -
    - {project.results.map((result, i) => ( -
  • - - • - - {result} -
  • - ))} -
- )} - - {/* External link */} - {project.externalUrl && ( - e.stopPropagation()} - style={{ - display: 'inline-flex', - alignItems: 'center', - gap: '5px', - fontSize: '10.5px', - fontWeight: 500, - color: 'var(--accent)', - textDecoration: 'none', - padding: '4px 8px', - borderRadius: '4px', - background: 'var(--accent-light)', - border: '1px solid var(--accent-border)', - transition: 'background 0.15s', - }} - onMouseEnter={(e) => { - e.currentTarget.style.background = 'rgba(10,128,128,0.14)' - }} - onMouseLeave={(e) => { - e.currentTarget.style.background = 'var(--accent-light)' - }} - > - - View Results - - )} -
- - )} - + {tech} + + ))} +
+ )}
) } export function ProjectsTile() { - const [expandedItemId, setExpandedItemId] = useState(null) - - const handleToggle = useCallback( - (id: string) => { - setExpandedItemId((prev) => (prev === id ? null : id)) - }, - [], - ) + const { openPanel } = useDetailPanel() return ( @@ -266,8 +133,7 @@ export function ProjectsTile() { handleToggle(project.id)} + onClick={() => openPanel({ type: 'project', investigation: project })} /> ))}