master
Reza_ashrafi 2 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>
{links.map((link, i) => (
{links?.map((link, i) => (
<Pressable style={tw("mt-1")} key={i}>
<Text style={{ fontSize: width / 34, fontFamily: "light" }}>
{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"
)}
onPress={() =>
OpenAnything.Pdf(`https://dnvn.ir/api/v1/file/${data.fileIds}`)
OpenAnything.Pdf(`https://dnvn.ir/api/v1/file/${data?.fileIds}`)
}
>
<Text
@ -34,7 +34,7 @@ export default function PDF({ data }) {
,
]}
>
{data.name}
{data?.name}
</Text>
<Image source={pdfIcon} style={{ width: 40, height: 40 }} />
</TouchableOpacity>

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

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

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

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

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

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

Loading…
Cancel
Save