Revize f22a2126
Přidáno uživatelem Michal Schwob před více než 1 rok
src/components/notes/NoteView.tsx | ||
---|---|---|
1 |
import { HStack, Box, Text, Image, VStack, Flex, Pressable, DeleteIcon, Button, Center, Avatar, TextArea, AlertDialog, ScrollView } from "native-base"; |
|
1 |
import { |
|
2 |
HStack, |
|
3 |
Box, |
|
4 |
Text, |
|
5 |
Image, |
|
6 |
VStack, |
|
7 |
Flex, |
|
8 |
Pressable, |
|
9 |
DeleteIcon, |
|
10 |
Button, |
|
11 |
Center, |
|
12 |
Avatar, |
|
13 |
TextArea, |
|
14 |
AlertDialog, |
|
15 |
ScrollView, |
|
16 |
KeyboardAvoidingView |
|
17 |
} from "native-base"; |
|
2 | 18 |
import { Note } from "../../types/note"; |
3 | 19 |
import { EditIcon } from "../general/Icons"; |
4 | 20 |
import { AVATAR_URL } from "../../api/constants"; |
5 | 21 |
import { useState } from "react"; |
6 | 22 |
import React from "react"; |
7 | 23 |
import NotesListView from "./NotesListView"; |
24 |
import {Platform} from "react-native" |
|
8 | 25 |
|
9 | 26 |
const NoteView = React.memo((props: { note: Note, handleReply: any, handleDelete: any, handleEdit: any, setConfirmDialog: any, navigation: any, parentId?: string, higlighted?: boolean }) => { |
10 | 27 |
const note = props.note; |
... | ... | |
83 | 100 |
} |
84 | 101 |
|
85 | 102 |
return ( |
86 |
<HStack style={props.higlighted && { backgroundColor: "#FFF8E1", borderBottomColor: '#FFD54F', borderBottomWidth: 1.5, paddingBottom: 10 }} marginTop={5}> |
|
103 |
|
|
104 |
<HStack backgroundColor={props.higlighted ? "secondary.50" : "white"} borderBottomColor={props.higlighted ? "secondary.800" : ""} |
|
105 |
borderBottomWidth={props.higlighted ? 1.5 : 0} paddingBottom={props.higlighted ? 10 : 0} marginTop={5}> |
|
87 | 106 |
<Box width="12" height="12" marginTop="2"> |
88 | 107 |
<Avatar bg={note.noteColor} width={10} height={10} source={{ |
89 | 108 |
uri: AVATAR_URL + "/" + note.avatarUrl |
... | ... | |
100 | 119 |
{note.username} |
101 | 120 |
</Text> |
102 | 121 |
|
103 |
<Text italic color="#8F8F8F" fontSize="xs">
|
|
122 |
<Text italic color="trueGray.500" fontSize="xs">
|
|
104 | 123 |
{getDateString(note.createdTime)} |
105 | 124 |
</Text> |
106 | 125 |
|
... | ... | |
116 | 135 |
|
117 | 136 |
{note.items && note.items.length > 0 && |
118 | 137 |
<Flex marginLeft={1} flex={0}> |
119 |
<Button p={1} variant="solid" backgroundColor="#F4DFAB" borderRadius={8} size="sm" onPress={() => props.navigation.navigate("Item", { itemId: note.items[0] })}>
|
|
120 |
<Text color="#654B07" fontSize={12}>
|
|
138 |
<Button p={1} variant="solid" backgroundColor="secondary.500" borderRadius={8} size="sm" onPress={() => props.navigation.navigate("Item", { itemId: note.items[0] })}>
|
|
139 |
<Text color="primary.500" fontSize={12}>
|
|
121 | 140 |
{note.items[0]} |
122 | 141 |
</Text> |
123 | 142 |
</Button> |
... | ... | |
132 | 151 |
<Flex direction="row" alignItems="center"> |
133 | 152 |
{props.handleReply != null && |
134 | 153 |
<Pressable onPress={() => props.handleReply(note.uuid, note.username)}> |
135 |
<Text color="#8F8F8F">Reply</Text>
|
|
154 |
<Text color="trueGray.500">Reply</Text>
|
|
136 | 155 |
</Pressable>} |
137 | 156 |
{!props.parentId && note.replies && note.replies.length > 0 && |
138 | 157 |
<Pressable marginLeft={3} onPress={() => toggleShowReplies()}> |
139 | 158 |
{!showReplies ? |
140 |
<Text color="#8F8F8F">{note.replies.length} replies</Text>
|
|
159 |
<Text color="trueGray.500">{note.replies.length} replies</Text>
|
|
141 | 160 |
: |
142 |
<Text color="#8F8F8F">Hide</Text>
|
|
161 |
<Text color="trueGray.500">Hide</Text>
|
|
143 | 162 |
} |
144 | 163 |
|
145 | 164 |
</Pressable>} |
... | ... | |
150 | 169 |
isEdited && |
151 | 170 |
<> |
152 | 171 |
< Pressable onPress={saveEdit} marginRight={5}> |
153 |
<Text color="#8F8F8F">Save</Text>
|
|
172 |
<Text color="trueGray.500">Save</Text>
|
|
154 | 173 |
</Pressable> |
155 | 174 |
<Pressable onPress={toggleEdited} marginRight={6}> |
156 |
<Text color="#8F8F8F">Cancel</Text>
|
|
175 |
<Text color="trueGray.500">Cancel</Text>
|
|
157 | 176 |
</Pressable> |
158 | 177 |
</>} |
159 | 178 |
{props.handleEdit && |
160 | 179 |
!isEdited && |
161 | 180 |
<Pressable onPress={toggleEdited} marginRight={5}> |
162 |
<EditIcon color="#8F8F8F" />
|
|
181 |
<EditIcon color="trueGray.500" />
|
|
163 | 182 |
</Pressable>} |
164 | 183 |
{props.handleDelete && |
165 | 184 |
<Pressable onPress={deleteClicked}> |
Také k dispozici: Unified diff
FIX: colors fix
re #10896