reza added some page

master
Reza_ashrafi 3 years ago
parent b9f3a35cd0
commit 47a08eda39
  1. BIN
      navigation/assets/book-deactive.png
  2. BIN
      navigation/assets/test-deactive.png
  3. 48
      navigation/index.js
  4. 1
      package.json
  5. 1
      src/components/Drawer.js
  6. 198
      src/components/MusicPlayer.js
  7. 9
      src/components/Navbar.js
  8. 6
      src/components/Pressable.js
  9. 2
      src/redux/actions/public.js
  10. 3
      src/redux/reducers/public.js
  11. 26
      src/screens/AR/components/Book.js
  12. 81
      src/screens/AR/index.js
  13. 1
      src/screens/Home/index.js
  14. 10
      src/screens/OrdersFollowUp/index.js
  15. 9
      src/screens/Product/components/Book.js
  16. 1
      src/screens/Product/index.js
  17. 2
      src/screens/Products/index.js
  18. 15
      src/screens/QR/Scan/index.js
  19. BIN
      src/screens/QR/assets/laptop.png
  20. 12
      src/screens/QRContent/Content/PDF.js
  21. 26
      src/screens/QRContent/Content/Video.js
  22. 8
      src/screens/QRContent/Content/Voice.js
  23. 18
      src/screens/QRContent/Content/index.js
  24. 21
      src/screens/QRContent/Tab/index.js
  25. 43
      src/screens/QRContent/index.js
  26. 12
      src/screens/Tests/index.js
  27. 4
      src/screens/Video/index.js
  28. 10
      yarn.lock

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B

