From 95032a3d3806f55b59745368141464fa06da6715 Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Mon, 14 Mar 2022 12:29:26 +0330 Subject: [PATCH] reza added blog --- navigation/vuesax-linear-bag-2.svg | 11 - .../BottomSheetComponents/ProductQuestion.js | 2 +- .../BottomSheetComponents/ProductReview.js | 2 +- src/components/Drawer.js | 8 +- src/components/Header.js | 2 +- src/components/Redirect.js | 2 +- src/screens/AR/components/Book.js | 9 +- src/screens/Activation/index.js | 6 +- src/screens/Address/index.js | 4 +- src/screens/Blog/index.js | 221 +++++++++++++++++- src/screens/Blogs/layouts/Hashtags.js | 29 +-- src/screens/Blogs/layouts/New.js | 14 +- src/screens/Blogs/layouts/Single.js | 19 +- src/screens/Blogs/layouts/Target.js | 36 +-- src/screens/Contact/Box.js | 2 +- src/screens/Contact/index.js | 2 +- src/screens/DeliveryForm/Address/index.js | 4 +- .../DeliveryForm/TransportDate/index.js | 2 +- .../DeliveryForm/TransportMethod/index.js | 2 +- src/screens/DeliveryForm/index.js | 2 +- src/screens/Faq/components/Instance.js | 2 +- src/screens/Faq/index.js | 2 +- src/screens/Home/components/Blogs.js | 11 +- src/screens/Home/components/MyBooks.js | 4 +- src/screens/Home/components/Scroll.js | 4 +- src/screens/Home/components/Videos.js | 4 +- src/screens/Login/index.js | 2 +- src/screens/OrderDetails/components/Book.js | 2 +- src/screens/OrderDetails/index.js | 4 +- .../OrdersFollowUp/components/Order.js | 6 +- src/screens/Product/components/Book.js | 8 +- src/screens/Product/components/Comments.js | 2 +- src/screens/Product/components/Description.js | 2 +- src/screens/Product/components/Rates.js | 4 +- src/screens/Products/components/Header.js | 2 +- src/screens/Products/components/Main.js | 2 +- src/screens/Profile/components/List.js | 2 +- .../components/ProfileAddress/index.js | 8 +- .../components/ProfileBookmark/index.js | 4 +- src/screens/Profile/components/User.js | 6 +- src/screens/QR/Scan/index.js | 2 +- src/screens/QRContent/Content/Links.js | 2 +- src/screens/QRContent/Content/Video.js | 4 +- src/screens/QRContent/Content/Voice.js | 2 +- src/screens/QRContent/Content/index.js | 6 +- src/screens/QRContent/Tab/index.js | 4 +- src/screens/ShoppingCart/components/Code.js | 2 +- .../ShoppingCart/components/Product.js | 6 +- src/screens/ShoppingCart/index.js | 2 +- src/screens/Video/components/Season.js | 6 +- src/screens/Video/index.js | 8 +- .../VideoDisplay/components/Season/index.js | 4 +- src/screens/VideoDisplay/index.js | 4 +- .../Videos/components/MostViewedVideo.js | 4 +- src/screens/Videos/components/NewestVideo.js | 4 +- .../Videos/components/VerticalGradeFilter.js | 2 +- 56 files changed, 362 insertions(+), 160 deletions(-) delete mode 100644 navigation/vuesax-linear-bag-2.svg diff --git a/navigation/vuesax-linear-bag-2.svg b/navigation/vuesax-linear-bag-2.svg deleted file mode 100644 index ab526a0..0000000 --- a/navigation/vuesax-linear-bag-2.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/src/components/BottomSheetComponents/ProductQuestion.js b/src/components/BottomSheetComponents/ProductQuestion.js index d2b350d..95b6f70 100644 --- a/src/components/BottomSheetComponents/ProductQuestion.js +++ b/src/components/BottomSheetComponents/ProductQuestion.js @@ -22,7 +22,7 @@ const ProductQuestion = ({ list, mobile }) => { const colorScheme = Appearance.getColorScheme(); const Question = ({ question }) => { return ( - + { const colorScheme = Appearance.getColorScheme(); const Property = ({ question }) => { return ( - + refRBSheet.current.open()} style={[ diff --git a/src/components/Drawer.js b/src/components/Drawer.js index 1f2ce31..d36372c 100644 --- a/src/components/Drawer.js +++ b/src/components/Drawer.js @@ -134,10 +134,10 @@ const Drawer = ({ position, setBoxPosition, user, mobile }) => { ), ]} > - + @@ -166,7 +166,7 @@ const Drawer = ({ position, setBoxPosition, user, mobile }) => { "flex flex-row-reverse w-full justify-between px-2 pb-3 mt-2" )} > - + { - + {routes.map((route, index) => ( ))} diff --git a/src/components/Header.js b/src/components/Header.js index 766e6cc..da5ba75 100644 --- a/src/components/Header.js +++ b/src/components/Header.js @@ -9,7 +9,7 @@ function Header({ title, description, background }) { return ( diff --git a/src/components/Redirect.js b/src/components/Redirect.js index e9705f6..cbadc71 100644 --- a/src/components/Redirect.js +++ b/src/components/Redirect.js @@ -14,7 +14,7 @@ export default function Redirect({ text }) { { backgroundColor: "#196EC0" }, ]} > - + { return ( Linking.openURL(`https://ar.dnvn.ir/lunch?id=${book.id}`)} > diff --git a/src/screens/Activation/index.js b/src/screens/Activation/index.js index 1b07d56..5f9c1d5 100644 --- a/src/screens/Activation/index.js +++ b/src/screens/Activation/index.js @@ -44,7 +44,7 @@ function Activation({ add, mobile }) { @@ -61,7 +61,7 @@ function Activation({ add, mobile }) { backgroundColor: "#E9F0F7", }} /> - + - + { return ( - + - + {/* */}
{ + const colorScheme = Appearance.getColorScheme(); + + useEffect(() => { + getInfo({ id: route.params.id }); + if (blogs.length === 0) { + getList(); + } + }, []); -function Blog({}) { return ( - - - - ) -} + + + + + + + + + + + + + + {"نوشته از:" + " " + "کامران ایزدی"} + + + {"سردبیر بخش وبلاگ دانوین"} + + + + + + {"زمان مطالعه" + " " + "۳۰ دقیقه"} + + + {"1400/11/24"} + + + + + + + + + {blog?.title} + + {blog?.text && ( + reza", textAlign: "right" }} + containerStyle={{ + textAlign: "right", + fontSize: fontSize.base, + display: "flex", + flex: 1, + justifyContent: "center", + alignItems: "center", + }} + /> + )} + +
+ } + keyExtractor={(item) => item.id} + /> + + + + ); +}; + +const mapStateToProps = (state) => ({ + blog: state.blog.blog, + blogs: state.blog.list, +}); + +const mapDispatchToProps = { + getInfo: blog.info, + getList: blog.list, + setHeaderOptions: publicApi.setHeaderOptions, +}; + +export default connect(mapStateToProps, mapDispatchToProps)(Blog); -export default Blog; +const styles = StyleSheet.create({ + contentContainerStyle: { + paddingBottom: 100, + }, + container: { + backgroundColor: "white", + paddingVertical: 0, + paddingHorizontal: 0, + }, +}); diff --git a/src/screens/Blogs/layouts/Hashtags.js b/src/screens/Blogs/layouts/Hashtags.js index 08900ba..e6685fe 100644 --- a/src/screens/Blogs/layouts/Hashtags.js +++ b/src/screens/Blogs/layouts/Hashtags.js @@ -10,20 +10,6 @@ import Colors from "../../../constants/Colors"; export const Hashtags = ({ hashtags }) => { const colorScheme = Appearance.getColorScheme(); - const Hashtag = ({ hashtag }) => { - return ( - - {"#" + " " + hashtag.title} - - ); - }; return ( { ); }; +const Hashtag = ({ hashtag }) => { + return ( + + {"#" + " " + hashtag.title} + + ); +}; + const mapStateToProps = (state) => ({ hashtags: state.blog.hashtags, }); diff --git a/src/screens/Blogs/layouts/New.js b/src/screens/Blogs/layouts/New.js index 2fc80d1..40711db 100644 --- a/src/screens/Blogs/layouts/New.js +++ b/src/screens/Blogs/layouts/New.js @@ -8,7 +8,6 @@ import { Appearance, Platform, } from "react-native"; -import { connect } from "react-redux"; import { useNavigation } from "@react-navigation/native"; //style @@ -16,7 +15,7 @@ import tw from "tailwind-rn"; import fontSize from "../../../constants/fontSize"; import Colors from "../../../constants/Colors"; -const { height, width } = Dimensions.get("window"); +const { width } = Dimensions.get("window"); const ios = Platform.OS === "ios"; export const New = ({ blog }) => { @@ -25,7 +24,7 @@ export const New = ({ blog }) => { return ( { > { { const colorScheme = Appearance.getColorScheme(); return ( navigation.push("Blog", { id: blog?.id })} > @@ -45,7 +46,7 @@ export const Single = ({ blog }) => { start={{ x: 0.0, y: 0.0 }} end={{ x: 0.0, y: 1.1 }} style={tw( - "flex flex-col justify-end absolute top-0 left-0 z-10 w-full h-full pb-2 px-2" + "flex justify-end absolute top-0 left-0 z-10 w-full h-full pb-2 px-2" )} > @@ -56,7 +57,7 @@ export const Single = ({ blog }) => { tw("rounded-full ml-1"), ]} > - + { - + { - - + + { { const colorScheme = Appearance.getColorScheme(); const Large = ({ blog }) => { return ( - + navigation.push("Blog", { id: blog?.id })} + > @@ -48,7 +52,7 @@ const Target = ({ blogs }) => { tw("my-3"), { fontFamily: "bold", - fontSize: fontSize.xl, + fontSize: fontSize.lg, textAlign: ios ? "right" : "auto", }, ]} @@ -64,9 +68,7 @@ const Target = ({ blogs }) => { ]} > { - + { const Small = ({ blog }) => { return ( - + navigation.push("Blog", { id: blog?.id })} + > - + { ); }; return ( - + {blogs?.slice(1, 3).map((blog, index) => ( diff --git a/src/screens/Contact/Box.js b/src/screens/Contact/Box.js index 693c341..fff2170 100644 --- a/src/screens/Contact/Box.js +++ b/src/screens/Contact/Box.js @@ -28,7 +28,7 @@ const Box = ({ info, mobile }) => { source={info.icon} style={{ width: mobile ? 40 : 55, height: mobile ? 40 : 55 }} /> - + - + {Object.keys(info).map((item, index) => ( ))} diff --git a/src/screens/DeliveryForm/Address/index.js b/src/screens/DeliveryForm/Address/index.js index 21c35f1..3e593be 100644 --- a/src/screens/DeliveryForm/Address/index.js +++ b/src/screens/DeliveryForm/Address/index.js @@ -70,7 +70,7 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile }) ]} > )} - + - + {addresses.map((address, index) => ( { > زمان ارسال را انتخاب کنید. - + {transportDate?.times?.map((time, index) => ( - + {list?.map((method, index) => ( - +
diff --git a/src/screens/Faq/components/Instance.js b/src/screens/Faq/components/Instance.js index 95b59e6..cb663c1 100644 --- a/src/screens/Faq/components/Instance.js +++ b/src/screens/Faq/components/Instance.js @@ -21,7 +21,7 @@ function Instance({ question, selectFaq, mobile }) { onPress={() => selectFaq(question.id)} style={[ tw( - `w-full flex flex-col my-1.5 rounded-md px-4 ${ + `w-full flex my-1.5 rounded-md px-4 ${ mobile ? "py-2" : "py-3" }` ), diff --git a/src/screens/Faq/index.js b/src/screens/Faq/index.js index d06cf09..0374dc4 100644 --- a/src/screens/Faq/index.js +++ b/src/screens/Faq/index.js @@ -61,7 +61,7 @@ function Faq({ list, getFaq, searchResult, search, selectFaq, searchFaq }) { /> {!search ? list.length > 0 && diff --git a/src/screens/Home/components/Blogs.js b/src/screens/Home/components/Blogs.js index 72797e7..6b9e98e 100644 --- a/src/screens/Home/components/Blogs.js +++ b/src/screens/Home/components/Blogs.js @@ -11,7 +11,7 @@ import { Platform, } from "react-native"; import { connect } from "react-redux"; -import Svg, { G, Path } from "react-native-svg"; +import { useNavigation} from '@react-navigation/native'; //components import Header from "../components/Header"; @@ -29,7 +29,7 @@ const ios = Platform.OS === "ios"; function Blogs({ blogs, mobile }) { return ( - +
@@ -41,6 +41,7 @@ function Blogs({ blogs, mobile }) { data={blogs} renderItem={({ item }) => } keyExtractor={(item) => item.id} + initialNumToRender={5} /> ); @@ -48,13 +49,15 @@ function Blogs({ blogs, mobile }) { const Blog = ({ blog, mobile }) => { const colorScheme = Appearance.getColorScheme(); + const navigation = useNavigation(); + return ( navigation.navigate('Product')} + onPress={() => navigation.push("Blog", { id: blog?.id })} > { {}} > @@ -77,7 +77,7 @@ function MyBooks({ books, grades }) { +
@@ -52,7 +52,7 @@ const Video = ({ video, mobile, grades }) => { return ( navigation.navigate("Video", { id: video.id })} diff --git a/src/screens/Login/index.js b/src/screens/Login/index.js index aaf1b97..67e3972 100644 --- a/src/screens/Login/index.js +++ b/src/screens/Login/index.js @@ -56,7 +56,7 @@ function Login(props) { behavior={ios ? "padding" : "height"} style={[ tw( - `flex flex-col flex-1 justify-center items-center bg-white px-4 relative` + `flex flex-1 justify-center items-center bg-white px-4 relative` ), ]} > diff --git a/src/screens/OrderDetails/components/Book.js b/src/screens/OrderDetails/components/Book.js index b600e64..0456d3e 100644 --- a/src/screens/OrderDetails/components/Book.js +++ b/src/screens/OrderDetails/components/Book.js @@ -33,7 +33,7 @@ function Book({ book, mobile }) { }, ]} /> - + @@ -238,7 +238,7 @@ function OrderDetails({ order, mobile }) { این کد را پس از دریافت کالا، به مامور ارسال دانوین اعلام فرمایید - + {order.items.map((item, index) => ( ))} diff --git a/src/screens/OrdersFollowUp/components/Order.js b/src/screens/OrdersFollowUp/components/Order.js index e5f6163..b5b374e 100644 --- a/src/screens/OrdersFollowUp/components/Order.js +++ b/src/screens/OrdersFollowUp/components/Order.js @@ -40,7 +40,7 @@ function Order({ order, mobile }) { return ( - + {order.items.length < 2 ? order?.items?.map((item, index) => ( @@ -139,7 +139,7 @@ function Order({ order, mobile }) { - + + {!mobile && } {pageLoading && ( - + - + { return ( diff --git a/src/screens/Product/components/Description.js b/src/screens/Product/components/Description.js index 3b12fa8..58ea9a0 100644 --- a/src/screens/Product/components/Description.js +++ b/src/screens/Product/components/Description.js @@ -11,7 +11,7 @@ export default function Description({ description }) { return ( diff --git a/src/screens/Product/components/Rates.js b/src/screens/Product/components/Rates.js index 199b8a5..0374e38 100644 --- a/src/screens/Product/components/Rates.js +++ b/src/screens/Product/components/Rates.js @@ -10,7 +10,7 @@ export default function Rates({ rates }) { @@ -31,7 +31,7 @@ export default function Rates({ rates }) { {"از" + " " + rates.allRates + " " + "نفر"} - + {rates.fields.map((field, index) => ( ))} diff --git a/src/screens/Products/components/Header.js b/src/screens/Products/components/Header.js index 6bb0bf7..bf88f95 100644 --- a/src/screens/Products/components/Header.js +++ b/src/screens/Products/components/Header.js @@ -13,7 +13,7 @@ import Select from "../../../components/Select"; const Header = ({ setFilterOptions, filterOptions, levels, productTypes }) => { return ( - + setFilterOptions({ ...filterOptions, search: val })} placeholder={"نام کتاب یا دوره را جستجو کنید"} diff --git a/src/screens/Products/components/Main.js b/src/screens/Products/components/Main.js index f3a53ae..bc14ca0 100644 --- a/src/screens/Products/components/Main.js +++ b/src/screens/Products/components/Main.js @@ -79,7 +79,7 @@ const Main = ({ books, filterOptions, grades, mobile }) => { borderWidth: 1, borderColor: Colors.theme1[colorScheme].grayE3, }, - tw(`flex flex-col mb-5 p-2 rounded-md ${mobile ? "w-full" : ""}`), + tw(`flex mb-5 p-2 rounded-md ${mobile ? "w-full" : ""}`), ]} key={index} onPress={() => navigation.navigate("Video", { id: product.id })} diff --git a/src/screens/Profile/components/List.js b/src/screens/Profile/components/List.js index 6f4a7d1..94e815f 100644 --- a/src/screens/Profile/components/List.js +++ b/src/screens/Profile/components/List.js @@ -203,7 +203,7 @@ const List = ({ mobile }) => { return ( {pages.map((page, index) => ( diff --git a/src/screens/Profile/components/ProfileAddress/index.js b/src/screens/Profile/components/ProfileAddress/index.js index 1866234..7410078 100644 --- a/src/screens/Profile/components/ProfileAddress/index.js +++ b/src/screens/Profile/components/ProfileAddress/index.js @@ -69,7 +69,7 @@ const ProfileAddress = ({ : update({ userAddressId: address.id, userId }) } > - + {active && ( - + setHeight(Dimensions.get("window").height)} > - + {addresses.map((address, index) => ( { minHeight: (80 * 4) / 2.7, }} /> - + { style={styles.container} > - + {bookmarkList.map((bookmark, index) => ( ))} diff --git a/src/screens/Profile/components/User.js b/src/screens/Profile/components/User.js index 04c87dd..5161651 100644 --- a/src/screens/Profile/components/User.js +++ b/src/screens/Profile/components/User.js @@ -21,7 +21,7 @@ const User = ({ user, mobile }) => { const colorScheme = Appearance.getColorScheme(); const [dropdown, setDropdown] = React.useState(true); return ( - + { ]} > )} - + { {dropdown && ( diff --git a/src/screens/QRContent/Content/Links.js b/src/screens/QRContent/Content/Links.js index 51ff79a..b1b99de 100644 --- a/src/screens/QRContent/Content/Links.js +++ b/src/screens/QRContent/Content/Links.js @@ -12,7 +12,7 @@ export default function Links({ links }) { "w-full flex-row-reverse justify-between items-center rounded-md bg-yellow-100 py-3 px-2 mt-5" )} > - + لینک ها diff --git a/src/screens/QRContent/Content/Video.js b/src/screens/QRContent/Content/Video.js index bf7fc4f..4ce438a 100644 --- a/src/screens/QRContent/Content/Video.js +++ b/src/screens/QRContent/Content/Video.js @@ -9,7 +9,7 @@ export default function VideoContent({ data }) { const [status, setStatus] = React.useState({}); const video = React.useRef(null); return ( - + {'موضوع:' + ' ' + data.name} - +