Skip to content

Commit

Permalink
fix: app id connection and login page
Browse files Browse the repository at this point in the history
  • Loading branch information
aswathy-deriv committed Feb 19, 2024
1 parent 43c9b90 commit 48bc72d
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 153 deletions.
41 changes: 23 additions & 18 deletions src/common/websocket/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ const isStaging = () => isBrowser() && domain_config.staging.hostname === window
const isBeta = () => isBrowser() && domain_config.beta.hostname === window.location.hostname
const isLive = () => isProduction() || isStaging() || isBeta()
const isLocalHost = () => isBrowser() && domain_config.local.hostname === window.location.hostname

const url = isBrowser() && window.location.href
const is_academy = isBrowser() && url.includes('academy')
const getAppId = (): null | number | string => {
let app_id = null
const user_app_id = '' // you can insert Application ID of your registered application here
Expand All @@ -83,24 +84,28 @@ const getAppId = (): null | number | string => {

const config_app_id = window.localStorage.getItem('config.app_id')

if (url_app_id) {
app_id = url_app_id
} else if (config_app_id) {
app_id = config_app_id
} else if (isStaging()) {
window.localStorage.removeItem('config.default_app_id')
app_id = domain_config.staging.app_id
} else if (isBeta()) {
window.localStorage.removeItem('config.default_app_id')
app_id = domain_config.beta.app_id
} else if (user_app_id.length) {
window.localStorage.setItem('config.default_app_id', user_app_id) // it's being used in endpoint chrome extension - please do not remove
app_id = user_app_id
} else if (isLocalHost()) {
app_id = domain_config.local.app_id
if (is_academy) {
app_id = 37228
} else {
window.localStorage.removeItem('config.default_app_id')
app_id = isProduction() ? prod_app_id : domain_config.test.app_id
if (url_app_id) {
app_id = url_app_id
} else if (config_app_id) {
app_id = config_app_id
} else if (isStaging()) {
window.localStorage.removeItem('config.default_app_id')
app_id = domain_config.staging.app_id
} else if (isBeta()) {
window.localStorage.removeItem('config.default_app_id')
app_id = domain_config.beta.app_id
} else if (user_app_id.length) {
window.localStorage.setItem('config.default_app_id', user_app_id) // it's being used in endpoint chrome extension - please do not remove
app_id = user_app_id
} else if (isLocalHost()) {
app_id = domain_config.local.app_id
} else {
window.localStorage.removeItem('config.default_app_id')
app_id = isProduction() ? prod_app_id : domain_config.test.app_id
}
}
}
return app_id
Expand Down
9 changes: 8 additions & 1 deletion src/features/hooks/use-residence-list/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useMemo } from 'react'
import { useEffect, useMemo, useState } from 'react'
import useWS from 'components/hooks/useWS'

export type ResidenceType = {
Expand Down Expand Up @@ -34,6 +34,13 @@ export const useResidenceList = ({
restricted_countries?: ['Iran', 'North Korea', 'Myanmar (Burma)', 'Syria', 'Cuba']
} = {}) => {
const { send, data } = useWS('residence_list')
// console.log(
// data.map((item) => {
// if (item.disabled === 'DISABLED') {

// }
// }),
// )
useEffect(() => {
send()
}, [send])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react'
import React from 'react'
import styled from 'styled-components'
import { next_btn } from './signup-academy.module.scss'
import { DropdownSearch } from 'components/elements'
Expand Down Expand Up @@ -93,7 +93,6 @@ const ResidenceForm = ({
items={item.list}
selected_item={country}
mb="5px"
// error={form_errors[`${item.name}_error_msg`]}
onChange={(country) => {
setSelectedValue((prevState) => ({
...prevState,
Expand All @@ -117,7 +116,6 @@ const ResidenceForm = ({
items={item.list}
selected_item={citizenship}
mb="5px"
// error={form_errors[`${item.name}_error_msg`]}
onChange={(citizenship) => {
setSelectedValue((prevState) => ({
...prevState,
Expand Down

This file was deleted.

39 changes: 27 additions & 12 deletions src/features/pages/signup-academy/form-container/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import React from 'react'
import { Analytics } from '@deriv-com/analytics'
import {
signup_form_container,
signup_form_line,
link_text,
sign_up_header,
sign_up_content,
signup_login_redirect,
} from '../signup.module.scss'
import FormSocialButtons from './form-social-buttons'
import SignUpPageForm from './signup-page-form'
import Flex from 'features/components/atoms/flex-box'
import Typography from 'features/components/atoms/typography'
import { Localize } from 'components/localization'
import Link from 'features/components/atoms/link'
import useRegion from 'components/hooks/use-region'
import Login from 'common/login'
import { isBrowser } from 'common/utility'

const SignUpFormContainer = () => {
const { is_eu } = useRegion()
Expand Down Expand Up @@ -60,16 +62,29 @@ const SignUpFormContainer = () => {
]}
/>
</Typography.Paragraph>
<Flex.Box justify="center" align="center" padding_block="4x">
<Flex.Item className={signup_form_line} basis="4-12" />
<Flex.Item grow="1">
<Typography.Paragraph align="center" textcolor="secondary">
<Localize translate_text="_t_Or sign up with_t_" />
</Typography.Paragraph>
</Flex.Item>
<Flex.Item className={signup_form_line} basis="4-12" />
</Flex.Box>
<FormSocialButtons />

<Typography.Paragraph align="center">
<Localize
translate_text="_t_Already have an account? <0>Log in</0>_t_"
components={[
<Typography.Paragraph
as="span"
textcolor="brand"
key={0}
className={signup_login_redirect}
onClick={(event) => {
event.preventDefault()
Analytics?.trackEvent('ce_virtual_signup_form', {
action: 'go_to_login',
form_source: isBrowser() && window.location.hostname,
form_name: 'default_diel_deriv',
})
Login.redirectToLogin()
}}
/>,
]}
/>
</Typography.Paragraph>
</Flex.Box>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/features/pages/signup-academy/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const SignUpAcademy = () => {
container="fluid"
align="start"
md={{
justify: 'around',
justify: 'center',
align: 'center',
gap: '16x',
}}
Expand Down
6 changes: 3 additions & 3 deletions src/features/pages/signup-academy/signup.content.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import React from 'react'
import { signup_content } from './signup.module.scss'
import Flex from 'features/components/atoms/flex-box'
import Typography from 'features/components/atoms/typography'
import { Localize } from 'components/localization'

const SignUpContent = () => {
return (
<Flex.Box
basis="6-12"
visible="larger-than-tablet"
direction="col"
justify="center"
align="center"
gap="8x"
>
<Typography.Heading size="small" align="center">
<Typography.Heading size="small" align="center" className={signup_content}>
<Localize translate_text="_t_Your go-to platform for exclusive trading courses_t_" />
</Typography.Heading>
<Typography.Paragraph align="center">
<Typography.Paragraph align="center" className={signup_content}>
<Localize translate_text="_t_Gain access to comprehensive modules on forex, Deriv MT5, and more._t_" />
</Typography.Paragraph>
</Flex.Box>
Expand Down
3 changes: 3 additions & 0 deletions src/features/pages/signup-academy/signup.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@
inline-size: 19.9rem;
block-size: 3.19rem;
}
.signup_content {
max-width: 44rem;
}

0 comments on commit 48bc72d

Please sign in to comment.