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.

Suthesh/update translations from master #2603

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
8c851b6
Niloofar Sadeghi / Improve live chat performance (#2479)
niloofar-deriv Jan 11, 2022
e8a6bfd
NikitaK/Help centre files with answers convert to TS (#2416)
Jan 11, 2022
7c36401
NikitaK/ Convert contact us page to TS 51832 (#2351)
Jan 11, 2022
2e74568
NikitaK/Responsible Page Convert to TS (#2417)
Jan 11, 2022
d7bfadb
convert interim-affiliate to typescript (#2394)
niloofar-deriv Jan 11, 2022
69edb8f
Niloofar Sadeghi / convert interm/dbot to TS (#2423)
niloofar-deriv Jan 11, 2022
682d1d0
convert interim faq and deriv and dmt5 to ts (#2460)
niloofar-deriv Jan 11, 2022
b4af932
fix: LCP (#2472)
yashim-deriv Jan 11, 2022
ff8c7c2
Mitra/Update CFD retail percentage (#2484)
mitra-deriv Jan 11, 2022
8d7b0ff
Revert "Mitra/Update CFD retail percentage (#2484)" (#2497)
ShuvoHabib Jan 11, 2022
596ffa7
Prince/ New show component (#2493)
prince-deriv Jan 12, 2022
cb904dc
suthesh/livechat-hotfix (#2499)
suthesank Jan 12, 2022
98cc1ad
GTM event delay (#2505)
khalid-deriv Jan 14, 2022
b0646c7
Gatsby4 - Major package updates (#2430)
Jan 14, 2022
9e16e2d
fix: failed build (#2507)
Jan 14, 2022
d4bc07e
Fix eslint rules (#2509)
Jan 14, 2022
70958b1
Mitra/ Update cfd retail percentage (#2502)
mitra-deriv Jan 17, 2022
06aed91
Nikita/To add trading platform deriv go in the navigation bar (#2382)
nikita-deriv Jan 17, 2022
6474bbd
Mohammad/ Add TS guidelines to Readme (#2451)
mohammad-hashemi-deriv Jan 17, 2022
298ab1c
Mohammad/ Fix p2p redirect to cashier-p2p (#2409)
mohammad-hashemi-deriv Jan 17, 2022
06f5c8e
NikitaK/Convert DMT5 Page to TS 52237 (#2365)
Jan 17, 2022
fa5cbd0
Mohammad/Reset-password to TS (#2424)
mohammad-hashemi-deriv Jan 17, 2022
7196a7e
Al-amin/convert Trade Types page to Typescript (#2467)
alamin-deriv Jan 17, 2022
68ffade
fix SEO 404 errors (#2393)
fiona-deriv Jan 17, 2022
7138dd1
Mohammad/ Convert signup and landing-signup to TS (#2457)
mohammad-hashemi-deriv Jan 17, 2022
3e62415
Al-amin/Convert Dtrader page to TS (#2408)
alamin-deriv Jan 17, 2022
ae6083d
Mitra/Convert Terms & Conditions page to TS (#2436)
mitra-deriv Jan 17, 2022
b086418
Niloofar / generalize academy and general footer into a single footer…
niloofar-deriv Jan 17, 2022
0d11d4a
Ako/ Add preact (#2454)
Jan 17, 2022
9484c26
khalid/add deriv.be domain (#2368)
khalid-deriv Jan 17, 2022
a0384bc
Ako/ Fix img attributes size bug (#2514)
Jan 17, 2022
2e74d4d
Replace `Deriv Go` with `Deriv GO` (#2513)
mitra-deriv Jan 17, 2022
0ab9bd3
Revert "khalid/add deriv.be domain (#2368)" (#2517)
Jan 17, 2022
79c40cb
fix/ fix hamburger menu width (#2515)
Jan 17, 2022
2d2ab62
nikolai.berestevich/fix/p2p-route (#2519)
nikolaiberestevich-deriv Jan 17, 2022
ca3f92d
feat/ add method to get base ref of passed element (#2520)
Jan 18, 2022
2174873
Dmt5 copywriting change (#2530)
Jan 19, 2022
82dbb42
suthesh/remove double slash on href (#2531)
suthesank Jan 19, 2022
788c790
About us v2 (#2533)
nikolaiberestevich-deriv Jan 19, 2022
a88a0da
Pavel-latyshov/ Crypto spreads reduction (#2525)
pavel-latyshou-deriv Jan 19, 2022
e2d2be4
Mitra/ Update Dp2p payment method section (#2495)
mitra-deriv Jan 19, 2022
73b692f
suthesh/crypto info hotfix (#2537)
suthesank Jan 20, 2022
cec6a9f
nikolai.berestevich/fixredirection (#2539)
nikolaiberestevich-deriv Jan 20, 2022
bbbadf6
chore: bump pushwoosh version (#2529)
yashim-deriv Jan 21, 2022
a9ce9a5
removed nprogress plugin (#2540)
khalid-deriv Jan 21, 2022
932525d
nikolai.berestevich/fix/crypto-icons (#2523)
nikolaiberestevich-deriv Jan 21, 2022
15d663f
sign-up-success to TS (#2426)
mohammad-hashemi-deriv Jan 21, 2022
3711dac
convert endpoint page to TS (#2439)
mohammad-hashemi-deriv Jan 21, 2022
3457d9d
Amina/ convert trade-forex page to TS (#2475)
amina-deriv Jan 21, 2022
d43d42a
Search and filter for academy (#2342)
Jan 21, 2022
ec5818c
Niloofar Sadeghi / Convert live chat components to typescript (#2402)
niloofar-deriv Jan 21, 2022
b455441
jump-indices-ts (#2463)
amina-deriv Jan 21, 2022
c0e248a
convert landing-dmt5 to TS (#2446)
mohammad-hashemi-deriv Jan 21, 2022
44b95cb
Mohammad/ Convert Regulatory page to TS (#2543)
mohammad-hashemi-deriv Jan 21, 2022
fe196f8
Mohammad/ Convert landing-forex-trading to TS (#2455)
mohammad-hashemi-deriv Jan 21, 2022
f753189
fix: unencoded url for categories (#2551)
Jan 24, 2022
50b95d7
chore: decrease image quality (#2555)
Jan 24, 2022
9906685
fix: preact missing images (#2556)
Jan 24, 2022
50c52d5
Prince/ Added generic types (#2550)
prince-deriv Jan 24, 2022
aca0e73
doc update: tnc Deriv_Investments_(Europe)_Limited (#2545)
pavel-latyshou-deriv Jan 25, 2022
e0eca7d
Mohammad/ Convert Landing-ebooks page to TS (#2447)
mohammad-hashemi-deriv Jan 25, 2022
cdd4e6e
nikolai.berestevich/fix/why-choose-us (#2546)
nikolaiberestevich-deriv Jan 25, 2022
ec968f4
Remove copyright and all rights reserved (#2524)
mitra-deriv Jan 25, 2022
31243f5
convert dmt5-trading-signals to ts (#2464)
niloofar-deriv Jan 25, 2022
1aa2392
Niloofar Sadeghi / convert p2p page to typescript (#2390)
niloofar-deriv Jan 25, 2022
c13fee8
Add svgo precommit step (#2560)
Jan 25, 2022
8110594
chore: fix ts-eslint warnings (#2565)
yashim-deriv Jan 26, 2022
42b2b97
Pavel-Latyshou/To update landing page for each `Crypto E-Book` based …
pavel-latyshou-deriv Jan 26, 2022
4e6a2f3
Kevin/Career-location Change office order (#2552)
virtualpowwa Jan 26, 2022
589d9d9
Niloofar Sadeghi / convert stocks to ts (#2521)
niloofar-deriv Jan 26, 2022
642e44f
Compress and minify images and icons on pre-commit (#2561)
Jan 26, 2022
d6cd831
Nuri/fix - Academy - fixed tab for mobile (#2553)
njazuli-deriv Jan 26, 2022
3a3e0f7
Amina/convert_partners-payment-agent_to_ts (#2491)
amina-deriv Jan 26, 2022
bae6c26
remove DEL refrence from Terms and condition (#2503)
niloofar-deriv Jan 26, 2022
44ede74
Mitra/ DEL EU footer changes (#2452)
mitra-deriv Jan 26, 2022
6227ae3
Remove DEL from regulatory information page (#2443)
mitra-deriv Jan 26, 2022
cb4feef
Niloofar / Weekend trading to ts (#2466)
niloofar-deriv Jan 26, 2022
80abb09
Kevin/ hide multiple products for EU (#2490)
virtualpowwa Jan 27, 2022
cdc496d
Aswathy/changed the 404 error page design (#2535)
aswathy-deriv Jan 27, 2022
f6b9bf5
yashim+khalid+nuri/feat: new homepage (#2265)
yashim-deriv Jan 27, 2022
dd8547c
Mitra/Make Apps list in footer same as Trade list for EU (#2573)
mitra-deriv Jan 27, 2022
b349916
khalid/fix platform order (#2574)
khalid-deriv Jan 27, 2022
923673b
Rename `Discover DMT5 now` to `Discover Deriv MT5 now` (#2576)
mitra-deriv Jan 27, 2022
0b685b6
Aswathy/image -blurrness in the 404 page image (#2581)
aswathy-deriv Jan 28, 2022
b1f663e
add missing text on footer (#2585)
fiona-deriv Jan 28, 2022
d63738c
Pavel Latyshou / Task - IB Commission Plan change for EU location als…
pavel-latyshou-deriv Jan 28, 2022
9147667
Prince/ visibility component update (#2577)
prince-deriv Jan 29, 2022
26ddfcb
Mitra/Fix blurred images in platform carousel (#2591)
mitra-deriv Jan 30, 2022
5ca9632
add: separate image wrapper for mobile version (#2587)
mohammad-hashemi-deriv Jan 30, 2022
ab2975e
Improve responsive UI for platform carousel on mobile (#2594)
mitra-deriv Jan 30, 2022
cd66bb6
Revert production_V20220126_0 & keep tnc changes (#2596)
prince-deriv Feb 1, 2022
9b7b0fd
Prince/ from Pavel Latyshou - update landing page for each `Crypto E-…
prince-deriv Feb 2, 2022
a0733ef
Nuri/fix - Academy - fixed tab for mobile (#2553)
njazuli-deriv Jan 26, 2022
5668f90
Pavel Latyshou / Task - IB Commission Plan change for EU location als…
pavel-latyshou-deriv Jan 28, 2022
89d7d99
chore: fix ts-eslint warnings (#2565)
yashim-deriv Jan 26, 2022
0b870b7
Kevin/Career-location Change office order (#2552)
virtualpowwa Jan 26, 2022
64b3557
Aswathy/changed the 404 error page design (#2535)
aswathy-deriv Jan 27, 2022
179a6a4
Niloofar / Weekend trading to ts (#2466)
niloofar-deriv Jan 26, 2022
fbee727
Niloofar Sadeghi / convert stocks to ts (#2521)
niloofar-deriv Jan 26, 2022
f174c37
Amina/convert_partners-payment-agent_to_ts (#2491)
amina-deriv Jan 26, 2022
67fccfa
yashim+khalid+nuri/feat: new homepage + uncompressed image
yashim-deriv Jan 27, 2022
6701007
khalid/fix platform order (#2574)
khalid-deriv Jan 27, 2022
40f5634
Mitra/Make Apps list in footer same as Trade list for EU (#2573)
mitra-deriv Jan 27, 2022
d82f886
Rename `Discover DMT5 now` to `Discover Deriv MT5 now` (#2576)
mitra-deriv Jan 27, 2022
bef076c
Aswathy/image -blurrness in the 404 page image (#2581)
aswathy-deriv Jan 28, 2022
a4c819b
Mitra/Fix blurred images in platform carousel (#2591)
mitra-deriv Jan 30, 2022
0155e72
add: separate image wrapper for mobile version (#2587)
mohammad-hashemi-deriv Jan 30, 2022
9d21295
Improve responsive UI for platform carousel on mobile (#2594)
mitra-deriv Jan 30, 2022
9ce74e0
Merge branch 'remerge-new-homepage-design-etc' of github.com:prince-d…
Feb 3, 2022
a12b910
updated translations
Feb 3, 2022
2db4f9e
fix string + download partial translations + update ach route
Feb 4, 2022
a801b0f
ach fix
Feb 4, 2022
c96ca5c
fix spacing in string, update translations and ach route
Feb 7, 2022
ba09e39
updated translations (complete)
Feb 9, 2022
2dfb196
fix untranslated strings
Feb 10, 2022
d0b54ff
hotfixes
Feb 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"src/**/*.{js,jsx,ts,tsx,json,md}": [
"prettier --write"
]
}
}
8 changes: 7 additions & 1 deletion .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@
]
}
],
"value-keyword-case": null
"value-keyword-case": null,
"declaration-block-no-redundant-longhand-properties": null,
"alpha-value-notation": null,
"color-function-notation": null,
"shorthand-property-no-redundant-values": null,
"keyframes-name-pattern": null,
"selector-class-pattern": null
},
"syntax": "scss"
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Deriv.com - An online trading platform that offers a wide selection of derivativ
- [File structures](documents/file-structures.md)
- [GTM workflow](documents/gtm-workflow.md) - Contains Google Tag Manager workflow and additional information
- [Translation workflow](documents/translation-workflow.md) - Contains general workflow and commands required for our translation process
- [Typescript guidelines](documents/typescript-guidelines.md) - Contains Typescript guidelines and conventions for this project

## Pre-installation

Expand Down Expand Up @@ -73,7 +74,7 @@ Moreover, having these extensions will help you to speed up the development proc
Create two files `.env.development` and `.env.production` inside your project root directory.

Then check your **lastpass** you'll see a shared item named **Deriv-com Env Variables** copy the variables, they look like this:

```sh
DIRECTUS_AUTH_TOKEN=********************************
GATSBY_DIRECTUS_AUTH_TOKEN=********************************
Expand Down
2 changes: 1 addition & 1 deletion crowdin/messages.json

Large diffs are not rendered by default.

133 changes: 133 additions & 0 deletions documents/typescript-guidelines.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# TS Conventions in Deriv-com (Work-in-progress)

Good reads:

- https://www.sitepoint.com/react-with-typescript-best-practices/
- https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/basic_type_example

### When to use .tsx over .ts

- A general rule of thumb would be that if the file either imports `react` or uses `jsx` syntax, use `.tsx`.
- If not, `.ts` will do.

### ⚠️ Avoid typing the return type

- We can allow Typescript to infer the return types of React components for us.

### Unions Over Enums

> Unlike most TypeScript features, [enum] is not a type-level addition to JavaScript but something added to the language and runtime. Because of this, it’s a feature which you should know exists, but maybe hold off on using unless you are sure.
> —TypeScript Handbook

Union types and enums tend to occupy the same space in React in that they both enforce that a particular prop must be one value of a given set. However, we recommend union types over enums for a number of reasons:

- They are compiler-only constructs, so they won't end up in your application's JS bundle.
- They are extensible to other union types.
- They are less verbose.

```jsx
// Avoid enums:
enum ButtonKind {
PRIMARY = "primary",
SECONDARY = "secondary",
}

// Prefer union types:
type ButtonKind = "primary" | "secondary";

// Extensible to other union types:
type ExtendedButtonKind = ButtonKind | "tertiary";
```

### Type vs. Interface

Use type when you might need a union or intersection:

```jsx
type Foo = number | { someProperty: number }
```

Use interface when you want extends or implements e.g.

```jsx
interface Foo {
foo: string;
}
interface FooBar extends Foo {
bar: string;
}
class X implements FooBar {
foo: string
bar: string
}
```

> Use **Type** until you need an **Interface**

### ⚠️ Type naming conventions

- When typing props, it should follow the component name in PascalCase along with a `Props` at the end of it, e.g. `type ContainerProps`
- If it's anything else, it should follow the variable name in PascalCase along with a `Type` at the end of it, e.g. `type TradingType`

### Extending Native HTML Elements

TypeScript ships with tons of helper types that cut down boilerplate for common React idioms. These types are particularly useful when extending native HTML elements like `button` or `input`, where you’ll want to maintain the component's original props to ensure extensibility.

Start by implementing a `Button` component in the two most important use-cases: clicking the button and defining its text. When typing everything manually, you get the following result:

```jsx
import React from 'react'

interface Props {
children: React.ReactNode;
onClick: () => void;
}

const Button = ({ children, onClick }: Props) => {
return <button onClick={onClick}>{children}</button>
}
```

We can use the helper type `React.PropsWithChildren` here, which automatically adds the children prop to the component:

```jsx
import React from 'react'

type Props = React.PropsWithChildren<{
onClick: () => void,
}>

const Button = ({ children, onClick }: Props) => {
return <button onClick={onClick}>{children}</button>
}
```

`ComponentPropsWithoutRef` is a generic type that supplies props for built-in React handlers and native HTML attributes. By passing in `"button"` as the template, you specify that the component is extending the HTML `button` element.

```jsx
import React from 'react'

type Props = React.ComponentPropsWithoutRef<'button'>

const Button = ({ children, onClick, type }: Props) => {
return (
<button onClick={onClick} type={type}>
{children}
</button>
)
}
```

If additional props are needed, swap the `type` for an `interface`:

```jsx
import React from 'react'

interface Props extends React.ComponentPropsWithoutRef<'button'> {
specialProp: number;
}

const Button = ({ children, onClick, type, specialProp }: Props) => {
// ...
}
```
12 changes: 1 addition & 11 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react'
import NProgress from 'nprogress'
import { Pushwoosh } from 'web-push-notifications'
import { WrapPagesWithLocaleContext } from './src/components/localization'
import { isProduction, isLive, isLocalHost } from './src/common/websocket/config'
Expand Down Expand Up @@ -112,13 +111,9 @@ export const onInitialClientRender = () => {
document.head.appendChild(jipt)
}
}

NProgress.done()
}

export const onClientEntry = () => {
NProgress.start()

const is_gtm_test_domain = window.location.hostname === gtm_test_domain
const push_woosh = new Pushwoosh()
if (isLive()) {
Expand Down Expand Up @@ -149,12 +144,7 @@ export const onClientEntry = () => {
checkLiveChatRedirection()
}

export const onPreRouteUpdate = () => {
NProgress.start()
}

export const onRouteUpdate = () => {
NProgress.done()
checkDomain()

const dataLayer = window.dataLayer
Expand All @@ -177,7 +167,7 @@ export const onRouteUpdate = () => {
userId: client_information.user_id,
}),
})
}, 50)
}, 1500)
}

export const wrapPageElement = WrapPagesWithLocaleContext
106 changes: 48 additions & 58 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ require('dotenv').config({
path: `.env.${process.env.NODE_ENV}`,
})

const site_url = 'https://deriv.com'

module.exports = {
// pathPrefix: process.env.PATH_PREFIX || '/deriv-com/', // For non CNAME GH-pages deployment
flags: {
FAST_DEV: true,
PRESERVE_WEBPACK_CACHE: true,
},
siteMetadata: {
title: 'Deriv',
description:
'Deriv.com gives everyone an easy way to participate in the financial markets. Trade with as little as $1 USD on major currencies, stocks, indices, and commodities.',
author: 'Deriv.com',
siteUrl: 'https://deriv.com',
siteUrl: site_url,
},
plugins: [
'gatsby-plugin-react-helmet',
Expand All @@ -32,7 +33,6 @@ module.exports = {
options: {
failOnError: true,
base64Width: 20,
forceBase64Format: 'webp',
stripMetadata: true,
defaultQuality: 50,
},
Expand All @@ -41,7 +41,7 @@ module.exports = {
{
resolve: 'gatsby-plugin-sitemap',
options: {
exclude: [
excludes: [
'/404',
'/**/404.html',
'/**/404',
Expand Down Expand Up @@ -73,55 +73,55 @@ module.exports = {
'/**/endpoint',
'/signup-success',
'/**/signup-success',
'/academy/blog/posts/preview',
],
serialize: ({ site, allSitePage }) =>
allSitePage.edges.map((edge) => {
const ignore_localized_regex = /careers|besquare|livechat|academy/
const path = edge.node.path
let priority = 0.7
const languages = Object.keys(language_config)
if (path === '/') {
priority = 1.0
} else if (path.match(/dbot|dtrader|dmt5|story/)) {
priority = 1.0
} else {
languages.forEach((lang) => {
if (path === `/${lang}/`) {
priority = 1.0
}
})
}

const path_array = path.split('/')
const current_lang = path_array[1]
const check_lang = current_lang.replace('-', '_')
let current_page = path
query: `
{
allSitePage {
nodes {
path
}
}
}
`,
resolveSiteUrl: () => site_url,
resolvePages: ({ allSitePage: { nodes: allPages } }) => {
return allPages.map((page) => {
return { ...page }
})
},
serialize: ({ path }) => {
const ignore_localized_regex = /careers|besquare|livechat|academy/
const languages = Object.keys(language_config)

if (languages.includes(check_lang)) {
path_array.splice(1, 1)
current_page = path_array.join('/')
}
const path_array = path.split('/')
const current_lang = path_array[1]
const check_lang = current_lang.replace('-', '_')
let current_page = path

languages.push('x-default')
languages.splice(languages.indexOf('ach'), 1)
const ignore_localized = current_page.match(ignore_localized_regex)
const links = languages.map((locale) => {
if (locale !== 'ach' && locale) {
const replaced_locale = locale.replace('_', '-')
const is_default = locale === 'en' || locale === 'x-default'
const href_locale = is_default ? '' : `/${replaced_locale}`
const href = `${site.siteMetadata.siteUrl}${href_locale}${current_page}`
return { lang: replaced_locale, url: href }
}
})
if (languages.includes(check_lang)) {
path_array.splice(1, 1)
current_page = path_array.join('/')
}

return {
url: site.siteMetadata.siteUrl + edge.node.path,
changefreq: `monthly`,
priority,
links: !ignore_localized ? links : null,
languages.push('x-default')
languages.splice(languages.indexOf('ach'), 1)
const ignore_localized = current_page.match(ignore_localized_regex)
const links = languages.map((locale) => {
if (locale !== 'ach' && locale) {
const replaced_locale = locale.replace('_', '-')
const is_default = ['en', 'x-default'].includes(locale)
const href_locale = is_default ? '' : `/${replaced_locale}`
const href = `${site_url}${href_locale}${current_page}`
return { lang: replaced_locale, url: href }
}
}),
})

return {
url: path,
links: !ignore_localized ? links : null,
}
},
},
},
{
Expand Down Expand Up @@ -149,8 +149,6 @@ module.exports = {
type: `image/png`,
},
],
gcm_sender_id: '370236002280',
gcm_user_visible_only: true,
crossOrigin: `use-credentials`,
// TODO: add translations and support for language routes e.g:
// localize: [
Expand Down Expand Up @@ -200,14 +198,6 @@ module.exports = {
},
},
'gatsby-plugin-anchor-links',
{
resolve: `gatsby-plugin-nprogress`,
options: {
color: `#85ACB0`,
showSpinner: false,
minimum: 0.4,
},
},
{
resolve: 'gatsby-plugin-google-tagmanager',
options: {
Expand Down
Loading