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

Fasih/DPROD-3321/Multiple build for market pages #7218

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
0bfff01
chore: create themes and sites dir
hasan-deriv Jan 29, 2024
0594f04
chore: created row and eu sites directiory
hasan-deriv Jan 29, 2024
5539851
chore: created gatsby-theme-deriv directory
hasan-deriv Jan 29, 2024
6a9f9a4
chore: moved src into deriv theme directory
hasan-deriv Jan 29, 2024
b4c1d33
chore: moved types into deriv theme directory
hasan-deriv Jan 29, 2024
2af0a33
chore: moved static and gatsby files into deriv theme directory
hasan-deriv Jan 29, 2024
3b36636
chore: moved storybook and favicons files into deriv theme directory
hasan-deriv Jan 29, 2024
ed42d30
chore: added eslint to theme
hasan-deriv Jan 29, 2024
92d6905
chore: added typescript to theme
hasan-deriv Jan 29, 2024
ab0cda6
chore: added workspaces
hasan-deriv Jan 29, 2024
6a7bba1
chore: added eslint script
hasan-deriv Jan 29, 2024
8f55c98
chore: added stylelint script
hasan-deriv Jan 29, 2024
6cac5ee
chore: added prettier script
hasan-deriv Jan 29, 2024
762e4b1
chore: added prettier and git ignore
hasan-deriv Jan 29, 2024
b5359dc
chore: udpated jest configure
hasan-deriv Jan 29, 2024
b69dbbe
chore: fixed checkbox test
hasan-deriv Jan 29, 2024
4b477b8
chore: added codegen script
hasan-deriv Jan 29, 2024
13638b5
chore: added storybook script
hasan-deriv Jan 29, 2024
49e0919
chore: added react packages
hasan-deriv Jan 29, 2024
70c6c62
chore: moved packages to theme
hasan-deriv Jan 30, 2024
68f88c8
chore: added theme config and options
hasan-deriv Jan 30, 2024
64e8352
chore: added row script
hasan-deriv Jan 30, 2024
c13bca0
chore: moved i18 files to theme
hasan-deriv Jan 30, 2024
1642f02
chore: updated favicon path in gatsby config
hasan-deriv Jan 30, 2024
c2e994f
chore: moved babel tailwind and js config file to theme
hasan-deriv Jan 30, 2024
0930ef3
chore: added clean script
hasan-deriv Jan 30, 2024
3581027
chore: updated eslint and tsconfig to fix alias import error
hasan-deriv Jan 30, 2024
64547f8
chore: added theme to sites
hasan-deriv Jan 30, 2024
4f0b201
chore: fixed sass classnames issue
hasan-deriv Jan 30, 2024
82c566b
chore: updated tailwind config
hasan-deriv Jan 30, 2024
d91a855
chore: fixed env issue
hasan-deriv Jan 30, 2024
771b88d
chore: fixed eslint issues
hasan-deriv Jan 30, 2024
490d003
chore: added build script
hasan-deriv Jan 31, 2024
e99f18e
chore: fixed html minification issue
hasan-deriv Jan 31, 2024
56702a3
chore: fixed html minification issue
hasan-deriv Jan 31, 2024
0b22713
chore: updated partytown scripts
hasan-deriv Jan 31, 2024
f227025
chore: updated serve scripts
hasan-deriv Jan 31, 2024
fdf6e45
chore: updated htaccess script
hasan-deriv Jan 31, 2024
b4bce28
chore: updated translation scripts
hasan-deriv Jan 31, 2024
de32223
chore: updated link generate workflow
hasan-deriv Jan 31, 2024
481365d
Merge branch 'master' into quill-pr-3317-setup-monorep-config
hasan-deriv Jan 31, 2024
f2a9451
chore: updated link generate workflow
hasan-deriv Jan 31, 2024
a1ce8c6
chore: added new workflow
hasan-deriv Feb 1, 2024
977a60d
chore: removed workflow
hasan-deriv Feb 1, 2024
5c837b4
empty: 🚀 to redeploy and trigger build
hasan-deriv Feb 1, 2024
314b608
Merge branch 'master' into quill-pr-3317-setup-monorep-config
hasan-deriv Feb 2, 2024
a3b703d
Merge branch 'master' into quill-pr-3317-setup-monorep-config
hasan-deriv Feb 21, 2024
5a74712
feat: added region conditions on home and header nav
fasihali-deriv Feb 22, 2024
ab8498f
Merge pull request #12 from fasihali-deriv/setup-monorepo-config-for-…
hasan-deriv Feb 27, 2024
9919e88
chore: test workflow
hasan-deriv Feb 21, 2024
cd7dda1
Merge branch 'master' into quill-pr-3317-setup-monorep-config
hasan-deriv Feb 27, 2024
197d103
chore: merge cleanup
hasan-deriv Feb 27, 2024
118bacc
chore: added region based data for homepage
hasan-deriv Feb 27, 2024
a06ac97
chore: added a different port to eu serve
hasan-deriv Feb 27, 2024
cfe982f
chore: test workflow
hasan-deriv Feb 21, 2024
4b15adc
empty: 🚀 to redeploy and trigger build
hasan-deriv Feb 27, 2024
7736903
Merge branch 'master' into quill-pr-3317-setup-monorep-config
hasan-deriv Feb 27, 2024
e1c1c9b
empty: 🚀 to redeploy and trigger build
hasan-deriv Feb 27, 2024
4b29790
empty: 🚀 to redeploy and trigger build
hasan-deriv Feb 27, 2024
9d18eb3
chore: test workflow
hasan-deriv Feb 21, 2024
80b9b65
Merge branch 'master' into quill-pr-3317-setup-monorep-config
hasan-deriv Feb 27, 2024
a641e81
chore: test workflow
hasan-deriv Feb 21, 2024
bf0f3c3
chore: removed
hasan-deriv Feb 28, 2024
8cc3682
empty: 🚀 to redeploy and trigger build
hasan-deriv Feb 28, 2024
bbba247
Merge branch 'master' into quill-pr-3317-setup-monorep-config
hasan-deriv Feb 28, 2024
789ec0d
chore: removed workflow
hasan-deriv Feb 28, 2024
6181ffe
feat: added conditions
Feb 29, 2024
74a7598
feat: added more eu conditions
Mar 1, 2024
ab9fe8e
feat: updated with master and resolved conflicts
Mar 1, 2024
0213eab
feat: added eu preview link file
Mar 1, 2024
6d3c4e7
feat: udpated region condition
Mar 4, 2024
3308cb6
feat: remove use effect and add normal conditions
Mar 4, 2024
5193daa
feat: removed unsued code
Mar 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/generate-preview-link-eu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ jobs:
''
].join('\n')
core.setOutput("comment", comment);

