Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yashim/feat: add mock server integration #9003

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
655318a
feat: add mock server integration
yashim-deriv Jun 13, 2023
0f472fb
Merge branch 'master' of github.com:binary-com/deriv-app into add_moc…
yashim-deriv Jun 15, 2023
74fb661
refactor: use session instead of client
yashim-deriv Jun 15, 2023
5e699be
Merge branch 'master' into add_mockserver_support
yashimwong Jun 16, 2023
6b7a15d
Merge branch 'master' of github.com:binary-com/deriv-app into add_moc…
yashim-deriv Jun 19, 2023
edd412e
Merge branch 'add_mockserver_support' of github.com:yashim-deriv/deri…
yashim-deriv Jun 19, 2023
056efd5
fix: persistent mock server enable state
yashim-deriv Jun 19, 2023
236995c
chore: draft
yashimwong Jun 20, 2023
605ca36
feat: add mock server control panel UI
yashim-deriv Jun 20, 2023
019b142
Merge branch 'master' of github.com:binary-com/deriv-app into add_moc…
yashimwong Jun 20, 2023
d191794
feat: add clear all functionality
yashimwong Jun 21, 2023
6c452f2
Merge branch 'master' into add_mockserver_support
yashim-deriv Jun 21, 2023
3aa9933
feat: completed login mock
yashim-deriv Jun 21, 2023
8e1f70e
fix: tests
yashim-deriv Jun 22, 2023
b7ac6aa
Merge branch 'master' of github.com:binary-com/deriv-app into add_moc…
yashim-deriv Jun 23, 2023
505119b
Merge branch 'master' of github.com:binary-com/deriv-app into add_moc…
yashim-deriv Jun 23, 2023
dff4cf6
fix: code
yashim-deriv Jun 23, 2023
08b25fe
feat: add feature toggle
yashim-deriv Jun 28, 2023
a8f4de4
feat: end of day commit
yashim-deriv Jun 30, 2023
55fc22e
fix: review comments + tests
yashim-deriv Jul 1, 2023
3b0d2af
Merge branch 'feature/wallets_with_traders_hub' of github.com:binary-…
yashim-deriv Jul 1, 2023
6320130
Merge branch 'master' of github.com:binary-com/deriv-app into add_moc…
yashim-deriv Jul 3, 2023
9d59884
Merge branch 'master' of github.com:binary-com/deriv-app into add_moc…
yashim-deriv Jul 3, 2023
8951a7e
chore: used deriv-api
yashim-deriv Jul 3, 2023
4b8a575
Merge branch 'master' of github.com:binary-com/deriv-app into add_moc…
yashim-deriv Jul 4, 2023
9a747c9
fix: typescript error
yashim-deriv Jul 4, 2023
d94d2ec
Merge branch 'feature/wallets_with_traders_hub' of github.com:binary-…
yashim-deriv Jul 4, 2023
7d97189
chore: update package lock
yashim-deriv Jul 4, 2023
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
92,135 changes: 68,797 additions & 23,338 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/appstore/src/modules/traders-hub/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const TradersHub = () => {
<Div100vhContainer
className={classNames('traders-hub--mobile', {
'traders-hub--mobile--eu-user': is_eu_user,
'traders-hub__wallets-bg': is_wallet_account || is_display_test_wallets,
'traders-hub__wallets-bg': is_wallet_account,
})}
height_offset='50px'
is_disabled={isDesktop()}
Expand Down
2 changes: 1 addition & 1 deletion packages/bot-skeleton/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"eslint-plugin-react-hooks": "^4.2.0"
},
"dependencies": {
"@deriv/deriv-api": "^1.0.11",
"@deriv/deriv-api": "^1.0.13",
"@deriv/indicators": "^1.0.0",
"@deriv/js-interpreter": "^3.0.0",
"@deriv/shared": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/bot-web-ui/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 packages/cashier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@deriv/api": "^1.0.0",
"@deriv/api-types": "^1.0.94",
"@deriv/components": "^1.0.0",
"@deriv/deriv-api": "^1.0.11",
"@deriv/deriv-api": "^1.0.13",
"@deriv/hooks": "^1.0.0",
"@deriv/p2p": "^0.7.3",
"@deriv/shared": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cfd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"@deriv/account": "^1.0.0",
"@deriv/api-types": "^1.0.94",
"@deriv/components": "^1.0.0",
"@deriv/deriv-api": "^1.0.11",
"@deriv/deriv-api": "^1.0.13",
"@deriv/shared": "^1.0.0",
"@deriv/stores": "^1.0.0",
"@deriv/translations": "^1.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint @typescript-eslint/triple-slash-reference: "off" */
/// <reference path="../../../@types/react-div-100vh/react-div-100vh-config.d.ts" />
import React from 'react';
import React, { ComponentProps } from 'react';
import Div100vh from 'react-div-100vh';

/* Div100vh is workaround for getting accurate height of 100vh from browsers on mobile,
Expand All @@ -15,14 +15,12 @@ import Div100vh from 'react-div-100vh';
/* To bypass usage of component altogether, use is_bypassed */

type TDiv100vhContainer = {
id?: string;
height_offset: string;
is_bypassed?: boolean;
is_disabled?: boolean;
max_height_offset?: string;
className: string;
max_autoheight_offset?: string;
};
} & ComponentProps<'div'>;

