diff --git a/src/components/AdvanceTradingView/AdvanceTradingView.jsx b/src/components/AdvanceTradingView/AdvanceTradingView.jsx index db209605..d60d723d 100644 --- a/src/components/AdvanceTradingView/AdvanceTradingView.jsx +++ b/src/components/AdvanceTradingView/AdvanceTradingView.jsx @@ -12,7 +12,7 @@ const removeTestCoin = (pair) => { } const AdvanceTradingView = () => { - const isDark = useSelector((state) => state.global.isDark) + const theme = useSelector((state) => state.global.theme) const activePair = useSelector((state) => state.exchange.activePair) const widgetOptions = { symbol: removeTestCoin(activePair.baseAsset+"/"+activePair.quoteAsset), @@ -32,13 +32,13 @@ const AdvanceTradingView = () => { useLayoutEffect(() => { const widget = (window.tvWidget = new window.TradingView.widget( - {...widgetOptions, theme: isDark ? "dark" : "light"}, + {...widgetOptions, theme: theme.toLowerCase()}, )); widget.onChartReady(() => { console.log("Chart has loaded!"); }); - }, [isDark]); + }, [theme]); return (
{ - + const type = useSelector((state) => state.exchange.dateType) const calendar = () => { - const type = window.env.REACT_APP_CALENDAR_TYPE + switch (type) { case "Jalali": return moment(date).format("jYY/jMM/jDD"); @@ -17,7 +18,7 @@ const Date = ({date}) => { } }; - return calendar(); + return (<>{calendar()}); }; export default Date; diff --git a/src/components/Loading/Loading.js b/src/components/Loading/Loading.js index 884c6bc1..340064ee 100644 --- a/src/components/Loading/Loading.js +++ b/src/components/Loading/Loading.js @@ -1,25 +1,17 @@ import React from "react"; import {useTranslation} from "react-i18next"; import {images} from "../../assets/images"; -import {connect} from "react-redux"; +import {useSelector} from "react-redux"; import {isMobile} from 'react-device-detect'; - -const Loading = ({isDark}) => { +const Loading = () => { + const theme = useSelector((state) => state.global.theme) const {t} = useTranslation(); return (
- loading... + loading... {t('loading')}
); }; - - -const mapStateToProps = (state) => { - return { - isDark: state.global.isDark, - }; -}; - -export default connect(mapStateToProps, null)(Loading); \ No newline at end of file +export default Loading; \ No newline at end of file diff --git a/src/components/TextInput/TextInput.js b/src/components/TextInput/TextInput.js index bafe4bab..4059e4c4 100644 --- a/src/components/TextInput/TextInput.js +++ b/src/components/TextInput/TextInput.js @@ -2,12 +2,12 @@ import React from "react"; import Icon from "../Icon/Icon"; import Select from "react-select"; import classes from "./TextInput.module.css"; -import i18n from "../../i18n/i18n"; import persian_fa from "react-date-object/locales/persian_fa"; import persian from "react-date-object/calendars/persian"; import DatePicker from "react-multi-date-picker"; import "react-multi-date-picker/styles/backgrounds/bg-dark.css" import {useSelector} from "react-redux"; +import i18n from "i18next"; const TextInput = (props) => { const { @@ -27,17 +27,18 @@ const TextInput = (props) => { ...other } = props - const isDark = useSelector((state) => state.global.isDark) - + const theme = useSelector((state) => state.global.theme) const optionClassHandler = (state) => { let className = classes.selectOptions - if (state.isFocused) { - className = className + " " + classes.isFocused - } - if (state.isSelected) { - className = className + " " + classes.isSelected - } + + if (state.isFocused) { + className = className + " " + classes.isFocused + } + if (state.isSelected) { + className = className + " " + classes.isSelected + } + return className; } @@ -55,12 +56,11 @@ const TextInput = (props) => { {...other} /> - if(lead){ + if (lead) { leadSection = {lead} } - - if ( select ){ + if (select) { inputSection =