- name: Post Cloudflare Pages Preview comment
uses: marocchino/sticky-pull-request-comment@efaaab3fd41a9c3de579aba759d2552635e590fd
with:
Expand Down Expand Up @@ -76,7 +75,6 @@ jobs:
path: |
sites/eu/.cache
sites/eu/public

- name: Install Dependencies
uses: "./.github/actions/npm_install_from_cache"

Expand Down Expand Up @@ -105,7 +103,6 @@ jobs:
echo "$EVENT_NUMBER" > .pr/NR
echo "$EVENT_USERNAME" > .pr/USERNAME
echo "$HEAD_REF" > .pr/BRANCHNAME

- name: Publish to Cloudflare Pages
id: publish-to-pages
env:
Expand All @@ -130,7 +127,6 @@ jobs:
echo "Deployment to Cloudflare Pages failed."
exit 1
fi

- name: 'Generate preview link comment'
if: success()
id: generate_preview_url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import Typography from 'features/components/atoms/typography'
import { Localize } from 'components/localization'
import Flex from 'features/components/atoms/flex-box'
import { TString } from 'types/generics'
import useRegion from 'components/hooks/use-region'
import useVisibleContent from 'components/hooks/use-visible-content'
import useBuildVariant from 'features/hooks/use-build-variant'

interface TradeBenefitWrapperProps {
data: BenefitTradeTypeItem[]
header: TString
}

