Skip to content

Commit

Permalink
Merge branch 'master' into translation-1743-dbot-2
Browse files Browse the repository at this point in the history
  • Loading branch information
mitra-deriv committed Jan 2, 2024
2 parents d59bd1c + d8b7766 commit 386f1c4
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 12 deletions.
49 changes: 44 additions & 5 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ exports.onPreBuild = async () => {
await copyLibFiles(path.join(__dirname, 'static', '~partytown'))
}
// Based upon https://github.com/gatsbyjs/gatsby/tree/master/examples/using-i18n
exports.onCreatePage = ({ page, actions }) => {
const { createRedirect, createPage, deletePage } = actions

// First delete the incoming page that was automatically created by Gatsby
// So everything in src/pages/
deletePage(page)
const BuildPage = (page, actions) => {
const { createRedirect, createPage } = actions
const is_responsible_trading = /responsible/g.test(page.path)
const is_contact_us = /contact_us/g.test(page.path)
const is_careers = /careers/g.test(page.path)
Expand Down Expand Up @@ -349,6 +346,48 @@ exports.onCreatePage = ({ page, actions }) => {
return current_page
})
}
exports.onCreatePage = ({ page, actions }) => {
const { deletePage } = actions
const isProduction = process.env.GATSBY_ENV === 'production'
const pagesToBuild = process.env.GATSBY_BUILD_PAGES || 'all'

// First delete the incoming page that was automatically created by Gatsby
// So everything in src/pages/
deletePage(page)

const pagesCategory = {
all: [''],
'no-affiliates': ['signup-affiliates', 'landing', 'ctrader', 'partners'],
'no-help-centre': ['help-centre'],
'no-tools': ['trader-tools'],
fast: [
'signup-affiliates',
'landing',
'ctrader',
'partners',
'help-centre',
'trader-tools',
'careers',
// 'markets',
// 'trade-types' Note: Feel free to adjust pages you want to skip building for faster local development
],
}

const disallowedPages = pagesCategory[pagesToBuild] || []

const regex = new RegExp(`/${disallowedPages.join('|') + '|'}/g`)

const isMatch = regex.test(page.path)

if (isProduction) {
return BuildPage(page, actions)
} else {
if (!isMatch || pagesToBuild === 'all') {
console.log(`\x1b[32mcreating\x1b[0m [${pagesToBuild}] ${page.path}`)
return BuildPage(page, actions)
}
}
}

const StylelintPlugin = require('stylelint-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@artsy/fresnel": "^6.2.1",
"@builder.io/partytown": "^0.8.1",
"@deriv-com/blocks": "^0.62.0",
"@deriv-com/blocks": "^0.66.0",
"@deriv-com/components": "^0.37.0",
"@deriv-com/hooks": "^0.10.0",
"@deriv-com/providers": "^0.10.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const MainNavigationButtons = () => {
</Button>
</>
)}
<MobileNavToggle />
<MobileNavToggle data-cy="hamburger-menu" />
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BrandDerivWordmarkCoralIcon } from '@deriv/quill-icons/Logo'

export const MainNavigationLogo = () => {
return (
<CustomLink href={'/'}>
<CustomLink href={'/'} data-cy="deriv-logo">
<BrandDerivWordmarkCoralIcon width={73} height={24} />
</CustomLink>
)
Expand Down

0 comments on commit 386f1c4

Please sign in to comment.