master
Reza_ashrafi 3 years ago
parent ad57dd813a
commit 0ecaab0b08
  1. 2
      src/screens/QRContent/Content/Links.js
  2. 4
      src/screens/QRContent/Content/PDF.js
  3. 4
      src/screens/QRContent/Content/Video.js
  4. 4
      src/screens/QRContent/Content/Voice.js
  5. 16
      src/screens/QRContent/Content/index.js
  6. 30
      src/screens/QRContent/Tab/index.js
  7. 2
      src/screens/QRContent/index.js
  8. 10
      src/screens/ShoppingCart/index.js

@ -29,7 +29,7 @@ export default function Links({ links }) {
> >
لینک ها لینک ها
</Text> </Text>
{links.map((link, i) => ( {links?.map((link, i) => (
<Pressable style={tw("mt-1")} key={i}> <Pressable style={tw("mt-1")} key={i}>
<Text style={{ fontSize: width / 34, fontFamily: "light" }}> <Text style={{ fontSize: width / 34, fontFamily: "light" }}>
{link} {link}

@ -19,7 +19,7 @@ export default function PDF({ data }) {
"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={() => onPress={() =>
OpenAnything.Pdf(`https://dnvn.ir/api/v1/file/${data.fileIds}`) OpenAnything.Pdf(`https://dnvn.ir/api/v1/file/${data?.fileIds}`)
} }
> >
<Text <Text
@ -34,7 +34,7 @@ export default function PDF({ data }) {
, ,
]} ]}
> >
{data.name} {data?.name}
</Text> </Text>
<Image source={pdfIcon} style={{ width: 40, height: 40 }} /> <Image source={pdfIcon} style={{ width: 40, height: 40 }} />
</TouchableOpacity> </TouchableOpacity>

@ -25,14 +25,14 @@ export default function VideoContent({ data, theme }) {
}, },
]} ]}
> >
{"موضوع:" + " " + data.name} {"موضوع:" + " " + data?.name}
</Text> </Text>
<View style={tw("flex ")}> <View style={tw("flex ")}>
<Video <Video
ref={video} ref={video}
style={{ width: "100%", height: (width * 9) / 16 - 16 }} style={{ width: "100%", height: (width * 9) / 16 - 16 }}
source={{ source={{
uri: `https://dnvn.ir/api/v1/file/${data.fileIds}`, uri: `https://dnvn.ir/api/v1/file/${data?.fileIds}`,
}} }}
useNativeControls useNativeControls
resizeMode="cover" resizeMode="cover"

@ -27,9 +27,9 @@ export default function Voice({ data }) {
, ,
]} ]}
> >
{data.name} {data?.name}
</Text> </Text>
<MusicPlayer fileIds={data.fileIds} /> <MusicPlayer fileIds={data?.fileIds} />
</View> </View>
); );
} }

@ -32,7 +32,7 @@ export default function Content({ data, grades, theme }) {
textAlign: "right", textAlign: "right",
}} }}
> >
{data.book.name} {data?.book?.name}
</Text> </Text>
<Text <Text
style={[ style={[
@ -45,7 +45,7 @@ export default function Content({ data, grades, theme }) {
}, },
]} ]}
> >
{"پایه" + " " + grades[data.book.gradeId]} {"پایه" + " " + grades[data?.book?.gradeId]}
</Text> </Text>
<Text <Text
style={[ style={[
@ -57,18 +57,18 @@ export default function Content({ data, grades, theme }) {
textAlign: "right", textAlign: "right",
}, },
]} ]}
>{`شما در حال مشاهده صفحه ${data.qr.pageNumber} هستید.`}</Text> >{`شما در حال مشاهده صفحه ${data?.qr?.pageNumber} هستید.`}</Text>
</View> </View>
</View> </View>
</View> </View>
</View> </View>
<Tab <Tab
data={{ data={{
voice: data.qr.content.filter((obj) => obj.type === "voice")[0], voice: data?.qr?.content?.filter((obj) => obj?.type === "voice")[0],
video: data.qr.content.filter((obj) => obj.type === "video")[0], video: data?.qr?.content?.filter((obj) => obj?.type === "video")[0],
pdf: data.qr.content.filter((obj) => obj.type === "pdf")[0], pdf: data?.qr?.content?.filter((obj) => obj?.type === "pdf")[0],
ppt: data.qr.content.filter((obj) => obj.type === "ppt")[0], ppt: data?.qr?.content?.filter((obj) => obj?.type === "ppt")[0],
links: data.qr.content.filter((obj) => obj.type === "links")[0], links: data?.qr?.content?.filter((obj) => obj?.type === "links")[0],
}} }}
theme={theme} theme={theme}
/> />

