Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1980ed09

Přidáno uživatelem Schwobik před téměř 2 roky(ů)

Search page finished
re #10606

Zobrazit rozdíly:

app.json
1 1
{
2 2
  "expo": {
3 3
    "name": "RudolfII",
4
    "slug": "RudolfII",
4
    "slug": "inventaria-rudolphina",
5 5
    "version": "1.0.0",
6 6
    "orientation": "portrait",
7 7
    "icon": "./assets/icon.png",
......
21 21
      "adaptiveIcon": {
22 22
        "foregroundImage": "./assets/adaptive-icon.png",
23 23
        "backgroundColor": "#ffffff"
24
      }
24
      },
25
      "package": "cz.zcu.kiv.tsp.inventaria_rudolphina"
25 26
    },
26 27
    "web": {
27 28
      "favicon": "./assets/favicon.png"
28
    }
29
    },
30
    "extra": {
31
      "eas": {
32
        "projectId": "9cbe973a-6a5e-4b5e-85dd-02a80f7e38cc"
33
      }
34
    },
35
    "owner": "mschwob"
29 36
  }
30 37
}
eas.json
1
{
2
  "cli": {
3
    "version": ">= 3.12.1"
4
  },
5
  "build": {
6
    "development": {
7
      "developmentClient": true,
8
      "distribution": "internal"
9
    },
10
    "preview": {
11
      "android": {
12
        "buildType": "apk"
13
      }
14
    },
15
    "preview2": {
16
      "android": {
17
        "gradleCommand": ":app:assembleRelease"
18
      }
19
    },
20
    "preview3": {
21
      "developmentClient": true
22
    },
23
    "production": {}
24
  },
25
  "submit": {
26
    "production": {}
27
  }
28
}
package-lock.json
18 18
        "native-base": "^3.4.28",
19 19
        "react": "18.2.0",
20 20
        "react-dom": "^18.2.0",
21
        "react-native": "0.71.6",
21
        "react-native": "0.71.8",
22 22
        "react-native-deck-swiper": "^2.0.13",
23 23
        "react-native-gesture-handler": "~2.9.0",
24 24
        "react-native-logs": "^5.0.1",
......
13337 13337
      "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="
13338 13338
    },
13339 13339
    "node_modules/react-native": {
13340
      "version": "0.71.6",
13341
      "resolved": "https://registry.npmjs.org/react-native/-/react-native-0.71.6.tgz",
13342
      "integrity": "sha512-gHrDj7qaAaiE41JwaFCh3AtvOqOLuRgZtHKzNiwxakG/wvPAYmG73ECfWHGxjxIx/QT17Hp37Da3ipCei/CayQ==",
13340
      "version": "0.71.8",
13341
      "resolved": "https://registry.npmjs.org/react-native/-/react-native-0.71.8.tgz",
13342
      "integrity": "sha512-ftMAuhpgTkbHU9brrqsEyxcNrpYvXKeATY+if22Nfhhg1zW+6wn95w9otwTnA3xHkljPCbng8mUhmmERjGEl7g==",
13343 13343
      "dependencies": {
13344 13344
        "@jest/create-cache-key-function": "^29.2.1",
13345 13345
        "@react-native-community/cli": "10.2.2",
......
13366 13366
        "promise": "^8.3.0",
13367 13367
        "react-devtools-core": "^4.26.1",
13368 13368
        "react-native-codegen": "^0.71.5",
13369
        "react-native-gradle-plugin": "^0.71.17",
13369
        "react-native-gradle-plugin": "^0.71.18",
13370 13370
        "react-refresh": "^0.4.0",
13371 13371
        "react-shallow-renderer": "^16.15.0",
13372 13372
        "regenerator-runtime": "^0.13.2",
......
13449 13449
      }
13450 13450
    },
