Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Padronização de código a cada commit #351

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
---
name: Bug report
about: Um modelo exemplo para você relatar algum defeito que tenha encontrado no site.
title: "[BUG] Título do problema"
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
- 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.

Adicione o que for possível, como captura de tela ou vídeo evidenciando o problema.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ dist-ssr
*.sln
*.sw?

.env
.env

bun.lockb
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"!(*.ts)": "prettier --write",
"*.ts": ["eslint . --fix", "prettier --write"]
}
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
.husky
.github
bun.lockb
.prettierignore
.gitignore
9 changes: 8 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"singleQuote": true
"arrowParens": "always",
"printWidth": 80,
"singleQuote": true,
"jsxSingleQuote": false,
"semi": true,
"trailingComma": "all",
"tabWidth": 2,
"plugins": ["prettier-plugin-tailwindcss"]
}
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ de forma desnecessária.
5. Faça um push para o seu repositório com `git push`.
6. [Sincronize seu repositório](#-sincronizando).
7. [Abra um pull request](https://docs.github.com/pt/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
Não deixe de informar, no seu pull request, qual a issue que está fechando.
Idealmente coloque um comentário no PR que já fechará a issue, como
`fixes #xxxx` ou `closes #xxxx` (onde `xxxx` é o número do issue). Veja
[como isso funciona](https://docs.github.com/pt/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests).
Não deixe de informar, no seu pull request, qual a issue que está fechando.
Idealmente coloque um comentário no PR que já fechará a issue, como
`fixes #xxxx` ou `closes #xxxx` (onde `xxxx` é o número do issue). Veja
[como isso funciona](https://docs.github.com/pt/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests).
8. Acompanhe a revisão do PR. Algumas verificações automáticas serão feitas (o
Github Actions rodará o build do Vite, por exemplo). Se uma delas falhar, corrija-a, a
revisão humana só começa quando estas checagem estão passando. Após abrir o
Expand Down
Binary file added bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion components.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"components": "@/components",
"utils": "@/lib/utils"
}
}
}
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="pt-br">
<head>
<script
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint-staged": "lint-staged . && tsc --noEmit",
"preview": "vite preview"
},
"dependencies": {
Expand Down Expand Up @@ -55,8 +56,12 @@
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"husky": "^9.0.11",
"javascript-obfuscator": "^4.1.0",
"lint-staged": "^15.2.7",
"postcss": "^8.4.38",
"prettier": "^3.3.2",
"prettier-plugin-tailwindcss": "^0.6.4",
"tailwindcss": "^3.4.3",
"typescript": "^5.2.2",
"vite": "^5.2.0"
Expand Down
2 changes: 1 addition & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export default {
tailwindcss: {},
autoprefixer: {},
},
}
};
20 changes: 19 additions & 1 deletion public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
{
"name": "",
"short_name": "",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
2 changes: 1 addition & 1 deletion src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ api.interceptors.response.use(
localStorage.removeItem('token');
}
return Promise.reject(error);
}
},
);

