Revize eb8efa3f
Přidáno uživatelem Fantič před více než 1 rok
src/pages/PlanViewPage.tsx | ||
---|---|---|
1 |
import React, { useCallback, useEffect } from "react" |
|
1 |
import React, { useCallback, useEffect, useState } from "react"
|
|
2 | 2 |
import { useDispatch, useSelector } from "react-redux" |
3 | 3 |
import { AppDispatch, RootState } from "../stores/store" |
4 | 4 |
import { getItem, getItemNotes, setConcordances } from "../stores/actions/itemThunks" |
... | ... | |
11 | 11 |
import { log } from "../logging/logger" |
12 | 12 |
import { DrawerScreenProps } from "@react-navigation/drawer" |
13 | 13 |
import { RootDrawerParamList } from "./Navigation" |
14 |
import { Box, useToast } from "native-base" |
|
14 |
import { Box, Select, useToast } from "native-base"
|
|
15 | 15 |
import { ErrorToast } from "../components/toast/ErrorToast" |
16 | 16 |
import Typography from "native-base/lib/typescript/theme/base/typography" |
17 |
import MultiSelect from "../components/search/MultiSelect" |
|
17 | 18 | |
18 | 19 | |
19 | 20 |
const PlanViewPage = ({ route, navigation }: DrawerScreenProps<RootDrawerParamList, 'Plan'>) => { |
20 | 21 | |
21 | 22 |
const layout = useWindowDimensions(); |
22 | 23 | |
23 |
const [routes, setRoutes] = React.useState<{ key: string, title: string }[]>([
|
|
24 |
const [routes, setRoutes] = useState<{ key: string, title: string }[]>([ |
|
24 | 25 |
// initial tab |
25 | 26 |
{ key: 'loading', title: 'Loading item...' }, |
26 | 27 |
]); |
27 | 28 | |
29 |
const [selectedFloor, setSelectedFloor] = useState<string>("first_floor") |
|
30 |
const [selectedRoom, setSelectedRoom] = useState<string | undefined>(undefined) |
|
31 |
const [selectedPlace, setSelectedPlace] = useState<string | undefined>(undefined) |
|
32 | ||
33 |
// TODO backend -> retrieve list of floors, not static -> not implemented at the time of coding |
|
34 |
const floorList = [ |
|
35 |
{ label: "Ground floor", id: "ground_floor" }, |
|
36 |
{ label: "First floor", id: "first_floor" }, |
|
37 |
{ label: "Second floor", id: "second_floor" }, |
|
38 |
] |
|
39 | ||
40 | ||
41 | ||
42 |
const [roomList, setRoomList] = useState<{ label: string, id: string }[]>([]) |
|
43 | ||
44 |
const [placeList, setPlaceList] = useState<{ label: string, id: string }[]>([]) |
|
45 | ||
46 |
const [itemList, setItemList] = useState<{ label: string, id: string }[]>([]) |
|
47 | ||
48 | ||
49 | ||
28 | 50 |
// // TODO vyřešit, aby nebyly freezy při přepínání |
29 | 51 |
// const [renderSceneDict, setRenderSceneDict] = React.useState({}); |
30 | 52 | |
... | ... | |
62 | 84 |
} |
63 | 85 | |
64 | 86 |
return ( |
65 |
<Box></Box> |
|
87 |
<Box> |
|
88 |
{/* Selection */} |
|
89 | ||
90 |
{/* Floor */} |
|
91 |
<Select |
|
92 |
mt={2.5} |
|
93 |
ml={2.5} |
|
94 |
mr={2.5} |
|
95 | ||
96 |
placeholder={"Floor"} |
|
97 |
selectedValue={selectedFloor} |
|
98 |
onValueChange={setSelectedFloor} |
|
99 |
variant="rounded" |
|
100 |
> |
|
101 |
{floorList.map((floor, index) => { |
|
102 |
return ( |
|
103 |
<Select.Item value={floor.id} label={floor.label} /> |
|
104 |
); |
|
105 |
})} |
|
106 |
</Select> |
|
107 | ||
108 |
{/* Room */} |
|
109 |
<Select |
|
110 |
mt={2.5} |
|
111 |
ml={2.5} |
|
112 |
mr={2.5} |
|
113 | ||
114 |
placeholder={"Room"} |
|
115 |
selectedValue={selectedRoom} |
|
116 |
onValueChange={setSelectedRoom} |
|
117 |
variant="rounded" |
|
118 |
> |
|
119 |
{roomList.map((room, index) => { |
|
120 |
return ( |
|
121 |
<Select.Item value={room.id} label={room.label} /> |
|
122 |
); |
|
123 |
})} |
|
124 |
</Select> |
|
125 | ||
126 |
{/* Place */} |
|
127 |
<Select |
|
128 |
mt={2.5} |
|
129 |
ml={2.5} |
|
130 |
mr={2.5} |
|
131 | ||
132 |
placeholder={"Place"} |
|
133 |
selectedValue={selectedPlace} |
|
134 |
onValueChange={setSelectedPlace} |
|
135 |
variant="rounded" |
|
136 |
> |
|
137 |
{placeList.map((place, index) => { |
|
138 |
return ( |
|
139 |
<Select.Item value={place.id} label={place.label} /> |
|
140 |
); |
|
141 |
})} |
|
142 |
</Select> |
|
143 | ||
144 | ||
145 | ||
146 |
{/* Plan */} |
|
147 | ||
148 | ||
149 |
{/* Item List */} |
|
150 | ||
151 |
{/* <ItemPreview |
|
152 |
// @ts-ignore |
|
153 |
caption={item.object[0].caption} |
|
154 |
title={item.text} |
|
155 |
name={parseArtists(item)} |
|
156 |
image={parseImage(item)} |
|
157 |
itemId={item.xml_id} |
|
158 |
inventoryLabel={props.inventoryLabel} |
|
159 |
navigation={props.navigation} |
|
160 |
/> */} |
|
161 |
</Box> |
|
162 | ||
163 | ||
66 | 164 |
); |
67 | 165 |
} |
68 | 166 |
Také k dispozici: Unified diff
re #10844: PlanViewPage: Select place, room, floor