From 6332eb5c18fe1d34a4cc2fc9867106163674958b Mon Sep 17 00:00:00 2001 From: Hossein Date: Tue, 3 Dec 2024 10:22:01 +0330 Subject: [PATCH] Handle various states for the MarketTitle component --- public/assets/locales/en/translation.json | 6 ++++++ public/assets/locales/fa/translation.json | 6 ++++++ .../components/MarketTitle/MarketTitle.js | 17 +++++++++++++++++ .../components/MarketViewCard/MarketViewCard.js | 4 ++-- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/public/assets/locales/en/translation.json b/public/assets/locales/en/translation.json index b66efbc..e341c77 100644 --- a/public/assets/locales/en/translation.json +++ b/public/assets/locales/en/translation.json @@ -632,6 +632,12 @@ "advancedTrading": "Advanced Trading", "easyTrading": "Easy Trading" }, + "Campaign": { + "hasCampaign":"false", + "title": "", + "content": "", + "link": "" + }, "GeneralInfo": { "activeUsers": "Active Users", "totalOrders": "Total Orders", diff --git a/public/assets/locales/fa/translation.json b/public/assets/locales/fa/translation.json index c680dd9..59f4df0 100644 --- a/public/assets/locales/fa/translation.json +++ b/public/assets/locales/fa/translation.json @@ -632,6 +632,12 @@ "advancedTrading": "معامله حرفه‌ای", "easyTrading": "معامله آسان" }, + "Campaign": { + "hasCampaign":"false", + "title": "", + "content": "", + "link": "" + }, "GeneralInfo": { "activeUsers": "کاربر فعال", "totalOrders": "سفارش ثبت شده", diff --git a/src/main/Mobile/Pages/Landing/components/MarketTitle/MarketTitle.js b/src/main/Mobile/Pages/Landing/components/MarketTitle/MarketTitle.js index 393cc61..dc0d148 100644 --- a/src/main/Mobile/Pages/Landing/components/MarketTitle/MarketTitle.js +++ b/src/main/Mobile/Pages/Landing/components/MarketTitle/MarketTitle.js @@ -10,9 +10,26 @@ const MarketTitle = () => { const {t} = useTranslation(); const navigate = useNavigate(); + const campaignLink = t("Campaign.link"); + const hasCampaign = t("Campaign.hasCampaign") === "true"; + + const clickHandler = () => { + if (campaignLink) { + window.open(campaignLink, "_blank"); + } else { + console.error("Link not found"); + } + } + return (
+ + { hasCampaign && <div className={`column jc-center ai-center fs-01 cursor-pointer card-bg card-border width-100 mb-2 mt-3 px-4 py-1`} onClick={()=>clickHandler()}> + <span className={`text-orange`}>{t("Campaign.title")}</span> + <span className={`mt-05 ${classes.flashit}`}>{t("Campaign.content")}</span> + </div>} + <div className={`row jc-between ai-center mt-2`}> <Button buttonClass={`${classes.thisButton} width-48`} diff --git a/src/main/Mobile/Pages/Landing/components/MarketView/components/MarketViewCard/MarketViewCard.js b/src/main/Mobile/Pages/Landing/components/MarketView/components/MarketViewCard/MarketViewCard.js index c8b165f..51f9e29 100644 --- a/src/main/Mobile/Pages/Landing/components/MarketView/components/MarketViewCard/MarketViewCard.js +++ b/src/main/Mobile/Pages/Landing/components/MarketView/components/MarketViewCard/MarketViewCard.js @@ -35,9 +35,9 @@ const MarketViewCard = ({title, data, error, isLoading, volume}) => { } return ( - <div className={` card-bg card-border column width-100 my-2`}> + <div className={`card-bg card-border column width-100 my-2`}> <p className={`text-orange text-center px-4 py-2 card-header-bg`}>{title}</p> - <div className={` row jc-between ai-center width-100 px-4 py-1`}> + <div className={` row jc-between ai-center width-100 px-4 py-1`}> {content()} </div> </div>