Skip to content

Commit

Permalink
Aizad/73994/pss ts (binary-com#48)
Browse files Browse the repository at this point in the history
* chore: migrate progress-slider-stream to tsx

* fix: imported TContractInfo inside deriv/shared/
  • Loading branch information
aizad-deriv committed Feb 7, 2023
1 parent 193d2a7 commit 1fae9d5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import moment from 'moment';
type TProgressSliderProps = {
className?: string;
current_tick: number;
expiry_time: number & string;
expiry_time: number;
getCardLabels: () => { [key: string]: string }; // TODO Use the one from shared workspace after migration
is_loading: boolean;
server_time: moment.Moment;
start_time: number & string;
start_time: number;
ticks_count: number;
};

Expand Down
2 changes: 1 addition & 1 deletion packages/reports/src/Constants/data-table-constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { Icon, Label, Money, ContractCard, Popover } from '@deriv/components';
import { isMobile, getCurrencyDisplayCode, getTotalProfit, shouldShowCancellation } from '@deriv/shared';
import { localize, Localize } from '@deriv/translations';
import ProgressSliderStream from '../Containers/progress-slider-stream.jsx';
import ProgressSliderStream from '../Containers/progress-slider-stream';

import { getCardLabels } from '_common/contract';
import { getProfitOrLoss } from '../Helpers/profit-loss';
Expand Down
2 changes: 1 addition & 1 deletion packages/reports/src/Containers/open-positions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
getTotalProfit,
getContractPath,
formatPortfolioPosition,
TContractInfo,
} from '@deriv/shared';
import { localize, Localize } from '@deriv/translations';
import { ReportsTableRowLoader } from '../Components/Elements/ContentLoader';
Expand All @@ -34,7 +35,6 @@ import PlaceholderComponent from '../Components/placeholder-component';
import { getCardLabels } from '_common/contract';
import { connect } from 'Stores/connect';
import type { TRootStore } from 'Stores/index';
import { TContractInfo } from '@deriv/shared/src/utils/contract/contract-types';

type TRangeFloatZeroToOne = React.ComponentProps<typeof ProgressBar>['value'];
type TFormatPortfolioPosition = ReturnType<typeof formatPortfolioPosition>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import PropTypes from 'prop-types';
import React from 'react';
import { ProgressSlider } from '@deriv/components';
import { getCurrentTick } from '@deriv/shared';
import { getCurrentTick, TContractInfo } from '@deriv/shared';
import { connect } from 'Stores/connect';
import { getCardLabels } from '_common/contract';
import moment from 'moment';
import { TRootStore } from 'Stores/index';

const ProgressSliderStream = ({ contract_info, is_loading, server_time }) => {
type TProgressSliderStream = {
contract_info: Required<TContractInfo>;
is_loading: boolean;
server_time: moment.Moment;
};

const ProgressSliderStream = ({ contract_info, is_loading, server_time }: TProgressSliderStream) => {
if (!contract_info) {
return <div />;
}
Expand All @@ -24,13 +31,7 @@ const ProgressSliderStream = ({ contract_info, is_loading, server_time }) => {
);
};

ProgressSliderStream.propTypes = {
contract_info: PropTypes.object,
is_loading: PropTypes.bool,
server_time: PropTypes.object,
};

export default connect(({ common, portfolio }) => ({
export default connect(({ common, portfolio }: TRootStore) => ({
is_loading: portfolio.is_loading,
server_time: common.server_time,
}))(ProgressSliderStream);
1 change: 1 addition & 0 deletions packages/shared/src/utils/contract/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './contract';
export * from './contract-types';

0 comments on commit 1fae9d5

Please sign in to comment.