Skip to content

Commit

Permalink
[P2PS] refactor: p2p modals (deriv-com#10193)
Browse files Browse the repository at this point in the history
* translations: 📚 sync translations with crowdin (deriv-com#8881)

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* thisyahlen/fix: change algo for realAccountSignup (deriv-com#8656)

* fix: change algo for realAccountSignup

* fix: refactor

* redeploy: vercel

* translations: 📚 sync translations with crowdin (deriv-com#8885)

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* translations: 📚 sync translations with crowdin (deriv-com#8890)

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* likhith/fix: 🐛 resolved required field error (deriv-com#8886)

* fix: 🐛 resolved required field error

* feat: fixed issue with Citizen field

* refactor: removed unused code

* refactor: updated test

* fix: code smells

* fix: tests

* refactor: reduce code complexity to remove code smell

* refactor: updated return

* refactor: udpated test

* refactor: delete text component and use default button text styles instead

* fix: raised subtasks

* fix: advertiser buy/sell row

* refactor: refactor ad-visibility-error-modal

* chore: refactored block-user-modal

* refactor: error modal

* refactor: refactor ed ad cancel modal

* chore: removed unused imports

* Update packages/p2p/src/components/modal-manager/modals/block-user-modal/__tests__/block-user-modal.spec.tsx

Co-authored-by: Farhan Ahmad Nurzi <125247833+farhan-nurzi-deriv@users.noreply.github.com>

* chore: refactored email link expired modal

* chore: refactored code based on reviews

* chore: added mocks folder to separate mock components

* chore: used ?? for default options

* chore: renamed test variables in test files

* chore: added new EOF lines

* chore: refactored code based on reviews

* refactor: currency selector modal refactor

* Shaheer/92065/error message translation (deriv-com#8397)

* refactor: 🎨 moves verification error checking to the common handler

* fix: 🐛 translates formik error message on language switch

* refactor: 🎨 sorts 2fa props asc

* refactor: 🎨 access hooks via React namespace

---------

Co-authored-by: Jim Daniels Wasswa <104334373+jim-deriv@users.noreply.github.com>
Co-authored-by: Ali(Ako) Hosseini <ali.hosseini@deriv.com>

* Task 88555 remove legacy connect from cfd (deriv-com#8209)

* refactor:  to use  instead of

* refactor:  to use  instead of

* refactor:  to use  instead of

* refactor:  to use  instead of

* refactor: add root state type on cfd app

* refactor: remove legacy connect in jurisdiction-card-banner

* refactor: remove legacy connect in jurisdiction-modal

* refactor: remove legacy connect on cfd modal components

* refactor: remove legacy connect in cfd reset and demo modal

* refactor: remove legacy connect from cfd dashboard and components

* refactor: remove connect module and use useStore in cfd signup form

* fix: type errors on components

* refactor: use cfd store provider in the app

* refactor: remove destrcturing of cfd state from useStore and add useCfdStore

* refactor: wrap component with observer at top

* fix: type errors on mock store

* fix: type errors and resolve todo fixes

* fix: circle ci build issue

* fix: build errors on cfd package

* fix: dashboard and app.tsx static errors

* fix: use relative path to import useCFDStore

* refactor: replace connect from test cases

* fix: cfd account-card.spec.tsx suite

* refactor: update mock props

* refactor: change poi specs

* fix: add cfd provider import int he test spec

* fix: cdf poi and financial step form specs errors

* fix: test spec for real account display

* fix: add mockStore imports in the spec

* refactor: cfd password modal spec

* fix: cfd password modal spec

* refactor: add store provider in cfd password manager modal spec

* fix: failing test cases on cfd specs

* fix: build error on mockstore

* fix: compare accounts prop types

* refactor: resolve review comments

* fix: resolve review comments

* refactor: make destructure more readable

* fix: cfd package imports and context errors

* fix: failing test cases on cfd-password-manager-modal

* fix: deriv mt5 password modal issue

* fix: resolve review comments

Co-authored-by: mahdiyeh-deriv <82078941+mahdiyeh-deriv@users.noreply.github.com>

* fix: resolve review comments

* chore: update type in store

* fix: type issue for `real_account_creation_unlock_date`

* fix: cfd password test spec

* fix: cfd compare account modal not closing

* fix: store types

* fix: initial value on mock store

* fix: notification message element type

* fix: path and types

* fix: type error on cfd-top-up-demo-modal

* fix: getChangeableField error in cfd-poi

* fix: dmt5 modal content props

---------

Co-authored-by: Jim Daniels Wasswa <104334373+jim-deriv@users.noreply.github.com>
Co-authored-by: mahdiyeh-deriv <82078941+mahdiyeh-deriv@users.noreply.github.com>
Co-authored-by: Ali(Ako) Hosseini <ali.hosseini@deriv.com>

* maryia/861mz0p4e/build: update deriv-charts version to 1.3.0 (deriv-com#9084)

* build: update deriv-charts version to 1.3.0

* build: trigger build

---------

Co-authored-by: Jim Daniels Wasswa <104334373+jim-deriv@users.noreply.github.com>
Co-authored-by: Ali(Ako) Hosseini <ali.hosseini@deriv.com>

* fix: type error of client_tnc_status (deriv-com#8939)

Co-authored-by: Ali(Ako) Hosseini <ali.hosseini@deriv.com>
Co-authored-by: Jim Daniels Wasswa <104334373+jim-deriv@users.noreply.github.com>

* fix: toggleModal is not a function error (deriv-com#9055)

Co-authored-by: Jim Daniels Wasswa <104334373+jim-deriv@users.noreply.github.com>

* Jim/feq 235/container is not in current document (deriv-com#9031)

* fix: resolve trackjs error

* chore: resolve review comments

* Adrienne / integrated useSubscription hook for website status (deriv-com#8702)

* Create codeql.yml

* Create codeql-test.yml

* chore: removed codeql workflows

* chore: removed dccache

* chore: added escapeHtml function to login

* refactor: added website status store

* chore: removed old changes

* chore: added checks for loginid

* chore: fixed an issue where website status is not subscribed properly and not after authorize

* chore: removed observer

* chore: removed duplicate if statement

* chore: added dependencies

* chore: moved unsubscribe outside

* refactor: use without websocket hooks

* chore: updated comments

* chore: removed prettier changes

* chore: fixed wrong type

* chore: fixed wrong type

* chore: incorporated code reviews

* chore: undo prettier formatting

* chore: undo prettier formatting

* chore: removed comments

* fix: fixed some issues with testing website-status store

---------

Co-authored-by: Jim Daniels Wasswa <104334373+jim-deriv@users.noreply.github.com>
Co-authored-by: Ali(Ako) Hosseini <ali.hosseini@deriv.com>

* maryia/ACCUM-125/feat: Accumulator updates for barriers and markers in C.Details and DTrader (deriv-com#8200)

* feat: pass refToAddTick callback to smartcharts to pass poc response

* feat: remove circle marker from on top of last ACCU tick in ongoing contract

* fix: manual build to gh-pages folder

* style: rename addTickByPOCResponse

* revert: deploy folder script update + fix build gh-pages script

* fix: added check to avoid disappearing markers when exit tick not found in tick_stream

* fix: improvements for accu markers + ensure observers are informed about active_positions update

* chore: remove refToAddTick callback and pass shouldDrawTicksFromContractInfo to charts instead

* feat: implement new chart markets for accum

* chore: add relative measure

* chore: add aligment in css

* feat: delay barriers for accu and show them based on current tick

* chore: make markers transparent

* chore: add opacity for light and transparency for dark theme

* refactor: add blue color to the preexit spot

* chore: replace blue color

* chore: remove comments

* build: trigger build

* fix: loss case barriers

* feat: new previous and last marker

* refactor: and tests

* chore: increase transparency of dark mode exit marker

* feat: add workaround for cases with current spot missing from tick stream + refactoring + tests

* chore: remove unnecessary optional chaining

* test: improved tests

* feat: getAccuBarriersDelayTimeMs based on symbol speed

* revert: fe workaround for current_spot missing from tick_stream

* style: update comment

* chore: add default value for isAccumulatorContractOpen param

* Merge branch "maryia/92755/remove_accu_barriers_calc" into maryia/88219/poc_instead_of_ticks_history

* fix: conflict with markers

* refactor: + fix conflicts

* refactor: address review comments

* feat: color contract barriers with green only when entry spot is present

* style: fixed typo

* chore: use proposal barriers before 1st contract tick is received

* fix: improved markers

* feat: make middle markers smaller in c.details

* fix: previous tick location in c.details

* Revert "feat: make middle markers smaller in c.details"

This reverts commit 848027d.

* revert: unnecessary custom classname

* test: added test file for DelayedAccuBarriersMarker + improved markers

* test: createTickMarkers + refactoring

* chore: improvements + tests

* chore: marker and animation improvements in dtrader chart

* chore: animation improvement

* fix: draw barriers lines together with labels

* fix: barriers in contract details

* chore: remove unused type

* fix: update barriers in DTrader page immediately on first render

* fix: display barriers immediately after switching between assets/trade types

* fix: sonarcloud warnings

* build: update deriv-charts version to 1.3.0

* refactor: refactoring

* build: trigger build

* build: trigger build

* fix: added crash and boom to the list of 1-s symbols + added delay for the first render of barriers

* refactor: check for 2-second symbols instead of 1-second symbols

* test: fix test for getAccuBarriersDelayTimeMs

* feat: calculations for animation timeout

* chore: comparing last tick update and current barriers update timestamps for animation

* test: getAccuBarriersDTraderDelay

* fix: barrier animation delay time

* fix: barrier animation adjustment

* refactor: & updated comments

* build: trigger build

* fix: markers

---------

Co-authored-by: kate-deriv <kate@regentmarkets.com>
Co-authored-by: kate-deriv <121025168+kate-deriv@users.noreply.github.com>
Co-authored-by: Ali(Ako) Hosseini <ali.hosseini@deriv.com>

* translations: 📚 sync translations with crowdin (deriv-com#9258)

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* translations: 📚 sync translations with crowdin (deriv-com#9259)

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* chore: changed regex to match route paths (deriv-com#9266)

* Vinu/fix: session sample rate in dbot (deriv-com#9267)

* fix: session sample rate in dbot

* fix: convert session sample rate to numer

* translations: 📚 sync translations with crowdin (deriv-com#9269)

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* fix: hide my ads is not translated (deriv-com#9260)

* translations: 📚 sync translations with crowdin (deriv-com#9274)

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* docs: add coveralls badge (deriv-com#9218)

* Revert "Adrienne / integrated useSubscription hook for website status (deriv-com#8702)" (deriv-com#9278)

This reverts commit 4f7c079.

* Ako/ Fix Eslint false positive error on import resolver rule (deriv-com#9282)

* build: update eslint import resolver ts

* ci: add ts config files to import resolver rule

* test: empty commit

* fix: raised subtasks

* fix: advertiser buy/sell row

* fix: fixed prettier issues on modal manager

* refactor: refactor loading modal

* refactor: create ad error modal

* refactor: reuse same modal for error/create error

* refactor: invalid verificatino mdoal refactor

* feat: updated failing test

* fix: style fix in edit/add payment method form in my profile

* fix: notification issue

* refactor: my-ads-delete-error-modal

* fix: block banned user bug

* fix: issue for popup not showing when rate updated before selecting form

* fix: removed console

* fix: added todo

* fix: added undefined check

* fix: subtasks raised

* refactor: cancel-edit-payment-method-modal

* chore: refactored modals

* chore: added suggestions to increase test cases and destructure variables

* chore: refactored email-verification-modal

* chore: reordered imports

* chore: fixed esline toggleModal issue

* chore: fixed esline onClick issue

* refactor: add payment method modal

* refactor: test fix

* refactor: recommended modal refactor

* chore: refactored rating-modal

* refactor: removed unused mock variables

* refactor: market rate change error modal refactor

* fix: daily limit notification

* fix: tests failed

* chore: refactored main component

* refactor: email link blocked modal refactor

* refactor: Refactor CreateAdAddPaymentMethodModal

* fix: typo in test description

* chore: added test cases for buy-sell-modal and moved most logic from modal

* chore: moved setting history, location to app, added is_buy, removed table_type check

* chore: rearranged onClickReset

* chore: removed logic from stores

* chore: added test cases

* chore: fixed test case for submitForm

* chore: added comment

* chore: remove pageHeaderText from mobile full page modal

* chore: made onClickClose optional

* chore: added suggestions

* fix: notification popup issue not shown in responsive

* refactor: order details cancel modal refactor

* fix: filter button spacing

* fix: failing tests

* fix: pr review comment

* refactor: email link verified modal refactoring

* fix: test fix

* refactor: refactor MyAdsDeleteModal

* refactor: my ads floating rate switch modal refactor

* fix: pr review fix

* refactor: refactor CancelAddPaymentMethodModal

* refactor: cleaning up test cases

* fix: get server hits bump error when in advertiser page and block it from BO

* fix: pr comment fix

* chore: moved reaction to component

* chore: fixed test cases for reaction

* fix: revert unwanted changes from master

* fix: conflicts

* fix: conflicts

* fix: conflicts

* fix: remove unnecessary changes

* fix: remove unnecessary changes

* refactor: filter modal refactoring, ts migration

* refactor: test changes

* fix: review comments

* refactor: order details confirm modal, fileuploader refactoring

* fix: changed order

* chore: removed @ts-ignore comments and fixed minor styling and test issue

* chore: fixed failing test cases

* fix: changed destructuring, moved nested component out

* fix: import reorder

* fix: moved interval id variable to global scope

* fix: removed unused localize import

* refactor: LeavePageModal

* fix: remove unwanted file changes

* fix: failing tests

* fix: removed unnecessary changes

* fix: removed unnecessary changes

* fix: remove unnecessary file

* fix: code smells

* fix: failing tests

* fix: code smell

* fix: issue with alignment of footer buttons

* fix: not able to confirm buy sell order

* chore: removed Observer component

* fix: wrong buy/sell modal title and not able to confirm order first time

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>
Co-authored-by: thisyahlen <104053934+thisyahlen-deriv@users.noreply.github.com>
Co-authored-by: Likhith Kolayari <98398322+likhith-deriv@users.noreply.github.com>
Co-authored-by: nada-deriv <nada.ajinas@deriv.com>
Co-authored-by: Farhan Ahmad Nurzi <farhan.nurzi@regentmarkets.com>
Co-authored-by: ameerul hady <ameerul@deriv.com>
Co-authored-by: adrienne-rio <adrienne@deriv.com>
Co-authored-by: ameerul-deriv <103412909+ameerul-deriv@users.noreply.github.com>
Co-authored-by: Farhan Ahmad Nurzi <125247833+farhan-nurzi-deriv@users.noreply.github.com>
Co-authored-by: adrienne-deriv <103016120+adrienne-deriv@users.noreply.github.com>
Co-authored-by: Shaheer <122449658+shaheer-deriv@users.noreply.github.com>
Co-authored-by: Jim Daniels Wasswa <104334373+jim-deriv@users.noreply.github.com>
Co-authored-by: Ali(Ako) Hosseini <ali.hosseini@deriv.com>
Co-authored-by: Amir Ali <129206554+amir-deriv@users.noreply.github.com>
Co-authored-by: mahdiyeh-deriv <82078941+mahdiyeh-deriv@users.noreply.github.com>
Co-authored-by: Maryia <103177211+maryia-deriv@users.noreply.github.com>
Co-authored-by: kate-deriv <kate@regentmarkets.com>
Co-authored-by: kate-deriv <121025168+kate-deriv@users.noreply.github.com>
Co-authored-by: vinu-deriv <100689171+vinu-deriv@users.noreply.github.com>
Co-authored-by: nada-deriv <122768621+nada-deriv@users.noreply.github.com>
  • Loading branch information
22 people authored Nov 27, 2023
1 parent dc381f8 commit 32aeb33
Show file tree
Hide file tree
Showing 177 changed files with 5,248 additions and 1,918 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ type TMobileFullPageModal = {
height_offset?: string;
is_flex?: boolean;
is_modal_open: boolean;
onClickClose: (event: MouseEvent) => void;
onClickClose?: (event: MouseEvent) => void;
pageHeaderReturnFn?: () => void;
renderPageFooterChildren?: () => React.ReactNode;
page_footer_className?: string;
page_header_className?: string;
page_header_text?: string;
renderPageHeaderElement?: JSX.Element;
renderPageHeaderTrailingIcon?: () => React.ReactNode;
renderPageHeaderText?: () => string;
should_header_stick_body?: boolean;
body_className?: string;
is_popup?: boolean;
Expand Down Expand Up @@ -50,7 +50,7 @@ const MobileFullPageModal = ({
renderPageHeaderTrailingIcon,
pageHeaderReturnFn,
renderPageHeader,
renderPageHeaderText,
renderPageHeaderElement,
// opt-in for backward compatibility.
children,
container_children,
Expand All @@ -68,7 +68,7 @@ const MobileFullPageModal = ({
})}
height_offset={height_offset}
>
{(renderPageHeader || page_header_text || renderPageHeaderText) && (
{(renderPageHeader || page_header_text || renderPageHeaderElement) && (
<div
className={classNames('dc-mobile-full-page-modal__header', {
'dc-mobile-full-page-modal__header--border-bottom': !should_header_stick_body,
Expand All @@ -85,9 +85,7 @@ const MobileFullPageModal = ({
)}
{renderPageHeader && renderPageHeader()}
<div className='dc-mobile-full-page-modal__header-text'>
{renderPageHeaderText ? (
renderPageHeaderText()
) : (
{renderPageHeaderElement ?? (
<Text as='p' color='prominent' line_height='m' size='s' weight='bold'>
{page_header_text}
</Text>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/modal/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ const ModalElement = ({
)}
{has_close_icon && (
<div onClick={toggleModal} className='dc-modal-header__close' role='button'>
<Icon icon='IcCross' color={close_icon_color} data_testid='dt-close-modal-icon' />
<Icon icon='IcCross' color={close_icon_color} data_testid='dt_modal_close_icon' />
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type TPageOverlay = {
id?: string;
is_from_app?: boolean;
is_open?: boolean;
onClickClose: (event: MouseEvent) => void;
onClickClose?: (event: MouseEvent) => void;
portal_id?: string;
header_classname?: string;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@ type TToggleSwitch = {
handleToggle: () => void;
id: string;
is_enabled: boolean;
name?: string;
};

const ToggleSwitch = ({ className, classNameButton, classNameLabel, handleToggle, id, is_enabled }: TToggleSwitch) => {
const ToggleSwitch = ({
className,
classNameButton,
classNameLabel,
handleToggle,
id,
is_enabled,
name = 'toggle_switch',
}: TToggleSwitch) => {
return (
<React.Fragment>
<input
aria-label={name}
className={classNames('dc-toggle-switch', className)}
id={id}
type='checkbox'
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import React from 'react';
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { StoreProvider, mockStore } from '@deriv/stores';
import FileUploaderComponent from '../file-uploader-component';

describe('<FileUploaderComponent />', () => {
beforeEach(() => {
jest.clearAllMocks();
});

const file = new File(['hello'], 'hello.png', { type: 'image/png' });
const props = {
accept: 'image/pdf, image/png',
filename_limit: 26,
hover_message: 'drop here',
max_size: 2097152,
multiple: false,
setDocumentFile: jest.fn(),
validation_error_message: null,
upload_message: 'upload here',
value: [],
};

it('should render FileUploaderComponent component in desktop mode', async () => {
render(<FileUploaderComponent {...props} />, {
wrapper: ({ children }) => <StoreProvider store={mockStore({})}>{children}</StoreProvider>,
});
expect(screen.getByText('upload here')).toBeInTheDocument();
});

it('should upload supported file', async () => {
const new_props = {
...props,
value: [file],
};
render(<FileUploaderComponent {...new_props} />, {
wrapper: ({ children }) => <StoreProvider store={mockStore({})}>{children}</StoreProvider>,
});
const input: HTMLInputElement = screen.getByTestId('dt_file_upload_input');
userEvent.upload(input, file);
await waitFor(() => {
expect(input.files?.[0]).toBe(file);
expect(input.files).toHaveLength(1);
});
expect(props.setDocumentFile).toHaveBeenCalledWith({ files: [file], error_message: null });
expect(screen.getByText('hello.png')).toBeInTheDocument();
});

it('should show error message when unsupported file is uploaded', async () => {
const new_props = { ...props, validation_error_message: 'error' };
render(<FileUploaderComponent {...new_props} />, {
wrapper: ({ children }) => <StoreProvider store={mockStore({})}>{children}</StoreProvider>,
});

const unsupported_file = new File(['hello'], 'hello.html', { type: 'html' });
const input = screen.getByTestId('dt_file_upload_input');
userEvent.upload(input, unsupported_file);

await waitFor(() => {
expect(screen.getByText('error')).toBeInTheDocument();
});
});
it('should handle remove File', async () => {
const new_props = { ...props, validation_error_message: 'error' };
render(<FileUploaderComponent {...new_props} />, {
wrapper: ({ children }) => <StoreProvider store={mockStore({})}>{children}</StoreProvider>,
});

const input: HTMLInputElement = screen.getByTestId('dt_file_upload_input');
userEvent.upload(input, file);
await waitFor(() => {
expect(input.files?.[0]).toBe(file);
expect(input.files).toHaveLength(1);
});
const remove_icon = screen.getByTestId('dt_remove_file_icon');
expect(remove_icon).toBeInTheDocument();
userEvent.click(remove_icon);
expect(props.setDocumentFile).toHaveBeenCalledWith({ files: [], error_message: null });
});
});

This file was deleted.

Loading

0 comments on commit 32aeb33

Please sign in to comment.