@@ -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,14 @@ 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
+
46
+
38
47
return (
39
48
< div className = "flex flex-col p-4 w-full border-2 border-border rounded-md gap-1 relative" >
40
49
< Button
@@ -97,6 +106,22 @@ const ShelterListItem = (props: IShelterListItemProps) => {
97
106
) ) }
98
107
</ div >
99
108
</ div >
109
+ < div className = "flex flex-col gap-3" >
110
+ < Separator className = "mt-2" />
111
+ < p className = "text-muted-foreground text-sm md:text-lg font-medium" >
112
+ Sobrando, para doações:
113
+ </ p >
114
+ < div className = "flex gap-2 flex-wrap" >
115
+ { donationsTags . map ( ( s , idx ) => (
116
+ < Chip
117
+ className = { getSupplyPriorityProps ( s . priority ) . className }
118
+ key = { idx }
119
+ label = { s . supply . name }
120
+ />
121
+ ) ) }
122
+ </ div >
123
+
124
+ </ div >
100
125
</ >
101
126
) }
102
127
{ data . updatedAt && (
0 commit comments