diff --git a/src/App.tsx b/src/App.tsx index 195debd..9fb10b9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -9,7 +9,7 @@ import CommonPage from "./screens/CommonPage/CommonPage"; export default function App() { let [fontsLoading] = useFonts({ - 'SF Pro Text': require('./assets/fonts/SF-Pro.ttf') + 'SF Pro Text': require('./assets/fonts/SF-Pro-Text-Regular.otf') }) if (!fontsLoading) return Loading... diff --git a/src/assets/icons/marketplaces/ozon.png b/src/assets/icons/marketplaces/ozon.png new file mode 100644 index 0000000..8110321 Binary files /dev/null and b/src/assets/icons/marketplaces/ozon.png differ diff --git a/src/assets/icons/marketplaces/wildberries.png b/src/assets/icons/marketplaces/wildberries.png new file mode 100644 index 0000000..3ab09b8 Binary files /dev/null and b/src/assets/icons/marketplaces/wildberries.png differ diff --git a/src/assets/icons/marketplaces/yandex_market.png b/src/assets/icons/marketplaces/yandex_market.png new file mode 100644 index 0000000..b562ddc Binary files /dev/null and b/src/assets/icons/marketplaces/yandex_market.png differ diff --git a/src/components/BasicButton/BasicButton.tsx b/src/components/BasicButton/BasicButton.tsx index 2db9390..7ae4475 100644 --- a/src/components/BasicButton/BasicButton.tsx +++ b/src/components/BasicButton/BasicButton.tsx @@ -30,13 +30,11 @@ const styles = StyleSheet.create({ backgroundColor: '#2478F8', borderRadius: responsiveWidth(1), padding: responsiveWidth(2), - flex: 1, - }, text: { color: "white", fontSize: RFPercentage(2), - textAlignVertical:"center", + textAlignVertical: "center", } }); diff --git a/src/components/DText/DText.tsx b/src/components/DText/DText.tsx index acda3a6..0351943 100644 --- a/src/components/DText/DText.tsx +++ b/src/components/DText/DText.tsx @@ -1,9 +1,10 @@ import React, {FC, ReactElement} from "react"; import {StyleProp, StyleSheet, Text, TextStyle, View, ViewStyle} from 'react-native'; import {RFPercentage} from "react-native-responsive-fontsize"; +import {responsiveHeight, responsiveWidth} from "react-native-responsive-dimensions"; type Props = { - children: string; + children: any; style?: StyleProp; } const DText: FC = ({children, style}) => { @@ -13,7 +14,8 @@ const DText: FC = ({children, style}) => { } const styles = StyleSheet.create({ text: { - fontFamily: 'SF Pro Text', + // fontFamily: 'SF Pro Text', + fontSize: responsiveWidth(3), } }) export default DText; \ No newline at end of file diff --git a/src/components/DTitle/DTitle.tsx b/src/components/DTitle/DTitle.tsx new file mode 100644 index 0000000..e45bdf8 --- /dev/null +++ b/src/components/DTitle/DTitle.tsx @@ -0,0 +1,21 @@ +import React, {FC, ReactElement} from "react"; +import {StyleProp, StyleSheet, Text, TextStyle, View, ViewStyle} from 'react-native'; +import {RFPercentage} from "react-native-responsive-fontsize"; +import DText from "../DText/DText"; +import {responsiveWidth} from "react-native-responsive-dimensions"; + +type Props = { + children: string; + style?: StyleProp; +} +const DTitle: FC = ({children, style}) => { + return ({children}) +} +const styles = StyleSheet.create({ + text: { + fontSize: responsiveWidth(4.5), + fontWeight: "600", + fontStyle: "normal" + } +}) +export default DTitle; \ No newline at end of file diff --git a/src/components/Hyperlink/Hyperlink.tsx b/src/components/Hyperlink/Hyperlink.tsx new file mode 100644 index 0000000..02823b4 --- /dev/null +++ b/src/components/Hyperlink/Hyperlink.tsx @@ -0,0 +1,27 @@ +import React, {ReactNode} from 'react'; +import {TouchableOpacity, Linking} from 'react-native'; + +type HyperlinkProps = { + url: string; + children: ReactNode; +}; + +const Hyperlink: React.FC = ({url, children}) => { + const handlePress = () => { + Linking.canOpenURL(url).then(supported => { + if (supported) { + Linking.openURL(url); + } else { + console.log("Don't know how to open URI: " + url); + } + }); + }; + + return ( + + {children} + + ); +}; + +export default Hyperlink; diff --git a/src/components/OrderCard/OrderCard.tsx b/src/components/OrderCard/OrderCard.tsx new file mode 100644 index 0000000..199c28c --- /dev/null +++ b/src/components/OrderCard/OrderCard.tsx @@ -0,0 +1,98 @@ +import {FC, useState} from "react"; +import {GestureResponderEvent, Image, StyleSheet, TouchableOpacity, View} from "react-native"; +import {RFPercentage} from "react-native-responsive-fontsize"; +import DText from "../DText/DText"; +import {responsiveHeight, responsiveWidth} from "react-native-responsive-dimensions"; +import DTitle from "../DTitle/DTitle"; + +type Props = { + onPress?: (event: GestureResponderEvent) => void + +} +const OrderCard: FC = ({onPress}) => { + + const [order, setOrder] = useState({ + article: 183658, + imageUrl: "https://421421.selcdn.ru/denco/996956/thumbzoom/h0b41036e5dc84a88b3dd344a46ab33edt.jpg-640x640.jpg", + orderNumber: "93757290-0104-7", + productName: "Фигурки животных «Собачки» 258, 5-7 см., статичные / 12 шт.", + supplierName: "simaland", + marketplaceName: "Wildberries РЕНТА", + sellerName: "DENCO", + assembled: false + }); + + return ( + { + console.log("pressed11") + }}> + + + + + + + + {order.orderNumber} + + + + Количество: 5 + Поставщик: {order.supplierName} + Селлер: {order.sellerName} + Цвет: ГОЛУБОЙ + + + Ожидает сборки + + + + + + + + ) +} +const styles = StyleSheet.create({ + container: { + backgroundColor: "white", + display: "flex", + borderRadius: RFPercentage(5), + height: responsiveHeight(20), + flexDirection: "row", + padding: RFPercentage(2), + + + }, + imageWrapper: { + width: responsiveWidth(30), + }, + image: { + width: "100%", + height: "100%", + + }, + description: { + backgroundColor:"red", + flex: 1, + display: "flex", + flexDirection: "column", + paddingLeft: responsiveWidth(3), + gap: 0, + }, + title: { + marginBottom: responsiveHeight(1), + flexDirection: "row", + alignItems: "center" + }, + titleImage: { + width: responsiveWidth(4), + height: responsiveHeight(4), + resizeMode: "center", + marginLeft: responsiveHeight(1) + }, + statusContainer: { + alignSelf: "flex-end", + } +}); +export default OrderCard; \ No newline at end of file diff --git a/src/features/auth/authSlice.ts b/src/features/auth/authSlice.ts index f542679..2d3ad50 100644 --- a/src/features/auth/authSlice.ts +++ b/src/features/auth/authSlice.ts @@ -22,16 +22,6 @@ const initialState: AuthState = { isAuthenticated: false }; -export const pokemonApi = createApi({ - reducerPath: 'pokemonApi', - baseQuery: fetchBaseQuery({baseUrl: 'https://pokeapi.co/api/v2/'}), - endpoints: (builder) => ({ - getPokemonByName: builder.query({ - query: (name) => `pokemon/${name}`, - }), - }), -}) -export const {useGetPokemonByNameQuery} = pokemonApi; export const loginUser = createAsyncThunk( 'auth/login', diff --git a/src/redux/store.ts b/src/redux/store.ts index a253502..36cbc23 100644 --- a/src/redux/store.ts +++ b/src/redux/store.ts @@ -1,14 +1,12 @@ import {configureStore} from '@reduxjs/toolkit'; -import authReducer, {pokemonApi} from 'features/auth/authSlice'; +import authReducer from 'features/auth/authSlice'; import {useDispatch} from "react-redux"; export const store = configureStore({ reducer: { auth: authReducer, - [pokemonApi.reducerPath]: pokemonApi.reducer }, - middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(pokemonApi.middleware) }); export type RootState = ReturnType; diff --git a/src/screens/HomeScreen/HomeScreen.tsx b/src/screens/HomeScreen/HomeScreen.tsx index 8ee48ef..9423351 100644 --- a/src/screens/HomeScreen/HomeScreen.tsx +++ b/src/screens/HomeScreen/HomeScreen.tsx @@ -1,6 +1,5 @@ import {Button, Modal, SafeAreaView, Text, View} from "react-native"; import {useAppDispatch} from "../../redux/store"; -import {logoutUser, useGetPokemonByNameQuery} from "../../features/auth/authSlice"; import * as process from "process"; import React, {useState} from "react"; import BasicButton from "../../components/BasicButton/BasicButton"; diff --git a/src/screens/MainScreen/MainScreen.tsx b/src/screens/MainScreen/MainScreen.tsx index 5960bca..6a836f7 100644 --- a/src/screens/MainScreen/MainScreen.tsx +++ b/src/screens/MainScreen/MainScreen.tsx @@ -11,6 +11,8 @@ import profileScreen from "../ProfileScreen/ProfileScreen"; import {responsiveHeight, responsiveWidth} from "react-native-responsive-dimensions"; import {RFPercentage} from "react-native-responsive-fontsize"; import LoginScreen from "../LoginScreen/LoginScreen"; +import OrderScreen from "../OrderScreen/OrderScreen"; +import OrdersScreen from "../OrdersScreen/OrdersScreen"; interface CustomTabProps { @@ -43,12 +45,12 @@ function MainScreen() { const tabScreens = [ { name: "Home", - component: HomeScreen, + component: OrderScreen, icon: require('assets/icons/home.png') }, { name: "Box", - component: BoxScreen, + component: OrdersScreen, icon: require('assets/icons/box.png') }, { diff --git a/src/screens/OrderScreen/OrderScreen.tsx b/src/screens/OrderScreen/OrderScreen.tsx new file mode 100644 index 0000000..5e8762f --- /dev/null +++ b/src/screens/OrderScreen/OrderScreen.tsx @@ -0,0 +1,120 @@ +import {View, Text, Image, StyleSheet, Button} from "react-native"; +import {responsiveHeight, responsiveWidth} from "react-native-responsive-dimensions"; +import DText from "../../components/DText/DText"; +import {RFPercentage} from "react-native-responsive-fontsize"; +import DTitle from "../../components/DTitle/DTitle"; +import BasicButton from "../../components/BasicButton/BasicButton"; +import Hyperlink from "../../components/Hyperlink/Hyperlink"; +import React, {useState} from "react"; + +type ArticleTextProps = { + article: number +} + + +function OrderScreen() { + + const [order, setOrder] = useState({ + article: 183658, + imageUrl: "https://421421.selcdn.ru/denco/996956/thumbzoom/h0b41036e5dc84a88b3dd344a46ab33edt.jpg-640x640.jpg", + orderNumber: "93757290-0104-7", + productName: "Фигурки животных «Собачки» 258, 5-7 см., статичные / 12 шт.", + supplierName: "simaland", + marketplaceName: "Wildberries РЕНТА", + sellerName: "DENCO", + assembled: false + }); + + return ( + + + + + + + + {order.orderNumber} + + Артикул: {order.article} + + Товар: {order.productName} + Поставщик: {order.supplierName} + Селлер: {order.sellerName} + Маркетплейс: {order.marketplaceName} + + + + + + {!order.assembled && + { + setOrder({...order, assembled: true}) + console.log(order); + }}/> + } + + {order.assembled && + + } + {/**/} + + + + ) +} + +const styles = StyleSheet.create({ + container: { + padding: 30, + width: "100%", + height: "100%", + overflow: "hidden", + display: "flex", + flex: 1, + }, + dataContainer: { + backgroundColor: "black", + display: "flex", + flexDirection: "row", + }, + buttonsContainer: { + backgroundColor: "blue", + flex: 1, + display: "flex", + justifyContent: "center", + paddingHorizontal: responsiveWidth(10) + }, + buttonsWrapper: { + backgroundColor: "red", + rowGap: responsiveHeight(3) + }, + imageWrapper: { + width: responsiveWidth(40), + // height: responsiveHeight(40), + backgroundColor: "red", + padding: RFPercentage(1) + }, + image: { + flex: 1, + borderRadius: RFPercentage(3) + }, + contentContainer: { + padding: RFPercentage(1), + backgroundColor: "pink", + flex: 1 + + }, + contentWrapper: { + display: "flex", + flexDirection: "column", + gap: 0, + }, + contentTitle: { + alignSelf: "center" + }, + articleText: { + color: 'blue', + textDecorationLine: 'underline' + } +}) +export default OrderScreen; \ No newline at end of file diff --git a/src/screens/OrdersScreen/OrdersScreen.tsx b/src/screens/OrdersScreen/OrdersScreen.tsx new file mode 100644 index 0000000..dcfa85c --- /dev/null +++ b/src/screens/OrdersScreen/OrdersScreen.tsx @@ -0,0 +1,48 @@ +import {ScrollView, StyleSheet, View} from "react-native"; +import SearchBar from "../../components/SearchBar/SearchBar"; +import OrderCard from "../../components/OrderCard/OrderCard"; +import {RFPercentage} from "react-native-responsive-fontsize"; +import {responsiveHeight} from "react-native-responsive-dimensions"; + +function OrdersScreen() { + return ( + + { + }}/> + + + + + + + + + + + + + + + ) +} + +const styles = StyleSheet.create({ + container: { + width: "100%", + height: "100%", + display: "flex", + }, + content: { + flex: 1, + paddingHorizontal: RFPercentage(3), + paddingTop: RFPercentage(3) + }, + scrollContainer: { + rowGap: responsiveHeight(2) + + } +}); + +export default OrdersScreen; \ No newline at end of file diff --git a/src/screens/ProfileScreen/ProfileScreen.tsx b/src/screens/ProfileScreen/ProfileScreen.tsx index 63efa74..5893727 100644 --- a/src/screens/ProfileScreen/ProfileScreen.tsx +++ b/src/screens/ProfileScreen/ProfileScreen.tsx @@ -1,6 +1,5 @@ import {Button, Text, View} from "react-native"; import {useAppDispatch} from "../../redux/store"; -import {logoutUser, useGetPokemonByNameQuery} from "../../features/auth/authSlice"; import * as process from "process"; function ProfileScreen() { diff --git a/src/types/order.ts b/src/types/order.ts new file mode 100644 index 0000000..b46baeb --- /dev/null +++ b/src/types/order.ts @@ -0,0 +1,4 @@ +export type Order = { + id: number; + imageUrl: string; +} \ No newline at end of file