diff --git a/navigation/index.js b/navigation/index.js index 2f1619b..e3ca014 100644 --- a/navigation/index.js +++ b/navigation/index.js @@ -1,6 +1,6 @@ import React, { useEffect } from "react"; import Svg, { G, Path } from "react-native-svg"; -import {Appearance} from 'react-native'; +import { Appearance } from "react-native"; import { NavigationContainer } from "@react-navigation/native"; import { createNativeStackNavigator } from "@react-navigation/native-stack"; import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; @@ -38,7 +38,6 @@ import fontSize from "../src/constants/fontSize"; import Colors from "../src/constants/Colors"; import tw from "tailwind-react-native-classnames"; - const Tab = createBottomTabNavigator(); const BottomTabNavigator = () => { const colorScheme = Appearance.getColorScheme(); @@ -178,11 +177,7 @@ const BottomTabNavigator = () => { title: "ویدئوها", tabBarIcon: ({ focused, color }) => focused ? ( - + { ) : ( - + { const ProductsStack = createNativeStackNavigator(); const ProductsStackScreen = () => { return ( - + @@ -385,7 +382,7 @@ const CARTStackScreen = () => { ); -} +}; const PROFILEStack = createNativeStackNavigator(); const PROFILEStackScreen = () => { @@ -408,7 +405,10 @@ const Navigation = ({ getStatus, isLogin }) => { diff --git a/src/redux/actions/activation.js b/src/redux/actions/activation.js new file mode 100644 index 0000000..427a5b0 --- /dev/null +++ b/src/redux/actions/activation.js @@ -0,0 +1,27 @@ +import proxy from "../proxy"; + +const activation = { + list: + (data = {}) => + async (dispatch) => + await proxy.get("activation/list", data, { dispatch }), + update: + (data = {}, data2 = {}) => + async (dispatch) => { + await proxy.put("activation/update", data); + await proxy.get("activation/list", data2, { dispatch }); + }, + add: + (data = {}) => + async (dispatch) => { + await proxy.post("activation/add", data); + }, + del: + (data = {}, data2 = {}) => + async (dispatch) => { + await proxy.delete("activation/delete", data); + await proxy.get("activation/list", data2, { dispatch }); + }, +}; + +export default activation; \ No newline at end of file diff --git a/src/redux/actions/index.js b/src/redux/actions/index.js index 4f60969..d354661 100644 --- a/src/redux/actions/index.js +++ b/src/redux/actions/index.js @@ -11,4 +11,5 @@ export { default as faq } from "./faq"; export { default as file } from "./file"; export { default as qr } from "./qr"; export {default as userAddress} from "./userAddress"; -export { default as transport } from "./transport"; \ No newline at end of file +export { default as transport } from "./transport"; +export { default as activation } from "./activation"; \ No newline at end of file diff --git a/src/redux/reducers/activation.js b/src/redux/reducers/activation.js new file mode 100644 index 0000000..b3fbf2f --- /dev/null +++ b/src/redux/reducers/activation.js @@ -0,0 +1,40 @@ +import { asyncAwesomeAlert } from "../../utils/AsyncWrappers"; + +const initialState = { + loading: false, + error: null, + list: [], + message: null, +}; +export default function activation(state = initialState, action) { + let { type, data } = action; + switch (type) { + case "activation/list": + return { ...state, loading: false, list: data, error: null }; + case "activation/update": + return { ...state, loading: false, error: null, message: data.message }; + case "activation/add": + asyncAwesomeAlert("نتیجه", data.message, { + showCancelButton: false, + }); + console.log(data.message); + return { ...state, loading: false, error: null }; + case "activation/delete": + return { ...state, loading: false, error: null }; + case "loading": + return { ...state, loading: true }; + case "error": + console.log(data.message); + asyncAwesomeAlert("خطا", data.message, { + showCancelButton: false, + }); + return { + ...state, + loading: false, + error: data.message, + message: data.message, + }; + default: + return state; + } +} diff --git a/src/redux/reducers/index.js b/src/redux/reducers/index.js index b6a4278..d2642b8 100644 --- a/src/redux/reducers/index.js +++ b/src/redux/reducers/index.js @@ -10,4 +10,5 @@ export { default as userFactor } from "./userFactor"; export { default as userProduct } from "./userProduct"; import { default as qr } from "./qr"; export { default as userAddress } from "./userAddress"; -export { default as transport } from "./transport"; \ No newline at end of file +export { default as transport } from "./transport"; +export { default as activation } from "./activation"; \ No newline at end of file diff --git a/src/screens/Activation/assets/alert.png b/src/screens/Activation/assets/alert.png deleted file mode 100644 index ab1dc0d..0000000 Binary files a/src/screens/Activation/assets/alert.png and /dev/null differ diff --git a/src/screens/Activation/assets/book.png b/src/screens/Activation/assets/book.png deleted file mode 100644 index 0808fe2..0000000 Binary files a/src/screens/Activation/assets/book.png and /dev/null differ diff --git a/src/screens/Activation/index.js b/src/screens/Activation/index.js index 185ebc2..28bb3e0 100644 --- a/src/screens/Activation/index.js +++ b/src/screens/Activation/index.js @@ -1,41 +1,34 @@ import React, { useState } from "react"; import { View, - Dimensions, - Image, + Text, TextInput, - SafeAreaView, StatusBar, Platform, KeyboardAvoidingView, TouchableWithoutFeedback, - Keyboard, + Appearance } from "react-native"; -import { Header } from "@react-navigation/native-stack"; import { connect } from "react-redux"; -import tw from "tailwind-rn"; -import fontSize from "../../constants/fontSize"; +import Svg, { Image as Imagee } from "react-native-svg"; +import {activation} from "../../redux/actions"; + import TopHeader from "../../components/Header"; import Navbar from "../../components/Navbar"; import CustomPressable from "../../components/Pressable"; import Or from "../../components/Or"; +//style +import tw from "tailwind-rn"; +import fontSize from "../../constants/fontSize"; +import Colors from "../../constants/Colors"; + //assets import bgQr from "./assets/bgQr.png"; -import bookIcon from "./assets/book.png"; -const { height } = Dimensions.get("window"); -function Activation({}) { - const [formData, setFormData] = useState({ - title: null, - department: null, - message: null, - file: null, - }); - - const onChange = (name, value) => { - setFormData({ ...formData, [name]: value }); - }; +function Activation({add}) { + const colorScheme = Appearance.getColorScheme(); + const [value, setValue] = useState(null); return ( - + - + + + @@ -82,21 +91,24 @@ function Activation({}) { fontFamily: "light", }, ]} + onChange={(name, value) => setValue(value)} /> add({code : value})} /> {}} /> @@ -109,8 +121,11 @@ Activation.defaultProps = { headerOptions: {}, }; -const mapStateToProps = (state) => ({}); +const mapStateToProps = (state) => ({ +}); -const mapDispatchToProps = {}; +const mapDispatchToProps = { + add : activation.add, +}; export default connect(mapStateToProps, mapDispatchToProps)(Activation); diff --git a/src/screens/Faq/components/Instance.js b/src/screens/Faq/components/Instance.js index a44f24d..9cebe2b 100644 --- a/src/screens/Faq/components/Instance.js +++ b/src/screens/Faq/components/Instance.js @@ -1,20 +1,34 @@ -import { View, Text, Dimensions, TouchableOpacity } from "react-native"; +import { + View, + Text, + Dimensions, + TouchableOpacity, + Appearance, +} from "react-native"; import { Entypo } from "@expo/vector-icons"; + +//style import tw from "tailwind-rn"; -import fontSize from '../../../constants/fontSize'; +import fontSize from "../../../constants/fontSize"; +import Colors from "../../../constants/Colors"; const { width } = Dimensions.get("window"); function Instance({ question, selectFaq }) { + const colorScheme = Appearance.getColorScheme(); return ( selectFaq(question.id)} style={[ tw("w-full flex flex-col my-1.5 rounded-md px-4 py-2"), { - backgroundColor: !question.active ? "#F9F9F9" : "#F6F9FD", - borderColor: !question.active ? "#DBDBDB" : "#196EC0", - borderWidth: 1, + backgroundColor: !question.active + ? "#F9F9F9" + : Colors.theme1[colorScheme].greenCF + "0a", + borderColor: !question.active + ? "#DBDBDB" + : Colors.theme1[colorScheme].greenCF, + borderWidth: 1.5, }, ]} > @@ -24,8 +38,8 @@ function Instance({ question, selectFaq }) { { width: "90%", textAlign: "right", - color: "#196EC0", - fontSize: fontSize.sm, + color: Colors.theme1[colorScheme].green79, + fontSize: fontSize.tiny, fontFamily: "bold", }, ]} @@ -33,16 +47,20 @@ function Instance({ question, selectFaq }) { {question.title} {question.active ? ( - + ) : ( - + )} {question.active && (