feat(servizio): Update open contacts display logic and add mapping for open contacts announcements

This commit is contained in:
Marco Pedone 2025-10-29 17:57:55 +01:00
parent 66ef4a7fbd
commit 6a72261c91

View file

@ -190,9 +190,10 @@ export const ServizioContent = () => {
);
}
const openContattiCount = servizio.annunci.filter(
(a) => a.open_contatti_at !== null,
).length;
const openContattiAnnunci = servizio.annunci.filter(
(a) => a.open_contatti_at !== null && a.user_confirmed_at === null,
);
const annunciInConferma = servizio.annunci.filter(
(a) => a.user_confirmed_at !== null,
@ -211,9 +212,9 @@ export const ServizioContent = () => {
<UserCircle className="size-6 text-primary" />
<span className="font-medium">Contatti sbloccati</span>
</div>
<span className="text-sm">{openContattiCount} / 10</span>
<span className="text-sm">{openContattiAnnunci.length} / 10</span>
</div>
<Progress className="h-2" value={openContattiCount * 10} />
<Progress className="h-2" value={openContattiAnnunci.length * 10} />
</div>
<ServizioDuration decorrenza={servizio.decorrenza} />
@ -255,6 +256,15 @@ export const ServizioContent = () => {
</div>
)}
<div className="flex flex-col gap-4">
<div className="flex flex-col gap-2 overflow-y-auto">
{openContattiAnnunci.map((data) => {
return (
<ServizioAnnuncioProvider data={data} key={data.id}>
<AnnuncioCard className="border-2 border-green-500" />
</ServizioAnnuncioProvider>
);
})}
</div>
<div className="flex flex-col gap-2 overflow-y-auto">
{annunciInConferma.map((data) => {
return (