@@ -43,7 +43,7 @@ function getConditions(symptoms: any[], id: string): string[] {
4343 : [ ] ;
4444}
4545
46- // Symptom card component
46+ // Symptom row component (same data as before, laid out as a compact row)
4747const SymptomCard = ( {
4848 symptom,
4949 dict,
@@ -53,50 +53,49 @@ const SymptomCard = ({
5353 dict : I18nRecord ;
5454 loading ?: boolean ;
5555} ) => {
56+ const conditions = symptom . conditions . filter ( Boolean ) ;
57+
5658 return (
57- < div className = "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg flex items-center gap-1 p-2 w-min-[150px] h-[70px] " >
58- { /* min-w-fit */ }
59- { /* First column: Icon and conditions */ }
60- < div className = "flex flex-col items-center gap-1 min-w-0.5" >
61- < div className = "text-gray-600 dark:text-gray-400 dark:bg-gray-300 rounded-lg p-1" >
62- < SymptomIcon
63- type = { symptom . icon }
64- size = "h-6 w-6"
65- dict = { dict }
66- fixed_label = { symptom . label }
67- />
68- </ div >
69- < div className = "flex gap-1" >
70- < div className = "flex -space-x-2.5 transition-all duration-[0.5s] animate-show-flex" >
71- { Array . from ( symptom . conditions ) . map ( ( condition ) => (
72- < ConditionIcon
73- key = { condition }
74- condition = { condition ?? "" }
75- size = "h-4 w-4"
76- dict = { dict }
77- />
78- ) ) }
79- </ div >
80- </ div >
59+ < div className = "flex items-center gap-2 py-1 px-1.5 rounded-md bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700" >
60+ < div className = "text-gray-600 dark:text-gray-400 dark:bg-gray-300 rounded-md p-0.5 shrink-0" >
61+ < SymptomIcon
62+ type = { symptom . icon }
63+ size = "h-5 w-5"
64+ dict = { dict }
65+ fixed_label = { symptom . label }
66+ />
8167 </ div >
8268
83- { /* Second column: Label */ }
84- < div className = "flex-1 justify-center text-gray-900 dark:text-gray-100 text-[11px] font-light min-w-0 overflow-hidden" >
85- { /* <span className="text-sm text-gray-700 font-light truncate block"> */ }
69+ < span className = "flex-1 min-w-0 truncate font-light text-sm text-gray-600 dark:text-gray-300" >
8670 { symptom . label }
87- { /* </span> */ }
88- </ div >
71+ </ span >
8972
90- { /* Third column: Number */ }
91- < div className = "text-xl text-gray-800 dark:text-gray-200 flex-shrink-0" >
92- { loading ? (
93- < div className = "bg-gray-300 dark:bg-gray-700 text-gray-300 dark:text-gray-700 animate-pulse rounded-lg h-full w-full" >
94- 00
95- </ div >
96- ) : (
97- symptom . count . toString ( ) . padStart ( 2 , "0" )
98- ) }
99- </ div >
73+ { conditions . length > 0 && (
74+ < div className = "flex -space-x-1.5 shrink-0" >
75+ { conditions . map ( ( condition ) => (
76+ < ConditionIcon
77+ key = { condition }
78+ condition = { condition }
79+ size = "h-4 w-4"
80+ dict = { dict }
81+ />
82+ ) ) }
83+ </ div >
84+ ) }
85+
86+ { loading ? (
87+ < div className = "bg-gray-300 dark:bg-gray-700 animate-pulse rounded h-4 w-6 shrink-0" />
88+ ) : (
89+ < span
90+ className = { `shrink-0 text-xs font-medium rounded px-1.5 py-0.5 min-w-6 text-center ${
91+ symptom . count > 0
92+ ? "bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-100"
93+ : "text-gray-300 dark:text-gray-600"
94+ } `}
95+ >
96+ { symptom . count . toString ( ) . padStart ( 2 , "0" ) }
97+ </ span >
98+ ) }
10099 </ div >
101100 ) ;
102101} ;
@@ -266,12 +265,19 @@ export default function SymptomsCard({
266265 subtitle = { null }
267266 >
268267 < div
269- className = { `grid gap-2 ${ reactive ? "grid-cols-3 lg:grid-cols-2 2xl:grid-cols-3" : "grid-cols-2 md:grid-cols-3" } ` }
268+ className = { `grid gap-1.5 ${
269+ reactive
270+ ? "grid-cols-1 lg:grid-cols-2 lg:[&>*:last-child:nth-child(odd)]:col-span-2"
271+ : "grid-cols-2 md:grid-cols-3 max-md:[&>*:last-child:nth-child(odd)]:col-span-2 md:[&>*:last-child:nth-child(3n+1)]:col-span-3 md:[&>*:last-child:nth-child(3n+2)]:col-span-2"
272+ } `}
270273 >
271274 { allSymptoms . map ( ( symptom ) => (
272- < div key = { symptom . key } >
273- < SymptomCard symptom = { symptom } dict = { dict } loading = { isLoading } />
274- </ div >
275+ < SymptomCard
276+ key = { symptom . key }
277+ symptom = { symptom }
278+ dict = { dict }
279+ loading = { isLoading }
280+ />
275281 ) ) }
276282 </ div >
277283 </ CustomCard >
0 commit comments