13451 13451
    "node_modules/react-native-gradle-plugin": {
13452
      "version": "0.71.17",
13453
      "resolved": "https://registry.npmjs.org/react-native-gradle-plugin/-/react-native-gradle-plugin-0.71.17.tgz",
13454
      "integrity": "sha512-OXXYgpISEqERwjSlaCiaQY6cTY5CH6j73gdkWpK0hedxtiWMWgH+i5TOi4hIGYitm9kQBeyDu+wim9fA8ROFJA=="
13452
      "version": "0.71.18",
13453
      "resolved": "https://registry.npmjs.org/react-native-gradle-plugin/-/react-native-gradle-plugin-0.71.18.tgz",
13454
      "integrity": "sha512-7F6bD7B8Xsn3JllxcwHhFcsl9aHIig47+3eN4IHFNqfLhZr++3ElDrcqfMzugM+niWbaMi7bJ0kAkAL8eCpdWg=="
13455 13455
    },
13456 13456
    "node_modules/react-native-logs": {
13457 13457
      "version": "5.0.1",
......
25956 25956
      "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="
25957 25957
    },
25958 25958
    "react-native": {
25959
      "version": "0.71.6",
25960
      "resolved": "https://registry.npmjs.org/react-native/-/react-native-0.71.6.tgz",
25961
      "integrity": "sha512-gHrDj7qaAaiE41JwaFCh3AtvOqOLuRgZtHKzNiwxakG/wvPAYmG73ECfWHGxjxIx/QT17Hp37Da3ipCei/CayQ==",
25959
      "version": "0.71.8",
25960
      "resolved": "https://registry.npmjs.org/react-native/-/react-native-0.71.8.tgz",
25961
      "integrity": "sha512-ftMAuhpgTkbHU9brrqsEyxcNrpYvXKeATY+if22Nfhhg1zW+6wn95w9otwTnA3xHkljPCbng8mUhmmERjGEl7g==",
25962 25962
      "requires": {
25963 25963
        "@jest/create-cache-key-function": "^29.2.1",
25964 25964
        "@react-native-community/cli": "10.2.2",
......
25985 25985
        "promise": "^8.3.0",
25986 25986
        "react-devtools-core": "^4.26.1",
25987 25987
        "react-native-codegen": "^0.71.5",
25988
        "react-native-gradle-plugin": "^0.71.17",
25988
        "react-native-gradle-plugin": "^0.71.18",
25989 25989
        "react-refresh": "^0.4.0",
25990 25990
        "react-shallow-renderer": "^16.15.0",
25991 25991
        "regenerator-runtime": "^0.13.2",
......
26063 26063
      }
26064 26064
    },
26065 26065
    "react-native-gradle-plugin": {
26066
      "version": "0.71.17",
26067
      "resolved": "https://registry.npmjs.org/react-native-gradle-plugin/-/react-native-gradle-plugin-0.71.17.tgz",
26068
      "integrity": "sha512-OXXYgpISEqERwjSlaCiaQY6cTY5CH6j73gdkWpK0hedxtiWMWgH+i5TOi4hIGYitm9kQBeyDu+wim9fA8ROFJA=="
26066
      "version": "0.71.18",
26067
      "resolved": "https://registry.npmjs.org/react-native-gradle-plugin/-/react-native-gradle-plugin-0.71.18.tgz",
26068
      "integrity": "sha512-7F6bD7B8Xsn3JllxcwHhFcsl9aHIig47+3eN4IHFNqfLhZr++3ElDrcqfMzugM+niWbaMi7bJ0kAkAL8eCpdWg=="
26069 26069
    },