const Div100vhContainer = ({
children,
Expand Down
2 changes: 0 additions & 2 deletions packages/components/src/components/icon/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,6 @@ import './common/ic-whats-app.svg';
import './common/ic-windows-logo.svg';
import './common/ic-windows.svg';
import './common/ic-wip.svg';
import './common/ic-withdraw-request-verification-sent.svg';
import './common/ic-withdraw-request-verification.svg';
import './common/ic-zingpay.svg';
import './common/ic-zoom-in.svg';
import './common/ic-zoom-out.svg';
Expand Down
13 changes: 10 additions & 3 deletions packages/components/src/components/input/input.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import classNames from 'classnames';
import React, { HTMLAttributes } from 'react';
import React, { ComponentProps, ComponentType, HTMLAttributes, RefObject } from 'react';
import Field from '../field';
import Text from '../text/text';

Expand Down Expand Up @@ -40,6 +40,13 @@ export type TInputProps = {
onMouseEnter?: React.MouseEventHandler<HTMLInputElement | HTMLTextAreaElement>;
onMouseLeave?: React.MouseEventHandler<HTMLInputElement | HTMLTextAreaElement>;
placeholder?: string;
ref?: RefObject<
ComponentType extends 'textarea'
? HTMLTextAreaElement
: ComponentType extends 'input'
? HTMLInputElement
: never
>;
required?: boolean;
trailing_icon?: React.ReactElement | null;
type?: string;
Expand All @@ -48,7 +55,7 @@ export type TInputProps = {
readOnly?: boolean;
is_autocomplete_disabled?: string;
is_hj_whitelisted?: string;
};
} & Omit<ComponentProps<'input'>, 'ref'>;

type TInputWrapper = {
has_footer: boolean;
Expand Down Expand Up @@ -129,7 +136,7 @@ const Input = React.forwardRef<HTMLInputElement & HTMLTextAreaElement, TInputPro
<textarea
ref={ref}
data-testid={data_testId}
{...props}
{...(props as ComponentProps<'textarea'>)}
className={classNames('dc-input__field dc-input__textarea', {
'dc-input__field--placeholder-visible': !label && props.placeholder,
})}
Expand Down
38 changes: 18 additions & 20 deletions packages/components/stories/icon/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const icons =
'IcAppstoreWalletUsdcLight',
'IcAppstoreWalletUsdtLight',
'IcAppstoreWalletsLink',
'IcAppstoreWarning',
'IcAppstoreWarning'
],
'brand': [
'IcBrandDerivEzWordmark',
Expand All @@ -67,7 +67,7 @@ export const icons =
'IcBrandDmt5FinancialStp',
'IcBrandDmt5Financial',
'IcBrandDmt5Synthetics',
'IcBrandDxtradeWordmark',
'IcBrandDxtradeWordmark'
],
'cashier': [
'IcCashierAdd',
Expand Down Expand Up @@ -243,7 +243,7 @@ export const icons =
'IcCashierWyreLight',
'IcCashierZenithbankDark',
'IcCashierZenithbankLight',
'IcCashier',
'IcCashier'
],
'common': [
'IcAccountCross',
Expand Down Expand Up @@ -614,11 +614,9 @@ export const icons =
'IcWindowsLogo',
'IcWindows',
'IcWip',
'IcWithdrawRequestVerificationSent',
'IcWithdrawRequestVerification',
'IcZingpay',
'IcZoomIn',
'IcZoomOut',
'IcZoomOut'
],
'contract': [
'IcContractBarrier',
Expand All @@ -636,7 +634,7 @@ export const icons =
'IcContractStartTimeCircle',
'IcContractStartTime',
'IcContractStrike',
'IcContractTarget',
'IcContractTarget'
],
'currency': [
'IcCurrencyAud',
Expand All @@ -660,10 +658,10 @@ export const icons =
'IcCurrencyUsdc',
'IcCurrencyUsdk',
'IcCurrencyUst',
'IcCurrencyVirtual',
'IcCurrencyVirtual'
],
'derivez': [
'IcDerivez',
'IcDerivez'
],
'dxtrade': [
'IcDxtradeDerivX',
Expand All @@ -680,7 +678,7 @@ export const icons =
'IcDxtradeFinancialPlatform',
'IcDxtradeFinancial',
'IcDxtradeOnePassword',
'IcDxtradeSyntheticPlatform',
'IcDxtradeSyntheticPlatform'
],
'flag': [
'IcFlagDe',
Expand All @@ -696,7 +694,7 @@ export const icons =
'IcFlagUk',
'IcFlagVi',
'IcFlagZhCn',
'IcFlagZhTw',
'IcFlagZhTw'
],
'mt5': [
'IcMt5Acuity',
Expand Down Expand Up @@ -725,7 +723,7 @@ export const icons =
'IcMt5SyntheticDashboard',
'IcMt5SyntheticIndices',
'IcMt5SyntheticPlatform',
'IcMt5TradeTypes',
'IcMt5TradeTypes'
],
'option': [
'IcOptionAccumulators',
Expand All @@ -743,7 +741,7 @@ export const icons =
'IcOptionOverUnder',
'IcOptionRaiseFall',
'IcOptionTouchNotouch',
'IcOptionUpDownAsian',
'IcOptionUpDownAsian'
],
'rebranding': [
'IcRebrandingBinaryBot',
Expand All @@ -768,7 +766,7 @@ export const icons =
'IcRebrandingMt5Logo',
'IcRebrandingMt5SwapFree',
'IcRebrandingSmarttraderDashboard',
'IcRebrandingSmarttrader',
'IcRebrandingSmarttrader'
],
'stock': [
'IcStockAdidasSalomon',
Expand Down Expand Up @@ -818,7 +816,7 @@ export const icons =
'IcStockVisa',
'IcStockWallMart',
'IcStockWaltDisney',
'IcStockZoom',
'IcStockZoom'
],
'tradetype': [
'IcTradetypeAccu',
Expand Down Expand Up @@ -856,7 +854,7 @@ export const icons =
'IcTradetypeTicklow',
'IcTradetypeUpordown',
'IcTradetypeVanillaLongCall',
'IcTradetypeVanillaLongPut',
'IcTradetypeVanillaLongPut'
],
'underlying': [
'IcUnderlying1HZ100V',
Expand Down Expand Up @@ -1015,7 +1013,7 @@ export const icons =
'IcUnderlyingWLDEUR',
'IcUnderlyingWLDGBP',
'IcUnderlyingWLDUSD',
'IcUnderlyingWLDXAU',
'IcUnderlyingWLDXAU'
],
'wallet': [
'IcWalletBitcoinDark',
Expand Down Expand Up @@ -1043,6 +1041,6 @@ export const icons =
'IcWalletTetherDark',
'IcWalletTetherLight',
'IcWalletUsdCoinDark',
'IcWalletUsdCoinLight',
],
}
'IcWalletUsdCoinLight'
]
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"@deriv/cashier": "^1.0.0",
"@deriv/cfd": "^1.0.0",
"@deriv/components": "^1.0.0",
"@deriv/deriv-api": "^1.0.11",
"@deriv/deriv-api": "^1.0.13",
"@deriv/deriv-charts": "1.2.2",
"@deriv/hooks": "^1.0.0",
"@deriv/p2p": "^0.7.3",
Expand Down
32 changes: 32 additions & 0 deletions packages/core/src/App/Components/dev-tools/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import MockDialog from './mock-dialog';
import { useLocalStorageData } from '@deriv/hooks';