@ -18,6 +18,7 @@ import Products from "../src/screens/Products";
import Login from "../src/screens/Login"; import Login from "../src/screens/Login";
import Otp from "../src/screens/Otp"; import Otp from "../src/screens/Otp";
import Product from "../src/screens/Product"; import Product from "../src/screens/Product";
import AR from "../src/screens/AR";
import QR from "../src/screens/QR"; import QR from "../src/screens/QR";
import QRContent from "../src/screens/QRContent"; import QRContent from "../src/screens/QRContent";
import Faq from "../src/screens/Faq"; import Faq from "../src/screens/Faq";
@ -30,6 +31,7 @@ import ShoppingCart from "../src/screens/ShoppingCart";
import Video from "../src/screens/Video"; import Video from "../src/screens/Video";
import VideoDisplay from "../src/screens/VideoDisplay"; import VideoDisplay from "../src/screens/VideoDisplay";
import Contact from "../src/screens/Contact"; import Contact from "../src/screens/Contact";
import Tests from "../src/screens/Tests";
import { user } from "../src/redux/actions"; import { user } from "../src/redux/actions";
//assets //assets
@ -37,6 +39,9 @@ import homeDeactiveIcon from "./assets/home-deactive.png";
import homeActiveIcon from "./assets/home-active.png"; import homeActiveIcon from "./assets/home-active.png";
import videoActiveIcon from "./assets/video-active.png"; import videoActiveIcon from "./assets/video-active.png";
import videoDeactiveIcon from "./assets/video-deactive.png"; import videoDeactiveIcon from "./assets/video-deactive.png";
import bookDeactiveIcon from "./assets/book-deactive.png";
import testDeactiveIcon from "./assets/test-deactive.png";
const width = Dimensions.get("window").width; const width = Dimensions.get("window").width;
@ -52,13 +57,12 @@ const BottomTabNavigator = () => {
tabBarStyle: { tabBarStyle: {
backgroundColor: "#CCE6FF", backgroundColor: "#CCE6FF",
zIndex: 10, zIndex: 10,
paddingVertical: 10, height: 70,
height: 60,
}, },
tabBarLabelStyle: { tabBarLabelStyle: {
fontSize: width / 36, fontSize: width / 34,
fontFamily: "regular", fontFamily: "regular",
marginTop: 5, transform: [{translateY : -7}]
}, },
tabBarShowLabel: true, tabBarShowLabel: true,
// tabBarLabel : 'reza' // tabBarLabel : 'reza'
@ -68,11 +72,35 @@ const BottomTabNavigator = () => {
name="ShoppingCartTab" name="ShoppingCartTab"
component={ShoppingCart} component={ShoppingCart}
options={{ options={{
tabBarStyle: {
flex : 'flex-col',
display: 'flex',
},
title : 'سبد خرید',
tabBarIcon: ({ focused, color }) => ( tabBarIcon: ({ focused, color }) => (
<FontAwesome <FontAwesome
name="shopping-cart" name="shopping-cart"
size={focused ? 32 : 32}
color={color}
/>
),
}}
/>
<Tab.Screen
name="Tests"
component={Tests}
options={{
title : 'آزمون',
tabBarIcon: ({ focused, color }) => ( focused ?
<FontAwesome
name="map"
size={focused ? 27 : 23} size={focused ? 27 : 23}
color={color} color={color}
/> :
<Image
source={testDeactiveIcon}
style={{ width: 33, height: 32 }}
/> />
), ),
}} }}
@ -81,6 +109,7 @@ const BottomTabNavigator = () => {
name="VODTab" name="VODTab"
component={VODStackScreen} component={VODStackScreen}
options={{ options={{
title : "ویدئوها",
tabBarIcon: ({ focused, color }) => tabBarIcon: ({ focused, color }) =>
focused ? ( focused ? (
<Image <Image
@ -99,8 +128,13 @@ const BottomTabNavigator = () => {
name="ProductsTab" name="ProductsTab"
component={ProductsStackScreen} component={ProductsStackScreen}
options={{ options={{
tabBarIcon: ({ focused, color }) => ( title : 'کتابها',
<Entypo name="shop" size={focused ? 27 : 23} color={color} /> tabBarIcon: ({ focused, color }) => ( focused ?
<Entypo name="shop" size={focused ? 27 : 23} color={color} /> :
<Image
source={bookDeactiveIcon}
style={{ width: 35, height: 34 }}
/>
), ),
}} }}
/> />
@ -108,6 +142,7 @@ const BottomTabNavigator = () => {
name="HomeTab" name="HomeTab"
component={HomeStackScreen} component={HomeStackScreen}
options={{ options={{
title : "خانه",
tabBarIcon: ({ focused, color }) => tabBarIcon: ({ focused, color }) =>
focused ? ( focused ? (
<Image <Image
@ -199,6 +234,7 @@ const Navigation = ({ getStatus, isLogin }) => {
<Stack.Screen name="Activation" component={Activation} /> <Stack.Screen name="Activation" component={Activation} />
<Stack.Screen name="QRContent" component={QRContent} /> <Stack.Screen name="QRContent" component={QRContent} />
<Stack.Screen name="Contact" component={Contact} /> <Stack.Screen name="Contact" component={Contact} />
<Stack.Screen name="AR" component={AR} />
</Stack.Navigator> </Stack.Navigator>
</NavigationContainer> </NavigationContainer>
); );

@ -35,6 +35,7 @@
"react-i18next": "^11.15.1", "react-i18next": "^11.15.1",
"react-native": "0.64.3", "react-native": "0.64.3",
"react-native-awesome-alerts": "^1.5.2", "react-native-awesome-alerts": "^1.5.2",
"react-native-openanything": "^0.0.6",
"react-native-qrcode-scanner": "^1.5.4", "react-native-qrcode-scanner": "^1.5.4",
"react-native-restart": "^0.0.22", "react-native-restart": "^0.0.22",
"react-native-safe-area-context": "3.3.2", "react-native-safe-area-context": "3.3.2",

@ -95,7 +95,6 @@ const Drawer = ({ position, setBoxPosition }) => {
}; };
return ( return (
<View <View
// onTouchStart={(e) => console.log(e.currentTarget._nativeTag)}
style={[ style={[
tw(`absolute z-50 top-0 flex flex-row justify-end `), tw(`absolute z-50 top-0 flex flex-row justify-end `),
{ {

@ -1,185 +1,31 @@
import React, { useState, useEffect } from "react"; import * as React from 'react';
import { StyleSheet, TouchableOpacity, View, Image, Text } from "react-native"; import { View, Button } from 'react-native';
import { Ionicons } from "@expo/vector-icons"; import { Audio } from 'expo-av';
import { Audio } from "expo-av";
const audioBookPlaylist = [ export default function VoicePlayer({fileIds}) {
{ const [sound, setSound] = React.useState();
title: "Hamlet - Act I",
author: "William Shakespeare",
source: "Librivox",
uri: "",
imageSource:
"http://www.archive.org/download/LibrivoxCdCoverArt8/hamlet_1104.jpg",
},
]; async function playSound() {
console.log('Loading Sound');
const MusicPlayer = () => { const { sound } = await Audio.Sound.createAsync(
const [isPlaying, setIsPlaying] = useState(false); {uri : `https://dnvn.ir/api/v1/file/${fileIds}`}
const [playbackInstance, setPlaybackInstance] = useState(null);
const [currentIndex, setCurrentIndex] = useState(0);
const [volume, setVolume] = useState(1.0);
const [isBuffering, setIsBuffering] = useState(true);
useEffect( async () => {
try {
await Audio.setAudioModeAsync({
allowsRecordingIOS: false,
interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
playsInSilentModeIOS: true,
interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
shouldDuckAndroid: true,
staysActiveInBackground: true,
playThroughEarpieceAndroid: true,
});
loadAudio();
} catch (e) {
console.log(e);
}
});
const loadAudio = async () => {
try {
const playbackInstance = new Audio.Sound();
const source = {
uri: audioBookPlaylist[currentIndex].uri,
};
const status = {
shouldPlay: isPlaying,
volume: volume,
};
playbackInstance.setOnPlaybackStatusUpdate(onPlaybackStatusUpdate);
await playbackInstance.loadAsync(source, status, false);
setPlaybackInstance(playbackInstance);
} catch (e) {
console.log(e);
}
};
const onPlaybackStatusUpdate = (status) => {
setIsBuffering(status.isBuffering);
};
const handlePlayPause = async () => {
if(isPlaying) {
await playbackInstance.pauseAsync();
}else{
await playbackInstance.playAsync();
}
setIsPlaying(() => !isPlaying);
};
const handlePreviousTrack = async () => {
let { playbackInstance, currentIndex } = state;
if (playbackInstance) {
await playbackInstance.unloadAsync();
setCurrentIndex(
currentIndex === 0 ? audioBookPlaylist.length - 1 : currentIndex - 1
); );
loadAudio(); setSound(sound);
}
};
const handleNextTrack = async () => { console.log('Playing Sound');
if (playbackInstance) { await sound.playAsync(); }
await playbackInstance.unloadAsync();
setCurrentIndex( React.useEffect(() => {
currentIndex + 1 > audioBookPlaylist.length - 1 ? 0 : currentIndex + 1 return sound
); ? () => {
loadAudio(); console.log('Unloading Sound');
} sound.unloadAsync(); }
}; : undefined;
}, [sound]);
const renderFileInfo = () => {
return playbackInstance ? (
<View style={styles.trackInfo}>
<Text style={[styles.trackInfoText, styles.largeText]}>
{audioBookPlaylist[currentIndex].title}
</Text>
<Text style={[styles.trackInfoText, styles.smallText]}>
{audioBookPlaylist[currentIndex].author}
</Text>
<Text style={[styles.trackInfoText, styles.smallText]}>
{audioBookPlaylist[currentIndex].source}
</Text>
</View>
) : null;
};
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Image <Button title="Play Sound" onPress={playSound} />
style={styles.albumCover}
source={{
uri: "http://www.archive.org/download/LibrivoxCdCoverArt8/hamlet_1104.jpg",
}}
/>
<View style={styles.controls}>
<TouchableOpacity
style={styles.control}
onPress={() => handlePreviousTrack()}
>
<Ionicons name="play-back" size={48} color="#444" />
</TouchableOpacity>
<TouchableOpacity
style={styles.control}
onPress={() => handlePlayPause()}
>
{isPlaying ? (
<Ionicons name="ios-pause" size={48} color="#444" />
) : (
<Ionicons name="ios-play-circle" size={48} color="#444" />
)}
</TouchableOpacity>
<TouchableOpacity
style={styles.control}
onPress={() => handleNextTrack()}
>
<Ionicons name="play-forward" size={48} color="#444" />
</TouchableOpacity>
</View>
{renderFileInfo()}
</View> </View>
); );
}; }
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
albumCover: {
width: 250,
height: 250,
},
trackInfo: {
padding: 40,
backgroundColor: "#fff",
},
trackInfoText: {
textAlign: "center",
flexWrap: "wrap",
color: "#550088",
},
largeText: {
fontSize: 22,
},
smallText: {
fontSize: 16,
},
control: {
margin: 20,
},
controls: {
flexDirection: "row",
},
});
export default MusicPlayer;

@ -10,6 +10,7 @@ import {
import { useNavigation } from "@react-navigation/native"; import { useNavigation } from "@react-navigation/native";
import { Ionicons, Entypo } from "@expo/vector-icons"; import { Ionicons, Entypo } from "@expo/vector-icons";
import tw from "tailwind-rn"; import tw from "tailwind-rn";
import fontSize from '../constants/fontSize';
import { connect } from "react-redux"; import { connect } from "react-redux";
const { width, height } = Dimensions.get("window"); const { width, height } = Dimensions.get("window");
@ -35,12 +36,12 @@ const Navbar = ({ notification, setBoxPosition, headerOptions }) => {
backgroundColor: Color.theme1.light.blue1, backgroundColor: Color.theme1.light.blue1,
borderColor: Color.theme1.light.blue2, borderColor: Color.theme1.light.blue2,
borderWidth: 1, borderWidth: 1,
marginLeft: route === "ar" ? 10 : 0, marginLeft: route === "AR" ? 10 : 0,
}, },
]} ]}
onPress={() => navigation.navigate(route)} onPress={() => navigation.navigate(route)}
> >
<Image source={icon} style={{ width: 20, height: 20 }} /> <Image source={icon} style={{ width: 22, height: 22 }} />
</Pressable> </Pressable>
); );
}, []); }, []);
@ -63,7 +64,7 @@ const Navbar = ({ notification, setBoxPosition, headerOptions }) => {
<Text <Text
style={{ style={{
fontFamily: "bold", fontFamily: "bold",
fontSize: width / 21, fontSize: fontSize.xl,
color: Color.theme1.light.blue5, color: Color.theme1.light.blue5,
paddingRight: 16 paddingRight: 16
}} }}
@ -118,7 +119,7 @@ const Navbar = ({ notification, setBoxPosition, headerOptions }) => {
{headerOptions?.qr && ( {headerOptions?.qr && (
<> <>
<Button icon={qrLightIcon} route={"QR"} /> <Button icon={qrLightIcon} route={"QR"} />
<Button icon={arLightIcon} route={"ar"} /> <Button icon={arLightIcon} route={"AR"} />
</> </>
)} )}
{headerOptions?.bookmark && ( {headerOptions?.bookmark && (

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import {Pressable, Text, Dimensions} from 'react-native'; import {TouchableOpacity, Text, Dimensions} from 'react-native';
import tw from 'tailwind-react-native-classnames'; import tw from 'tailwind-react-native-classnames';
const fullWidth = Dimensions.get('window').width; const fullWidth = Dimensions.get('window').width;
@ -13,7 +13,7 @@ export default function Pressable1({
onPress, onPress,
}) { }) {
return ( return (
<Pressable <TouchableOpacity
onPress={() => onPress()} onPress={() => onPress()}
style={[ style={[
tw.style('rounded-md py-3 flex flex-row justify-center mb-3'), tw.style('rounded-md py-3 flex flex-row justify-center mb-3'),
@ -25,6 +25,6 @@ export default function Pressable1({
}, },
]}> ]}>
<Text style={{fontSize: fullWidth / 31, color: color, fontFamily : 'light'}}>{title}</Text> <Text style={{fontSize: fullWidth / 31, color: color, fontFamily : 'light'}}>{title}</Text>
</Pressable> </TouchableOpacity>
); );
} }

@ -43,6 +43,8 @@ const publicApi = {
await dispatch({ type: "active/category", data: data }), await dispatch({ type: "active/category", data: data }),
setVideoActive: (data) => async (dispatch) => setVideoActive: (data) => async (dispatch) =>
await dispatch({ type: "active/video", data: data }), await dispatch({ type: "active/video", data: data }),
getArList: (data, history) => async (dispatch) =>
await proxy.get("public/ar", data, { history, dispatch }),
}; };
export default publicApi; export default publicApi;

@ -141,7 +141,8 @@ const publicApi = (state = initialState, action) => {
error: null, error: null,
homeData: data, homeData: data,
}; };
case "public/ar":
return { ...state, loading: false, error: null, arList: data };
case "public/contact": case "public/contact":
return { ...state, loading: false, error: null, contactData: data }; return { ...state, loading: false, error: null, contactData: data };
case "public/blogList": case "public/blogList":

@ -0,0 +1,26 @@
import { View, Text, Image, Dimensions } from "react-native";
import React from "react";
import tw from "tailwind-rn";
import fontSize from '../../../constants/fontSize';
import Colors from '../../../constants/Colors';
const { width } = Dimensions.get("window");
const Book = ({ book }) => {
return (
<View
style={[tw("w-full flex flex-row-reverse rounded-md p-2 my-2"), {backgroundColor : Colors.theme1.light.blue3}]}
>
<Image
source={{ uri: `https://dnvn.ir/api/v1/file/${book.fileId}` }}
style={[
tw("rounded-md"),
{ width: width / 5.5, height: ((width / 5.5) * 3) / 2 },
]}
/>
<Text style={[{fontFamily: "regular", fontSize: fontSize.base, marginRight : 10 }]}>{book.title}</Text>
</View>
);
};
export default Book;

@ -1,13 +1,76 @@
import React from 'react' import React, { useState, useEffect } from "react";
import { View, Text } from 'react-native'; import {
import {connect} from 'react-redux'; SafeAreaView,
ScrollView,
StatusBar,
LayoutAnimation,
Platform,
Dimensions,
} from "react-native";
import { connect } from "react-redux";
import { publicApi } from "../../redux/actions";
import Navbar from "../../components/Navbar";
import Drawer from "../../components/Drawer";
import Book from "./components/Book";
const { height } = Dimensions.get("window");
function AR({ getArList, arList }) {
const [position, setPosition] = useState("100%");
useEffect(() => {
getArList();
}, []);
const setBoxPosition = () => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setPosition(position === "100%" ? "0%" : "100%");
};
function AR({}) {
return ( return (
<View> <SafeAreaView
<Text></Text> style={{
</View> paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
) position: "relative",
// minHeight: height,
backgroundColor: "white",
}}
>
<Navbar
setBoxPosition={setBoxPosition}
headerOptions={{
logo: false,
menu: false,
hamburgerMenu: false,
title: "واقعیت افزوده",
bookmark: false,
qr: false,
back: true,
}}
/>
<Drawer setBoxPosition={setBoxPosition} position={position} />
<ScrollView
style={{
paddingHorizontal: 16,
height: height,
backgroundColor: "white",
}}
contentContainerStyle={{ paddingBottom: 100 }}
>
{arList.length > 0 &&
arList.map((book, index) => <Book book={book} key={index} />)}
</ScrollView>
</SafeAreaView>
);
} }
export default AR; const mapStateToProps = (state) => ({
arList: state.publicApi.arList,
});
const mapDispatchToProps = {
getArList: publicApi.getArList,
};
export default connect(mapStateToProps, mapDispatchToProps)(AR);

@ -38,7 +38,6 @@ const Home = ({
getBlogs(); getBlogs();
getBooks(); getBooks();
getUserProducts(); getUserProducts();
// getVideos();
}, []); }, []);
const setBoxPosition = () => { const setBoxPosition = () => {

@ -32,13 +32,13 @@ function OrdersFollowUp({ orders }) {
<Navbar <Navbar
setBoxPosition={setBoxPosition} setBoxPosition={setBoxPosition}
headerOptions={{ headerOptions={{
logo: true, logo: false,
menu: false, menu: false,
hamburgerMenu: true, hamburgerMenu: false,
title: "", title: "سفارشات",
bookmark: false, bookmark: false,
qr: true, qr: false,
back: false, back: true,
}} }}
/> />
<Drawer setBoxPosition={setBoxPosition} position={position} /> <Drawer setBoxPosition={setBoxPosition} position={position} />

@ -4,8 +4,9 @@ import {
Text, Text,
Image, Image,
ScrollView, ScrollView,
Pressable, TouchableOpacity
} from "react-native"; } from "react-native";
import { useNavigation } from "@react-navigation/native";
import { Entypo } from "@expo/vector-icons"; import { Entypo } from "@expo/vector-icons";
import CustomPressable from "../../../components/Pressable"; import CustomPressable from "../../../components/Pressable";
import Description from "./Description"; import Description from "./Description";
@ -18,6 +19,7 @@ import { product, userProduct } from "../../../redux/actions";
import { connect } from "react-redux"; import { connect } from "react-redux";
function Book({ book, grades, pushToCart, userId }) { function Book({ book, grades, pushToCart, userId }) {
const navigation = useNavigation();
const [type, setType] = useState(1); const [type, setType] = useState(1);
return ( return (
<ScrollView style={[tw.style("flex flex-col flex-1")]}> <ScrollView style={[tw.style("flex flex-col flex-1")]}>
@ -170,13 +172,14 @@ function Book({ book, grades, pushToCart, userId }) {
border={{ color: "#196EC0", width: 1 }} border={{ color: "#196EC0", width: 1 }}
width={"33%"} width={"33%"}
/> />
<Pressable <TouchableOpacity
style={[ style={[
tw.style( tw.style(
"w-full rounded-md flex flex-row justify-center items-center py-2.5" "w-full rounded-md flex flex-row justify-center items-center py-2.5"
), ),
{ backgroundColor: "#196EC01a" }, { backgroundColor: "#196EC01a" },
]} ]}
onPress={() => navigation.navigate("Video", {id : book.id})}
> >
<Entypo name="chevron-small-left" size={20} color="#196EC0" /> <Entypo name="chevron-small-left" size={20} color="#196EC0" />
<Text <Text
@ -187,7 +190,7 @@ function Book({ book, grades, pushToCart, userId }) {
> >
مشاهده دوره ویدئویی این محصول مشاهده دوره ویدئویی این محصول
</Text> </Text>
</Pressable> </TouchableOpacity>
</View> </View>
{book.product[type].description && ( {book.product[type].description && (
<Description description={book.description} /> <Description description={book.description} />

@ -54,7 +54,6 @@ function Product({
contentContainerStyle={styles.contentContainerStyle} contentContainerStyle={styles.contentContainerStyle}
style={styles.container} style={styles.container}
> >
{book && (route.params.type === 'video' ? ( {book && (route.params.type === 'video' ? (
<Video /> <Video />
) : ( ) : (

@ -64,7 +64,7 @@ function Products({ grades, productTypes, books }) {
/> />
</View> </View>
</View> </View>
<ScrollView> <ScrollView contentContainerStyle={{ paddingBottom: 100 }}>
<View <View
style={tw( style={tw(
"flex w-full px-4 flex-row flex-wrap justify-between bg-white" "flex w-full px-4 flex-row flex-wrap justify-between bg-white"

@ -5,12 +5,13 @@ import {
TouchableOpacity, TouchableOpacity,
Dimensions, Dimensions,
ImageBackground, ImageBackground,
StatusBar StatusBar,
} from "react-native"; } from "react-native";
import { useNavigation } from "@react-navigation/native"; import { useNavigation } from "@react-navigation/native";
import tw from "tailwind-rn"; import tw from "tailwind-rn";
import { BarCodeScanner } from "expo-barcode-scanner"; import { BarCodeScanner } from "expo-barcode-scanner";
import Colors from "../../../constants/Colors"; import Colors from "../../../constants/Colors";
import { Entypo } from "@expo/vector-icons";
const { width, height } = Dimensions.get("window"); const { width, height } = Dimensions.get("window");
@ -63,7 +64,7 @@ export default function Scan({}) {
<TouchableOpacity <TouchableOpacity
onPress={() => navigation.goBack()} onPress={() => navigation.goBack()}
style={[ style={[
tw("py-2.5 rounded-full flex justify-center flex-row"), tw("py-2.5 rounded-full flex justify-center flex-row items-center"),
{ {
width: height / 3.5, width: height / 3.5,
borderWidth: 1, borderWidth: 1,
@ -71,7 +72,15 @@ export default function Scan({}) {
}, },
]} ]}
> >
<Text style={{ color: "white", fontSize: width / 27 }}>بازگشت</Text> <Entypo name="back" size={width / 27} style={{marginRight : 5, color : 'white'}} />
<Text
style={[
{ color: "white", fontSize: width / 27, fontFamily: "regular" },
]}
>
بازگشت
</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
{/* )} */} {/* )} */}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 175 KiB

@ -1,17 +1,19 @@
import React from "react"; import React from "react";
import { View, Text, Image, Dimensions } from "react-native"; import { View, Text, Image, Dimensions, TouchableOpacity } from "react-native";
import tw from "tailwind-rn"; import tw from "tailwind-rn";
import * as OpenAnything from 'react-native-openanything';
import pdfIcon from "../../../assets/icons/pdf.png"; import pdfIcon from "../../../assets/icons/pdf.png";
const { width } = Dimensions.get("window"); const { width } = Dimensions.get("window");
export default function PDF({ name, file }) { export default function PDF({ data }) {
return ( return (
<View <TouchableOpacity
style={tw( style={tw(
"w-full flex-row-reverse justify-between items-center rounded-md bg-red-100 py-3 px-2 mt-5" "w-full flex-row-reverse justify-between items-center rounded-md bg-red-100 py-3 px-2 mt-5"
)} )}
onPress={() => OpenAnything.Pdf(`https://dnvn.ir/api/v1/file/${data.fileIds}`)}
> >
<Text <Text
style={[ style={[
@ -19,9 +21,9 @@ export default function PDF({ name, file }) {
{ fontSize: width / 34, fontFamily: "regular" }, { fontSize: width / 34, fontFamily: "regular" },
]} ]}
> >
{name} {data.name}
</Text> </Text>
<Image source={pdfIcon} style={{ width: 40, height: 40 }} /> <Image source={pdfIcon} style={{ width: 40, height: 40 }} />
</View> </TouchableOpacity>
); );
} }

@ -1,23 +1,37 @@
import React from "react"; import React from "react";
import { View, Text, Dimensions } from "react-native"; import { View, Text, Dimensions } from "react-native";
import tw from "tailwind-rn"; import tw from "tailwind-rn";
import { Video } from "expo-av";
const {width} = Dimensions.get("window"); const {width} = Dimensions.get("window");
export default function Video({ name, file }) { export default function VideoContent({ data }) {
const [status, setStatus] = React.useState({});
const video = React.useRef(null);
return ( return (
<View style={tw("w-full flex-col mt-5")}> <View style={tw("w-full flex-col mt-5")}>
<Text <Text
style={[ style={[
tw("w-full text-right text-green-900 mb-2"), tw("w-full text-right text-green-900 mb-4"),
{ fontSize: width / 34, fontFamily: "bold" }, { fontSize: width / 34, fontFamily: "bold" },
]} ]}
> >
{name} {'موضوع:' + ' ' + data.name}
</Text> </Text>
<View <View style={tw("flex flex-col")}>
style={[tw("w-full bg-blue-200 rounded-md"), { minHeight: 200 }]} <Video
></View> ref={video}
style={{ width: "100%", height: (width * 9) / 16 - 16 }}
source={{
uri: `https://dnvn.ir/api/v1/file/${data.fileIds}`,
}}
useNativeControls
resizeMode="cover"
// onFullscreenUpdate={setOrientation}
isLooping
onPlaybackStatusUpdate={(status) => setStatus(() => status)}
/>
</View>
</View> </View>
); );
} }

@ -1,11 +1,11 @@
import React from "react"; import React from "react";
import { View, Text, Dimensions } from "react-native"; import { View, Text, Dimensions } from "react-native";
import tw from "tailwind-rn"; import tw from "tailwind-rn";
// import MusicPlayer from "../../../components/MusicPlayer"; import MusicPlayer from "../../../components/MusicPlayer";
const { width } = Dimensions.get("window"); const { width } = Dimensions.get("window");
export default function Voice({ name, file }) { export default function Voice({ data }) {
return ( return (
<View style={tw("w-full flex-col rounded-md bg-green-200 py-3 px-2 mt-4")}> <View style={tw("w-full flex-col rounded-md bg-green-200 py-3 px-2 mt-4")}>
<Text <Text
@ -14,9 +14,9 @@ export default function Voice({ name, file }) {
{ fontSize: width / 34, fontFamily: "regular" }, { fontSize: width / 34, fontFamily: "regular" },
]} ]}
> >
{name} {data.name}
</Text> </Text>
{/* <MusicPlayer /> */} <MusicPlayer fileIds={data.fileIds} />
</View> </View>
); );
} }

@ -6,7 +6,7 @@ import Colors from "../../../constants/Colors";
const { width} = Dimensions.get("window"); const { width} = Dimensions.get("window");
export default function Content({ data }) { export default function Content({ data, grades }) {
return ( return (
<View style={tw("flex-1 flex flex-col px-4 pb-20")}> <View style={tw("flex-1 flex flex-col px-4 pb-20")}>
<View style={tw("flex flex-1 flex-col")}> <View style={tw("flex flex-1 flex-col")}>
@ -24,7 +24,7 @@ export default function Content({ data }) {
color: Colors.theme1.light.blue6, color: Colors.theme1.light.blue6,
}} }}
> >
{data.name} {data.book.name}
</Text> </Text>
<Text <Text
style={[ style={[
@ -36,7 +36,7 @@ export default function Content({ data }) {
}, },
]} ]}
> >
{data.grade} { 'پایه' + ' ' + grades[data.book.gradeId]}
</Text> </Text>
<Text <Text
style={[ style={[
@ -47,18 +47,18 @@ export default function Content({ data }) {
color: Colors.theme1.light.blue5, color: Colors.theme1.light.blue5,
}, },
]} ]}
>{`شما در حال مشاهده صفحه ${data.page} هستید.`}</Text> >{`شما در حال مشاهده صفحه ${data.qr.pageNumber} هستید.`}</Text>
</View> </View>
</View> </View>
</View> </View>
</View> </View>
<Tab <Tab
data={{ data={{
voice: data.voice, voice: data.qr.content.filter((obj) => obj.type === 'voice')[0],
video: data.video, video: data.qr.content.filter((obj) => obj.type === 'video')[0],
pdf: data.pdf, pdf: data.qr.content.filter((obj) => obj.type === 'pdf')[0],
ppt: data.ppt, ppt: data.qr.content.filter((obj) => obj.type === 'ppt')[0],
links: data.links, links: data.qr.content.filter((obj) => obj.type === 'links')[0],
}} }}
/> />
</View> </View>

@ -14,6 +14,7 @@ const { width} = Dimensions.get("window");
export default function Tab({ data }) { export default function Tab({ data }) {
const [dataType, setDataType] = useState("all"); const [dataType, setDataType] = useState("all");
console.log(data);
return ( return (
<View <View
style={[ style={[
@ -188,20 +189,20 @@ export default function Tab({ data }) {
{dataType === "all" && ( {dataType === "all" && (
<> <>
{data.voice && ( {data.voice && (
<Voice name={data.voice.name} file={data.voice.file} /> <Voice data={data.voice} />
)} )}
{data.video && ( {data.video && (
<Video name={data.video.name} file={data.voice.file} /> <Video data={data.video} />
)} )}
{data.ppt && <PPT name={data.ppt.name} file={data.ppt.file} />} {data.ppt && <PPT data={data.ppt} />}
{data.pdf && <PDF name={data.ppt.name} file={data.ppt.file} />} {data.pdf && <PDF data={data.pdf} />}
{data.links && <Links links={data.links} />} {data.links && <Links data={data.links} />}
</> </>
)} )}
{dataType === "voice" && ( {dataType === "voice" && (
<> <>
{data.voice ? ( {data.voice ? (
<Voice name={data.voice.name} file={data.voice.file} /> <Voice data={data.voice} />
) : ( ) : (
<Text <Text
style={{ style={{
@ -218,7 +219,7 @@ export default function Tab({ data }) {
{dataType === "video" && ( {dataType === "video" && (
<> <>
{data.video ? ( {data.video ? (
<Video name={data.video.name} file={data.voice.file} /> <Video data={data.video} />
) : ( ) : (
<Text <Text
style={{ style={{
@ -235,7 +236,7 @@ export default function Tab({ data }) {
{dataType === "ppt" && ( {dataType === "ppt" && (
<> <>
{data.ppt ? ( {data.ppt ? (
<PPT name={data.ppt.name} file={data.ppt.file} /> <PPT data={data.ppt} />
) : ( ) : (
<Text <Text
style={{ style={{
@ -252,7 +253,7 @@ export default function Tab({ data }) {
{dataType === "pdf" && ( {dataType === "pdf" && (
<> <>
{data.pdf ? ( {data.pdf ? (
<PDF name={data.pdf.name} file={data.pdf.file} /> <PDF data={data.pdf} />
) : ( ) : (
<Text <Text
style={{ style={{
@ -269,7 +270,7 @@ export default function Tab({ data }) {
{dataType === "links" && ( {dataType === "links" && (
<> <>
{data.links ? ( {data.links ? (
<Links name={data.links.name} links={data.links} /> <Links data={data.links} />
) : ( ) : (
<Text <Text
style={{ style={{

@ -6,65 +6,58 @@ import {
Dimensions, Dimensions,
StatusBar, StatusBar,
} from "react-native"; } from "react-native";
import tw from 'tailwind-rn';
import { connect } from "react-redux"; import { connect } from "react-redux";
import {qr} from '../../redux/actions' import { qr } from "../../redux/actions";
import Content from "./Content"; import Content from "./Content";
import Navbar from "../../components/Navbar"; import Navbar from "../../components/Navbar";
function QRContent({ route, getQrData, data }) { const {height} = Dimensions.get("window");
function QRContent({ route, getQrData, data, grades }) {
useEffect(() => { useEffect(() => {
getQrData({tail : 'zist10_14'}); getQrData({ tail: "zist10-17" });
}, []); }, []);
useEffect(() => { useEffect(() => {
console.log(data); if (data) {
// console.log(data.qr.content);
}
}, [data]); }, [data]);
return ( return (
<SafeAreaView <SafeAreaView
style={{ style={{
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
height: height,
backgroundColor: 'white'
}} }}
> >
<Navbar <Navbar
headerOptions={{ headerOptions={{
logo: false, logo: false,
menu: true, menu: false,
hamburgerMenu: false, hamburgerMenu: false,
title: "", title: "",
bookmark: true, bookmark: false,
qr: false, qr: false,
back: true, back: true,
}} }}
/> />
<ScrollView <ScrollView
contentContainerStyle={styles.contentContainerStyle}
style={styles.container}
> >
<Content /> {data && <Content data={data} grades={grades} />}
</ScrollView> </ScrollView>
</SafeAreaView> </SafeAreaView>
); );
} }
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
data : state.qr.list data: state.qr.list,
grades : state.publicApi.grades
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
getQrData : qr.info getQrData: qr.info,
} };
export default connect(mapStateToProps, mapDispatchToProps)(QRContent); export default connect(mapStateToProps, mapDispatchToProps)(QRContent);
const styles = StyleSheet.create({
contentContainerStyle: {
paddingBottom: 0,
},
container: {
width: Dimensions.get("window").width,
backgroundColor: "white",
flexDirection: "column",
paddingVertical: 5,
paddingHorizontal: 0,
},
});

@ -0,0 +1,12 @@
import { View, Text } from 'react-native';
import React from 'react';
const Tests = () => {
return (
<View>
<Text></Text>
</View>
);
};
export default Tests;

@ -50,11 +50,11 @@ function Product({
headerOptions={{ headerOptions={{
logo: true, logo: true,
menu: false, menu: false,
hamburgerMenu: true, hamburgerMenu: false,
title: "", title: "",
bookmark: false, bookmark: false,
qr: true, qr: true,
back: false, back: true,
}} }}
/> />
<Drawer setBoxPosition={setBoxPosition} position={position} /> <Drawer setBoxPosition={setBoxPosition} position={position} />

@ -4116,7 +4116,7 @@ lodash.topath@^4.5.2:
resolved "https://registry.yarnpkg.com/lodash.topath/-/lodash.topath-4.5.2.tgz#3616351f3bba61994a0931989660bd03254fd009" resolved "https://registry.yarnpkg.com/lodash.topath/-/lodash.topath-4.5.2.tgz#3616351f3bba61994a0931989660bd03254fd009"
integrity sha1-NhY1Hzu6YZlKCTGYlmC9AyVP0Ak= integrity sha1-NhY1Hzu6YZlKCTGYlmC9AyVP0Ak=
lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.21: lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.21, lodash@^4.17.4:
version "4.17.21" version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
@ -5249,6 +5249,14 @@ react-native-codegen@^0.0.6:
jscodeshift "^0.11.0" jscodeshift "^0.11.0"
nullthrows "^1.1.1" nullthrows "^1.1.1"
react-native-openanything@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/react-native-openanything/-/react-native-openanything-0.0.6.tgz#7b694a28ce6de0363d46474ab3c72f5c0d14e658"
integrity sha512-ZFTYFFPH5j0VNpZDxd7jlaFz8qz1NMgXaHPioynAErk3CWyj6y261H1R06+nyoq7i0tJFKJXhuQzUrNemwcelQ==
dependencies:
lodash "^4.17.4"
prop-types "^15.6.0"
react-native-permissions@^2.0.2: react-native-permissions@^2.0.2:
version "2.2.2" version "2.2.2"
resolved "https://registry.yarnpkg.com/react-native-permissions/-/react-native-permissions-2.2.2.tgz#3d2a63f6b7d6be52fc86e30f77412a9566283028" resolved "https://registry.yarnpkg.com/react-native-permissions/-/react-native-permissions-2.2.2.tgz#3d2a63f6b7d6be52fc86e30f77412a9566283028"

Loading…
Cancel
Save