-
Notifications
You must be signed in to change notification settings - Fork 296
Modificação nas telas de abrigos para adicionar cidades #110
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
Merged
filipepacheco
merged 17 commits into
SOS-RS:develop
from
kelvinsb:feat/filter-by-cities
May 15, 2024
Merged
Changes from 11 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7b868a9
feat: filter shlters by cities
kelvinsb 0572133
feat: city on shelter forms, info and list
kelvinsb 0e0544b
feat: shelter city quantities on filter
kelvinsb 0621830
fix: wrong conditional
kelvinsb 4160035
fix: bug that removing city filter on home doesnt affect the filter
kelvinsb 6a15743
feat: new address fields on shelter forms
kelvinsb 69e0c77
feat: useDebouncedValue, useViaCep
kelvinsb e749f64
feat: adapt useFetch for conditional paths and different response
kelvinsb 2fe44d7
feat: address fields required and zipCode triggering viaCep
kelvinsb 9306326
feat: address fields required on update shelter
kelvinsb 5f38379
feat: address fields on shelter details when theres no address field
kelvinsb bd62211
fix: suggestions(shorthand, optional chaining, separated zipCode, for…
kelvinsb b85be01
feat: sticky footer on filter dialog
kelvinsb 04968bf
Merge branch 'develop' into feat/filter-by-cities
kelvinsb 781875a
fix: reset errors on zipcode search; copy filter change
kelvinsb 873f0ad
Merge branch 'develop' into feat/filter-by-cities
kelvinsb 615a8a9
fix: timeoutId not assigned value; InfoRow copy can copy undefined
kelvinsb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { useDebouncedValue } from './useDebouncedValue'; | ||
|
||
export { useDebouncedValue }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useState, useEffect } from 'react'; | ||
|
||
export const useDebouncedValue = (value: string, delay: number): string => { | ||
const [debouncedValue, setDebouncedValue] = useState<string>(value); | ||
const [currentValue, setCurrentValue] = useState<string>(value); | ||
|
||
useEffect(() => { | ||
setCurrentValue(value); | ||
}, [value]); | ||
|
||
useEffect(() => { | ||
let timeoutId: NodeJS.Timeout; | ||
|
||
if (currentValue !== debouncedValue) { | ||
clearTimeout(timeoutId); | ||
timeoutId = setTimeout(() => { | ||
setDebouncedValue(currentValue); | ||
}, delay); | ||
} | ||
|
||
return () => { | ||
clearTimeout(timeoutId); | ||
}; | ||
}, [currentValue, debouncedValue, delay]); | ||
|
||
return debouncedValue; | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export enum PaginatedQueryPath { | ||
Shelters = '/shelters', | ||
ShelterCities = '/shelters/cities', | ||
SupplyCategories = '/supply-categories', | ||
Supplies = '/supplies', | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { useShelterCities } from './useShelterCities'; | ||
|
||
export { useShelterCities }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface IShelterCitiesData { | ||
city: string; | ||
sheltersCount: string; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { useFetch } from '../useFetch'; | ||
import { PaginatedQueryPath } from '../usePaginatedQuery/paths'; | ||
import { IShelterCitiesData } from './types'; | ||
|
||
export const useShelterCities = () => { | ||
return useFetch<IShelterCitiesData[]>(PaginatedQueryPath.ShelterCities, { | ||
cache: true, | ||
}); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { useViaCep } from './useViaCep'; | ||
|
||
export { useViaCep }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export interface IViaCepData { | ||
cep: string; | ||
logradouro: string; | ||
complemento: string; | ||
bairro: string; | ||
localidade: string; | ||
uf: string; | ||
ibge: string; | ||
gia: string; | ||
dd: string; | ||
siafi: string; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { useFetch } from '..'; | ||
import { IViaCepData } from './types'; | ||
|
||
export const useViaCep = (cep: string | undefined) => { | ||
const createdPath = | ||
!cep || cep.length < 8 | ||
? undefined | ||
: `https://viacep.com.br/ws/${cep}/json/`; | ||
return useFetch<IViaCepData>(createdPath); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.