Skip to content

Commit c7f37dd

Browse files
rhuamhelenapaixaofagundesjgluccas-spechtMatheusDubin
authored
Staging (#251)
* [fix] Config readme * wip: loading * Delete yarn.lock * refact: created shelter list view component in home page * Fix: mobile UI has broken for mobile devices (#22) *Fix: mobile UI has broken for mobile devices * fix: remove chip as fixed as no wrap property * chore: add shelter card clickable * chore: remove Fragment component * build: add set sm as max mobile dimension sm: 425px * style: add responsive layout * refactor: filter page * fix: priority * fix: filter parameters * fix: fixed volunteer supply that had been fulfilled displaying on shelter page * fix: improve readability * feat: hidden filter button if filter is empty * feat: cache in axios request * fix: cache search params * feat: cache clean on searchs * wip: donation tags * fix: clean search params * Update README.md [fix] Retirando a seção Funcionalidades e Backlog * fix: donation tags / componentized the urgent supplies section * fix: removed empty shelter tags empty row * feat: full edit shelter and improved interface of pet friendly in shelter page * refact: add live link and tech stack to readme * Fix/develop bugs (#90) * fix: cache bug (invalite cache on create/update operation) * feat: added update many shelter supplies and admin rule * Add license (#81) Closes #65. * fix: app port (#80) * docs: added shadcn/ui reference * fix for volunteer shelter title (#95) * treat contact link as a proper link * simplified href * docs: add discord link on readme * Normalizes search string in supply filter so it ignores accents (#125) * normalized search string to ignore accents * revert removed button * add a copy to clipboard button to PIX and contact info (#124) * add a copy to clipboard button to PIX and contact info * use && operator instead of ternary * Substitui onClick e useNavigate por <Link> para melhorar acessibilidade (#128) * replaced navigate in favour of html link and added card hover * fixed lint warnings * fix: change shelter title style (#106) Prevents badge misalignment on very large titles * Add new feature and creating LoadingSkeleton (#115) * Add new feature and creating LoadingSkeleton * fix/add: add favicon and canonical metatag (#136) * fix/add: add favicon and canonical metatag * fix: fixed the path * refactor: changed order of shelters to updated at instead priority sum (#137) * Remove zod dependency (#143) * replaced zod validation with yup * removed zod dependency from package.json * sort dependencies * fixed validation schema variable name * removed .shape() and added .strict() * deleted unused file * Added burger menu to home page (#149) * Implemented Burger menu * commented unused components * feat: Update BurgerMenu to display user's name when logged in * removed comments * implemented login and logout button * Feat/partners (#155) * fix: menu bar with api partners * fix: menu bar with api partners * fix: remove unused session in burguer menu / removed import all icons from lucide and use link icon instead custom icons * [BUG] Botão de Limpar Filtro sumindo após remover input de busca (#147) * fix: clean filter button disappearing after removing search input manually * fix: removing log * Modificação nas telas de abrigos para adicionar cidades (#110) * feat: filter shlters by cities * feat: city on shelter forms, info and list * feat: shelter city quantities on filter * fix: wrong conditional * fix: bug that removing city filter on home doesnt affect the filter * feat: new address fields on shelter forms * feat: useDebouncedValue, useViaCep * feat: adapt useFetch for conditional paths and different response * feat: address fields required and zipCode triggering viaCep * feat: address fields required on update shelter * feat: address fields on shelter details when theres no address field * fix: suggestions(shorthand, optional chaining, separated zipCode, formatted city on list) * feat: sticky footer on filter dialog * fix: reset errors on zipcode search; copy filter change * fix: timeoutId not assigned value; InfoRow copy can copy undefined * Campo de quantidade adicionado quando adicionar suprimento a um abrigo (#46) * feat(shelter-supply): input to add quantity supply * feat(shelter-supply): show quantity supply at Shelter page and EditShelter page * resolve conflict --------- Co-authored-by: Lipe <[email protected]> * feat: google analytics * feat: edit shelter supply item quantity (#170) * fix: send address field formatted (#171) * feat: add a template to log bugs/defects (#168) * feat: add a template to log bugs/defects * Feat/privacy terms about us (#169) * feat: privacy policy page * feat: done about us page * fix: removed redundant value check in info row component * fix: ordering the list of items on the shelter edit page (#166) * feat: Melhoria no esquema de cores dos chip's e ajuste de acessibilidade (#162) * feat: new text colors with adjusted light var colors * feat: change chip element tag to span and improve a11y * feat: added update date information to shelter page (#159) * Adding update date to shelter page * (Aditional) Informing when no update date for shelter in main page * feat: ajuste de textos de voluntários e doações (#129) * hotfix: shelter list item broken div tag * Feat/back navigation to home (#177) * feat: added back navigation to home when click in header label * Hotfix/merge bugs (#183) * fix: shelter list item duplicate code after merge * fix: order in filter select menu, filter supplies by category and useSupplies interface * fix: update shelter validation schema and created useAuthRoles hook to reduce complexity of code * fix: conflicts with master branch * feat: dev and staging gh actions * wip * feat: done supporters page * feat: added shelter category (#250) Co-authored-by: José Fagundes <[email protected]> --------- Co-authored-by: helenapaixao <[email protected]> Co-authored-by: José Fagundes <[email protected]> Co-authored-by: Luccas Specht <[email protected]> Co-authored-by: MatheusDubin <[email protected]> Co-authored-by: danmqs <[email protected]> Co-authored-by: Giovanni Bassi <[email protected]> Co-authored-by: Felipe Monteiro <[email protected]> Co-authored-by: André Ferraz <[email protected]> Co-authored-by: Sombrio <[email protected]> Co-authored-by: Filipe Pacheco de Fraga <[email protected]> Co-authored-by: Daniel Marques <[email protected]> Co-authored-by: Matheus Dubin Da Silveira <[email protected]> Co-authored-by: Miguel Dalberto <[email protected]> Co-authored-by: Pablo A. Maximo <[email protected]> Co-authored-by: Marcos Nascimento <[email protected]> Co-authored-by: Gilmar José <[email protected]> Co-authored-by: Kelvin <[email protected]> Co-authored-by: Jhonatan David <[email protected]> Co-authored-by: Alexander Scheibler <[email protected]> Co-authored-by: Giovani Andrino Carnaval <[email protected]> Co-authored-by: Thiago Oliveira <[email protected]> Co-authored-by: Henrique Uhlmann Gobbi <[email protected]> Co-authored-by: Janderson Soares <[email protected]>
1 parent 8854303 commit c7f37dd

File tree

14 files changed

+206
-104
lines changed

14 files changed

+206
-104
lines changed

src/components/Authenticated/Authenticated.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ import { Fragment } from 'react';
33
import { IAuthenticatedProps } from './types';
44
import { useAuthRoles } from '@/hooks';
55

6-
const Authenticated = ({ children, role = 'User' }: IAuthenticatedProps) => {
6+
const Authenticated = ({
7+
children,
8+
bypass = false,
9+
role = 'User',
10+
}: IAuthenticatedProps) => {
711
const isAuthenticated = useAuthRoles(role);
812

9-
if (!isAuthenticated) return <Fragment />;
13+
if (!bypass && !isAuthenticated) return <Fragment />;
1014

1115
return <div className="contents">{children}</div>;
1216
};

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: 18 additions & 4 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,22 +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" />}
77+
/>
78+
<BurguerMenuItem
79+
label="Apoiadores"
80+
link="/apoiadores"
81+
icon={<HeartHandshake className="w-5 h-5" />}
6882
/>
6983
<BurguerMenuItem
7084
label="Apoiadores"

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/components/CardAboutShelter/components/InfoRow/InfoRow.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const InfoRow = React.forwardRef<HTMLDivElement, IInfoRowProps>(
1818
) : isLink ? (
1919
<a
2020
href={value}
21-
target="_blank"
2221
className="text-blue-500 break-all cursor-pointer hover:underline"
2322
>
2423
{value}

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
}

src/hooks/useShelters/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ShelterTagType } from '@/pages/Home/components/ShelterListItem/types';
2+
import { ShelterCategory } from '../useShelter/types';
23

34
export interface IUseSheltersData {
45
id: string;
@@ -18,6 +19,8 @@ export interface IUseSheltersData {
1819
verified: boolean;
1920
latitude?: string | null;
2021
longitude?: string | null;
22+
category: ShelterCategory;
23+
actived: boolean;
2124
createdAt: string;
2225
updatedAt?: string | null;
2326
shelterSupplies: IUseSheltersDataSupplyData[];

src/lib/utils.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ShelterCategory } from '@/hooks/useShelter/types';
12
import { IUseSheltersDataSupplyData } from '@/hooks/useShelters/types';
23
import {
34
ShelterTagInfo,
@@ -41,11 +42,18 @@ function nameStatusPriority(priority: SupplyPriority) {
4142
if (priority === SupplyPriority.Remaining) return 'Disponível para doação';
4243
}
4344

44-
function getAvailabilityProps(
45-
capacity?: number | null,
46-
shelteredPeople?: number | null
47-
) {
48-
if (capacity && (shelteredPeople || shelteredPeople === 0)) {
45+
function getAvailabilityProps(props: {
46+
capacity?: number | null;
47+
shelteredPeople?: number | null;
48+
category: ShelterCategory;
49+
}) {
50+
const { category, capacity, shelteredPeople } = props;
51+
if (category === ShelterCategory.DistributionCenter) {
52+
return {
53+
availability: 'Centro de Distribuição',
54+
className: 'text-green-600',
55+
};
56+
} else if (capacity && (shelteredPeople || shelteredPeople === 0)) {
4957
if (shelteredPeople < capacity)
5058
return {
5159
availability: 'Abrigo disponível',

src/pages/Home/components/Filter/Filter.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,14 @@ const Filter = (props: IFilterProps) => {
149149

150150
return (
151151
<Dialog open={open} onOpenChange={onClose}>
152-
<DialogContent className="rounded-md overflow-y-scroll max-h-[90vh]">
152+
<DialogContent className="rounded-md overflow-y-scroll max-h-[85vh] mt-8">
153153
<DialogHeader>
154154
<DialogTitle className="text-base font-medium">
155155
Faça sua busca:
156156
</DialogTitle>
157157
</DialogHeader>
158158
<form onSubmit={handleSubmit}>
159-
<div className="pl-4 pr-4 pb-4 flex flex-col max-w-5xl w-full items-start h-full">
159+
<div className="pl-4 pr-4 pb-4 flex flex-col max-w-5xl w-full items-start">
160160
<div className="flex flex-col gap-2 w-full my-4">
161161
<SearchInput
162162
value={values.search}

src/pages/Home/components/ShelterListItem/ShelterListItem.tsx

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,36 @@ import { VerifiedBadge } from '@/components/VerifiedBadge/VerifiedBadge.tsx';
1919
import { IUseSheltersDataSupplyData } from '@/hooks/useShelters/types';
2020
import { ShelterSupplyCategoryRow } from '../ShelterSupplyCategoryRow';
2121

22+
const Wrapper = ({
23+
children,
24+
active,
25+
link,
26+
}: {
27+
children: React.ReactNode;
28+
link: string;
29+
active: boolean;
30+
}) => {
31+
if (active) return <Link to={link}>{children}</Link>;
32+
else
33+
return (
34+
<div className="[&>div]:hover:bg-white [&_*]:text-muted-foreground [&>div]:blur-[1px]">
35+
{children}
36+
</div>
37+
);
38+
};
39+
2240
const ShelterListItem = (props: IShelterListItemProps) => {
2341
const { data } = props;
2442
const { capacity, shelteredPeople } = data;
2543
const { availability, className: availabilityClassName } =
2644
useMemo<IShelterAvailabilityProps>(
27-
() => getAvailabilityProps(capacity, shelteredPeople),
28-
[capacity, shelteredPeople]
45+
() =>
46+
getAvailabilityProps({
47+
capacity,
48+
shelteredPeople,
49+
category: data.category,
50+
}),
51+
[capacity, shelteredPeople, data.category]
2952
);
3053

3154
const tags: ShelterTagInfo<IUseSheltersDataSupplyData[]> = useMemo(() => {
@@ -45,7 +68,7 @@ const ShelterListItem = (props: IShelterListItemProps) => {
4568
: '(sem informação)';
4669

4770
return (
48-
<Link to={`/abrigo/${data.id}`} target="_blank">
71+
<Wrapper link={`/abrigo/${data.id}`} active={data.actived}>
4972
<div className="flex flex-col p-4 w-full border-2 border-border rounded-md gap-1 relative hover:bg-accent">
5073
<div className="inline-flex justify-between">
5174
<div className="flex flex-row items-center gap-1">
@@ -58,9 +81,11 @@ const ShelterListItem = (props: IShelterListItemProps) => {
5881
</div>
5982
)}
6083
</div>
61-
<Button size="sm" variant="ghost">
62-
<ChevronRight className="h-5 w-5" />
63-
</Button>
84+
{data.actived && (
85+
<Button size="sm" variant="ghost">
86+
<ChevronRight className="h-5 w-5" />
87+
</Button>
88+
)}
6489
</div>
6590
<h6 className={cn('font-semibold text-md', availabilityClassName)}>
6691
{availability}
@@ -88,7 +113,7 @@ const ShelterListItem = (props: IShelterListItemProps) => {
88113
Atualizado em {updatedAtDate}
89114
</small>
90115
</div>
91-
</Link>
116+
</Wrapper>
92117
);
93118
};
94119

0 commit comments

Comments
 (0)