1
|
import { Center, Box, Heading, VStack, FormControl, Link, Input, Button, HStack, Text, StatusBar, Container, Divider, Spacer } from "native-base"
|
2
|
import React, { useState } from "react"
|
3
|
import { useDispatch, useSelector } from "react-redux"
|
4
|
import { AppDispatch } from "../stores/store"
|
5
|
import { getPreviousConcordance, getNextConcordance, getItem } from "../stores/actions/itemThunks"
|
6
|
import { Item, ItemState } from "../stores/reducers/itemSlice"
|
7
|
|
8
|
interface ItemViewProps {
|
9
|
itemId: string
|
10
|
}
|
11
|
|
12
|
const ItemViewPage = (props: ItemViewProps) => {
|
13
|
|
14
|
const dispatch = useDispatch<AppDispatch>();
|
15
|
|
16
|
const itemState = useSelector((state: ItemState) => state)
|
17
|
|
18
|
useEffect(() => {
|
19
|
dispatch(getItem(props.itemId));
|
20
|
}, []);
|
21
|
|
22
|
const handleGetPreviousConcordance = async () => {
|
23
|
await dispatch(getPreviousConcordance());
|
24
|
};
|
25
|
|
26
|
const handleGetNextConcordance = async () => {
|
27
|
await dispatch(getNextConcordance());
|
28
|
};
|
29
|
|
30
|
|
31
|
|
32
|
return (
|
33
|
<VStack>
|
34
|
<Center>
|
35
|
<Heading
|
36
|
size="lg"
|
37
|
fontWeight="600"
|
38
|
color="coolGray.800"
|
39
|
_dark={{ color: "warmGrey.50" }}
|
40
|
>
|
41
|
{item.authorName}
|
42
|
</Heading>
|
43
|
|
44
|
<Text fontSize="xl" mt="2">
|
45
|
{item.caption}
|
46
|
</Text>
|
47
|
|
48
|
<HStack>
|
49
|
<Button onPress={handleGetPreviousConcordance} mr={2}>
|
50
|
Previous Concordance
|
51
|
</Button>
|
52
|
<Button onPress={handleGetNextConcordance}>Next Concordance</Button>
|
53
|
</HStack>
|
54
|
<Divider my="2" />
|
55
|
</Center>
|
56
|
</VStack>
|
57
|
);
|
58
|
}
|
59
|
|
60
|
export default ItemViewPage
|
61
|
|
62
|
function useEffect(arg0: () => void, arg1: (string | (import("redux-thunk").ThunkDispatch<{ user: import("../stores/reducers/userSlice").UserState; item: import("../stores/reducers/itemSlice").ItemState }, undefined, import("redux").AnyAction> & import("redux").Dispatch<...>))[]) {
|
63
|
throw new Error("Function not implemented.")
|
64
|
}
|