export { api };
6 changes: 3 additions & 3 deletions src/api/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function log(...args: any[]) {

function checkCacheHasExpired(
timestamp: number,
ttl: number = defaultTtl
ttl: number = defaultTtl,
): boolean {
return new Date().getTime() - timestamp >= ttl;
}
Expand All @@ -20,7 +20,7 @@ function clearCache(onlyExpired: boolean = true) {
log(
onlyExpired
? 'cache - checando caches expirados...'
: 'cache - limpando cache...'
: 'cache - limpando cache...',
);
Object.keys(localStorage)
.filter((key: string) => key.startsWith('cache:'))
Expand Down Expand Up @@ -73,7 +73,7 @@ function handleCacheResponse(resp: AxiosResponse<any, any>) {
JSON.stringify({
data: { data, headers, status, statusText },
timestamp: new Date().getTime(),
})
}),
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/hmac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function getHmacHeaders(props: Partial<IHmacProps>) {

const signature = CryptoJS.HmacSHA256(
payload,
import.meta.env.VITE_HMAC_SECRET_KEY
import.meta.env.VITE_HMAC_SECRET_KEY,
).toString(CryptoJS.enc.Hex);

return {
Expand Down
2 changes: 1 addition & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { api } from "./api";
import { api } from './api';

export { api };
2 changes: 1 addition & 1 deletion src/components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const Alert = (props: IAlert) => {
const { description, startAdornment } = props;

return (
<Card className="p-3 flex gap-3 border-zinc-200 border-[1px] rounded-md select-none w-full items-center text-justify">
<Card className="flex w-full select-none items-center gap-3 rounded-md border-[1px] border-zinc-200 p-3 text-justify">
<div>{startAdornment}</div>
<span className="text-sm text-zinc-600">{description}</span>
</Card>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Alert/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { Alert } from "./Alert";
import { Alert } from './Alert';

export { Alert };
5 changes: 1 addition & 4 deletions src/components/BackToTop/BackToTop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ const BackToTop = () => {
return (
isVisible && (
<button
className=" fixed ease-in-out hidden sm:flex justify-center items-center duration-300
bg-red-600/75 focus:bg-red-700 hover:bg-red-700 z-[100] shadow-slate-600/75
right-6 bottom-6 rounded-full shadow-md
w-12 h-12 "
className="fixed bottom-6 right-6 z-[100] hidden h-12 w-12 items-center justify-center rounded-full bg-red-600/75 shadow-md shadow-slate-600/75 duration-300 ease-in-out hover:bg-red-700 focus:bg-red-700 sm:flex"
onClick={scrollToTop}
>
<ArrowUp color="white" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/BackToTop/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { BackToTop } from "./BackToTop";
import { BackToTop } from './BackToTop';

export { BackToTop };
26 changes: 13 additions & 13 deletions src/components/BurgerMenu/BurgerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const BurgerMenu = () => {
<SheetTrigger>
<Menu color="white" className="ml-2 mr-2" />
</SheetTrigger>
<SheetContent side="left" className="pt-[96px] flex flex-col z-[90]">
<DialogFooter className="absolute top-16 right-4">
<SheetContent side="left" className="z-[90] flex flex-col pt-[96px]">
<DialogFooter className="absolute right-4 top-16">
<DialogClose asChild>
<Button type="button" variant="ghost">
<X className="stroke-muted-foreground" />
Expand All @@ -52,7 +52,7 @@ const BurgerMenu = () => {
<div className="flex flex-col gap-4">
{session && (
<Fragment>
<div className="inline-flex items-center text-semibold">
<div className="text-semibold inline-flex items-center">
Olá, {session.name}
</div>
<Separator />
Expand All @@ -61,46 +61,46 @@ const BurgerMenu = () => {
<BurguerMenuItem
label="Sobre nós"
link="/sobre-nos"
icon={<Info className="w-5 h-5" />}
icon={<Info className="h-5 w-5" />}
/>
<BurguerMenuItem
label="Minhas Doações"
link="/doacoes"
icon={<HeartHandshake className="w-5 h-5" />}
icon={<HeartHandshake className="h-5 w-5" />}
className={clsx({ hidden: !session })}
/>
<BurguerMenuItem
label="Cadastrar abrigo"
link="https://forms.gle/2S7L2gR529Dc8P3T9"
icon={<CirclePlus className="w-5 h-5" />}
icon={<CirclePlus className="h-5 w-5" />}
openExternal={true}
/>
<BurguerMenuItem
label="Canal de Denúncias"
link="https://contatoseguro.com.br/sos_rs"
icon={<ShieldAlert className="w-5 h-5" />}
icon={<ShieldAlert className="h-5 w-5" />}
openExternal={true}
/>
<BurguerMenuItem
label="Como Ajudar"
link="https://www.instagram.com/reel/C613CfGuh4b"
icon={<CircleHelp className="w-5 h-5" />}
icon={<CircleHelp className="h-5 w-5" />}
openExternal={true}
/>
<BurguerMenuItem
label="Política de Privacidade"
link="/politica-de-privacidade"
icon={<Info className="w-5 h-5" />}
icon={<Info className="h-5 w-5" />}
/>
<BurguerMenuItem
label="Apoiadores"
link="/apoiadores"
icon={<HeartHandshake className="w-5 h-5" />}
icon={<HeartHandshake className="h-5 w-5" />}
/>
<BurguerMenuItem
label="Visão Geral"
link="/dashboard"
icon={<Info className="w-4 h-4" />}
icon={<Info className="h-4 w-4" />}
/>
<Separator />
{partners.length > 0 && (
Expand All @@ -111,7 +111,7 @@ const BurgerMenu = () => {
key={idx}
label={partner.name}
link={partner.link}
icon={<LinkIcon className="w-4 h-4" />}
icon={<LinkIcon className="h-4 w-4" />}
/>
))}
</Fragment>
Expand All @@ -120,7 +120,7 @@ const BurgerMenu = () => {
{session && (
<div className="mt-auto">
<span
className="inline-flex items-center hover:font-semibold cursor-pointer"
className="inline-flex cursor-pointer items-center hover:font-semibold"
onClick={logout}
>
<DoorOpen className="mr-2" /> Sair
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ const BurguerMenuItem = React.forwardRef<
ref={ref}
href={link}
className={cn(
'hover:font-semibold flex gap-2 items-center text-zinc-600 [&_svg]:stroke-zinc-500',
className
'flex items-center gap-2 text-zinc-600 hover:font-semibold [&_svg]:stroke-zinc-500',
className,
)}
onClick={onClick}
{...rest}
target={openExternal ? '_blank' : undefined}
>
{icon}
{label}
{openExternal && <ExternalLink className="w-3 h-3" />}
{openExternal && <ExternalLink className="h-3 w-3" />}
</a>
);
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/BurgerMenu/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { BurgerMenu } from "./BurgerMenu";
import { BurgerMenu } from './BurgerMenu';

export { BurgerMenu };
Loading