const TradeBenefitWrapper = ({ data, header }: TradeBenefitWrapperProps) => {
const { is_eu } = useRegion()
const visible_trade_benefits = useVisibleContent({ content: data, config: { is_eu } })
const { region } = useBuildVariant()
const visible_trade_benefits = useVisibleContent({ content: data, config: { is_eu: region === 'eu' ? true : false } })
return (
<Container.Fixed
as="section"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { TString } from 'types/generics'
import TabMenu from 'features/components/templates/tabs/menu'
import Icon from 'features/components/atoms/icon'
import Link from 'features/components/atoms/link'
import useRegion from 'components/hooks/use-region'
import useVisibleContent from 'components/hooks/use-visible-content'
import useBuildVariant from 'features/hooks/use-build-variant'

interface TradesAvailableWrapperProps {
header?: TString
Expand All @@ -17,14 +17,13 @@ interface TradesAvailableWrapperProps {

const TradesAvailableWrapper = ({ item }: TradesAvailableWrapperProps) => {
const [current_tab, setCurrentTab] = useState('_t_CFDs_t_')
const { is_eu } = useRegion()
const { region } = useBuildVariant()
const available_trade_items = useVisibleContent({
content: item.trade_items,
config: {
is_eu,
is_eu: region === 'eu' ? true : false,
},
})

return (
<Flex.Box direction="col" gap="10x" md={{ gap: '20x' }} align="center" justify="center">
<TabMenu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const MainFooter = () => {
const [is_career, setIsCareer] = useState(false)
const [social_buttons, setSocialButtons] = useState(socialButtonsROW)
const [warn_text, setWarnText] = useState(warnText)
const region_buttons = region === "eu" ? socialButtonsEU : socialButtonsROW

useEffect(() => {
const current_path = getLocationPathname()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import MainRowNavigation from 'features/components/templates/navigation/main-nav
import { usePlatformQueryParam } from 'components/hooks/use-platform-query-param'
import MarketBottomNav from 'features/components/templates/navigation/template/market-bottom-nav'
import MainFooter from 'features/components/templates/footer'
import { TPageContext } from 'features/types'

const ETFMarket = () => {
const ETFMarket = ({ region }: TPageContext) => {
const { is_deriv_go } = usePlatformQueryParam()
return (
<Layout>
<Layout region={region}>
{!is_deriv_go && (
<div className="fixed z-[4] w-full">
<MainRowNavigation />
Expand All @@ -43,7 +44,7 @@ const ETFMarket = () => {
<CheckTrading />
<WhyTrade />
<Steps />
<OtherMarketsSlider current_market="etfs" />
<OtherMarketsSlider current_market="etfs"/>
<SignupPublic />
<MainFooter />
</Layout>
Expand Down
2 changes: 1 addition & 1 deletion themes/gatsby-theme-deriv/src/features/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { HeadProps } from 'gatsby'
import { BuildVariantContextType } from 'features/contexts/build-variant/build-variant.context'
import type { HeadProps } from 'gatsby'
import { TString } from 'types/generics'

export type ContentSectionTagOptions =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@ import { WithIntl } from 'components/localization'
import { SEO } from 'components/containers'
import { TGatsbyHead } from 'features/types'

const BasketPage = () => (
<Layout type="noNav" padding_top="0">
<DerivedFXHero
title="_t_Derived_t_"
description="_t_Trade on asset prices derived from real-world or simulated markets. Manage your exposure by selecting the volatility level to suit your risk appetite. Choose from our 24/7 synthetics, derived FX, and baskets._t_"
is_derived_row
/>
<NavTab route_from="basket-indices" />
<BasketIndices simple_step_content={simple_step_content_basket} />
<SignupPublic />
</Layout>
)
const BasketPage = ({pageContext}: TGatsbyHead) => {
const {region} = pageContext
return (
<Layout type="noNav" padding_top="0" region={region}>
<DerivedFXHero
title="_t_Derived_t_"
description="_t_Trade on asset prices derived from real-world or simulated markets. Manage your exposure by selecting the volatility level to suit your risk appetite. Choose from our 24/7 synthetics, derived FX, and baskets._t_"
is_derived_row={region === 'row'}
/>
<NavTab route_from="basket-indices" />
<BasketIndices simple_step_content={simple_step_content_basket} />
<SignupPublic />
</Layout>
)
}

export default WithIntl()(BasketPage)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
import React, { useEffect, useState } from 'react'
import React from 'react'
import Commodities from '../components/markets/_commodities'
import { DerivedFXHero } from '../components/sections/_hero_derived_fx'
import { simple_step_content_commodities } from '../static/content/_commodities'
import SignupPublic from 'features/components/templates/signup/with-banner'
import Layout from 'components/layout/layout'
import { WithIntl } from 'components/localization'
import { SEO } from 'components/containers'
import useRegion from 'components/hooks/use-region'
import { TGatsbyHead } from 'features/types'
import { TString } from 'types/generics'

const CommoditiesPage = () => {
const { is_eu } = useRegion()
const [description, setDescription] = useState<TString>(
'_t_Trade popular assets in the commodities market such as silver, gold, oil, and more without owning the underlying asset. Speculate on the price movements and benefit from our high leverage and competitive spreads._t_',
)

useEffect(() => {
if (is_eu)
setDescription(
'_t_Trade popular assets in the commodities market such as silver, gold, oil, and more without owning the underlying asset. Speculate on the price movements and benefit from our competitive spreads._t_',
)
}, [is_eu])
const CommoditiesPage = ({pageContext}: TGatsbyHead) => {
const {region} = pageContext
const description = region === 'eu'?
'_t_Trade popular assets in the commodities market such as silver, gold, oil, and more without owning the underlying asset. Speculate on the price movements and benefit from our competitive spreads._t_':
'_t_Trade popular assets in the commodities market such as silver, gold, oil, and more without owning the underlying asset. Speculate on the price movements and benefit from our high leverage and competitive spreads._t_'

return (
<Layout type="noNav" padding_top="0">
<Layout type="noNav" padding_top="0" region={region}>
<DerivedFXHero title="_t_Commodities_t_" description={description} is_commodities />
<Commodities simple_step_content={simple_step_content_commodities} />
<SignupPublic />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import DBot from 'images/svg/custom/rebranding/deriv-bot-icon.svg'
import DMT5 from 'images/svg/custom/rebranding/dmt5-icon.svg'
import DTrader from 'images/svg/custom/rebranding/dtrader-icon.svg'
import DerivGo from 'images/svg/custom/rebranding/deriv-go-icon.svg'
import useRegion from 'components/hooks/use-region'
import useBuildVariant from 'features/hooks/use-build-variant'

type AvailablePlatformsProps = {
dmt5?: boolean
Expand Down Expand Up @@ -93,12 +93,10 @@ const AvailablePlatforms = ({
tablet_direction,
m_top,
}: AvailablePlatformsProps) => {
const { is_eu } = useRegion()
const [show_derivx, setShowDerivX] = useState(true)

const { region } = useBuildVariant()
const show_derivx = region === 'row' ? true : false

useEffect(() => {
if (is_eu) setShowDerivX(false)
}, [is_eu])
const deriv_mt5_name = 'Deriv MT5'
const deriv_go_name = 'Deriv GO'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { SectionContainer, Flex, Container } from 'components/containers'
import { Header } from 'components/elements'
import { Localize } from 'components/localization'
import device from 'themes/device'
import useRegion from 'components/hooks/use-region'
import { useIsRtl } from 'components/hooks/use-isrtl'
import { isBrowser } from 'common/utility'
import { TString } from 'types/generics'
import { usePlatformQueryParam } from 'components/hooks/use-platform-query-param'
import useBuildVariant from 'features/hooks/use-build-variant'

type CardProps = {
active_tab: string
Expand Down Expand Up @@ -201,19 +201,15 @@ const AvailableTradesDesktop = ({
Multipliers,
display_title,
}: AvailableTradesProps) => {
const { is_eu } = useRegion()
const { region } = useBuildVariant()
const [tab, setTab] = useState('cfds')
const params = new URLSearchParams(isBrowser() && location.search)
const [show_digital_options, setShowDigitalOptions] = useState(true)
const show_digital_options = region === 'row' ? true : false

useEffect(() => {
setTab(params.get('tab') || 'cfds')
}, [params])

useEffect(() => {
if (is_eu) setShowDigitalOptions(false)
}, [is_eu])

const { is_deriv_go } = usePlatformQueryParam()

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import { Localize, localize } from 'components/localization'
import Typography from 'features/components/atoms/typography'
import LinkButton from 'features/components/atoms/link-button'
import Flex from 'features/components/atoms/flex-box'
import useRegion from 'components/hooks/use-region'
import { FullWidthMultiColumn } from 'components/elements/full-width-multicolumn'
import OtherMarketsSlider from 'features/components/molecules/other-markets-slider'
import { TSimpleStepContent } from 'pages/markets/static/content/_types'
import useBuildVariant from 'features/hooks/use-build-variant'

//Lazy-load
const SimpleSteps = Loadable(() => import('components/custom/_simple-steps'))
Expand All @@ -28,10 +28,10 @@ type BasketIndicesProps = {
}

const BasketIndices = ({ simple_step_content }: BasketIndicesProps) => {
const { is_eu, is_row } = useRegion()
const { region } = useBuildVariant()
return (
<>
{is_row && (
{region === 'row' && (
<>
<TradeDetails description="_t_Trade your favourite currency against a basket of major currencies and benefit from reduced risk and volatility._t_" />
<AvailableTrades
Expand Down Expand Up @@ -69,7 +69,7 @@ const BasketIndices = ({ simple_step_content }: BasketIndicesProps) => {
</LinkButton.Primary>
</Flex.Box>
<FullWidthMultiColumn header="_t_Why trade baskets on Deriv_t_">
{(!is_eu ? basket_indices_content : basket_indices_content_eu).map(
{(region === 'row' ? basket_indices_content : basket_indices_content_eu).map(
({ alt, src, text }) => (
<StyledBox
key={text}
Expand All @@ -94,7 +94,7 @@ const BasketIndices = ({ simple_step_content }: BasketIndicesProps) => {
<OtherMarketsSlider current_market="synthetic" />
</>
)}
{is_eu && <PageNotFound />}
{region === 'eu' && <PageNotFound region={region}/>}
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import Typography from 'features/components/atoms/typography'
import LinkButton from 'features/components/atoms/link-button'
import Flex from 'features/components/atoms/flex-box'
import { Localize, localize } from 'components/localization'
import useRegion from 'components/hooks/use-region'
import { FullWidthMultiColumn } from 'components/elements/full-width-multicolumn'
import OtherMarketsSlider from 'features/components/molecules/other-markets-slider'
import { TSimpleStepContent } from 'pages/markets/static/content/_types'
import useBuildVariant from 'features/hooks/use-build-variant'

//Lazy-load
const SimpleSteps = Loadable(() => import('components/custom/_simple-steps'))
Expand All @@ -24,13 +24,9 @@ type CommoditiesProps = {
}

const Commodities = ({ simple_step_content }: CommoditiesProps) => {
const { is_eu } = useRegion()
const [show_digital_options, setShowDigitalOptions] = useState(true)

useEffect(() => {
if (is_eu) setShowDigitalOptions(false)
}, [is_eu])

const { region } = useBuildVariant()
const show_digital_options = region === 'row' ? true : false

simple_step_content[1].text =
'_t_Open a real account, make a deposit, and start trading commodities and other markets. _t_'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import TightSpread from 'images/svg/markets/tight-spread-new.svg'
import CryptoPairs from 'images/svg/markets/crypto-pairs-new.svg'
import ZeroCommission from 'images/svg/markets/zero-commission-new.svg'
import Leverage from 'images/svg/stock-indices/stocks-high-leverage.svg'
import useRegion from 'components/hooks/use-region'
import Typography from 'features/components/atoms/typography'
import LinkButton from 'features/components/atoms/link-button'
import Flex from 'features/components/atoms/flex-box'
Expand All @@ -21,6 +20,7 @@ import OtherMarketsSlider from 'features/components/molecules/other-markets-slid
import { TMarket, TSimpleStepContent } from 'pages/markets/static/content/_types'
import { TSmartContent } from 'types/generics'
import useVisibleContent from 'components/hooks/use-visible-content'
import useBuildVariant from 'features/hooks/use-build-variant'

//Lazy-load
const SimpleSteps = Loadable(() => import('components/custom/_simple-steps'))
Expand Down Expand Up @@ -85,9 +85,9 @@ const crypto_content: SmartMarketItem[] = [
]

const Cryptocurrencies = ({ simple_step_content }: CryptocurrenciesProps) => {
const { is_eu } = useRegion()
const { region } = useBuildVariant()
const { is_deriv_go } = usePlatformQueryParam()
const visible_items = useVisibleContent({ content: crypto_content, config: { is_eu } })
const visible_items = useVisibleContent({ content: crypto_content, config: { is_eu : region === 'eu' ? true : false } })

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import { StyledBox } from '../../static/style/_markets-style'
import Typography from 'features/components/atoms/typography'
import LinkButton from 'features/components/atoms/link-button'
import Flex from 'features/components/atoms/flex-box'
import useRegion from 'components/hooks/use-region'
import { Localize, localize } from 'components/localization'
import { FullWidthMultiColumn } from 'components/elements/full-width-multicolumn'
import OtherMarketsSlider from 'features/components/molecules/other-markets-slider'
import { TSimpleStepContent } from 'pages/markets/static/content/_types'
import useBuildVariant from 'features/hooks/use-build-variant'

//Lazy-load
const SimpleSteps = Loadable(() => import('components/custom/_simple-steps'))
Expand All @@ -26,20 +26,12 @@ type ForexProps = {
}

const Forex = ({ simple_step_content }: ForexProps) => {
const { is_eu } = useRegion()
const [content, setContent] = useState(forex_content)
const [cfds, setCfds] = useState(forex_cfds)
const [show_digital_options, setShowDigitalOptions] = useState(true)
const [multiplier, setMultiplier] = useState(forex_multiplier)
const { region } = useBuildVariant()

useEffect(() => {
if (is_eu) {
setContent(forex_content_eu)
setCfds(forex_cfds_eu)
setShowDigitalOptions(false)
setMultiplier(forex_multiplier_eu)
}
}, [is_eu])
const content = region === 'eu' ? forex_content_eu : forex_content
const cfds = region === 'eu' ? forex_cfds_eu : forex_cfds
const show_digital_options = region === 'eu' ? false : true
const multiplier = region === 'eu' ? forex_multiplier_eu : forex_multiplier

return (
<>
Expand Down
Loading
Loading