-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1161 from City-of-Helsinki/UHF-11057
UHF-11057: Support address query param in searches
- Loading branch information
Showing
24 changed files
with
211 additions
and
81 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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
42 changes: 29 additions & 13 deletions
42
src/js/react/apps/health-station-search/containers/SearchContainer.tsx
This file contains 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,20 +1,36 @@ | ||
import { Suspense } from 'react'; | ||
import { Suspense, useEffect } from 'react'; | ||
|
||
import { useSetAtom } from 'jotai'; | ||
import LoadingOverlay from '@/react/common/LoadingOverlay'; | ||
import FormContainer from './FormContainer'; | ||
import ResultsContainer from './ResultsContainer'; | ||
import useInitialParams from '@/react/common/hooks/useInitialParams'; | ||
import { paramsAtom } from '../store'; | ||
|
||
const SearchContainer = () => ( | ||
<Suspense fallback={ | ||
<div className='hdbt__loading-wrapper'> | ||
<LoadingOverlay /> | ||
</div> | ||
}> | ||
<div className='hdbt-search--react'> | ||
<FormContainer /> | ||
<ResultsContainer /> | ||
</div> | ||
</Suspense> | ||
); | ||
const SearchContainer = () => { | ||
const setParams = useSetAtom(paramsAtom); | ||
const initialParams = useInitialParams({ | ||
address: '', | ||
}); | ||
|
||
useEffect(() => { | ||
if (initialParams) { | ||
setParams(initialParams); | ||
} | ||
}, [initialParams, setParams]); | ||
|
||
return ( | ||
<Suspense fallback={ | ||
<div className='hdbt__loading-wrapper'> | ||
<LoadingOverlay /> | ||
</div> | ||
}> | ||
<div className='hdbt-search--react'> | ||
<FormContainer initialParams={initialParams} /> | ||
<ResultsContainer /> | ||
</div> | ||
</Suspense> | ||
); | ||
}; | ||
|
||
export default SearchContainer; |
This file contains 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 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,5 @@ | ||
type SearchParams = { | ||
keyword?: string; | ||
address?: string; | ||
page?: number; | ||
query?: string; | ||
sv_only?: boolean; | ||
|
2 changes: 1 addition & 1 deletion
2
src/js/react/apps/health-station-search/types/SubmitEventTarget.ts
This file contains 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,5 @@ | ||
interface SubmitEventTarget extends EventTarget { | ||
keyword: HTMLInputElement; | ||
address: HTMLInputElement; | ||
} | ||
|
||
export default SubmitEventTarget; |
This file contains 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 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
43 changes: 30 additions & 13 deletions
43
src/js/react/apps/maternity-and-child-health-clinic-search/containers/SearchContainer.tsx
This file contains 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,20 +1,37 @@ | ||
import { Suspense } from 'react'; | ||
import { Suspense, useEffect } from 'react'; | ||
|
||
import { useSetAtom } from 'jotai'; | ||
import LoadingOverlay from '@/react/common/LoadingOverlay'; | ||
import FormContainer from './FormContainer'; | ||
import ResultsContainer from './ResultsContainer'; | ||
import SearchParams from '../types/SearchParams'; | ||
import useInitialParams from '@/react/common/hooks/useInitialParams'; | ||
import { paramsAtom } from '../store'; | ||
|
||
const SearchContainer = () => ( | ||
<Suspense fallback={ | ||
<div className='hdbt__loading-wrapper'> | ||
<LoadingOverlay /> | ||
</div> | ||
}> | ||
<div className='hdbt-search--react'> | ||
<FormContainer /> | ||
<ResultsContainer /> | ||
</div> | ||
</Suspense> | ||
); | ||
const SearchContainer = () => { | ||
const setParams = useSetAtom(paramsAtom); | ||
const initialParams = useInitialParams<SearchParams>({ | ||
address: '', | ||
}); | ||
|
||
useEffect(() => { | ||
if (initialParams) { | ||
setParams(initialParams); | ||
} | ||
}); | ||
|
||
return ( | ||
<Suspense fallback={ | ||
<div className='hdbt__loading-wrapper'> | ||
<LoadingOverlay /> | ||
</div> | ||
}> | ||
<div className='hdbt-search--react'> | ||
<FormContainer initialParams={initialParams} /> | ||
<ResultsContainer /> | ||
</div> | ||
</Suspense> | ||
); | ||
}; | ||
|
||
export default SearchContainer; |
This file contains 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
2 changes: 1 addition & 1 deletion
2
src/js/react/apps/maternity-and-child-health-clinic-search/types/SearchParams.ts
This file contains 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,5 @@ | ||
type SearchParams = { | ||
keyword?: string; | ||
address?: string; | ||
page?: number; | ||
query?: string; | ||
sv_only?: boolean; | ||
|
This file contains 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 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
4 changes: 2 additions & 2 deletions
4
src/js/react/apps/ploughing-schedule/helpers/GetQueryString.ts
This file contains 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.