Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
Konstantinos Remove Appgallery and/ or Appstore download option from …
Browse files Browse the repository at this point in the history
…Deriv GO product page for countries not listed in iOS and/ or Huawei (#5650)

* fix: conditional render of buttons per country

* auto-pull-translation

* translation: 📚 sync translations from crowdin feature branch

* fix: empty

---------

Co-authored-by: Konstantinos-Gk <[email protected]>
Co-authored-by: DerivFE <[email protected]>
  • Loading branch information
3 people authored Sep 28, 2023
1 parent 74f84b9 commit 4e00807
Show file tree
Hide file tree
Showing 23 changed files with 4,651 additions and 4,632 deletions.
3 changes: 3 additions & 0 deletions crowdin/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,7 @@
"1557977381": "<p>The potential payout is predetermined based on the specific details of the trade and if your market predictions are right.</p><p>For Rise/Fall contracts, potential payouts generally range from 85% to 95% of your stake.</p><p>For Higher/Lower contracts, potential payouts can range from 1% to 3,900% of your stake, depending on where the barrier is set.</p><p>The potential payout and potential loss (your initial stake) will be clearly displayed before you enter the trade.</p>",
"1559136143": "No, we don't offer cryptocurrencies on DBot.",
"1559712313": "Commodity trades available on Deriv",
"1560383409": "Android",
"1561008060": "<ul><li>Choose the instrument you want to trade.</li><li>Select the duration of your contract.</li><li>Enter your stake or desired potential payout.</li><li>Predict the price direction of the instrument.</li><li>Open your contract.</li></ul>",
"1562241070": "All favourite markets and more",
"1563919822": "You'll get daily commission payouts in your MT5 Synthetic account.",
Expand Down Expand Up @@ -3338,6 +3339,8 @@
"-247192100": "Deriv EZ – a CFD trading platform | Deriv",
"-612077545": "Deriv EZ is our intuitive CFD trading platform where you can trade forex, commodities, stocks & indices, cryptocurrencies, and derived indices.",
"-2082435325": "A trading platform for on-the-go traders",
"-1607871978": "Android and Huawei",
"-1444700007": "Android, and iOS",
"-1485956312": "Get trading with Deriv GO",
"-930794949": "Sign in to your Deriv account. If you don’t have one, sign up for free; then create a Deriv real account.",
"-502692472": "Fund your Deriv",
Expand Down
42 changes: 37 additions & 5 deletions src/common/country-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,9 @@ export const not_available_appgallery_countries = [
'br',
'bn',
'bf',
'bi',
'kh',
'cm',
'cv',
'cf',
'td',
'km',
'cg',
Expand All @@ -371,9 +369,7 @@ export const not_available_appgallery_countries = [
'dj',
'do',
'eg',
'gq',
'er',
'et',
'fj',
'gf',
'pf',
Expand All @@ -390,7 +386,6 @@ export const not_available_appgallery_countries = [
'kw',
'la',
'lb',
'ls',
'lr',
'ly',
'mg',
Expand Down Expand Up @@ -447,8 +442,45 @@ export const not_available_appgallery_countries = [
'ye',
'zm',
'zw',
'bt',
'xk',
'tv',
]

export const not_avalable_appgallery_and_ios_countries = [
'bv',
'io',
'cx',
'cc',
'cw',
'fk',
'tf',
'gg',
'cf',
'im',
'je',
'ki',
'nu',
'nf',
'pn',
'bq',
'sh',
'vc',
'gs',
'tl',
'tk',
'eh',
'aq',
'hm',
'um',
'bi',
'et',
'gq',
'ls',
]

export const not_available_iOS_countries = ['ad', 'ck', 'ps']

export const not_available_ctrader_countries = [
'as',
'au',
Expand Down
2 changes: 1 addition & 1 deletion src/components/custom/_multi-width-column-download.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type TDownloadColumn = {
items?: TDownloadColumnItem[]
QRImage?: string
QRHeading1?: TString
QRHeading2?: TString
QRHeading2?: TString | (() => void)
is_rtl: boolean
}

Expand Down
34 changes: 26 additions & 8 deletions src/pages/deriv-go/_footer-banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,34 @@ const TextAndButtonWrapper = styled.div`
const DerivGoGetApp = () => {
const { is_mobile_or_tablet } = useBreakpoints()
const is_rtl = useIsRtl()
const { is_appgallery_supported } = useRegion()
const { is_appgallery_supported, is_ios_supported, is_appgallery_and_ios_supported } =
useRegion()

const items: TDownloadColumnItem[] = [
{ text: 'Google Play', icon: AndroidIcon, link: deriv_go_playstore_url },
{ text: 'App Store', icon: AppleIcon, link: deriv_go_ios_url },
...(is_appgallery_supported
...(is_ios_supported && is_appgallery_and_ios_supported
? [{ text: 'App Store', icon: AppleIcon, link: deriv_go_ios_url }]
: []),
...(is_appgallery_supported && is_appgallery_and_ios_supported
? [{ text: 'AppGallery', icon: AppGalleryIcon, link: deriv_go_huaweiappgallery_url }]
: []),
]

function findQRHeading(
is_appgallery_supported,
is_ios_supported,
is_appgallery_and_ios_supported,
) {
if (!is_appgallery_and_ios_supported) {
return '_t_Android_t_'
} else if (!is_ios_supported) {
return '_t_Android and Huawei_t_'
} else if (!is_appgallery_supported) {
return '_t_Android, and iOS_t_'
} else {
return '_t_Android, iOS, and Huawei_t_'
}
}
return (
<MultiWidthColumn
firstColumnBackground="#4C515C"
Expand Down Expand Up @@ -88,11 +106,11 @@ const DerivGoGetApp = () => {
<DownloadColumn
QRImage={derivGoQR}
QRHeading1="_t_Scan to download_t_"
QRHeading2={
is_appgallery_supported
? '_t_Android, iOS, and Huawei_t_'
: '_t_Android and iOS_t_'
}
QRHeading2={findQRHeading(
is_appgallery_supported,
is_ios_supported,
is_appgallery_and_ios_supported,
)}
items={items}
is_rtl={is_rtl}
/>
Expand Down
16 changes: 15 additions & 1 deletion src/store/region-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
cpa_plan_countries,
p2p_countries,
not_available_appgallery_countries,
not_avalable_appgallery_and_ios_countries,
not_available_iOS_countries,
} from 'common/country-base'
import useWebsiteStatus from 'components/hooks/use-website-status'
import {
Expand Down Expand Up @@ -35,7 +37,9 @@ type RegionContextType = Record<
| 'is_row'
| 'is_dev'
| 'is_africa'
| 'is_appgallery_supported',
| 'is_appgallery_supported'
| 'is_appgallery_and_ios_supported'
| 'is_ios_supported',
boolean
> & { user_country: string }

Expand All @@ -57,6 +61,8 @@ export const RegionProvider = ({ children }: RegionProviderProps) => {
})
const [is_p2p_allowed_country, setP2PAllowedCountry] = useState(false)
const [is_appgallery_supported, setAppgallerySupported] = useState(false)
const [is_appgallery_and_ios_supported, setAppgalleryIosSupported] = useState(false)
const [is_ios_supported, setIosSupported] = useState(false)
const [is_p2p_loading, setP2PLoading] = useState(true)
const [user_country, setUserCountry] = useState(null)

Expand Down Expand Up @@ -90,6 +96,12 @@ export const RegionProvider = ({ children }: RegionProviderProps) => {
not_available_appgallery_countries.includes(qa_url_region)
? setAppgallerySupported(false)
: setAppgallerySupported(true)
not_avalable_appgallery_and_ios_countries.includes(qa_url_region)
? setAppgalleryIosSupported(false)
: setAppgalleryIosSupported(true)
not_available_iOS_countries.includes(qa_url_region)
? setIosSupported(false)
: setIosSupported(true)
}
setUserCountry(clients_country)
setRegion({
Expand Down Expand Up @@ -155,6 +167,8 @@ export const RegionProvider = ({ children }: RegionProviderProps) => {
is_row,
is_dev,
is_appgallery_supported,
is_appgallery_and_ios_supported,
is_ios_supported,
}}
>
{children}
Expand Down
Loading

1 comment on commit 4e00807

@vercel
Copy link

@vercel vercel bot commented on 4e00807 Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

deriv-com – ./

deriv-com.binary.sx
deriv-com-git-master.binary.sx

Please sign in to comment.