26070 26070
    "react-native-logs": {
26071 26071
      "version": "5.0.1",
package.json
19 19
    "native-base": "^3.4.28",
20 20
    "react": "18.2.0",
21 21
    "react-dom": "^18.2.0",
22
    "react-native": "0.71.6",
22
    "react-native": "0.71.8",
23 23
    "react-native-deck-swiper": "^2.0.13",
24 24
    "react-native-gesture-handler": "~2.9.0",
25 25
    "react-native-logs": "^5.0.1",
src/components/listView/ItemPreview.tsx
1
import { Center, HStack, Image, Pressable, Text, VStack } from "native-base"
1
import { Center, HStack, Image, Pressable, ScrollView, Text, VStack } from "native-base"
2 2
import { useEffect } from "react"
3 3
import { DrawerScreenProps } from "@react-navigation/drawer"
4 4
import { RootDrawerParamList } from "../Navigation"
......
36 36
                    />
37 37
                    <VStack h={70}>
38 38
                        <Text fontSize={"sm"} italic>{ props.name }</Text>
39
                        <Text fontSize={"sm"} bold>{ props.caption }</Text>
39
                        <Text fontSize={"sm"} bold noOfLines={1}>{ props.caption }</Text>
40 40
                        <Text fontSize={"xs"}>{ props.title }</Text>
41 41
                    </VStack>
42 42
                </HStack>
src/components/listView/ListView.tsx
18 18

  
19 19
    return (
20 20
        <>
21
            {inventories.map((inventory) => (
22
                <ListViewInventoryGroup inventory={inventory.name} navigation={props.navigation}/>
21
            <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
                                inventory={ inventory.label }
27
                                navigation={ props.navigation }
28
                            />
29
                        )
30
                    ) : (
31
                        <ListViewInventoryGroup
32
                            inventory={ inventories[0].label }
33
                            navigation={ props.navigation }
34
                            defaultOpen={ true }
35
                        />
36
                    )) : (
37
                    <Text alignSelf={ "center" }>No results found</Text>
23 38
                )
24
            )}
39
            }
25 40
        </>
26 41
    )
27 42
}
src/components/listView/ListViewInventoryGroup.tsx
1
import { Badge, Pressable, VStack } from "native-base"
1
import { Badge, Button, Pressable, VStack, Text, Fab } from "native-base"
2 2
import { ItemPreviewType } from "../../types/listViewTypes"
3 3
import ItemPreview from "./ItemPreview"
4 4
import { useDispatch, useSelector } from "react-redux"
......
9 9
interface ListViewInventoryGroupProps {
10 10
    inventory: string
11 11
    navigation: any
12
    defaultOpen?: boolean
12 13
}
13 14

  
14 15
const ListViewInventoryGroup = (props: ListViewInventoryGroupProps) => {
15 16
    const items = useSelector((state: RootState) => state.listView.data[props.inventory])
16 17
    const loading = useSelector((state: RootState) => state.listView.loading)
17
    const [isExpanded, setIsExpanded] = useState(false)
18
    const [isExpanded, setIsExpanded] = useState(props.defaultOpen ? props.defaultOpen : false)
18 19
    const pagination = useSelector((state: RootState) => state.listView.loadedPages[props.inventory])
19 20

  
20 21
    const dispatch = useDispatch<AppDispatch>()
......
75 76
        }
76 77
    }, [loading])
77 78

  
79
    useEffect(() => {
80
        if (props.defaultOpen) {
81
            if (!items || items.length == 0) {
82
                dispatch(loadItemsByInventory(props.inventory))
83
            }
84
        }
85
    }, [])
86

  
78 87
    return (
79 88
        <>
80
            <VStack mb={2}>
81
                <Pressable
82
                    onPress={() => setIsExpanded(!isExpanded) }
89
            <VStack mb={ 2 }>
90
                <Button
91
                    onPress={ () => setIsExpanded(!isExpanded) }
92
                    alignSelf={ "start" }
93
                    variant="solid"
94
                    bg={ "primary.500" }
95
                    mb={ 2 }
96
                    p={ 1 }
97
                    size={ "md" }
83 98
                >
84
                    <Badge
85
                        colorScheme="primary"
86
                        variant="solid"
87
                    >
88
                        { props.inventory }
89
                    </Badge>
90
                </Pressable>
99
                    { props.inventory }
100
                </Button>
91 101
                { isExpanded && items && items.map((item) => (
92 102
                    <ItemPreview
93 103
                        // @ts-ignore
......
100 110
                    />
101 111
                )) }
102 112
                { isExpanded && items && pagination && pagination.cursor < pagination.records && (
103
                    <Pressable
104
                        onPress={() => dispatch(loadItemsByInventory(props.inventory))}
105
                        mt={2}
106
                        >
107
                        <Badge colorScheme={"primary"} variant={"outline"}>
108
                            Load more
109
                        </Badge>
110
                    </Pressable>
111
                )}
113
                    <Button
114
                        onPress={ () => dispatch(loadItemsByInventory(props.inventory)) }
115
                        variant={ "Link" }
116
                        mt={ 2 }
117
                        size={ "sm" }
118
                        color={ "primary.500" }
119
                        textDecoration={ "underline" }
120
                    >
121
                        <Text fontSize={ "sm" } color={ "primary.6 00" } underline>Load more</Text>
122
                    </Button>
123
                ) }
