Skip to content

Commit

Permalink
Merge pull request #42 from SOS-RS/develop
Browse files Browse the repository at this point in the history
develop into master
  • Loading branch information
MatheusDubin authored May 10, 2024
2 parents 06975e4 + 646f11b commit 3e749ee
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
11 changes: 10 additions & 1 deletion src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ const Header = React.forwardRef<HTMLDivElement, IHeader>((props, ref) => {
{startAdornment}
<h3 className="font-medium text-white">{title}</h3>
</div>
<div className="cursor-pointer ">{endAdornment}</div>
<div className="flex items-center">
<a
href="https://forms.gle/2S7L2gR529Dc8P3T9"
className="bg-white hover:bg-rose-50 text-red-600 font-medium text-xs md:text-base py-2 px-1 md:py-2 md:px-4 rounded-full"
target="_blank"
>
Cadastrar abrigo
</a>
<div className="cursor-pointer ">{endAdornment}</div>
</div>
</div>
);
});
Expand Down
27 changes: 26 additions & 1 deletion src/components/ShelterListItem/ShelterListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Separator } from '../ui/separator';
import { Chip } from '../Chip';
import { Button } from '../ui/button';
import { VerifiedBadge } from '@/components/VerifiedBadge/VerifiedBadge.tsx';
import { SupplyPriority } from '@/service/supply/types';

const ShelterListItem = (props: IShelterListItemProps) => {
const { data } = props;
Expand All @@ -22,7 +23,7 @@ const ShelterListItem = (props: IShelterListItemProps) => {

const tags = useMemo(
() => {
return data.shelterSupplies?.filter((s) => !getCategoriesToFilterVolunteers().some(c => c.includes(s.supply?.supplyCategory?.name.toLowerCase())))
return data.shelterSupplies?.filter((s) => !getCategoriesToFilterVolunteers().some(c => c.includes(s.supply?.supplyCategory?.name.toLowerCase())) && !(s.priority === SupplyPriority.Remaining))
.sort((a, b) => b.priority - a.priority).slice(0, 10)
},
[data.shelterSupplies]
Expand All @@ -35,6 +36,14 @@ const ShelterListItem = (props: IShelterListItemProps) => {
[data.shelterSupplies]
)

const donationsTags = useMemo(
() => {
return data.shelterSupplies?.filter((s) => !getCategoriesToFilterVolunteers().some(c => c.includes(s.supply?.supplyCategory?.name.toLowerCase())) && s.priority === SupplyPriority.Remaining).reverse()
},
[data.shelterSupplies]
)


return (
<div className="flex flex-col p-4 w-full border-2 border-border rounded-md gap-1 relative">
<Button
Expand Down Expand Up @@ -97,6 +106,22 @@ const ShelterListItem = (props: IShelterListItemProps) => {
))}
</div>
</div>
<div className="flex flex-col gap-3">
<Separator className="mt-2" />
<p className="text-muted-foreground text-sm md:text-lg font-medium">
Sobrando, para doações:
</p>
<div className="flex gap-2 flex-wrap">
{donationsTags.map((s, idx) => (
<Chip
className={getSupplyPriorityProps(s.priority).className}
key={idx}
label={s.supply.name}
/>
))}
</div>

</div>
</>
)}
{data.updatedAt && (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EditShelterSupply/EditShelterSupply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const EditShelterSupply = () => {
value: `${SupplyPriority.Remaining}`,
},
{
label: 'Remover item',
label: 'Não preciso',
value: `${SupplyPriority.NotNeeded}`,
},
]}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Shelter/Shelter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const Shelter = () => {
</h3>
</div>
<div className="flex gap-2 flex-wrap">
{volunteerTags.map((v, idx) => (
{ volunteerTags.length == 0 ? <p>Não informado. <i> (Pode ser adicionado ao clicar em Editar itens) </i></p> : volunteerTags.map((v, idx) => (
<Chip
className={getSupplyPriorityProps(v.priority).className}
key={idx}
Expand Down

0 comments on commit 3e749ee

Please sign in to comment.