Skip to content

Commit

Permalink
Merge branch 'feat/improve-address-input-sort' of github.com:emiliosh…
Browse files Browse the repository at this point in the history
…einz/sos-pet into feat/restore-missing-code
  • Loading branch information
emiliosheinz committed May 15, 2024
2 parents 30da8ce + b05796a commit 6662401
Show file tree
Hide file tree
Showing 5 changed files with 949 additions and 828 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/lint-type-check-and-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 🚀 Lint, Type Check, and Build

on:
pull_request:
branches:
- main
- develop

jobs:
lint-type-check-and-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"

- name: Setup .env file
run: echo "${{ secrets.DOT_ENV_FILE_CONTENT }}" > .env

- name: Install dependencies
run: yarn

- name: Lint
run: yarn lint

- name: Type check
run: yarn type-check

- name: Build
run: yarn build
114 changes: 114 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"branches": [
"main"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalCommits",
"releaseRules": [
{
"type": "revert",
"release": "patch"
},
{
"type": "docs",
"release": "patch"
},
{
"type": "style",
"release": "patch"
},
{
"type": "chore",
"release": "patch"
},
{
"type": "refactor",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"type": "build",
"release": "patch"
},
{
"type": "ci",
"release": "patch"
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalCommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "New Features",
"hidden": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
},
{
"type": "perf",
"section": "Performance Improvements",
"hidden": false
},
{
"type": "revert",
"section": "Reverts",
"hidden": false
},
{
"type": "docs",
"section": "Documentation",
"hidden": false
},
{
"type": "style",
"section": "Styles",
"hidden": false
},
{
"type": "chore",
"section": "Miscellaneous Chores",
"hidden": false
},
{
"type": "refactor",
"section": "Code Refactors",
"hidden": false
},
{
"type": "test",
"section": "Tests",
"hidden": false
},
{
"type": "build",
"section": "Build System",
"hidden": false
},
{
"type": "ci",
"section": "CI/CD",
"hidden": false
}
]
}
}
],
"@semantic-release/npm",
"@semantic-release/github"
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"dev": "next dev",
"postinstall": "prisma generate",
"lint": "next lint",
"type-check": "tsc --noEmit",
"start": "next start",
"vercel-build": "prisma migrate deploy && yarn build"
},
Expand Down
161 changes: 85 additions & 76 deletions src/app/shelter/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,71 +223,106 @@ function Shelter() {
<CardContent>
<h2 className="my-4 text-xl">Endereço</h2>
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-5 lg:flex-row">
<div className="flex-none lg:w-32">
<FormField
control={form.control}
name="address.cep"
render={({ field, fieldState }) => (
<FormItem>
<FormLabel>CEP</FormLabel>
<FormControl>
<Input
placeholder="xxxxx-xxx"
{...field}
onChange={(e) => {
field.onChange(cepMask(e.target.value));
}}
onBlur={() => {
if (fieldState.invalid) return;
fetch(
`https://viacep.com.br/ws/${field.value}/json/`,
)
.then((response) => response.json())
.then(populateAddressWithViaCepData)
.catch((error) => {
console.log(error);
});
}}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</div>
<div className="lg:flex-1">
<FormField
control={form.control}
name="address.street"
render={({ field }) => (
<FormItem>
<FormLabel>Logradouro</FormLabel>
<FormControl>
<Input placeholder="Nome da rua" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</div>
</div>
<div className="grid gap-5 lg:grid-cols-2">
<FormField
control={form.control}
name="address.neighborhood"
render={({ field }) => (
<FormItem>
<FormLabel>Bairro</FormLabel>
<FormControl>
<Input placeholder="Bairro" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>

<FormField
control={form.control}
name="address.number"
render={({ field }) => (
<FormItem>
<FormLabel>Número</FormLabel>
<FormControl>
<Input placeholder="Número" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</div>
<FormField
control={form.control}
name="address.cep"
render={({ field, fieldState }) => (
<FormItem>
<FormLabel>CEP</FormLabel>
<FormControl>
<Input
placeholder="XXXXX-XXX"
{...field}
onChange={(e) => {
field.onChange(cepMask(e.target.value));
}}
onBlur={() => {
if (fieldState.invalid) return;
fetch(
`https://viacep.com.br/ws/${field.value}/json/`,
)
.then((response) => response.json())
.then(populateAddressWithViaCepData)
.catch((error) => {
console.log(error);
});
}}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="address.street"
render={({ field }) => (
<FormItem>
<FormLabel>Rua</FormLabel>
<FormControl>
<Input placeholder="Nome da rua" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="address.neighborhood"
name="address.complement"
render={({ field }) => (
<FormItem>
<FormLabel>Bairro</FormLabel>
<FormLabel>Complemento (opcional)</FormLabel>
<FormControl>
<Input placeholder="Bairro" {...field} />
<Input placeholder="Complemento" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<div className="grid grid-cols-2 gap-5">
<div className="grid gap-5 lg:grid-cols-2">
<FormField
control={form.control}
name="address.number"
name="address.city"
render={({ field }) => (
<FormItem>
<FormLabel>Número</FormLabel>
<FormLabel>Cidade</FormLabel>
<FormControl>
<Input placeholder="Número" {...field} />
<Input placeholder="Cidade" {...field} />
</FormControl>
<FormMessage />
</FormItem>
Expand Down Expand Up @@ -315,32 +350,6 @@ function Shelter() {
)}
/>
</div>
<FormField
control={form.control}
name="address.city"
render={({ field }) => (
<FormItem>
<FormLabel>Cidade</FormLabel>
<FormControl>
<Input placeholder="Cidade" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="address.complement"
render={({ field }) => (
<FormItem>
<FormLabel>Complemento (opcional)</FormLabel>
<FormControl>
<Input placeholder="Complemento" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</div>
</CardContent>
</CardBase>
Expand Down
Loading

0 comments on commit 6662401

Please sign in to comment.