112 124

  
113 125
            </VStack>
114 126
        </>
src/components/search/SearchForm.tsx
1 1
import {
2 2
    Box,
3
    Button,
4
    CloseIcon,
5
    ScrollView,
3
    Button, ChevronDownIcon, ChevronUpIcon,
4
    CloseIcon, FormControl, HStack, Input,
5
    ScrollView, Text,
6 6
    VStack
7 7
} from "native-base"
8 8
import { useDispatch, useSelector } from "react-redux"
......
42 42
    const [selectedCountries, setSelectedCountries] = useState<{ label: string, value: string }[]>([])
43 43
    const [selectedCities, setSelectedCities] = useState<{ label: string, value: string }[]>([])
44 44
    const [selectedInstitutions, setSelectedInstitutions] = useState<{ label: string, value: string }[]>([])
45
    const [searchQuery, setSearchQuery] = useState<string>("")
45 46

  
46 47
    const [isSchoolOfPrague, setIsSchoolOfPrague] = useState(false)
47 48
    const [isOriginal, setIsOriginal] = useState(false)
......
66 67
            isOriginal,
67 68
            isCopy,
68 69
            isHighQuality,
69
            isLowQuality
70
            isLowQuality,
71
            searchQuery: searchQuery,
70 72
        }
71 73
        dispatch(setFilterState(filterState))
72 74
        dispatch(search(filterState))
......
85 87
        setSelectedCountries([])
86 88
        setSelectedCities([])
87 89
        setSelectedInstitutions([])
90
        setSearchQuery("")
91
    }
92

  
93
    const getSearchHeader = () => {
94
        if (inventories && inventories.length === 1) {
95
            return `Search: ${ inventories[0].name }`
96
        } else if (rooms && rooms.length === 1) {
97
            return `Search: ${ rooms[0].label }`
98
        } else {
99
            return "Search:"
100
        }
88 101
    }
89 102

  
90 103
    return (
91 104
        <>
105
            <Text
106
                fontSize={ "2xl" }
107
                fontWeight={ "bold" }
108
                color={ "primary.500" }
109
            >
110
                { getSearchHeader() }
111
            </Text>
112
            <Input
113
                placeholder="Search"
114
                size={ "md" }
115
                variant="underlined"
116
                value={searchQuery}
117
                onChangeText={ setSearchQuery }
118
            />
119
            <HStack justifyContent={"space-between"}>
120
                <Button
121
                    alignSelf={ "start" }
122
                    onPress={ () => props.setIsFilterOpen(!props.isFilterOpen) }
123
                    variant="outline"
124
                    endIcon={
125
                        <>
126
                            { props.isFilterOpen ?
127
                                (<ChevronUpIcon size={ 4 } color={ "primary.500" }/>)
128
                                : (<ChevronDownIcon size={ 4 } color={ "primary.500" }/>) }
129
                        </>
130
                    }
131
                    flexWrap={ "nowrap" }
132
                    borderColor={ "primary.500" }
133
                    size={ "sm" }
134
                    mt={ 2 }
135
                    p={ 2 }
136

  
137
                >
138
                    Filter
139
                </Button>
140
                { !props.isFilterOpen && (
141
                    <Button
142
                        borderRadius={ 10 }
143
                        onPress={ () => searchSubmit() }
144
                        colorScheme="primary"
145
                        background={ "primary.500" }
146
                        variant="solid"
147
                        mt={2}
148
                        p={2}
149
                        size={ "md" }
150
                    >
151
                        Search
152
                    </Button>
153
                )}
154
            </HStack>
92 155
            { props.isFilterOpen && (
93 156
                <>
94 157
                    <MultiSelect
......
206 269
                    </Box>
207 270
                </>
208 271
            ) }
272

  
209 273
        </>
210 274
    )