@ -227,17 +227,17 @@ function Tab({ data, theme }) {
<View style={tw("flex w-full p-4")}> <View style={tw("flex w-full p-4")}>
{dataType === "all" ? ( {dataType === "all" ? (
<> <>
{data.voice ? <Voice data={data.voice} theme={theme} /> : null} {data?.voice ? <Voice data={data?.voice} theme={theme} /> : null}
{data.video ? <Video data={data.video} theme={theme} /> : null} {data?.video ? <Video data={data?.video} theme={theme} /> : null}
{data.ppt ? <PPT data={data.ppt} theme={theme} /> : null} {data?.ppt ? <PPT data={data?.ppt} theme={theme} /> : null}
{data.pdf ? <PDF data={data.pdf} theme={theme} /> : null} {data?.pdf ? <PDF data={data?.pdf} theme={theme} /> : null}
{data.links ? <Links data={data.links} theme={theme} /> : null} {data?.links ? <Links data={data?.links} theme={theme} /> : null}
</> </>
) : null} ) : null}
{dataType === "voice" ? ( {dataType === "voice" ? (
<> <>
{data.voice ? ( {data?.voice ? (
<Voice data={data.voice} theme={theme} /> <Voice data={data?.voice} theme={theme} />
) : ( ) : (
<Text <Text
style={{ style={{
@ -254,8 +254,8 @@ function Tab({ data, theme }) {
) : null} ) : null}
{dataType === "video" ? ( {dataType === "video" ? (
<> <>
{data.video ? ( {data?.video ? (
<Video data={data.video} theme={theme} /> <Video data={data?.video} theme={theme} />
) : ( ) : (
<Text <Text
style={{ style={{
@ -272,8 +272,8 @@ function Tab({ data, theme }) {
) : null} ) : null}
{dataType === "ppt" ? ( {dataType === "ppt" ? (
<> <>
{data.ppt ? ( {data?.ppt ? (
<PPT data={data.ppt} theme={theme} /> <PPT data={data?.ppt} theme={theme} />
) : ( ) : (
<Text <Text
style={{ style={{
@ -290,8 +290,8 @@ function Tab({ data, theme }) {
) : null} ) : null}
{dataType === "pdf" ? ( {dataType === "pdf" ? (
<> <>
{data.pdf ? ( {data?.pdf ? (
<PDF data={data.pdf} theme={theme} /> <PDF data={data?.pdf} theme={theme} />
) : ( ) : (
<Text <Text
style={{ style={{
@ -308,8 +308,8 @@ function Tab({ data, theme }) {
) : null} ) : null}
{dataType === "links" ? ( {dataType === "links" ? (
<> <>
{data.links ? ( {data?.links ? (
<Links data={data.links} theme={theme} /> <Links data={data?.links} theme={theme} />
) : ( ) : (
<Text <Text
style={{ style={{

@ -18,7 +18,7 @@ const {height} = Dimensions.get("window");
function QRContent({ route, getQrData, data, grades, theme }) { function QRContent({ route, getQrData, data, grades, theme }) {
useEffect(() => { useEffect(() => {
getQrData({ tail: route.params.data }); getQrData({ tail: route?.params?.data });
}, []); }, []);
return ( return (

@ -102,14 +102,14 @@ function ShoppingCart({
const [position, setPosition] = useState("100%"); const [position, setPosition] = useState("100%");
const isEmpty = React.useMemo(() => { const isEmpty = React.useMemo(() => {
return list.filter((product) => product.condition < 2).length === 0; return list?.filter((product) => product?.condition < 2)?.length === 0;
}, [list]); }, [list]);
const hasPhysical = React.useMemo(() => { const hasPhysical = React.useMemo(() => {
return ( return (
list.filter( list?.filter(
(product) => product.condition < 2 && product.productType === 2 (product) => product?.condition < 2 && product?.productType === 2
).length !== 0 )?.length !== 0
); );
}, [list]); }, [list]);
@ -152,7 +152,7 @@ function ShoppingCart({
{list {list
?.sort((a, b) => a?.id - b?.id) ?.sort((a, b) => a?.id - b?.id)
?.map((product, index) => ?.map((product, index) =>
product.condition < 2 ? ( product?.condition < 2 ? (
<Product key={index} product={product} loading={loading} /> <Product key={index} product={product} loading={loading} />
) : null ) : null
)} )}

Loading…
Cancel
Save