Projekt

Obecné

Profil

Stáhnout (1.8 KB) Statistiky
| Větev: | Tag: | Revize:
1
import {
2
    Button,
3
    Center,
4
    ChevronDownIcon,
5
    ChevronUpIcon, ScrollView,
6
    VStack
7
} from "native-base"
8
import ListView from "../components/listView/ListView"
9
import SearchForm from "../components/search/SearchForm"
10
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
import { DrawerScreenProps } from "@react-navigation/drawer"
22
import { RootDrawerParamList } from "../components/Navigation"
23

    
24
const SearchPage = ({navigation}: DrawerScreenProps<RootDrawerParamList, 'Search'>) => {
25
    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

    
45
    return (
46
        <Center m={ 2 } mr={0} mb={6} flex={1}>
47

    
48
            <ScrollView flex={1} w={"100%"} >
49
                <VStack space={ 1 } mr={ 4 }>
50
                    <SearchForm isFilterOpen={ isFilterOpen } setIsFilterOpen={setIsFilterOpen}/>
51
                    <ListView navigation={navigation}/>
52
                </VStack>
53
            </ScrollView>
54
        </Center>
55
    )
56
}
57

    
58
export default SearchPage
(6-6/6)