From 2a75282c18dafe7fc73514b82a0a0598206a2e3d Mon Sep 17 00:00:00 2001 From: aliyanlatif Date: Tue, 6 Feb 2024 09:59:39 +0500 Subject: [PATCH] removed extra code --- .../components/Menu/StatusCard/StatusCard.js | 38 -- .../Modals/PaymentModal/PaymentModal.js | 87 ++-- CustomerApp/src/screens/Cart/Cart.js | 1 - .../src/screens/ItemDetail/ItemDetail.js | 14 +- .../src/screens/OrderDetail/OrderDetail.js | 7 - CustomerApp/src/screens/Settings/Settings.js | 20 +- CustomerApp/translations/ar.js | 469 +++++++++--------- CustomerApp/translations/de.js | 1 + CustomerApp/translations/en.js | 407 +++++++-------- CustomerApp/translations/fr.js | 1 + CustomerApp/translations/km.js | 1 + CustomerApp/translations/zh.js | 1 + 12 files changed, 499 insertions(+), 548 deletions(-) diff --git a/CustomerApp/src/components/Menu/StatusCard/StatusCard.js b/CustomerApp/src/components/Menu/StatusCard/StatusCard.js index 7673d41..d8519a2 100644 --- a/CustomerApp/src/components/Menu/StatusCard/StatusCard.js +++ b/CustomerApp/src/components/Menu/StatusCard/StatusCard.js @@ -11,33 +11,6 @@ import TextError from "../../Text/TextError/TextError"; import useStyle from "./styles"; import i18n from "../../../../i18n"; -// export const orderStatuses = [ -// { -// key: i18n.t("PENDING"), -// status: 1, -// statusText: i18n.t("orderPending"), -// }, -// { -// key: i18n.t("ACCEPTED"), -// status: 2, -// statusText: i18n.t("prepFood"), -// }, -// { -// key: i18n.t("PICKED"), -// status: 3, -// statusText: i18n.t("riderOnWay"), -// }, -// { -// key: i18n.t("DELIVERED"), -// status: 4, -// statusText: i18n.t("orderDelivered"), -// }, -// { -// key: i18n.t("COMPLETED"), -// status: 5, -// statusText: i18n.t("completeOrder"), -// }, -// ]; export const orderStatuses = { PENDING: { status: 1, @@ -76,13 +49,6 @@ const StatusCard = () => { } = useContext(UserContext); const configuration = useContext(ConfigurationContext); - // const checkStatus = (status) => { - // const obj = orderStatuses.filter((x) => { - // return x.key === status; - // }); - // return obj[0]; - // }; - if (loadingOrders) return ; if (errorOrders) return {errorOrders.message}; @@ -95,7 +61,6 @@ const StatusCard = () => { refreshing={networkStatusOrders === 4} onRefresh={() => networkStatusOrders === 7 && fetchOrders()} data={orders.filter((o) => orderStatusActive.includes(o.order_status))} - //keyExtractor={(item) => item._id} keyExtractor={(item, index) => String(index)} renderItem={({ item, index }) => ( { {i18n.t(item.order_status)}{" "} - {/* {checkStatus(item.order_status).status}.{' '} */} - {/* {checkStatus(i18n.t(item.order_status)?.status)?.statusText || - "..."} */} {`(${i18n.t(orderStatuses[item.order_status]?.statusText)})`} diff --git a/CustomerApp/src/components/Modals/PaymentModal/PaymentModal.js b/CustomerApp/src/components/Modals/PaymentModal/PaymentModal.js index 9a08117..e61a763 100644 --- a/CustomerApp/src/components/Modals/PaymentModal/PaymentModal.js +++ b/CustomerApp/src/components/Modals/PaymentModal/PaymentModal.js @@ -1,51 +1,51 @@ -import { useTheme } from '@react-navigation/native' -import PropTypes from 'prop-types' -import React, { useState } from 'react' -import { TouchableOpacity, View } from 'react-native' -import i18n from '../../../../i18n' -import RadioButton from '../../../components/FdRadioBtn/RadioBtn' -import { alignment } from '../../../utils/alignment' -import { ICONS_NAME } from '../../../utils/constant' -import { scale } from '../../../utils/scaling' -import { CustomIcon } from '../../CustomIcon' -import TextDefault from '../../Text/TextDefault/TextDefault' -import useStyles from './styles' +import { useTheme } from "@react-navigation/native"; +import PropTypes from "prop-types"; +import React, { useState } from "react"; +import { TouchableOpacity, View } from "react-native"; +import i18n from "../../../../i18n"; +import RadioButton from "../../../components/FdRadioBtn/RadioBtn"; +import { alignment } from "../../../utils/alignment"; +import { ICONS_NAME } from "../../../utils/constant"; +import { scale } from "../../../utils/scaling"; +import { CustomIcon } from "../../CustomIcon"; +import TextDefault from "../../Text/TextDefault/TextDefault"; +import useStyles from "./styles"; function PaymentModal(props) { - const styles = useStyles() - const { colors } = useTheme() + const styles = useStyles(); + const { colors } = useTheme(); const [selectedPayment, setSelectedPayment] = useState( props.payment ?? {}, {} - ) + ); const CASH = [ { - payment: 'STRIPE', - label: i18n.t('creditCart'), + payment: "STRIPE", + label: i18n.t("creditCart"), index: 0, icon: ICONS_NAME.Visa, - iconSize: scale(30) + iconSize: scale(30), }, { - payment: 'PAYPAL', - label: i18n.t('paypal'), + payment: "PAYPAL", + label: i18n.t("paypal"), index: 1, icon: ICONS_NAME.Paypal, - iconSize: scale(30) + iconSize: scale(30), }, { - payment: 'COD', - label: i18n.t('cod'), + payment: "COD", + label: i18n.t("cod"), index: 2, icon: ICONS_NAME.Cash, - iconSize: scale(25) - } - ] + iconSize: scale(25), + }, + ]; function onSelectPayment(payment) { - setSelectedPayment(payment) - props.paymentChange(payment) + setSelectedPayment(payment); + props.paymentChange(payment); } return ( @@ -57,9 +57,10 @@ function PaymentModal(props) { alignment.MTlarge, alignment.PTmedium, alignment.MBlarge, - alignment.PBxSmall - ]}> - Change Payment Method + alignment.PBxSmall, + ]} + > + {`(${i18n.t("Change Payment Method")})`} {CASH.map((item, index) => ( @@ -67,8 +68,9 @@ function PaymentModal(props) { style={[styles.radioGroup]} key={index.toString()} onPress={() => { - onSelectPayment(item) - }}> + onSelectPayment(item); + }} + > { - onSelectPayment(item) + onSelectPayment(item); }} /> @@ -98,21 +100,22 @@ function PaymentModal(props) { ))} - Done + {`(${i18n.t("Done")})`} - Cancel + style={[styles.width100, alignment.PBlarge, alignment.PTlarge]} + > + {`(${i18n.t("Cancel")})`} - ) + ); } PaymentModal.propTypes = { payment: PropTypes.object, paymentChange: PropTypes.func, - onClose: PropTypes.func -} -export default PaymentModal + onClose: PropTypes.func, +}; +export default PaymentModal; diff --git a/CustomerApp/src/screens/Cart/Cart.js b/CustomerApp/src/screens/Cart/Cart.js index 53d5356..0bf688e 100755 --- a/CustomerApp/src/screens/Cart/Cart.js +++ b/CustomerApp/src/screens/Cart/Cart.js @@ -147,7 +147,6 @@ function Cart() { function update(cache, { data: { placeOrder } }) { if (placeOrder && placeOrder.payment_method === 'COD') { const data = cache.readQuery({ query: ORDERS }) - // console.log('placeorder', placeOrder) if (data) { cache.writeQuery({ query: ORDERS, diff --git a/CustomerApp/src/screens/ItemDetail/ItemDetail.js b/CustomerApp/src/screens/ItemDetail/ItemDetail.js index 78c461e..b0753d0 100644 --- a/CustomerApp/src/screens/ItemDetail/ItemDetail.js +++ b/CustomerApp/src/screens/ItemDetail/ItemDetail.js @@ -201,11 +201,13 @@ function ItemDetail() { status="Required" /> - {} + { + + } )} @@ -214,7 +216,7 @@ function ItemDetail() { { -// const obj = orderStatuses.filter((x) => { -// return x.key === status; -// }); -// return obj[0]; -// }; - function OrderDetail() { const styles = useStyle(); const route = useRoute(); diff --git a/CustomerApp/src/screens/Settings/Settings.js b/CustomerApp/src/screens/Settings/Settings.js index 4baa856..5d52815 100644 --- a/CustomerApp/src/screens/Settings/Settings.js +++ b/CustomerApp/src/screens/Settings/Settings.js @@ -1,19 +1,11 @@ import { useMutation } from "@apollo/react-hooks"; import AsyncStorage from "@react-native-async-storage/async-storage"; import { useNavigation, useTheme } from "@react-navigation/native"; -import Constants from "expo-constants"; import * as Device from "expo-device"; import * as Localization from "expo-localization"; import * as Notifications from "expo-notifications"; -import * as Updates from "expo-updates"; import gql from "graphql-tag"; -import React, { - useContext, - useEffect, - useLayoutEffect, - useRef, - useState, -} from "react"; +import React, { useContext, useEffect, useRef, useState } from "react"; import { AppState, Linking, @@ -24,7 +16,6 @@ import { } from "react-native"; import { Modalize } from "react-native-modalize"; -import { async } from "validate.js"; import i18n from "../../../i18n"; import { moderateScale } from "../../utils/scaling"; @@ -84,7 +75,6 @@ function Settings() { profile.is_order_notification ); const [activeRadio, activeRadioSetter] = useState(languageTypes[0].index); - // eslint-disable-next-line no-unused-vars const [appState, setAppState] = useState(AppState.currentState); const [uploadToken] = useMutation(PUSH_TOKEN); const [updateUserInfo] = useMutation(UPDATEUSER); @@ -96,7 +86,7 @@ function Settings() { const modalizeRef = useRef(null); const modalizeRef1 = useRef(null); - useLayoutEffect(() => { + useEffect(() => { navigation.setOptions({ headerTitle: i18n.t("titleSettings"), headerRight: null, @@ -176,7 +166,6 @@ function Settings() { const langName = languageTypes[defLang].value; activeRadioSetter(defLang); languageNameSetter(langName); - // Updates.reloadAsync(); } }; @@ -343,11 +332,6 @@ function Settings() { /> - {/* - - {/* Version: {Constants.manifest.version} - - */}