From 340cdd5d07cc851915b3e097de16a065a8c12f0b Mon Sep 17 00:00:00 2001 From: Hossein Date: Sun, 14 Apr 2024 15:13:45 +0330 Subject: [PATCH 1/7] #54: Add dismiss option & fix toast style --- src/index.css | 4 +++ src/index.js | 56 +++++++++++++++++++++++++++++++++++++++ src/main/Mobile/Mobile.js | 28 -------------------- 3 files changed, 60 insertions(+), 28 deletions(-) diff --git a/src/index.css b/src/index.css index 890dd54..c1c13ee 100644 --- a/src/index.css +++ b/src/index.css @@ -155,10 +155,12 @@ html, body { --greenAlpha: #18a97978; --greenAlphaGradient: #09a16e85; --darkGreen: #18a979; + --blackGreen: #123f30; --red: #d73e36; --redAlpha: #d73e3678; --redAlphaGradient: #e124175e; --darkRed: #d73e36; + --blackRed: #79150f; --orange: #ff8124; --orangeAlpha: #e97b50b0; --blue: #0e4095; @@ -195,10 +197,12 @@ html, body { --greenAlpha: #18a97978; --greenAlphaGradient: #31cc6a4d; --darkGreen: #18a979; + --blackGreen: #123f30; --red: #ff5555; --redAlpha: #d73e3678; --redAlphaGradient: #e8201236; --darkRed: #d73e36; + --blackRed: #79150f; --orange: #ff8124; --orangeAlpha: #b16649d9; --blue: #6f9ffff5; diff --git a/src/index.js b/src/index.js index 304aebd..c11712b 100644 --- a/src/index.js +++ b/src/index.js @@ -20,6 +20,8 @@ import i18n from "i18next"; import LanguageDetector from "i18next-browser-languagedetector"; import Backend from "i18next-http-backend"; import {initReactI18next} from "react-i18next"; +import toast, {ToastBar, Toaster} from "react-hot-toast"; +import Icon from "./components/Icon/Icon"; const sagaMiddleware = createSagaMiddleware(); @@ -72,6 +74,59 @@ i18n }, }); +const Toast = () => { + return + {(t) => { + return + {({ icon, message }) => ( + <> + {t.type !== 'loading' && ( + /**/ + toast.dismiss(t.id)} + /> + )} + {message} + + )} + + } + } + ; +} + //React query client const queryClient = new QueryClient() @@ -84,6 +139,7 @@ root.render(
+ diff --git a/src/main/Mobile/Mobile.js b/src/main/Mobile/Mobile.js index 1183527..a00999a 100644 --- a/src/main/Mobile/Mobile.js +++ b/src/main/Mobile/Mobile.js @@ -72,33 +72,6 @@ const Mobile = () => { meta.description.content = description ? description : " " }, [title, description]) - const Toast = () => if (isLoading) return @@ -123,7 +96,6 @@ const Mobile = () => { - ); From cf1b89c902bfa05858246513b34a36555c31649b Mon Sep 17 00:00:00 2001 From: Hossein Date: Sun, 14 Apr 2024 16:06:47 +0330 Subject: [PATCH 2/7] Fix null properties in user wallet --- src/queries/hooks/useGetUserAccount.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/queries/hooks/useGetUserAccount.js b/src/queries/hooks/useGetUserAccount.js index 77e4408..e2e6489 100644 --- a/src/queries/hooks/useGetUserAccount.js +++ b/src/queries/hooks/useGetUserAccount.js @@ -1,8 +1,10 @@ import {useQuery} from "@tanstack/react-query"; import {getUserAccount, parseWalletsResponse} from "js-api-client"; +import {useSelector} from "react-redux"; export const useGetUserAccount = () => { - return useQuery(['userAccount'], getUserAccountFunc, + const userId = useSelector((state) => state.auth.id) + return useQuery(['userAccount', userId], () => getUserAccountFunc(userId), { retry: 1, refetchInterval: 10000 @@ -10,7 +12,8 @@ export const useGetUserAccount = () => { ); } -export const getUserAccountFunc = async () => { +export const getUserAccountFunc = async (userId) => { + if (!userId) return null const params = new URLSearchParams(); params.append('timestamp', Date.now().toString()); const {data} = await getUserAccount() From 4264926422b79c546684e9968af94d7c83d5acb9 Mon Sep 17 00:00:00 2001 From: Hossein Date: Sun, 14 Apr 2024 17:14:48 +0330 Subject: [PATCH 3/7] Fix expand option in subHeader --- .../Secttions/SubHeader/SubHeader.js | 4 ++- .../MarketSubHeader/MarketSubHeader.js | 30 +++++++++---------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/main/Mobile/Pages/UserPanel/Secttions/SubHeader/SubHeader.js b/src/main/Mobile/Pages/UserPanel/Secttions/SubHeader/SubHeader.js index 1a5bd73..77a92f4 100644 --- a/src/main/Mobile/Pages/UserPanel/Secttions/SubHeader/SubHeader.js +++ b/src/main/Mobile/Pages/UserPanel/Secttions/SubHeader/SubHeader.js @@ -13,8 +13,10 @@ const SubHeader = (props) => { const [expand, setExpand] = useState(false) const location = useLocation() + const expandable = !(location.pathname.includes(RoutesName.SettingsRelative) || location.pathname.includes(RoutesName.TxHistoryRelative)) + const clickHandler = () => { - if (!(location.pathname.includes(RoutesName.SettingsRelative) || RoutesName.TxHistoryRelative) ) { + if (expandable) { setExpand(true) } } diff --git a/src/main/Mobile/Pages/UserPanel/Secttions/SubHeader/components/MarketSubHeader/MarketSubHeader.js b/src/main/Mobile/Pages/UserPanel/Secttions/SubHeader/components/MarketSubHeader/MarketSubHeader.js index 53ded62..e877279 100644 --- a/src/main/Mobile/Pages/UserPanel/Secttions/SubHeader/components/MarketSubHeader/MarketSubHeader.js +++ b/src/main/Mobile/Pages/UserPanel/Secttions/SubHeader/components/MarketSubHeader/MarketSubHeader.js @@ -21,22 +21,22 @@ const MarketSubHeader = () => { <>
{t("header.lastPrice")} - {new BN(lastPrices[activePair.symbol] || 0).toFormat()+" "+t("currency." + activePair.quoteAsset)}
- -
- {t("header.availableBalance")} -
-
- {/*{ new BN (base).decimalPlaces(activePair.baseAssetPrecision).toFormat()}*/} - { new BN (base).toFormat()} - {t("currency." + activePair.baseAsset)} -
- | -
- { new BN(quote).toFormat()} - {t("currency." + activePair.quoteAsset)} -
+
+ {new BN(lastPrices[activePair.symbol] || 0).toFormat()+" "+t("currency." + activePair.quoteAsset)} +
+
+
{t("header.availableBalance")}
+
+
+
+ { new BN (base).toFormat()} + {t("currency." + activePair.baseAsset)} +
+ | +
+ { new BN(quote).toFormat()} + {t("currency." + activePair.quoteAsset)}
From 5979960a4737f04a05672c6d81c5e80369ea11bd Mon Sep 17 00:00:00 2001 From: Hossein Date: Sun, 14 Apr 2024 19:26:55 +0330 Subject: [PATCH 4/7] Close #56: Fix last access date --- .../Security/components/ActiveSessions/ActiveSessions.js | 3 ++- .../components/ActiveSessions/components/Session/Session.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Settings/components/Security/components/ActiveSessions/ActiveSessions.js b/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Settings/components/Security/components/ActiveSessions/ActiveSessions.js index 8102928..2857d86 100644 --- a/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Settings/components/Security/components/ActiveSessions/ActiveSessions.js +++ b/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Settings/components/Security/components/ActiveSessions/ActiveSessions.js @@ -10,6 +10,7 @@ import Error from "../../../../../../../../../../../../components/Error/Error"; import Loading from "../../../../../../../../../../../../components/Loading/Loading"; import moment from "moment-jalaali"; import Session from "./components/Session/Session"; +import Date from "../../../../../../../../../../../../components/Date/Date"; const ActiveSessions = () => { @@ -39,7 +40,7 @@ const ActiveSessions = () => { {t("ActiveSessions.thisSession")}
- {moment(current?.lastAccess * 1000).format("HH:mm:ss , jYY/jMM/jDD")} + {moment(current?.lastAccess * 1000).format("HH:mm:ss")} , {other.length > 0 ? {t("ActiveSessions.closeOtherSessions")} : ""} diff --git a/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Settings/components/Security/components/ActiveSessions/components/Session/Session.js b/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Settings/components/Security/components/ActiveSessions/components/Session/Session.js index 4ead7c0..849941e 100644 --- a/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Settings/components/Security/components/ActiveSessions/components/Session/Session.js +++ b/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/Settings/components/Security/components/ActiveSessions/components/Session/Session.js @@ -6,6 +6,7 @@ import {Trans, useTranslation} from "react-i18next"; import {images} from "../../../../../../../../../../../../../../assets/images"; import {toast} from "react-hot-toast"; import {expireSessionById} from "js-api-client"; +import Date from "../../../../../../../../../../../../../../components/Date/Date"; const Session = ({list, reloadSessionsList}) => { const {t} = useTranslation(); @@ -36,7 +37,7 @@ const Session = ({list, reloadSessionsList}) => {
- {moment(list?.lastAccess * 1000).format("HH:mm:ss , jYY/jMM/jDD")} + {moment(list?.lastAccess * 1000).format("HH:mm:ss")} , {isLoading ? Date: Mon, 15 Apr 2024 19:28:19 +0330 Subject: [PATCH 5/7] Close #57: Fix period filter in transactions history --- package.json | 2 +- src/components/TextInput/TextInput.js | 3 +- .../TransactionHistory/TransactionHistory.js | 43 +++++++++++++------ yarn.lock | 20 ++++----- 4 files changed, 42 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index c9c61a2..7f82edb 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "react-dropzone": "^11.3.1", "react-hot-toast": "^2.4.1", "react-i18next": "^12.2.2", - "react-multi-date-picker": "^4.3.1", + "react-multi-date-picker": "^4.4.1", "react-number-format": "^4.9.3", "react-qr-code": "^2.0.11", "react-redux": "^8.0.5", diff --git a/src/components/TextInput/TextInput.js b/src/components/TextInput/TextInput.js index a25bfd5..a329e1c 100644 --- a/src/components/TextInput/TextInput.js +++ b/src/components/TextInput/TextInput.js @@ -13,6 +13,7 @@ const TextInput = (props) => { const {customRef,readOnly,onchange,customClass,options, lead, ltr, after ,select ,alerts ,max, datePicker, ...other} = props const theme = useSelector((state) => state.global.theme) + const type = useSelector((state) => state.exchange.dateType) const optionClassHandler = (state) => { let className = classes.selectOptions @@ -64,7 +65,7 @@ const TextInput = (props) => { inputSection = } {...other} diff --git a/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/TransactionHistory/TransactionHistory.js b/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/TransactionHistory/TransactionHistory.js index 5184084..955d8ce 100644 --- a/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/TransactionHistory/TransactionHistory.js +++ b/src/main/Mobile/Pages/UserPanel/Secttions/Content/components/TransactionHistory/TransactionHistory.js @@ -24,8 +24,8 @@ const TransactionHistory = () => { const [query, setQuery] = useState({ "coin": null, // optional "category": null, // optional [DEPOSIT, FEE, TRADE, WITHDRAW, ORDER_CANCEL, ORDER_CREATE, ORDER_FINALIZED] - "startTime": moment().subtract(1, 'months').startOf("day").valueOf(), - "endTime": moment().endOf("day").valueOf(), + "startTime": null, + "endTime": null, "ascendingByTime": false, "limit": 10, "offset": 0 @@ -108,13 +108,13 @@ const TransactionHistory = () => { }) } const startDateHandler = (dateRange) => { - if (dateRange.length === 2) { - setQuery({ - ...query, - startTime: moment.unix(dateRange[0].toUnix()).startOf("day").valueOf(), - endTime: moment.unix(dateRange[1].toUnix()).endOf("day").valueOf() - }) - } + const start = dateRange[0] ? moment.unix(dateRange[0].toUnix()).startOf("day").valueOf() : null; + const end = dateRange[1] ? moment.unix(dateRange[1].toUnix()).endOf("day").valueOf() : null; + setQuery({ + ...query, + startTime: start, + endTime: end + }) } const content = () => { @@ -126,6 +126,21 @@ const TransactionHistory = () => { } + const periodTextHandler = () => { + if (query?.startTime && query?.endTime) return <> + {t("from")} + + {t("until")} + + + if (query?.startTime) return <> + {t("from")} + + {t("until")} + + + } + return (
@@ -173,7 +188,7 @@ const TransactionHistory = () => { + ]} lead={t('TransactionHistory.period')} type="input" @@ -181,6 +196,9 @@ const TransactionHistory = () => { value={[query.startTime, query.endTime]} dateSeparator={" " + t('to') + " "} range + hideOnScroll + dataPanelPosition="Bottom" + position="bottom-center" customClass={`width-100 my-1 ${classes.thisInput}`} /> @@ -200,10 +218,7 @@ const TransactionHistory = () => {

{t("txHistory.title")}

- {t("from")} - - {t("until")} - + {periodTextHandler()}
diff --git a/yarn.lock b/yarn.lock index 90ba258..cfc6bf4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10148,7 +10148,7 @@ __metadata: react-dropzone: ^11.3.1 react-hot-toast: ^2.4.1 react-i18next: ^12.2.2 - react-multi-date-picker: ^4.3.1 + react-multi-date-picker: ^4.4.1 react-number-format: ^4.9.3 react-qr-code: ^2.0.11 react-redux: ^8.0.5 @@ -11526,10 +11526,10 @@ __metadata: languageName: node linkType: hard -"react-date-object@npm:^2.1.5": - version: 2.1.7 - resolution: "react-date-object@npm:2.1.7" - checksum: f8e16484a16a56251697b52cb6c78c2aaa89ba33694c5f2032a967a68b70446cdb6ff9f4357e6e2a7ad50d48f1518f7b1b49ed7ca111542a8a32902c080a3c8a +"react-date-object@npm:^2.1.8": + version: 2.1.8 + resolution: "react-date-object@npm:2.1.8" + checksum: 8c4ecc7f849efccc483fd78411d88971b48b2e695f1fe331ff83a0e1d87299f3c9d073bd7efba0dd542f5500923ed05dc65af0ea03e1bb344918e3e9e998d703 languageName: node linkType: hard @@ -11670,16 +11670,16 @@ __metadata: languageName: node linkType: hard -"react-multi-date-picker@npm:^4.3.1": - version: 4.3.1 - resolution: "react-multi-date-picker@npm:4.3.1" +"react-multi-date-picker@npm:^4.4.1": + version: 4.4.1 + resolution: "react-multi-date-picker@npm:4.4.1" dependencies: - react-date-object: ^2.1.5 + react-date-object: ^2.1.8 react-element-popper: ^2.1.6 peerDependencies: react: ">=16.8.0" react-dom: ">=16.8.0" - checksum: 1b8352c355dd68be256f503cf02ab1ac059b8479a1bccea1ddfe180e93a028421ad9989bccac58798b2cddf985828f53fe7535e44a395b4c31143886de2c14e0 + checksum: fb225006e24f90ac1283f0e51339b941c17fcdf92418b55c7c51619a17e6f8786bed663187ef24b5f657c20d3bf178bb1ba56e593c314a9add30c43a491a0c6a languageName: node linkType: hard From 9ce5eccf134fc1f17370c196990cf67d68c40b13 Mon Sep 17 00:00:00 2001 From: Hossein Date: Tue, 16 Apr 2024 14:32:51 +0330 Subject: [PATCH 6/7] Close #58: Handle Georgian & Solar Hijri calendar type in transactions history filter --- src/components/TextInput/TextInput.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/components/TextInput/TextInput.js b/src/components/TextInput/TextInput.js index a329e1c..b1dca7e 100644 --- a/src/components/TextInput/TextInput.js +++ b/src/components/TextInput/TextInput.js @@ -3,8 +3,12 @@ import Icon from "../Icon/Icon"; import Select from "react-select"; import classes from "./TextInput.module.css"; import DatePicker from "react-multi-date-picker"; -import persian_fa from "react-date-object/locales/persian_fa"; +import gregorian from "react-date-object/calendars/gregorian"; import persian from "react-date-object/calendars/persian"; +import englishGregorian from "react-date-object/locales/gregorian_en"; +import farsiGregorian from "react-date-object/locales/gregorian_fa"; +import englishJalali from "react-date-object/locales/persian_en"; +import farsiJalali from "react-date-object/locales/persian_fa"; import {useSelector} from "react-redux"; import i18n from "i18next"; import "react-multi-date-picker/styles/backgrounds/bg-dark.css" @@ -26,6 +30,21 @@ const TextInput = (props) => { return className; } + const calenderTypeHandler = () => { + if (type === "Hijri" && i18n.language === "en") { + return englishGregorian + } + if (type === "Hijri" && i18n.language === "fa") { + return farsiGregorian + } + if (type === "Jalali" && i18n.language === "en") { + return englishJalali + } + if (type === "Jalali" && i18n.language === "fa") { + return farsiJalali + } + }; + let leadSection = null let afterSection = null @@ -64,8 +83,8 @@ const TextInput = (props) => { if ( datePicker ){ inputSection = } {...other} From 52cb3384c46a193ab7114cc68773d4f003a50236 Mon Sep 17 00:00:00 2001 From: Hossein Date: Tue, 16 Apr 2024 15:04:10 +0330 Subject: [PATCH 7/7] Close #59: Release v1.0.3-beta.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7f82edb..6173731 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opex", - "version": "v1.0.1-beta.5", + "version": "v1.0.3-beta.6", "homepage": "", "private": true, "dependencies": {