const DevTools = () => {
const [show_mockserver_panel, setShowMockServerPanel] = useLocalStorageData<boolean>(
'show_mockserver_panel',
false
);

React.useEffect(() => {
const handleShortcutKey = (event: globalThis.KeyboardEvent) => {
if (event.ctrlKey && event.key === '0') {
setShowMockServerPanel(prev => !prev);
}
};

window.addEventListener('keydown', handleShortcutKey);

return () => {
window.removeEventListener('keydown', handleShortcutKey);
};
}, [setShowMockServerPanel]);

if (show_mockserver_panel) {
return <MockDialog />;
}

return <React.Fragment />;
};

export default DevTools;
69 changes: 69 additions & 0 deletions packages/core/src/App/Components/dev-tools/mock-dialog.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
.mock-dialog {
position: absolute;
bottom: 4.6rem;
right: 1rem;
width: 34rem;
border-radius: $BORDER_RADIUS;
padding: 1.2rem 1.6rem;
background-color: var(--general-main-1);
box-shadow: 0 20px 13px rgba(0, 0, 0, 0.01), 0 4px 3px rgba(0, 0, 0, 0.02);
border: 1px solid var(--general-hover);
z-index: 69420;

&__title {
margin-bottom: 1.4rem;
}

&__status {
border-radius: 4px;
border: 2px solid;
padding: 0.8rem 1.2rem;
margin-bottom: 2.4rem;

&--online {
}
&--connecting {
}
&--offline {
background-color: #f3f4f6;
border-color: #e5e7eb;

.dc-text {
color: #6b7280;
}
}
}

&__form {
display: flex;
min-height: 40rem;
flex-direction: column;
gap: 2rem;

&--dropdown-container {
display: inline-flex;
gap: 1rem;

button {
height: unset;
}
}

&--input {
margin-bottom: unset;
}

&--submit-container {
display: flex;
justify-content: end;
gap: 1rem;

button:disabled {
cursor: not-allowed;
span {
color: #9ca3af;
}
}
}
}
}
Loading