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.
 
 
 
 
 

85 lines
2.2 KiB

import { View, Text, Image, TouchableOpacity, FlatList } from "react-native";
import { useNavigation } from "@react-navigation/native";
import tw from "tailwind-rn";
import fontSize from "../../../constants/fontSize";
import { connect } from "react-redux";
import Progress from "../../../components/Progress";
import Header from "../components/Header";
//Color
import Color from "../../../constants/Colors";
function Videos({ videos, grades }) {
return (
<View style={[tw("w-full px-2 mb-5")]}>
<View
style={[
tw("w-full flex flex-col rounded-md pt-2 px-2 overflow-hidden"),
]}
>
<Header title="دورههای ویدئویی شما" route={"VOD"} />
<FlatList
showsHorizontalScrollIndicator={false}
style={[tw("py-3")]}
horizontal={true}
inverted={true}
data={videos}
renderItem={({ item }) => <Video video={item} grades={grades} />}
keyExtractor={(item) => item.id}
/>
</View>
</View>
);
}
const Video = ({ video, grades }) => {
const navigation = useNavigation();
return (
<TouchableOpacity
style={tw("flex flex-col ml-3")}
onPress={() => navigation.navigate("Video", { id: video.id })}
>
<Image
source={{ uri: `https://dnvn.ir/api/v1/file/${video.fileIds}` }}
style={[
tw("rounded-md"),
{
height: 160,
width: 110,
},
]}
/>
<Text
style={[
tw("mt-2 pr-1"),
{
color: Color.theme1.light.blue6,
fontFamily: "bold",
fontSize: fontSize.sm,
},
]}
>
{video.name}
</Text>
<Text
style={[
tw("mt-1 pr-1"),
{
color: Color.theme1.light.blue5,
fontFamily: "light",
fontSize: fontSize.xs,
},
]}
>
{grades[video.gradeId]}
</Text>
<Progress percent={60} alignItems={"items-end"} />
</TouchableOpacity>
);
};
const mapStateToProps = (state) => ({
grades: state.publicApi.grades,
});
export default connect(mapStateToProps, {})(Videos);