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

Maryia/dtra-270/TS migration: trade-store #5

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions packages/shared/src/utils/digital-options/digital-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type TShowError = {
message: string;
header: string;
redirect_label: string;
redirectOnClick: (() => void) | null;
redirectOnClick?: (() => void) | null;
should_show_refresh: boolean;
redirect_to: string;
should_clear_error_on_click: boolean;
Expand All @@ -25,8 +25,8 @@ type TAccounts = {
export const showDigitalOptionsUnavailableError = (
showError: (t: TShowError) => void,
message: TMessage,
redirectOnClick: (() => void) | null,
should_redirect: boolean,
redirectOnClick?: (() => void) | null,
should_redirect = false,
should_clear_error_on_click = true
) => {
const { title, text, link } = message;
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/src/utils/helpers/duration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ export const hasIntradayDurationUnit = (duration_units_list: TUnit[]) => {
* On switching symbols, end_time value of volatility indices should be set to today
*
* @param {String} symbol
* @param {String} expiry_type
* @param {String | null} expiry_type
* @returns {*}
*/
export const resetEndTimeOnVolatilityIndices = (symbol: string, expiry_type: string) =>
export const resetEndTimeOnVolatilityIndices = (symbol: string, expiry_type: string | null) =>
/^R_/.test(symbol) && expiry_type === 'endtime' ? toMoment(null).format('DD MMM YYYY') : null;

export const getDurationMinMaxValues = (
Expand Down
1 change: 1 addition & 0 deletions packages/trader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"devDependencies": {
"@babel/eslint-parser": "^7.17.0",
"@babel/preset-react": "^7.16.7",
"@types/lodash.debounce": "^4.0.7",
"@types/react": "^18.0.7",
"@types/react-dom": "^18.0.0",
"babel-loader": "^8.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ type TBasis = {
setAmountError: (has_error: boolean) => void;
};

type TObject = {
duration_unit: string;
duration: number;
basis: string;
amount: string | number;
};

const Basis = observer(
({
basis,
Expand Down Expand Up @@ -57,7 +50,7 @@ const Basis = observer(
const formatAmount = (value: number | string) =>
!isNaN(+value) && value !== '' ? Number(value).toFixed(user_currency_decimal_places) : value;
const setBasisAndAmount = (amount: number | string) => {
const on_change_obj = {} as TObject;
const on_change_obj: Partial<ReturnType<typeof useTraderStore>> = {};

// Check for any duration changes in Duration trade params Tab before sending onChange object
if (duration_unit !== trade_duration_unit && !has_duration_error)
Expand All @@ -66,7 +59,7 @@ const Basis = observer(

if (amount !== trade_amount || basis !== trade_basis) {
on_change_obj.basis = basis;
on_change_obj.amount = amount;
on_change_obj.amount = +amount;
}

if (!isEmptyObject(on_change_obj)) onChangeMultiple(on_change_obj);
Expand Down
2 changes: 0 additions & 2 deletions packages/trader/src/Modules/Trading/Containers/trade.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ const ChartTrade = observer(props => {
wsSubscribe,
active_symbols,
has_alternative_source,
refToAddTick,
} = useTraderStore();

const settings = {
Expand Down Expand Up @@ -384,7 +383,6 @@ const ChartTrade = observer(props => {
onExportLayout={exportLayout}
shouldFetchTradingTimes={!end_epoch}
hasAlternativeSource={has_alternative_source}
refToAddTick={refToAddTick}
getMarketsOrder={getMarketsOrder}
yAxisMargin={{
top: isMobile() ? 76 : 106,
Expand Down
Loading