Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Revert assets info #2679

Merged
2 commits merged into from Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9,143 changes: 4,328 additions & 4,815 deletions package-lock.json

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"version": "0.1.0",
"author": "Deriv",
"dependencies": {
"@artsy/fresnel": "^3.2.2",
"@directus/gatsby-source-directus": "^9.4.3",
"@artsy/fresnel": "^3.2.1",
"@directus/gatsby-source-directus": "^9.4.2",
"@livechat/customer-sdk": "^3.1.0",
"@loadable/component": "^5.15.2",
"@svgr/webpack": "^6.1.2",
"commander": "^8.3.0",
"crc-32": "^1.2.1",
"crc-32": "^1.2.0",
"embla-carousel-react": "^6.0.2",
"eslint-import-resolver-node": "^0.3.6",
"extend": "^3.0.2",
Expand All @@ -32,41 +32,41 @@
"gatsby-source-filesystem": "^4.4.0",
"gatsby-transformer-sharp": "^4.4.0",
"gbimage-bridge": "^0.2.1",
"i18next": "^21.6.11",
"i18next": "^21.6.5",
"js-cookie": "^2.2.1",
"lottie-web": "^5.8.1",
"match-sorter": "^6.3.1",
"postcss": "^8.4.6",
"preact": "^10.6.6",
"preact-render-to-string": "^5.1.20",
"postcss": "^8.4.5",
"preact": "^10.6.4",
"preact-render-to-string": "^5.1.19",
"prop-types": "^15.8.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-helmet": "^6.1.0",
"react-i18next": "^11.15.5",
"react-i18next": "^11.15.3",
"react-is": "^17.0.2",
"react-paginate": "^8.1.2",
"react-paginate": "^8.1.0",
"react-perfect-scrollbar": "^1.5.8",
"react-ticker": "^1.3.1",
"use-query-params": "^1.2.3",
"web-push-notifications": "^3.24.0",
"webpack": "^5.65.0"
},
"devDependencies": {
"@storybook/addon-actions": "^6.4.19",
"@storybook/addon-essentials": "^6.4.19",
"@storybook/addon-links": "^6.4.19",
"@storybook/builder-webpack5": "^6.4.19",
"@storybook/manager-webpack5": "^6.4.19",
"@storybook/react": "^6.4.19",
"@types/node": "^17.0.19",
"@types/react": "^17.0.39",
"@storybook/addon-actions": "^6.4.9",
"@storybook/addon-essentials": "^6.4.9",
"@storybook/addon-links": "^6.4.9",
"@storybook/builder-webpack5": "^6.4.9",
"@storybook/manager-webpack5": "^6.4.9",
"@storybook/react": "^6.4.9",
"@types/node": "^17.0.8",
"@types/react": "^17.0.38",
"@types/react-dom": "^17.0.11",
"@types/styled-components": "^5.1.23",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"@types/styled-components": "^5.1.19",
"@typescript-eslint/eslint-plugin": "^5.9.0",
"@typescript-eslint/parser": "^5.9.0",
"babel-eslint": "10.1.0",
"babel-plugin-styled-components": "^2.0.5",
"babel-plugin-styled-components": "^2.0.2",
"eslint": "^7.32.0",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.25.4",
Expand All @@ -77,7 +77,7 @@
"gatsby-plugin-styled-components": "^5.4.0",
"gh-pages": "^3.2.3",
"husky": "^7.0.4",
"lint-staged": "^12.1.7",
"lint-staged": "^12.1.5",
"npm-force-resolutions": "0.0.10",
"prettier": "^2.5.1",
"query-string": "^7.0.1",
Expand All @@ -87,8 +87,8 @@
"stylelint-config-standard": "^24.0.0",
"stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.10.0",
"stylelint-webpack-plugin": "^3.1.1",
"typescript": "^4.5.5"
"stylelint-webpack-plugin": "^3.1.0",
"typescript": "^4.5.4"
},
"keywords": [
"deriv",
Expand Down
3 changes: 0 additions & 3 deletions src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ const getDomainAppID = () => {
else return deriv_com_app_id
}

export const eu_domains = ['eu', 'staging-eu']
export const uk_domains = ['uk', 'staging-uk']

// URL
export const domain_full_url = `https://${getDomainUrl()}`
export const deriv_app_id = getDomainAppID()
Expand Down
3 changes: 1 addition & 2 deletions src/components/containers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import CssGrid, { CssGridColumn } from './css-grid'
import SEO from './seo'
import Show from './show'
import Box from './box'
import { Desktop, Mobile, EU, UK, ROW, NonEU, NonUK, UKEU } from './visibility'
import { Desktop, Mobile, EU, UK, ROW, NonEU, NonUK } from './visibility'

export {
Container,
Expand All @@ -26,7 +26,6 @@ export {
Mobile,
EU,
UK,
UKEU,
ROW,
NonUK,
NonEU,
Expand Down
63 changes: 28 additions & 35 deletions src/components/containers/visibility.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { ReactElement, useEffect, useState, useContext } from 'react'
import React, { ReactElement, useEffect, useState } from 'react'
import styled from 'styled-components'
import { size } from 'themes/device'
import { useBrowserResize } from 'components/hooks/use-browser-resize'
import { DerivStore } from 'store'
import { eu_domains, uk_domains } from 'common/constants'

type ResponsiveContainerProps = {
children: ReactElement
Expand All @@ -27,7 +26,6 @@ const DesktopLayer = styled.div<LayerProps>`
display: none;
}
`

const MobileLayer = styled.div<LayerProps>`
@media (min-width: ${({ breakpoint }) => breakpoint}px) {
display: none;
Expand All @@ -40,12 +38,11 @@ const domainBasedCheck = () => {

useEffect(() => {
if (window) {
const subdomain = window.location.hostname.split('.').slice(0, -2).join('.')

if (eu_domains.includes(subdomain)) {
const host_name = window.location.hostname
if (host_name.includes('eu')) {
setEuDomain(true)
}
if (uk_domains.includes(subdomain)) {
if (host_name.includes('uk')) {
setUkDomain(true)
}
}
Expand All @@ -68,20 +65,6 @@ const deviceRenderer = (): boolean => {
return is_loaded
}

export const getCountryRule = () => {
const { is_eu_domain, is_uk_domain } = domainBasedCheck()
const { is_eu_country, is_uk_country } = useContext<StoreDataType>(DerivStore)

const is_eu = (is_eu_country || is_eu_domain) && !is_uk_country
const is_uk = is_uk_country || is_uk_domain
const is_non_uk = !is_uk
const is_non_eu = !is_eu
const is_eu_uk = !(!is_eu && !is_uk)
const is_row = !is_eu_uk

return { is_eu, is_uk, is_non_uk, is_non_eu, is_eu_uk, is_row }
}

export const Desktop = ({
children,
breakpoint = DEFAULT_BREAKPOINT,
Expand All @@ -91,7 +74,7 @@ export const Desktop = ({
const [is_mobile] = useBrowserResize(breakpoint_size)
const is_loaded = deviceRenderer()

const desktop_view = is_mobile ? <></> : <>{children}</>
const desktop_view = is_mobile ? <></> : <div className={className}>{children}</div>

return is_loaded ? (
desktop_view
Expand Down Expand Up @@ -119,37 +102,47 @@ export const Mobile = ({
}

export const EU = ({ children }: ResponsiveContainerProps) => {
const { is_eu } = getCountryRule()
const { is_eu_domain } = domainBasedCheck()
const { is_eu_country } = React.useContext<StoreDataType>(DerivStore)

const is_eu = is_eu_country || is_eu_domain

return is_eu ? <>{children}</> : null
}

export const NonEU = ({ children }: ResponsiveContainerProps) => {
const { is_non_eu } = getCountryRule()
const { is_eu_domain } = domainBasedCheck()
const { is_eu_country } = React.useContext<StoreDataType>(DerivStore)

return is_non_eu ? <>{children}</> : null
const is_eu = is_eu_domain || is_eu_country

return !is_eu ? <>{children}</> : null
}

export const UK = ({ children }: ResponsiveContainerProps) => {
const { is_uk } = getCountryRule()
const { is_uk_domain } = domainBasedCheck()
const { is_uk_country } = React.useContext<StoreDataType>(DerivStore)

const is_uk = is_uk_country || is_uk_domain

return is_uk ? <>{children}</> : null
}

export const NonUK = ({ children }: ResponsiveContainerProps) => {
const { is_non_uk } = getCountryRule()
const { is_uk_domain } = domainBasedCheck()
const { is_uk_country } = React.useContext<StoreDataType>(DerivStore)

return is_non_uk ? <>{children}</> : null
}
const is_uk = is_uk_domain || is_uk_country

export const UKEU = ({ children }: ResponsiveContainerProps) => {
const { is_eu_uk } = getCountryRule()

return is_eu_uk ? <>{children}</> : null
return !is_uk ? <>{children}</> : null
}

export const ROW = ({ children }: ResponsiveContainerProps) => {
const { is_row } = getCountryRule()
const { is_uk_domain, is_eu_domain } = domainBasedCheck()
const { is_uk_country, is_eu_country } = React.useContext<StoreDataType>(DerivStore)

const is_uk = is_uk_country || is_uk_domain
const is_eu = is_eu_domain || is_eu_country

return is_row ? <>{children}</> : null
return !is_eu && !is_uk ? <>{children}</> : null
}
Loading