Skip to content

Commit

Permalink
Release/0.0.3 (#187)
Browse files Browse the repository at this point in the history
* [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

---------

Co-authored-by: helenapaixao <[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]>
  • Loading branch information
1 parent fbcb711 commit 0d9053f
Show file tree
Hide file tree
Showing 86 changed files with 2,205 additions and 216 deletions.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Um modelo exemplo para você relatar algum defeito que tenha encontrado no site.
title: "[BUG] Título do problema"
labels: bug
assignees: ''

---
# Descrição
Aqui você escreve sobre o que é o defeito.

# Problema encontrado
Aqui você dá detalhes sobre o problema, incluíndo os passos para reproduzir, se necessário.

# Prioridade
Registre apenas a prioridade ou seriedade do defeito. Um guia:
- Crítico: site fora do ar, erros fatas que impedem utilização por completo, página em branco
- Grave: site online, mas com defeito sério que impedem o uso de forma considerável
- Média: defeito não tão sério, mas que dificulta o uso da aplicação de modo geral
- Baixa: coisas poucas, sistema pode ser usado. Problemas de grafia são incluídos aqui

# Solução proposta
Como deveria ser o comportamento sem o defeito?

# Ambiente
Aqui você escreve o tipo de dispositivo (Modelo do celular ou sistema operacional do computador) e o navegador que utilizou para o teste.

# Evidência
Adicione o que for possível, como captura de tela ou vídeo evidenciando o problema.
11 changes: 1 addition & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,29 @@
"formik": "^2.4.6",
"lucide-react": "^0.378.0",
"qs": "^6.12.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.51.4",
"react-input-mask": "^2.0.4",
"react-router-dom": "^6.23.0",
"react-select": "^5.8.0",
"react": "^18.2.0",
"tailwind-merge": "^2.3.0",
"tailwindcss-animate": "^1.0.7",
"yup": "^1.4.0",
"zod": "^3.23.6"
"yup": "^1.4.0"
},
"devDependencies": {
"@types/node": "^20.12.8",
"@types/qs": "^6.9.15",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@types/react-input-mask": "^3.0.5",
"@types/react": "^18.2.66",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.19",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"eslint": "^8.57.0",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3",
"typescript": "^5.2.2",
Expand Down
17 changes: 4 additions & 13 deletions src/components/Authenticated/Authenticated.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import { Fragment, useContext } from 'react';
import { Fragment } from 'react';

import { SessionContext } from '@/contexts';
import { IAuthenticatedProps } from './types';
import { AccessLevel } from '@/service/sessions/types';

const MappedRoles: Record<AccessLevel, AccessLevel[]> = {
Admin: ['Admin'],
DistributionCenter: ['Admin', 'DistributionCenter'],
Staff: ['Admin', 'Staff'],
User: ['Admin', 'Staff', 'DistributionCenter', 'User'],
};
import { useAuthRoles } from '@/hooks';

const Authenticated = ({ children, role = 'User' }: IAuthenticatedProps) => {
const { session } = useContext(SessionContext);
const isAuthenticated = useAuthRoles(role);

if (!session || !MappedRoles[role].includes(session.accessLevel))
return <Fragment />;
if (!isAuthenticated) return <Fragment />;

return <div className="contents">{children}</div>;
};
Expand Down
98 changes: 98 additions & 0 deletions src/components/BurgerMenu/BurgerMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import { Fragment, useCallback, useContext } from 'react';
import {
CircleHelp,
CirclePlus,
DoorOpen,
Info,
LinkIcon,
Menu,
} from 'lucide-react';

import { SessionServices } from '@/service';
import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet';
import { BurguerMenuItem } from './components';
import { Separator } from '../ui/separator';
import { SessionContext } from '@/contexts';
import { usePartners } from '@/hooks';

const BurgerMenu = () => {
const { session } = useContext(SessionContext);
const { data: partners } = usePartners();

const logout = useCallback(() => {
SessionServices.logout()
.then(() => {
localStorage.removeItem('token');
window.location.href = '/';
})
.catch((err) => {
console.log(`Erro ao realizar logout: ${err}`);
});
}, []);

return (
<Sheet>
<SheetTrigger>
<Menu color="white" className="ml-2 mr-2" />
</SheetTrigger>
<SheetContent side="left" className="pt-[96px] flex flex-col">
<div className="flex flex-col gap-4">
{session && (
<Fragment>
<div className="inline-flex items-center text-semibold">
Olá, {session.name}
</div>
<Separator />
</Fragment>
)}
<BurguerMenuItem
label="Sobre nós"
link="/sobre-nos"
icon={<Info className="w-4 h-4" />}
/>
<BurguerMenuItem
label="Cadastrar abrigo"
link="https://forms.gle/2S7L2gR529Dc8P3T9"
icon={<CirclePlus className="w-4 h-4" />}
/>
<BurguerMenuItem
label="Como Ajudar"
link="https://www.instagram.com/reel/C613CfGuh4b"
icon={<CircleHelp className="w-4 h-4" />}
/>
<BurguerMenuItem
label="Política de Privacidade"
link="/politica-de-privacidade"
icon={<Info className="w-4 h-4" />}
/>
<Separator />
{partners.length > 0 && (
<Fragment>
<span>Parcerias</span>
{partners.map((partner, idx) => (
<BurguerMenuItem
key={idx}
label={partner.name}
link={partner.link}
icon={<LinkIcon className="w-4 h-4" />}
/>
))}
</Fragment>
)}
</div>
{session && (
<div className="mt-auto">
<span
className="inline-flex items-center hover:font-semibold cursor-pointer"
onClick={logout}
>
<DoorOpen className="mr-2" /> Sair
</span>
</div>
)}
</SheetContent>
</Sheet>
);
};

export { BurgerMenu };
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';

import { IBurguerMenuItemProps } from './types';
import { cn } from '@/lib/utils';

const BurguerMenuItem = React.forwardRef<
HTMLAnchorElement,
IBurguerMenuItemProps
>((props, ref) => {
const { icon, label, onClick, link, className = '', ...rest } = props;

return (
<a
ref={ref}
href={link}
target="_blank"
className={cn(
'hover:font-semibold flex gap-2 items-center text-zinc-600 [&_svg]:stroke-zinc-500',
className
)}
onClick={onClick}
{...rest}
>
{icon}
{label}
</a>
);
});

export { BurguerMenuItem };
3 changes: 3 additions & 0 deletions src/components/BurgerMenu/components/BurguerMenuItem/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { BurguerMenuItem } from './BurguerMenuItem';

export { BurguerMenuItem };
7 changes: 7 additions & 0 deletions src/components/BurgerMenu/components/BurguerMenuItem/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export interface IBurguerMenuItemProps
extends React.ComponentPropsWithoutRef<'a'> {
label: string;
icon?: React.ReactNode;
link?: string;
onClick?: () => void;
}
3 changes: 3 additions & 0 deletions src/components/BurgerMenu/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { BurguerMenuItem } from './BurguerMenuItem';

export { BurguerMenuItem };
3 changes: 3 additions & 0 deletions src/components/BurgerMenu/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { BurgerMenu } from "./BurgerMenu";

export { BurgerMenu };
12 changes: 11 additions & 1 deletion src/components/CardAboutShelter/CardAboutShelter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,34 @@ import {
PawPrint,
Landmark,
Smartphone,
Building,
MapPinned,
} from 'lucide-react';

import { Card } from '../ui/card';
import { ICardAboutShelter } from './types';
import { InfoRow } from './components';
import { checkAndFormatAddress } from './utils';

const CardAboutShelter = (props: ICardAboutShelter) => {
const { shelter } = props;

const check = (v?: string | number | boolean | null) => {
return v !== undefined && v !== null;
};
const formatAddress = checkAndFormatAddress(shelter, false);

return (
<Card className="flex flex-col gap-2 p-4 bg-[#E8F0F8] text-sm">
<div className="text-[#646870] font-medium">Sobre o abrigo</div>
<div className="flex flex-col flex-wrap gap-3">
<InfoRow icon={<Home />} label={shelter.address} />
<InfoRow icon={<Home />} label={formatAddress} />
{Boolean(shelter.city) && (
<InfoRow icon={<Building />} label="Cidade:" value={shelter.city} />
)}
{Boolean(shelter.zipCode) && (
<InfoRow icon={<MapPinned />} label="CEP:" value={shelter.zipCode} />
)}
<InfoRow
icon={<PawPrint />}
label={
Expand Down
14 changes: 11 additions & 3 deletions src/components/CardAboutShelter/components/InfoRow/InfoRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@ import { IInfoRowProps } from './types';

const InfoRow = React.forwardRef<HTMLDivElement, IInfoRowProps>(
(props, ref) => {
const { icon, label, value, clipboardButton = false, className = '', ...rest } = props;
const {
icon,
label,
value,
clipboardButton = false,
className = '',
...rest
} = props;
const isLink = value?.startsWith('http');
const ValueComp = !value ? (
<Fragment />
) : isLink ? (
<a href={value} target='_blank'
<a
href={value}
target="_blank"
className="text-blue-500 break-all cursor-pointer hover:underline"
>
{value}
Expand Down Expand Up @@ -46,7 +55,6 @@ const InfoRow = React.forwardRef<HTMLDivElement, IInfoRowProps>(
</div>
)}
</span>

</div>
</div>
);
Expand Down
5 changes: 3 additions & 2 deletions src/components/CardAboutShelter/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CardAboutShelter } from "./CardAboutShelter";
import { CardAboutShelter } from './CardAboutShelter';
import { checkAndFormatAddress } from './utils';

export { CardAboutShelter };
export { CardAboutShelter, checkAndFormatAddress };
28 changes: 28 additions & 0 deletions src/components/CardAboutShelter/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { IUseShelterData } from '@/hooks/useShelter/types';

const formatShelterAddressFields = (
payload: Partial<
Pick<IUseShelterData, 'street' | 'streetNumber' | 'neighbourhood'>
>
): string => {
const { street, streetNumber, neighbourhood } = payload;
return [street, streetNumber, neighbourhood].filter(Boolean).join(', ');
};

const checkAndFormatAddress = (
payload: Partial<
Pick<
IUseShelterData,
'address' | 'city' | 'street' | 'streetNumber' | 'neighbourhood'
>
>,
showCity = true
): string => {
const { address, city, ...rest } = payload;
return (
address ??
`${formatShelterAddressFields(rest)}${showCity ? ` - ${city}` : ''}`
);
};

export { checkAndFormatAddress };
6 changes: 3 additions & 3 deletions src/components/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { cva } from 'class-variance-authority';
const Chip = React.forwardRef<HTMLDivElement, IChipProps>((props, ref) => {
const { label, className, variant = 'info', ...rest } = props;

const variants = cva('px-4 py-1 font-normal text-sm md:text-md rounded-3xl', {
const variants = cva('px-4 py-1.5 font-medium text-sm md:text-md rounded-2xl', {
variants: {
variant: {
warn: 'bg-light-yellow',
Expand All @@ -21,9 +21,9 @@ const Chip = React.forwardRef<HTMLDivElement, IChipProps>((props, ref) => {
});

return (
<div ref={ref} {...rest} className={variants({ className, variant })}>
<span tabIndex={0} ref={ref} {...rest} className={variants({ className, variant })}>
{label}
</div>
</span>
);
});

Expand Down
1 change: 1 addition & 0 deletions src/components/Chip/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export type ChipVariant = 'info' | 'success' | 'warn' | 'danger';
export interface IChipProps extends React.ComponentPropsWithoutRef<'div'> {
label: string;
variant?: ChipVariant;
quantity?: number;
}
Loading

0 comments on commit 0d9053f

Please sign in to comment.