You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
165 lines
4.4 KiB
165 lines
4.4 KiB
import React from "react"; |
|
import { View, Text, Dimensions, Pressable } from "react-native"; |
|
import { connect } from "react-redux"; |
|
import { publicApi } from "../../../../redux/actions"; |
|
import tw from "tailwind-rn"; |
|
import Colors from "../../../../constants/Colors"; |
|
import { useNavigation } from "@react-navigation/native"; |
|
|
|
const { width} = Dimensions.get("window"); |
|
|
|
const Season = ({ season, activeUnit, name }) => { |
|
const navigation = useNavigation(); |
|
const Unit = ({ unit }) => { |
|
return ( |
|
<View |
|
style={[ |
|
tw("w-full flex flex-col rounded-md overflow-hidden mb-3"), |
|
{ |
|
borderWidth: 1, |
|
borderColor: Colors.theme1.light.blue3, |
|
}, |
|
]} |
|
> |
|
<View |
|
style={[ |
|
tw( |
|
"w-full flex flex-row-reverse justify-between items-center py-1.5 px-2" |
|
), |
|
{ |
|
borderBottomWidth: 1, |
|
borderColor: Colors.theme1.light.blue3, |
|
backgroundColor: activeUnit === unit ? "#aaa" : "transparent", |
|
}, |
|
]} |
|
> |
|
<Text |
|
style={[ |
|
{ |
|
fontFamily: "regular", |
|
fontSize: width / 34, |
|
color: |
|
activeUnit === unit ? "white" : Colors.theme1.light.blue5, |
|
}, |
|
]} |
|
> |
|
{unit.name} |
|
</Text> |
|
{/* <Text |
|
style={[ |
|
{ |
|
fontFamily: "regular", |
|
fontSize: width / 36, |
|
color: Colors.theme1.light.blue5, |
|
backgroundColor: "white", |
|
}, |
|
]} |
|
> |
|
{unit.duration} |
|
</Text> */} |
|
</View> |
|
<View style={[tw("w-full flex flex-row-reverse")]}> |
|
{1 && ( |
|
<Pressable |
|
style={[ |
|
tw("flex flex-1 flex-row items-center py-1.5 px-2"), |
|
{ |
|
borderLeftWidth: 1, |
|
borderColor: Colors.theme1.light.blue3, |
|
backgroundColor: "white", |
|
}, |
|
]} |
|
onPress={() => |
|
navigation.navigate("VideoDisplay", { |
|
season: season, |
|
unit: unit, |
|
name: name, |
|
}) |
|
} |
|
> |
|
<Text |
|
style={{ |
|
width: "100%", |
|
textAlign: "center", |
|
fontFamily: "regular", |
|
fontSize: width / 34, |
|
color: Colors.theme1.light.blue5, |
|
}} |
|
> |
|
نمایش |
|
</Text> |
|
</Pressable> |
|
)} |
|
{1 && ( |
|
<Pressable |
|
style={tw("flex flex-1 flex-row items-center py-1.5 px-2")} |
|
> |
|
<Text |
|
style={{ |
|
width: "100%", |
|
textAlign: "center", |
|
fontFamily: "regular", |
|
fontSize: width / 34, |
|
color: Colors.theme1.light.blue5, |
|
}} |
|
> |
|
دانلود |
|
</Text> |
|
</Pressable> |
|
)} |
|
</View> |
|
</View> |
|
); |
|
}; |
|
return ( |
|
<View style={tw("w-full flex flex-col mt-5")}> |
|
<Pressable |
|
style={[ |
|
tw( |
|
"flex flex-row-reverse justify-between items-center rounded-md py-2 px-3 mb-3" |
|
), |
|
{ backgroundColor: Colors.theme1.light.blue5 }, |
|
]} |
|
> |
|
<Text |
|
style={[ |
|
{ |
|
fontFamily: "regular", |
|
fontSize: width / 34, |
|
color: "white", |
|
}, |
|
]} |
|
> |
|
{name} |
|
</Text> |
|
<Text |
|
style={[ |
|
{ |
|
fontFamily: "regular", |
|
fontSize: width / 36, |
|
color: "white", |
|
}, |
|
]} |
|
> |
|
{season.duration} |
|
</Text> |
|
</Pressable> |
|
{season.map((unit, index) => ( |
|
<Unit unit={unit} key={index} /> |
|
))} |
|
</View> |
|
); |
|
}; |
|
|
|
const mapStateToProps = (state) => ({ |
|
selectedVideo: state.publicApi.selectedVideo, |
|
realSeasons: state.publicApi.bookInfo?.categories, |
|
vods: state.publicApi.bookSection?.vods, |
|
userid: state.user.status.id, |
|
}); |
|
|
|
const mapDispatchToProps = { |
|
setVideoActive: publicApi.setVideoActive, |
|
}; |
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Season);
|
|
|