Projekt

Obecné

Profil

Stáhnout (1.8 KB) Statistiky
| Větev: | Tag: | Revize:
1 e49b1f44 Schwobik
import {
2
    Button,
3
    Center,
4
    ChevronDownIcon,
5
    ChevronUpIcon, ScrollView,
6
    VStack
7
} from "native-base"
8 9c55d3bb Schwobik
import ListView from "../components/listView/ListView"
9
import SearchForm from "../components/search/SearchForm"
10 e49b1f44 Schwobik
import { useEffect, useState } from "react"
11
import {
12
    fetchArtists, fetchCities, fetchCountries, fetchInstitutions,
13
    fetchInventories,
14
    fetchNationalities,
15
    fetchPlans,
16
    fetchSubjects, fetchTechniques
17
} from "../stores/actions/searchFormThunks"
18
import { useDispatch } from "react-redux"
19
import { AppDispatch } from "../stores/store"
20
import { log } from "../logging/logger"
21 04928342 Schwobik
import { DrawerScreenProps } from "@react-navigation/drawer"
22
import { RootDrawerParamList } from "../components/Navigation"
23 b7014ba2 Schwobik
24 04928342 Schwobik
const SearchPage = ({navigation}: DrawerScreenProps<RootDrawerParamList, 'Search'>) => {
25 e49b1f44 Schwobik
    const [isFilterOpen, setIsFilterOpen] = useState(true)
26
27
    const dispatch = useDispatch<AppDispatch>()
28
29
    useEffect(() => {
30
        log.debug("SearchPage", "useEffect", "fetchEverything")
31
32
        dispatch(fetchInventories())
33
        dispatch(fetchNationalities())
34
        dispatch(fetchArtists())
35
        dispatch(fetchSubjects())
36
        dispatch(fetchPlans())
37
        dispatch(fetchTechniques())
38
        dispatch(fetchCountries())
39
        dispatch(fetchCities())
40
        dispatch(fetchInstitutions())
41
42
        log.debug("SearchPage", "useEffect", "fetchEverything", "done")
43
    }, [dispatch])
44 b7014ba2 Schwobik
45
    return (
46 1980ed09 Schwobik
        <Center m={ 2 } mr={0} mb={6} flex={1}>
47
48 e49b1f44 Schwobik
            <ScrollView flex={1} w={"100%"} >
49 1980ed09 Schwobik
                <VStack space={ 1 } mr={ 4 }>
50 ca44ce3d Schwobik
                    <SearchForm isFilterOpen={ isFilterOpen } setIsFilterOpen={setIsFilterOpen}/>
51 04928342 Schwobik
                    <ListView navigation={navigation}/>
52 ca53e9f1 Schwobik
                </VStack>
53
            </ScrollView>
54 e49b1f44 Schwobik
        </Center>
55 b7014ba2 Schwobik
    )
56
}
57
58
export default SearchPage