Skip to content

Commit

Permalink
Merge pull request #129 from pedrolivaresanchez/fix/towns
Browse files Browse the repository at this point in the history
fix: towns id
  • Loading branch information
patrickwebsdev authored Nov 7, 2024
2 parents 990a5c8 + 85f4c20 commit 194cca8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/app/casos-activos/solicitudes/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ export default function Solicitudes() {
className="bg-green-500 text-white px-4 py-2 rounded hover:bg-green-600 flex items-center gap-2 whitespace-nowrap"
>
<HeartHandshake className="w-5 h-5" />
Ofrecer ayuda {filtroData.pueblo === 'todos' ? '' : ' a ' + towns[filtroData.pueblo - 1]?.name}
Ofrecer ayuda{' '}
{filtroData.pueblo === 'todos'
? ''
: ' a ' + towns.find((town) => town.id === Number(filtroData.pueblo))?.name}
</button>
</div>
) : (
Expand All @@ -189,7 +192,11 @@ export default function Solicitudes() {
</div>
{showModal && (
<Modal>
<OfferHelp town={towns[filtroData.pueblo - 1]} onClose={closeModal} isModal={true} />
<OfferHelp
town={towns.find((town) => town.id === Number(filtroData.pueblo))?.name}
onClose={closeModal}
isModal={true}
/>
</Modal>
)}
</>
Expand Down
3 changes: 2 additions & 1 deletion src/components/OfferCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export default function OfferCard({
<div className="flex items-start gap-2">
<MapPinned className="h-4 w-4 text-gray-500 flex-shrink-0 mt-1" />
<span className="break-words">
<span className="font-semibold">Pueblo:</span> {towns[caso.town_id - 1]?.name || ''}
<span className="font-semibold">Pueblo:</span>{' '}
{towns.find((town) => town.id === caso.town_id)?.name || ''}
</span>
</div>
)}
Expand Down
6 changes: 5 additions & 1 deletion src/components/PhoneInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ export default function PhoneInfo({ caseInfo }) {
return (
<span className="break-words">
<span className="font-semibold">Contacto:</span>{' '}
{!!userAssignment ? caseInfo.contact_info : 'Ayuda a esta persona para ver sus datos de contacto'}
{session && session.user
? !!userAssignment
? caseInfo.contact_info
: 'Dale al botón "Quiero ayudar" para ver sus datos de contacto.'
: 'Inicia sesion para ver este dato'}
</span>
);
}

0 comments on commit 194cca8

Please sign in to comment.