|
|
import React, { useMemo, useEffect, useCallback } from "react"; |
|
|
import { |
|
|
SafeAreaView, |
|
|
View, |
|
|
StatusBar, |
|
|
Platform, |
|
|
FlatList, |
|
|
} from "react-native"; |
|
|
import { connect } from "react-redux"; |
|
|
import { userProduct, comment, file, form } from "../../../redux/actions"; |
|
|
import { useNavigation } from "@react-navigation/native"; |
|
|
//components |
|
|
import CustomPressable from "../../../components/Pressable"; |
|
|
import Navbar from "../../../components/Navbar"; |
|
|
import Empty from "../../../components/Empty"; |
|
|
|
|
|
//style |
|
|
import tw from "tailwind-rn"; |
|
|
import Colors from "../../../constants/Colors"; |
|
|
import fontSize from "../../../constants/fontSize"; |
|
|
|
|
|
export const Tickets = ({ tickets = [], theme }) => { |
|
|
const navigation = useNavigation(); |
|
|
return ( |
|
|
<SafeAreaView |
|
|
style={{ |
|
|
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, |
|
|
position: "relative", |
|
|
flex: 1, |
|
|
}} |
|
|
> |
|
|
<Navbar |
|
|
headerOptions={{ |
|
|
logo: false, |
|
|
menu: false, |
|
|
hamburgerMenu: false, |
|
|
title: "تیکتها", |
|
|
bookmark: false, |
|
|
qr: false, |
|
|
back: true, |
|
|
}} |
|
|
/> |
|
|
{tickets.length ? ( |
|
|
<FlatList |
|
|
data={tickets} |
|
|
style={tw("px-4 flex-1")} |
|
|
renderItems={({ item }) => <Ticket ticket={item} />} |
|
|
keyExtractor={(item, index) => { |
|
|
return index; |
|
|
}} |
|
|
/> |
|
|
) : ( |
|
|
<Empty text="هیچ تیکتی وجود ندارد." /> |
|
|
)} |
|
|
<View style={tw("w-full px-4")}> |
|
|
<CustomPressable |
|
|
title={"ارسال تیکت جدید"} |
|
|
backgroundColor={Colors.theme1.greenCF} |
|
|
color={"white"} |
|
|
border={{ color: "#196EC0", width: 0 }} |
|
|
width={"100%"} |
|
|
onPress={() => navigation.push("Ticket")} |
|
|
/> |
|
|
</View> |
|
|
</SafeAreaView> |
|
|
); |
|
|
}; |
|
|
|
|
|
const mapStateToProps = (state) => ({ |
|
|
theme: state.publicApi.theme, |
|
|
}); |
|
|
|
|
|
const mapDispatchToProps = {}; |
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Tickets);
|
|
|
|