211 275
}
src/pages/LoginPage.tsx
48 48
                >
49 49
                    <Heading
50 50
                        size="2xl"
51
                        color="primary.100"
51
                        color="primary.500"
52 52
                        textAlign="center"
53 53
                        _dark={ {
54 54
                            color: "primary.100"
......
60 60
                        mt="10"
61 61
                        textAlign="center"
62 62
                        _dark={ {
63
                            color: "primary.50"
63
                            color: "primary.500"
64 64
                        } }
65
                        color="primary.50"
65

  
66 66
                        fontWeight="bold"
67 67
                        size="xl"
68 68
                    >
......
81 81
                            <Input
82 82
                                // value={username}
83 83
                                textContentType={"username"}
84
                                rounded={ "xl" }
84 85
                                autoComplete={"username"}
85 86
                                onSubmitEditing={ () => { loginUser() } }
86 87
                                onChangeText={ (username) => setUsername(username) }
87 88
                            />
88
                        </FormControl>
89
                        <FormControl>
90 89
                            <FormControl.Label>Password</FormControl.Label>
91 90
                            <Input
92 91
                                type="password"
93 92
                                autoComplete={ "password" }
94 93
                                id={ "password" }
95
                                returnKeyType={ "done" }
94
                                returnKeyType={ "go" }
95
                                rounded={ "xl" }
96 96
                                onSubmitEditing={ () => loginUser() }
97 97
                                onChangeText={ (password) => setPassword(password) }
98 98
                            />
99
                            <Button
100
                                mt="2"
101
                                bg={ "primary.500" }
102
                                onPress={ loginUser }
103
                                rounded={ "xl"}
104
                            >
105
                                Sign in
106
                            </Button>
99 107
                        </FormControl>
100
                        <Button
101
                            mt="2"
102
                            colorScheme="indigo"
103
                            onPress={ loginUser }
104
                        >
105
                            Sign in
106
                        </Button>
107
                        <HStack mt="6" justifyContent="center">
108
                            <Text fontSize="sm" color="coolGray.600" _dark={ {
109
                                color: "warmGray.200"
110
                            } }>
111
                                I'm a new user.{ " " }
112
                            </Text>
113
                            <Link _text={ {
114
                                color: "indigo.500",
115
                                fontWeight: "medium",
116
                                fontSize: "sm"
117
                            } } href="#">
118
                                Sign Up
119
                            </Link>
120
                        </HStack>
121 108
                    </VStack>
122 109
                </Box>
123 110
            </Center>
src/pages/SearchPage.tsx
43 43
    }, [dispatch])
44 44

  
45 45
    return (
46
        <Center m={ 2 } mr={ 4 } flex={1}>
47
            <Button
48
                alignSelf={ "start" }
49
                onPress={ () => setIsFilterOpen(!isFilterOpen) }
50
                variant="outline"
51
                endIcon={
52
                    <>
53
                        { isFilterOpen ?
54
                            (<ChevronUpIcon size={ 4 } color={ "primary.500" }/>)
55
                            : (<ChevronDownIcon size={ 4 } color={ "primary.500" }/>) }
56
                    </>
57
                }
58
                flexWrap={ "nowrap" }
59
                borderColor={ "primary.500" }
60
                mb={ 2 }
61
            >
62
                Filter
63
            </Button>
46
        <Center m={ 2 } mr={0} mb={6} flex={1}>
47

  
64 48
            <ScrollView flex={1} w={"100%"} >
65
                <VStack space={ 1 }>
49
                <VStack space={ 1 } mr={ 4 }>
66 50
                    <SearchForm isFilterOpen={ isFilterOpen } setIsFilterOpen={setIsFilterOpen}/>
67 51
                    <ListView navigation={navigation}/>
68 52
                </VStack>
src/theme/nativeBaseTheme.ts
14 14
            800: '#8B5800',
15 15
            900: '#5D3A00',
16 16
        },
17
        buttonBackground: 'primary.500'
17 18

  
18 19
    }
19 20
})

Také k dispozici: Unified diff