@@ -9,6 +9,7 @@ import { Separator } from '../ui/separator';
9
9
import { Chip } from '../Chip' ;
10
10
import { Button } from '../ui/button' ;
11
11
import { VerifiedBadge } from '@/components/VerifiedBadge/VerifiedBadge.tsx' ;
12
+ import { SupplyPriority } from '@/service/supply/types' ;
12
13
13
14
const ShelterListItem = ( props : IShelterListItemProps ) => {
14
15
const { data } = props ;
@@ -22,7 +23,7 @@ const ShelterListItem = (props: IShelterListItemProps) => {
22
23
23
24
const tags = useMemo (
24
25
( ) => {
25
- return data . shelterSupplies ?. filter ( ( s ) => ! getCategoriesToFilterVolunteers ( ) . some ( c => c . includes ( s . supply ?. supplyCategory ?. name . toLowerCase ( ) ) ) )
26
+ return data . shelterSupplies ?. filter ( ( s ) => ! getCategoriesToFilterVolunteers ( ) . some ( c => c . includes ( s . supply ?. supplyCategory ?. name . toLowerCase ( ) ) ) && ! ( s . priority === SupplyPriority . Remaining ) )
26
27
. sort ( ( a , b ) => b . priority - a . priority ) . slice ( 0 , 10 )
27
28
} ,
28
29
[ data . shelterSupplies ]
@@ -35,6 +36,13 @@ const ShelterListItem = (props: IShelterListItemProps) => {
35
36
[ data . shelterSupplies ]
36
37
)
37
38
39
+ const donationsTags = useMemo (
40
+ ( ) => {
41
+ return data . shelterSupplies ?. filter ( ( s ) => ! getCategoriesToFilterVolunteers ( ) . some ( c => c . includes ( s . supply ?. supplyCategory ?. name . toLowerCase ( ) ) ) && s . priority === SupplyPriority . Remaining ) . reverse ( )
42
+ } ,
43
+ [ data . shelterSupplies ]
44
+ )
45
+
38
46
return (
39
47
< div className = "flex flex-col p-4 w-full border-2 border-border rounded-md gap-1 relative" >
40
48
< Button
@@ -97,6 +105,21 @@ const ShelterListItem = (props: IShelterListItemProps) => {
97
105
) ) }
98
106
</ div >
99
107
</ div >
108
+ < div className = "flex flex-col gap-3" >
109
+ < Separator className = "mt-2" />
110
+ < p className = "text-muted-foreground text-sm md:text-lg font-medium" >
111
+ Sobrando, para doações:
112
+ </ p >
113
+ < div className = "flex gap-2 flex-wrap" >
114
+ { donationsTags . map ( ( s , idx ) => (
115
+ < Chip
116
+ className = { getSupplyPriorityProps ( s . priority ) . className }
117
+ key = { idx }
118
+ label = { s . supply . name }
119
+ />
120
+ ) ) }
121
+ </ div >
122
+ </ div >
100
123
</ >
101
124
) }
102
125
{ data . updatedAt && (
0 commit comments