Projekt

Obecné

Profil

Stáhnout (1.63 KB) Statistiky
| Větev: | Tag: | Revize:
1 9c55d3bb Schwobik
import { useEffect, useState } from "react"
2 ca53e9f1 Schwobik
import { ScrollView, Text, VStack } from "native-base"
3 9c55d3bb Schwobik
import { useSelector } from "react-redux"
4
import { RootState } from "../../stores/store"
5 ca53e9f1 Schwobik
import ItemPreview from "./ItemPreview"
6 e49b1f44 Schwobik
import { ItemPreviewType } from "../../types/listViewTypes"
7
import { log } from "../../logging/logger"
8 ca44ce3d Schwobik
import ListViewInventoryGroup from "./ListViewInventoryGroup"
9 e49b1f44 Schwobik
10 04928342 Schwobik
type ListViewProps = {
11
    navigation: any
12
}
13 9c55d3bb Schwobik
14 04928342 Schwobik
const ListView = (props: ListViewProps) => {
15 9c55d3bb Schwobik
16 ca44ce3d Schwobik
    const inventories = useSelector((state: RootState) => state.listView.inventories)
17 e49b1f44 Schwobik
18
19 9c55d3bb Schwobik
    return (
20 e49b1f44 Schwobik
        <>
21 1980ed09 Schwobik
            <Text fontSize={ 16 } fontWeight={ "bold" } color={"primary.500"}>Search results:</Text>
22
            { inventories && inventories.length > 0 ?
23
                (inventories.length > 1 ?
24
                    inventories.map((inventory) => (
25
                            <ListViewInventoryGroup
26 6c38c709 Schwobik
                                inventoryName={ inventory.name }
27
                                inventoryLabel={ inventory.label }
28 1980ed09 Schwobik
                                navigation={ props.navigation }
29
                            />
30
                        )
31
                    ) : (
32
                        <ListViewInventoryGroup
33 6c38c709 Schwobik
                            inventoryName={ inventories[0].name }
34
                            inventoryLabel={ inventories[0].label }
35 1980ed09 Schwobik
                            navigation={ props.navigation }
36
                            defaultOpen={ true }
37
                        />
38
                    )) : (
39
                    <Text alignSelf={ "center" }>No results found</Text>
40 ca44ce3d Schwobik
                )
41 1980ed09 Schwobik
            }
42 e49b1f44 Schwobik
        </>
43 9c55d3bb Schwobik
    )
44
}
45
46
export default ListView