Projekt

Obecné

Profil

« Předchozí | Další » 

Revize fb120216

Přidáno uživatelem Fantič před více než 1 rok

re #10895: ItemView: ItemObjects switching, display color

Zobrazit rozdíly:

src/components/item/ItemView.tsx
1 1
import { Center, Box, VStack, Button, HStack, Text, Image, ScrollView, View, Spacer, Card, Heading, Switch, Flex, ChevronLeftIcon, ChevronRightIcon, Divider, Pressable } from "native-base"
2 2
import React, { useCallback, useEffect, useState } from "react"
3
import { Item } from "../../types/item"
3
import { Certainty, Item, RelationshipType } from "../../types/item"
4 4
import { Note } from "../../types/note"
5 5
import LoadingBox from "../loading/LoadingBox"
6 6
import NotesListView from "../notes/NotesListView"
......
15 15
import { DrawerNavigationProp } from "@react-navigation/drawer"
16 16
import { RootStackParamList } from "../../pages/Navigation"
17 17
import { select } from "d3"
18
import { CertaintyWithColors } from "../../stores/reducers/itemSlice"
18 19

  
19 20
interface ItemDetailProps {
20 21
    item: Item,
......
86 87
                            {item.fullView && item.images && item.images.length > 0 && (
87 88
                                <VStack marginTop={5} alignItems="center" justifyContent="center" backgroundColor="#F5F4F1" borderRadius={10} borderColor="#F5F4F1" padding={2}>
88 89

  
89
                                    <Box marginTop={2.5} borderWidth={1} width={Dimensions.get('window').width - 110} alignItems="center" backgroundColor="red" borderTopRadius={10} >
90
                                        <Text marginBottom={2}>{"Resembling objects"}
91
                                            {selectedImage + 1 + "/" + item.images.length + item.images[selectedImage].cert + item.images[selectedImage].relationship_type}
90
                                    <Box style={{ backgroundColor: item.images[selectedImage].relationship_type != RelationshipType.IdentifiedArtwork ? "#B3B3B3" : CertaintyWithColors[item.images[selectedImage].cert ?? Certainty.Unknown].color }}
91
                                        marginTop={2.5} width={Dimensions.get('window').width - 110} alignItems="center" borderTopRadius={10} >
92
                                        <Text marginBottom={2}>
93
                                            
94
                                            {item.images[selectedImage].relationship_type == RelationshipType.Resembling && "Resembling object"}
95
                                            {item.images[selectedImage].relationship_type == RelationshipType.IdentifiedArtwork && "Identified artwork"}
96
                                            {item.images[selectedImage].relationship_type == RelationshipType.Related && "Related item"}
97

  
98
                                            {item.images[selectedImage].relationship_type == RelationshipType.IdentifiedArtwork && item.images[selectedImage].cert && item.images[selectedImage].cert != Certainty.Unknown && ` - ${item.images?.[selectedImage].cert}`}
92 99
                                        </Text>
93 100
                                    </Box>
94 101

  
......
126 133
                                        <HStack>
127 134
                                            <Text marginTop={2.5}>
128 135
                                                <Text color="#654B07" italic fontWeight={"semibold"}>Author name: </Text>
129
                                                {item.authorName}
136
                                                {item.images?.[selectedImage]?.author}
130 137
                                            </Text>
131 138
                                        </HStack>}
132 139
                                    {item.title &&
133 140
                                        <HStack>
134 141
                                            <Text marginTop={2.5}>
135 142
                                                <Text color="#654B07" italic fontWeight={"semibold"}>Title: </Text>
136
                                                {item.title}
143
                                                {item.images?.[selectedImage].title}
137 144
                                            </Text>
138 145
                                        </HStack>}
139 146
                                    {item.institution &&
140 147
                                        <HStack>
141 148
                                            <Text marginTop={2.5}>
142 149
                                                <Text color="#654B07" italic fontWeight={"semibold"}>Institution: </Text>
143
                                                {item.institution.name}, Inv. No. {item.institution.inventoryNumber}, {item.institution.city} {"(" + item.institution.country + ")"}
150
                                                {item.images?.[selectedImage].institution.name && `${item.images?.[selectedImage].institution.name}`}
151
                                                {item.images?.[selectedImage].institution.inventoryNumber && `, Inv. No. ${item.images?.[selectedImage].institution.inventoryNumber}`}
152
                                                {item.images?.[selectedImage].institution.city && `, ${item.images?.[selectedImage].institution.city}`}
153
                                                {item.images?.[selectedImage].institution.country && ` (${item.images?.[selectedImage].institution.country})`}
144 154
                                            </Text>
145 155
                                        </HStack>}
146 156
                                    {item.repository &&
147 157
                                        <HStack>
148 158
                                            <Text marginTop={2.5}>
149 159
                                                <Text color="#654B07" italic fontWeight={"semibold"}>Repository: </Text>
150
                                                {item.repository}
160
                                                {item.images?.[selectedImage].repository}
151 161
                                            </Text>
152 162
                                        </HStack>}
153
                                    {item.provenance &&
163
                                    {item.images?.[selectedImage].provenance &&
154 164
                                        <HStack>
155 165
                                            <Text marginTop={2.5}>
156 166
                                                <Text color="#654B07" italic fontWeight={"semibold"}>Provenance: </Text>
157
                                                {item.provenance}
167
                                                {item.images?.[selectedImage].provenance}
158 168
                                            </Text>
159 169
                                        </HStack>}
160
                                    {item.description &&
170
                                    {item.images?.[selectedImage].description &&
161 171
                                        <HStack>
162 172
                                            <Text marginTop={2.5}>
163 173
                                                <Text color="#654B07" italic fontWeight={"semibold"}>Description: </Text>
164
                                                {item.description}
174
                                                {item.images?.[selectedImage].description}
165 175
                                            </Text>
166 176
                                        </HStack>}
167 177
                                </View>)}

Také k dispozici: Unified diff