Skip to content

Commit 94695ae

Browse files
rhuamfagundesjg
authored andcommitted
feat: added shelter category (SOS-RS#250)
Co-authored-by: José Fagundes <[email protected]>
1 parent d3487ea commit 94695ae

File tree

6 files changed

+77
-43
lines changed

6 files changed

+77
-43
lines changed

src/components/Authenticated/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ import { AccessLevel } from '@/service/sessions/types';
22

33
export interface IAuthenticatedProps {
44
role?: AccessLevel;
5+
bypass?: boolean;
56
children?: React.ReactNode;
67
}

src/components/BurgerMenu/BurgerMenu.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
Info,
88
LinkIcon,
99
Menu,
10+
ShieldAlert,
1011
} from 'lucide-react';
1112

1213
import { SessionServices } from '@/service';
@@ -49,27 +50,35 @@ const BurgerMenu = () => {
4950
<BurguerMenuItem
5051
label="Sobre nós"
5152
link="/sobre-nos"
52-
icon={<Info className="w-4 h-4" />}
53+
icon={<Info className="w-5 h-5" />}
5354
/>
5455
<BurguerMenuItem
5556
label="Cadastrar abrigo"
5657
link="https://forms.gle/2S7L2gR529Dc8P3T9"
57-
icon={<CirclePlus className="w-4 h-4" />}
58+
icon={<CirclePlus className="w-5 h-5" />}
59+
openExternal={true}
60+
/>
61+
<BurguerMenuItem
62+
label="Canal de Denúncias"
63+
link="https://contatoseguro.com.br/sos_rs"
64+
icon={<ShieldAlert className="w-5 h-5" />}
65+
openExternal={true}
5866
/>
5967
<BurguerMenuItem
6068
label="Como Ajudar"
6169
link="https://www.instagram.com/reel/C613CfGuh4b"
62-
icon={<CircleHelp className="w-4 h-4" />}
70+
icon={<CircleHelp className="w-5 h-5" />}
71+
openExternal={true}
6372
/>
6473
<BurguerMenuItem
6574
label="Política de Privacidade"
6675
link="/politica-de-privacidade"
67-
icon={<Info className="w-4 h-4" />}
76+
icon={<Info className="w-5 h-5" />}
6877
/>
6978
<BurguerMenuItem
7079
label="Apoiadores"
7180
link="/apoiadores"
72-
icon={<HeartHandshake className="w-4 h-4" />}
81+
icon={<HeartHandshake className="w-5 h-5" />}
7382
/>
7483
<Separator />
7584
{partners.length > 0 && (

src/components/BurgerMenu/components/BurguerMenuItem/BurguerMenuItem.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { ExternalLink } from 'lucide-react';
23

34
import { IBurguerMenuItemProps } from './types';
45
import { cn } from '@/lib/utils';
@@ -7,22 +8,31 @@ const BurguerMenuItem = React.forwardRef<
78
HTMLAnchorElement,
89
IBurguerMenuItemProps
910
>((props, ref) => {
10-
const { icon, label, onClick, link, className = '', ...rest } = props;
11+
const {
12+
icon,
13+
label,
14+
onClick,
15+
link,
16+
className = '',
17+
openExternal,
18+
...rest
19+
} = props;
1120

1221
return (
1322
<a
1423
ref={ref}
1524
href={link}
16-
target="_blank"
1725
className={cn(
1826
'hover:font-semibold flex gap-2 items-center text-zinc-600 [&_svg]:stroke-zinc-500',
1927
className
2028
)}
2129
onClick={onClick}
2230
{...rest}
31+
target={openExternal ? '_blank' : undefined}
2332
>
2433
{icon}
2534
{label}
35+
{openExternal && <ExternalLink className="w-3 h-3" />}
2636
</a>
2737
);
2838
});

src/components/BurgerMenu/components/BurguerMenuItem/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ export interface IBurguerMenuItemProps
33
label: string;
44
icon?: React.ReactNode;
55
link?: string;
6+
openExternal?: boolean;
67
onClick?: () => void;
78
}

src/components/CardAboutShelter/CardAboutShelter.tsx

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import { Card } from '../ui/card';
1313
import { ICardAboutShelter } from './types';
1414
import { InfoRow } from './components';
1515
import { checkAndFormatAddress } from './utils';
16+
import { ShelterCategory } from '@/hooks/useShelter/types';
17+
import { Fragment } from 'react/jsx-runtime';
1618

1719
const CardAboutShelter = (props: ICardAboutShelter) => {
1820
const { shelter } = props;
@@ -33,42 +35,46 @@ const CardAboutShelter = (props: ICardAboutShelter) => {
3335
{Boolean(shelter.zipCode) && (
3436
<InfoRow icon={<MapPinned />} label="CEP:" value={shelter.zipCode} />
3537
)}
36-
<InfoRow
37-
icon={<PawPrint />}
38-
label={
39-
check(shelter.petFriendly) ? (
40-
shelter.petFriendly ? (
41-
<p>
42-
O abrigo <b>aceita</b> animais
43-
</p>
44-
) : (
45-
<p>
46-
O abrigo <b>não</b> aceita animais
47-
</p>
48-
)
49-
) : (
50-
<b>Não informado se aceita animais</b>
51-
)
52-
}
53-
/>
54-
<InfoRow
55-
icon={<HandHeart />}
56-
label="Pessoas abrigadas:"
57-
value={
58-
check(shelter.shelteredPeople)
59-
? `${shelter.shelteredPeople} pessoas`
60-
: 'Não informado'
61-
}
62-
/>
63-
<InfoRow
64-
icon={<UsersRound />}
65-
label="Capacidade do abrigo:"
66-
value={
67-
check(shelter.capacity)
68-
? `${shelter.capacity} pessoas`
69-
: 'Não informado'
70-
}
71-
/>
38+
{shelter.category === ShelterCategory.Shelter && (
39+
<Fragment>
40+
<InfoRow
41+
icon={<PawPrint />}
42+
label={
43+
check(shelter.petFriendly) ? (
44+
shelter.petFriendly ? (
45+
<p>
46+
O abrigo <b>aceita</b> animais
47+
</p>
48+
) : (
49+
<p>
50+
O abrigo <b>não</b> aceita animais
51+
</p>
52+
)
53+
) : (
54+
<b>Não informado se aceita animais</b>
55+
)
56+
}
57+
/>
58+
<InfoRow
59+
icon={<HandHeart />}
60+
label="Pessoas abrigadas:"
61+
value={
62+
check(shelter.shelteredPeople)
63+
? `${shelter.shelteredPeople} pessoas`
64+
: 'Não informado'
65+
}
66+
/>
67+
<InfoRow
68+
icon={<UsersRound />}
69+
label="Capacidade do abrigo:"
70+
value={
71+
check(shelter.capacity)
72+
? `${shelter.capacity} pessoas`
73+
: 'Não informado'
74+
}
75+
/>
76+
</Fragment>
77+
)}
7278
<InfoRow
7379
icon={<Smartphone />}
7480
label="Contato:"

src/hooks/useShelter/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
export enum ShelterCategory {
2+
Shelter = 'Shelter',
3+
DistributionCenter = 'DistributionCenter',
4+
}
5+
16
export interface IUseShelterData {
27
id: string;
38
name: string;
@@ -17,6 +22,8 @@ export interface IUseShelterData {
1722
latitude?: string | null;
1823
longitude?: string | null;
1924
shelterSupplies: IUseShelterDataSupply[];
25+
category: ShelterCategory;
26+
actived: boolean;
2027
createdAt: string;
2128
updatedAt?: string | null;
2229
}

0 commit comments

Comments
 (0)