@@ -3,16 +3,25 @@ import { Note } from "@/types/OmopTables";
33import { Card , CardContent , CardHeader , CardTitle } from "@/components/ui/card" ;
44import { getMultiplePmcArticles } from "@/lib/services/pmcService" ;
55import { Badge } from "@/components/ui/badge" ;
6- import { ScrollArea , ScrollBar } from "./ui/scroll-area" ;
7-
6+ import { ConceptHover } from "./ConceptHover" ;
87export default async function NotesList ( {
8+ relatedConcepts,
99 notes,
10- conceptIds,
11- conceptName,
10+ conceptDetails,
1211} : {
12+ relatedConcepts : Array < {
13+ inputConceptId : string ;
14+ groupConcepts : Array < {
15+ conceptId : string ;
16+ conceptName : string ;
17+ } > ;
18+ } > ;
1319 notes : Note [ ] ;
14- conceptIds : Array < string > | null ;
15- conceptName : string | null ;
20+ conceptDetails : Array < {
21+ conceptId : string ;
22+ conceptName : string ;
23+ domain : string ;
24+ } > ;
1625} ) {
1726 // Sort the PMC IDs for caching
1827 const pmcids = Array . from (
@@ -22,60 +31,79 @@ export default async function NotesList({
2231 . filter ( ( id ) : id is string => Boolean ( id ) ) ,
2332 ) ,
2433 ) . sort ( ) ;
25-
2634 if ( pmcids . length === 0 ) return ;
2735 const articles =
2836 pmcids . length > 0 ? await getMultiplePmcArticles ( pmcids ) : { } ;
2937
3038 return (
3139 < Card className = "col-span-2" >
3240 < CardHeader >
33- < CardTitle className = "text-2xl" >
34- { conceptIds && conceptName
35- ? `Case Reports for ${ conceptName } `
36- : "No term selected" }
41+ < CardTitle className = "flex flex-wrap gap-2 items-center" >
42+ < span className = "text-2xl" > Case Reports for: </ span >
43+ { conceptDetails . map ( ( c ) => {
44+ const related = relatedConcepts . find (
45+ ( r ) => r . inputConceptId === c . conceptId ,
46+ ) ;
47+ return (
48+ < ConceptHover
49+ key = { c . conceptId }
50+ conceptName = { c . conceptName }
51+ relatedConcepts = { related ?. groupConcepts }
52+ />
53+ ) ;
54+ } ) }
3755 </ CardTitle >
3856 </ CardHeader >
3957
4058 < CardContent >
41- { ! conceptIds ? (
59+ { ! conceptDetails ? (
4260 < div className = "text-muted-foreground text-center py-10" >
4361 Select a concept from the sidebar to view the associated Case
4462 Reports.
4563 </ div >
4664 ) : notes . length === 0 ? (
4765 < div className = "text-muted-foreground text-center py-10" >
48- No notes found for { conceptName }
66+ No notes found for
67+ { conceptDetails . map ( ( c ) => c . conceptName ) . join ( ", " ) } .
4968 </ div >
5069 ) : (
5170 < div className = "grid grid-cols-1 gap-4" >
5271 < div className = "mb-4 flex items-center gap-2" >
5372 < Badge variant = "outline" className = "bg-sky-100 dark:bg-[#1B3C53]" >
5473 Condition
5574 </ Badge >
56- < Badge variant = "outline" className = "bg-emerald-100 dark:bg-[#3F4F44]" >
75+ < Badge
76+ variant = "outline"
77+ className = "bg-emerald-100 dark:bg-[#3F4F44]"
78+ >
5779 Drug
5880 </ Badge >
59- < Badge variant = "outline" className = "bg-violet-100 dark:bg-[#49243E]" >
81+ < Badge
82+ variant = "outline"
83+ className = "bg-violet-100 dark:bg-[#49243E]"
84+ >
6085 Procedure
6186 </ Badge >
62- < Badge variant = "outline" className = "bg-orange-100 dark:bg-amber-800" >
87+ < Badge
88+ variant = "outline"
89+ className = "bg-orange-100 dark:bg-amber-800"
90+ >
6391 Measurement
6492 </ Badge >
6593 </ div >
66- < div className = "grid grid-cols-1 gap-4 px-1 py-1" >
67- { notes . map ( ( note ) => {
68- const pmcid = note . note_source_value ?. match ( / P M C ( \d + ) / ) ?. [ 1 ] ;
94+ < div className = "grid grid-cols-1 gap-4 px-1 py-1" >
95+ { notes . map ( ( note ) => {
96+ const pmcid = note . note_source_value ?. match ( / P M C ( \d + ) / ) ?. [ 1 ] ;
6997
70- return (
71- < NoteCard
72- key = { note . note_id }
73- note = { note }
74- article = { pmcid ? articles [ pmcid ] : null }
75- />
76- ) ;
77- } ) }
78- </ div >
98+ return (
99+ < NoteCard
100+ key = { note . note_id }
101+ note = { note }
102+ article = { pmcid ? articles [ pmcid ] : null }
103+ />
104+ ) ;
105+ } ) }
106+ </ div >
79107 </ div >
80108 ) }
81109 </ CardContent >
0 commit comments