Revize d26c4168
Přidáno uživatelem Fantič před více než 1 rok
src/components/general/Icons.tsx | ||
---|---|---|
18 | 18 |
</Icon> |
19 | 19 |
) |
20 | 20 |
|
21 |
export const FullscreenIcon = (props: { color: string }): JSX.Element => ( |
|
22 |
<Icon> |
|
23 |
<G fill={props.color} stroke={props.color} strokeWidth={1}> |
|
24 |
<Path d="M1.5 1a.5.5 0 0 0-.5.5v4a.5.5 0 0 1-1 0v-4A1.5 1.5 0 0 1 1.5 0h4a.5.5 0 0 1 0 1h-4zM10 .5a.5.5 0 0 1 .5-.5h4A1.5 1.5 0 0 1 16 1.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5h-4a.5.5 0 0 1-.5-.5zM.5 10a.5.5 0 0 1 .5.5v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 1 0 1h-4A1.5 1.5 0 0 1 0 14.5v-4a.5.5 0 0 1 .5-.5zm15 0a.5.5 0 0 1 .5.5v4a1.5 1.5 0 0 1-1.5 1.5h-4a.5.5 0 0 1 0-1h4a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 1 .5-.5z" /> |
|
25 |
</G> |
|
26 |
</Icon> |
|
27 |
) |
|
28 |
|
|
29 |
export const TargetIcon = (props: { color: string }): JSX.Element => ( |
|
30 |
<Icon> |
|
31 |
<G fill={props.color} stroke={props.color} strokeWidth={1}> |
|
32 |
<Path d="M2 7V2H7" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> |
|
33 |
<Path d="M22 7V2H17" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> |
|
34 |
<Path d="M7 22L2 22L2 17" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> |
|
35 |
<Path d="M17 22L22 22L22 17" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> |
|
36 |
</G> |
|
37 |
</Icon> |
|
38 |
) |
|
39 |
|
|
40 |
export const ExitfullscreenIcon = (props: { color: string }): JSX.Element => ( |
|
41 |
<Icon> |
|
42 |
<G fill={props.color} stroke={props.color} strokeWidth={1}> |
|
43 |
<Path d="M5.5 0a.5.5 0 0 1 .5.5v4A1.5 1.5 0 0 1 4.5 6h-4a.5.5 0 0 1 0-1h4a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 1 .5-.5zm5 0a.5.5 0 0 1 .5.5v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 1 0 1h-4A1.5 1.5 0 0 1 10 4.5v-4a.5.5 0 0 1 .5-.5zM0 10.5a.5.5 0 0 1 .5-.5h4A1.5 1.5 0 0 1 6 11.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5h-4a.5.5 0 0 1-.5-.5zm10 1a1.5 1.5 0 0 1 1.5-1.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 0-.5.5v4a.5.5 0 0 1-1 0v-4z" /> |
|
44 |
</G> |
|
45 |
</Icon> |
|
46 |
) |
|
21 | 47 |
|
src/components/plan/CastlePlanView.tsx | ||
---|---|---|
1 |
import { Box } from 'native-base'; |
|
2 |
import React, { useRef } from 'react';
|
|
1 |
import { Box, HStack, Pressable, View, Text, Flex, IconButton } from 'native-base';
|
|
2 |
import React, { useEffect, useRef, useState } from 'react';
|
|
3 | 3 |
import { StyleSheet, Dimensions, TouchableOpacity, GestureResponderEvent } from 'react-native'; |
4 | 4 |
import { PanGestureHandler, PinchGestureHandler, State, TapGestureHandler } from 'react-native-gesture-handler'; |
5 | 5 |
import Animated, { |
... | ... | |
8 | 8 |
useSharedValue, |
9 | 9 |
} from 'react-native-reanimated'; |
10 | 10 |
import { PlanImage, Room } from '../../types/plan'; |
11 |
import Svg, { Path, SvgXml, Text } from 'react-native-svg'; |
|
11 |
import Svg, { Path, SvgXml, Text as SvgText } from 'react-native-svg';
|
|
12 | 12 |
|
13 | 13 |
// @ts-ignore |
14 | 14 |
import pointInSvgPolygon from "point-in-svg-polygon" |
15 |
import { ExitfullscreenIcon, FullscreenIcon } from '../general/Icons'; |
|
15 | 16 |
|
16 | 17 |
const CastlePlanView = (props: { mapImage: PlanImage, roomList: Room[], selectedRoom?: Room, fullScreenMode?: boolean, height?: number, setSelectedRoom?: (room: Room) => void }) => { |
17 | 18 |
|
... | ... | |
23 | 24 |
width: "100%" |
24 | 25 |
} |
25 | 26 |
|
26 |
const { mapImage, roomList, selectedRoom, fullScreenMode, height, setSelectedRoom } = props; |
|
27 |
const { mapImage, roomList, selectedRoom, height, setSelectedRoom } = props; |
|
28 |
|
|
29 |
const [fullScreenMode, setFullScreen] = useState(false); |
|
30 |
|
|
31 |
useEffect(() => { |
|
32 |
if (props.fullScreenMode) { |
|
33 |
setFullScreen(props.fullScreenMode) |
|
34 |
} |
|
35 |
}, [props.fullScreenMode]) |
|
36 |
|
|
27 | 37 |
|
28 | 38 |
const panRef = useRef<React.ReactElement>(); |
29 | 39 |
const pinchRef = useRef<React.ReactElement>(); |
... | ... | |
87 | 97 |
function calculateStraightLineDistance(x1: number, y1: number, planX: number, planY: number, log?: boolean) { |
88 | 98 |
// Apply scale and translations to both points |
89 | 99 |
|
90 |
const xOffset = 250 |
|
91 |
const yOffset = 120 |
|
92 |
|
|
93 |
const x2 = planX + xOffset |
|
94 |
const y2 = planY + yOffset |
|
100 |
const x2 = planX |
|
101 |
const y2 = planY |
|
95 | 102 |
|
96 | 103 |
|
97 | 104 |
const x_distance = Math.abs(x1 - x2); |
... | ... | |
107 | 114 |
return x_distance + y_distance; |
108 | 115 |
} |
109 | 116 |
|
117 |
const zoomOut = () => { |
|
118 |
translateX.value = 0; |
|
119 |
translateY.value = 0; |
|
120 |
scale.value = DEFAULT_SCALE; |
|
121 |
} |
|
122 |
|
|
123 |
const zoomToRoom = (room: Room) => { |
|
124 |
// Todo |
|
125 |
translateX.value = room.kx; |
|
126 |
translateY.value = room.ky; |
|
127 |
scale.value = DEFAULT_SCALE; |
|
128 |
} |
|
129 |
|
|
130 |
const handleFullScreenPressed = () => { |
|
131 |
console.log("neco") |
|
132 |
if (scale.value != DEFAULT_SCALE && translateX.value != 0 && translateY.value != 0) { |
|
133 |
console.log("todo zoom out") |
|
134 |
zoomOut() |
|
135 |
} |
|
136 |
else { |
|
137 |
console.log("Toggling fullscreen") |
|
138 |
setFullScreen && setFullScreen(!fullScreenMode) |
|
139 |
} |
|
140 |
} |
|
110 | 141 |
|
111 | 142 |
const handleSvgPress = (event: GestureResponderEvent) => { |
112 | 143 |
|
... | ... | |
139 | 170 |
const room: Room = roomList[i] |
140 | 171 |
if (room.in_plan) { |
141 | 172 |
|
173 |
// TODO |
|
174 |
console.log() |
|
175 |
console.log("Room + " + room.id) |
|
176 |
|
|
142 | 177 |
const currentDistance = calculateStraightLineDistance(room.number_x, room.number_y, locationX, locationY, true) |
143 | 178 |
|
144 | 179 |
if (currentDistance < minDistance) { |
... | ... | |
148 | 183 |
} |
149 | 184 |
}; |
150 | 185 |
|
151 |
console.log('Room clicked with id:', clickedRoom.id); |
|
186 |
console.log('Room clicked with id:', clickedRoom?.id);
|
|
152 | 187 |
console.log(minDistance) |
153 | 188 |
if (clickedRoom && minDistance < maxNumberDistance) { |
154 | 189 |
// TODO |
... | ... | |
162 | 197 |
} |
163 | 198 |
}; |
164 | 199 |
|
200 |
console.log(Dimensions.get('window').height) |
|
201 |
|
|
165 | 202 |
return ( |
166 | 203 |
// container |
167 |
<Box
|
|
204 |
<View
|
|
168 | 205 |
width={!fullScreenMode ? MAP_VIEW_SIZE.width : Dimensions.get('window').width - 5 |
169 | 206 |
} |
170 | 207 |
height={height ? height : (!fullScreenMode ? MAP_VIEW_SIZE.height : Dimensions.get('window').height - 62.5)} |
171 | 208 |
// @ts-ignore |
172 | 209 |
style={ |
173 | 210 |
fullScreenMode ? { |
174 |
marginTop: 2.5, |
|
175 |
marginLeft: 2.5, |
|
176 |
marginRight: 2.5, |
|
211 |
|
|
212 |
position: "absolute", |
|
213 |
top: -230, |
|
214 |
left: 0, |
|
215 |
zIndex: 1000, |
|
216 |
backgroundColor:"white", |
|
217 |
|
|
218 |
height: Dimensions.get('window').height - 120, |
|
219 |
width: Dimensions.get('window').width - 20, |
|
220 |
|
|
221 |
|
|
177 | 222 |
} |
178 | 223 |
: |
179 |
{ overflow: "hidden" } |
|
224 |
{ |
|
225 |
overflow: "hidden", |
|
226 |
} |
|
180 | 227 |
} |
181 | 228 |
borderColor={"light.300"} |
182 | 229 |
borderRadius={10} |
183 |
borderWidth={1} |
|
230 |
borderWidth={fullScreenMode ? 0 : 1}
|
|
184 | 231 |
> |
232 |
{/* control panel */} |
|
233 |
<Flex direction="row" alignItems="center" justify="flex-end" style={{ height: 50, width: 100, top: 5, right: 10, position: "absolute", zIndex: 5 }}> |
|
234 |
<Pressable padding={1.5} backgroundColor={"#654B07"} borderRadius={5} marginRight={selectedRoom ? 1 : -2} onPress={handleFullScreenPressed}> |
|
235 |
<FullscreenIcon color="white" /> |
|
236 |
</Pressable> |
|
237 |
{ |
|
238 |
selectedRoom && |
|
239 |
<Pressable padding={1.5} backgroundColor={"#654B07"} borderRadius={5} marginRight={-2} onPress={() => { zoomToRoom(selectedRoom) }}> |
|
240 |
<ExitfullscreenIcon color="white" /> |
|
241 |
</Pressable> |
|
242 |
} |
|
243 |
|
|
244 |
</Flex> |
|
185 | 245 |
|
186 | 246 |
<PinchGestureHandler |
187 | 247 |
ref={pinchRef} |
... | ... | |
242 | 302 |
return |
243 | 303 |
} |
244 | 304 |
return ( |
245 |
< Text |
|
305 |
< SvgText
|
|
246 | 306 |
x={room.number_x} // Adjust the x-coordinate based on your room data |
247 | 307 |
y={room.number_y} // Adjust the y-coordinate based on your room data |
248 | 308 |
fill="red" // Text color |
... | ... | |
252 | 312 |
vectorEffect='non-scaling-stroke' // Helps prevent stroke from scaling |
253 | 313 |
> |
254 | 314 |
{room.id} |
255 |
</Text> |
|
315 |
</SvgText>
|
|
256 | 316 |
) |
257 | 317 |
})} |
258 | 318 |
</Svg> |
... | ... | |
260 | 320 |
</PanGestureHandler> |
261 | 321 |
</Animated.View> |
262 | 322 |
</PinchGestureHandler > |
263 |
</Box >
|
|
323 |
</View >
|
|
264 | 324 |
); |
265 | 325 |
}; |
266 | 326 |
|
src/pages/PlanViewPage.tsx | ||
---|---|---|
12 | 12 |
import { login } from "../stores/actions/userThunks" |
13 | 13 |
import { getPlanItemsRequest } from "../api/planservice" |
14 | 14 |
import ItemPreview from "../components/listView/ItemPreview" |
15 |
import PlanView from "../components/plan/CastlePlanView" |
|
16 | 15 |
import { BASE_API_URL } from "../api/constants" |
17 | 16 |
import ListView from "../components/listView/ListView" |
18 | 17 |
import SearchForm from "../components/search/SearchForm" |
... | ... | |
40 | 39 |
const [selectedRoom, setSelectedRoom] = useState<Room | undefined>(undefined) |
41 | 40 |
const [selectedPlace, setSelectedPlace] = useState<Place | undefined>(undefined) |
42 | 41 |
|
43 |
const [isInteractingWithCastlePlan, setIsInteractingWithCastlePlan] = useState(false); |
|
42 |
const [isInteractingWithCastlePlan, setIsInteractingWithCastlePlan] = useState(false) |
|
43 |
|
|
44 | 44 |
|
45 | 45 |
const { floorListLoading, floorList, totalItemsCount, lastError } = useSelector((state: RootState) => state.planViewState) |
46 | 46 |
|
... | ... | |
56 | 56 |
const floorMapImage = useSelector((state: RootState) => state.planViewState.mapImage) |
57 | 57 |
const floorMapImageLoading = useSelector((state: RootState) => state.planViewState.mapImageLoading) |
58 | 58 |
|
59 |
// todo |
|
60 |
const castlePlanFullScreenMode = false |
|
61 |
|
|
62 | 59 |
const toast = useToast(); |
63 | 60 |
|
64 | 61 |
useEffect(() => { |
... | ... | |
186 | 183 |
|
187 | 184 |
return ( |
188 | 185 |
<Box flex={1}> |
189 |
{!castlePlanFullScreenMode || !castlePlanShown ? ( |
|
190 |
<Box h={Dimensions.get('window').height - 55}> |
|
191 |
<ScrollView flex={1} w={"100%"} nestedScrollEnabled={!isInteractingWithCastlePlan}> |
|
192 |
<VStack space={1}> |
|
186 |
<Box h={Dimensions.get('window').height - 55}> |
|
187 |
<ScrollView flex={1} w={"100%"} nestedScrollEnabled={!isInteractingWithCastlePlan}> |
|
188 |
<VStack space={1}> |
|
189 |
|
|
190 |
{/* Selection */} |
|
191 |
|
|
192 |
{ |
|
193 |
floorListLoading ? |
|
194 |
<LoadingBox text="Floor list loading"></LoadingBox> |
|
195 |
: |
|
196 |
<> |
|
197 |
{/* Floor */} |
|
198 |
<Select |
|
199 |
mt={2.5} |
|
200 |
ml={2.5} |
|
201 |
mr={2.5} |
|
193 | 202 |
|
194 |
{/* Selection */} |
|
203 |
placeholder={"Floor"} |
|
204 |
selectedValue={selectedFloor?.id} |
|
205 |
onValueChange={selectFloor} |
|
206 |
variant="rounded" |
|
207 |
> |
|
208 |
{floorList.map((floor, index) => { |
|
209 |
return ( |
|
210 |
<Select.Item value={floor.id} label={floor.label} /> |
|
211 |
); |
|
212 |
})} |
|
213 |
</Select> |
|
214 |
|
|
215 |
{/* Room */} |
|
216 |
|
|
217 |
< Select |
|
218 |
mt={2.5} |
|
219 |
ml={2.5} |
|
220 |
mr={2.5} |
|
195 | 221 |
|
196 |
{ |
|
197 |
floorListLoading ? |
|
198 |
<LoadingBox text="Floor list loading"></LoadingBox> |
|
199 |
: |
|
200 |
<> |
|
201 |
{/* Floor */} |
|
202 |
<Select |
|
203 |
mt={2.5} |
|
204 |
ml={2.5} |
|
205 |
mr={2.5} |
|
206 |
|
|
207 |
placeholder={"Floor"} |
|
208 |
selectedValue={selectedFloor?.id} |
|
209 |
onValueChange={selectFloor} |
|
210 |
variant="rounded" |
|
211 |
> |
|
212 |
{floorList.map((floor, index) => { |
|
222 |
isDisabled={(selectedFloor && selectedFloor.roomList && selectedFloor.roomList.length) ? false : true} |
|
223 |
|
|
224 |
placeholder={"Room"} |
|
225 |
selectedValue={selectedRoom?.id.toString()} |
|
226 |
onValueChange={(value: string) => selectRoom(parseInt(value))} |
|
227 |
variant="rounded" |
|
228 |
> |
|
229 |
{selectedFloor?.roomList?.map((room, index) => { |
|
230 |
if (room.room_list) { |
|
213 | 231 |
return ( |
214 |
<Select.Item value={floor.id} label={floor.label} />
|
|
232 |
<Select.Item value={room.id.toString()} label={room.label} />
|
|
215 | 233 |
); |
216 |
})} |
|
217 |
</Select> |
|
218 |
|
|
219 |
{/* Room */} |
|
234 |
} |
|
235 |
})} |
|
236 |
</Select> |
|
220 | 237 |
|
221 |
< Select |
|
222 |
mt={2.5} |
|
223 |
ml={2.5} |
|
224 |
mr={2.5} |
|
225 |
|
|
226 |
isDisabled={(selectedFloor && selectedFloor.roomList && selectedFloor.roomList.length) ? false : true} |
|
238 |
{/* Place */} |
|
239 |
<Select |
|
240 |
mt={2.5} |
|
241 |
ml={2.5} |
|
242 |
mr={2.5} |
|
227 | 243 |
|
228 |
placeholder={"Room"} |
|
229 |
selectedValue={selectedRoom?.id.toString()} |
|
230 |
onValueChange={(value: string) => selectRoom(parseInt(value))} |
|
231 |
variant="rounded" |
|
244 |
isDisabled={(selectedRoom && selectedRoom.places && selectedRoom.places.length > 0) ? false : true} |
|
245 |
placeholder={"Place"} |
|
246 |
selectedValue={selectedPlace?.id.toString()} |
|
247 |
onValueChange={(value: string) => selectPlace(parseInt(value))} |
|
248 |
variant="rounded" |
|
249 |
> |
|
250 |
{selectedRoom?.places?.map((place, index) => { |
|
251 |
return ( |
|
252 |
<Select.Item value={place.id.toString()} label={place.label} /> |
|
253 |
); |
|
254 |
})} |
|
255 |
</Select> |
|
256 |
|
|
257 |
{/* Filter */} |
|
258 |
<Flex direction="row" alignItems="center" justify="flex-end" |
|
259 |
mt={2.5} |
|
260 |
ml={2.5} |
|
261 |
mr={3} |
|
262 |
> |
|
263 |
<Button |
|
264 |
startIcon={ |
|
265 |
<CloseIcon size="xs" /> |
|
266 |
} |
|
267 |
onPress={clearForm} |
|
268 |
variant="subtle" |
|
269 |
color="secondary.500" |
|
270 |
mr={2} |
|
271 |
borderRadius={10} |
|
272 |
size={"sm"} |
|
232 | 273 |
> |
233 |
{selectedFloor?.roomList?.map((room, index) => { |
|
234 |
if (room.room_list) { |
|
235 |
return ( |
|
236 |
<Select.Item value={room.id.toString()} label={room.label} /> |
|
237 |
); |
|
274 |
Reset |
|
275 |
</Button> |
|
276 |
<Button |
|
277 |
onPress={() => { |
|
278 |
if (selectedRoom && !selectedPlace) { |
|
279 |
searchSubmit(selectedRoom.id) |
|
238 | 280 |
} |
239 |
})} |
|
240 |
</Select> |
|
241 |
|
|
242 |
{/* Place */} |
|
243 |
<Select |
|
244 |
mt={2.5} |
|
245 |
ml={2.5} |
|
246 |
mr={2.5} |
|
247 |
|
|
248 |
isDisabled={(selectedRoom && selectedRoom.places && selectedRoom.places.length > 0) ? false : true} |
|
249 |
placeholder={"Place"} |
|
250 |
selectedValue={selectedPlace?.id.toString()} |
|
251 |
onValueChange={(value: string) => selectPlace(parseInt(value))} |
|
252 |
variant="rounded" |
|
253 |
> |
|
254 |
{selectedRoom?.places?.map((place, index) => { |
|
255 |
return ( |
|
256 |
<Select.Item value={place.id.toString()} label={place.label} /> |
|
257 |
); |
|
258 |
})} |
|
259 |
</Select> |
|
260 |
|
|
261 |
{/* Filter */} |
|
262 |
<Flex direction="row" alignItems="center" justify="flex-end" |
|
263 |
mt={2.5} |
|
264 |
ml={2.5} |
|
265 |
mr={3} |
|
266 |
> |
|
267 |
<Button |
|
268 |
startIcon={ |
|
269 |
<CloseIcon size="xs" /> |
|
281 |
else if (selectedRoom && selectedPlace) { |
|
282 |
searchSubmit(selectedRoom.id, selectedPlace.id) |
|
270 | 283 |
} |
271 |
onPress={clearForm} |
|
272 |
variant="subtle" |
|
273 |
color="secondary.500" |
|
274 |
mr={2} |
|
275 |
borderRadius={10} |
|
276 |
size={"sm"} |
|
277 |
> |
|
278 |
Reset |
|
279 |
</Button> |
|
280 |
<Button |
|
281 |
onPress={() => { |
|
282 |
if (selectedRoom && !selectedPlace) { |
|
283 |
searchSubmit(selectedRoom.id) |
|
284 |
} |
|
285 |
else if (selectedRoom && selectedPlace) { |
|
286 |
searchSubmit(selectedRoom.id, selectedPlace.id) |
|
287 |
} |
|
288 |
|
|
289 |
}} |
|
290 |
backgroundColor={"#654B07"} |
|
291 |
variant="subtle" |
|
292 |
borderRadius={10} |
|
293 |
size={"sm"} |
|
294 |
> |
|
295 |
<Text color="white" fontSize={11}> |
|
296 |
Search |
|
297 |
</Text> |
|
298 |
</Button> |
|
299 |
</Flex> |
|
300 |
</> |
|
301 |
} |
|
302 | 284 |
|
303 |
{/* Plan */} |
|
304 |
{castlePlanShown && selectedFloor && !floorListLoading && ( |
|
305 |
floorMapImageLoading ? |
|
306 |
<LoadingBox text="Loading castle plan" /> |
|
285 |
}} |
|
286 |
backgroundColor={"#654B07"} |
|
287 |
variant="subtle" |
|
288 |
borderRadius={10} |
|
289 |
size={"sm"} |
|
290 |
> |
|
291 |
<Text color="white" fontSize={11}> |
|
292 |
Search |
|
293 |
</Text> |
|
294 |
</Button> |
|
295 |
</Flex> |
|
296 |
</> |
|
297 |
} |
|
298 |
|
|
299 |
{/* Plan */} |
|
300 |
{castlePlanShown && selectedFloor && !floorListLoading && ( |
|
301 |
floorMapImageLoading ? |
|
302 |
<LoadingBox text="Loading castle plan" /> |
|
303 |
: |
|
304 |
floorMapImage && |
|
305 |
<Box |
|
306 |
mt={2.5} |
|
307 |
ml={2.5} |
|
308 |
mr={2.5} |
|
309 |
height={Dimensions.get("window").height - 350} |
|
310 |
onTouchStart={() => setIsInteractingWithCastlePlan(true)} |
|
311 |
onTouchEnd={() => setIsInteractingWithCastlePlan(true)}> |
|
312 |
<CastlePlanView mapImage={floorMapImage} selectedRoom={selectedRoom} roomList={selectedFloor.roomList} height={Dimensions.get("window").height - 350} |
|
313 |
setSelectedRoom={(room: Room) => { |
|
314 |
selectRoom(room.id) |
|
315 |
}} |
|
316 |
fullScreenMode={false} |
|
317 |
/> |
|
318 |
</Box> |
|
319 |
) |
|
320 |
} |
|
321 |
|
|
322 |
{/* Item List */} |
|
323 |
<> |
|
324 |
{!castlePlanShown && ( |
|
325 |
inventoriesLoading ? |
|
326 |
<LoadingBox text="Loading available inventories..." /> |
|
307 | 327 |
: |
308 |
floorMapImage && |
|
309 |
<Box |
|
310 |
mt={2.5} |
|
311 |
ml={2.5} |
|
312 |
mr={2.5} |
|
313 |
onTouchStart={() => setIsInteractingWithCastlePlan(true)} |
|
314 |
onTouchEnd={() => setIsInteractingWithCastlePlan(true)}> |
|
315 |
<CastlePlanView mapImage={floorMapImage} selectedRoom={selectedRoom} roomList={selectedFloor.roomList} height={Dimensions.get("window").height - 350} |
|
316 |
setSelectedRoom={(room : Room) => { |
|
317 |
selectRoom(room.id) |
|
328 |
<Box mt={5} ml={2.5} mr={2.5}> |
|
329 |
<ListView |
|
330 |
|
|
331 |
navigation={navigation} |
|
332 |
hideHeaderText |
|
333 |
|
|
334 |
inventories={inventories} |
|
335 |
numOfResults={numberOfResults} |
|
336 |
|
|
337 |
data={data} |
|
338 |
loadedPages={pagination ?? {}} |
|
339 |
inventoriesDataLoading={dataLoading ?? {}} |
|
340 |
handleLoadMoreItems={(inventoryName: string, cursor: number) => { |
|
341 |
dispatch(getPlanItems({ cursor: cursor, inventory: inventoryName, room: selectedRoom?.id ?? 0, place: selectedPlace?.id })) |
|
318 | 342 |
}} |
319 | 343 |
/> |
320 | 344 |
</Box> |
321 | 345 |
) |
322 | 346 |
} |
323 |
|
|
324 |
{/* Item List */} |
|
325 |
<> |
|
326 |
{!castlePlanShown && ( |
|
327 |
inventoriesLoading ? |
|
328 |
<LoadingBox text="Loading available inventories..." /> |
|
329 |
: |
|
330 |
<Box mt={5} ml={2.5} mr={2.5}> |
|
331 |
<ListView |
|
332 |
|
|
333 |
navigation={navigation} |
|
334 |
hideHeaderText |
|
335 |
|
|
336 |
inventories={inventories} |
|
337 |
numOfResults={numberOfResults} |
|
338 |
|
|
339 |
data={data} |
|
340 |
loadedPages={pagination ?? {}} |
|
341 |
inventoriesDataLoading={dataLoading ?? {}} |
|
342 |
handleLoadMoreItems={(inventoryName: string, cursor: number) => { |
|
343 |
dispatch(getPlanItems({ cursor: cursor, inventory: inventoryName, room: selectedRoom?.id ?? 0, place: selectedPlace?.id })) |
|
344 |
}} |
|
345 |
|
|
346 |
/> |
|
347 |
</Box> |
|
348 |
) |
|
349 |
} |
|
350 |
</> |
|
351 |
|
|
347 |
</> |
|
348 |
|
|
349 |
</VStack> |
|
350 |
</ScrollView> |
|
351 |
{/* item notes switch tab */} |
|
352 |
<HStack alignItems="center"> |
|
353 |
<Button |
|
354 |
variant={"unstyled"} |
|
355 |
w="50%" |
|
356 |
onPress={() => { setCastlePlanShown(true) }} |
|
357 |
> |
|
358 |
<VStack alignItems={"center"}> |
|
359 |
<Text bold={castlePlanShown} mb={castlePlanShown ? undefined : 2}> |
|
360 |
Castle |
|
361 |
</Text> |
|
362 |
{castlePlanShown && <Divider borderWidth={1} width={60} mt={2} />} |
|
352 | 363 |
</VStack> |
353 |
</ScrollView> |
|
354 |
{/* item notes switch tab */} |
|
355 |
<HStack alignItems="center"> |
|
356 |
<Button |
|
357 |
variant={"unstyled"} |
|
358 |
w="50%" |
|
359 |
onPress={() => { setCastlePlanShown(true) }} |
|
360 |
> |
|
361 |
<VStack alignItems={"center"}> |
|
362 |
<Text bold={castlePlanShown} mb={castlePlanShown ? undefined : 2}> |
|
363 |
Castle |
|
364 |
</Text> |
|
365 |
{castlePlanShown && <Divider borderWidth={1} width={60} mt={2} />} |
|
366 |
</VStack> |
|
367 |
</Button> |
|
368 |
<Button |
|
369 |
variant={"unstyled"} |
|
370 |
w="50%" |
|
371 |
onPress={() => { setCastlePlanShown(false) }} |
|
372 |
> |
|
373 |
<VStack alignItems={"center"}> |
|
374 |
<Text bold={!castlePlanShown} mb={!castlePlanShown ? undefined : 2}> |
|
375 |
Results |
|
376 |
</Text> |
|
377 |
{!castlePlanShown && <Divider borderWidth={1} width={60} mt={2} />} |
|
378 |
</VStack> |
|
379 |
</Button> |
|
380 |
</HStack> |
|
381 |
</Box> |
|
382 |
) |
|
383 |
: |
|
384 |
floorMapImageLoading ? |
|
385 |
<LoadingBox text="Loading castle plan" /> |
|
386 |
: |
|
387 |
floorMapImage && selectedFloor && |
|
388 |
<Box> |
|
389 |
<CastlePlanView fullScreenMode mapImage={floorMapImage} selectedRoom={selectedRoom} roomList={selectedFloor.roomList} /> |
|
390 |
</Box> |
|
391 |
} |
|
364 |
</Button> |
|
365 |
<Button |
|
366 |
variant={"unstyled"} |
|
367 |
w="50%" |
|
368 |
onPress={() => { setCastlePlanShown(false) }} |
|
369 |
> |
|
370 |
<VStack alignItems={"center"}> |
|
371 |
<Text bold={!castlePlanShown} mb={!castlePlanShown ? undefined : 2}> |
|
372 |
Results |
|
373 |
</Text> |
|
374 |
{!castlePlanShown && <Divider borderWidth={1} width={60} mt={2} />} |
|
375 |
</VStack> |
|
376 |
</Button> |
|
377 |
</HStack> |
|
378 |
</Box> |
|
392 | 379 |
</Box> |
393 | 380 |
); |
394 | 381 |
} |
Také k dispozici: Unified diff
re #10871: PlanViewPage: FullscreenMode refactor