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

Sergei / chore: migrate open-positions to tsx #40

Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,19 @@ const ContractCardSell = ({ contract_info, getCardLabels, is_sell_requested, onC
ev.preventDefault();
};

if (!should_show_sell) return <React.Fragment />;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we are returning empty fragment? isn't to return null instead?

Copy link
Collaborator Author

@sergei-deriv sergei-deriv Jan 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we are returning empty fragment? isn't to return null instead?

I did it because component is waiting JSX. I'll change it now

if (!is_valid_to_sell)
return <div className='dc-contract-card__no-resale-msg'>{getCardLabels().RESALE_NOT_OFFERED}</div>;
return (
should_show_sell && (
<React.Fragment>
{is_valid_to_sell ? (
<Button
className={classNames('dc-btn--sell', {
'dc-btn--loading': is_sell_requested,
})}
is_disabled={is_sell_requested}
text={getCardLabels().SELL}
onClick={onClick}
secondary
/>
) : (
<div className='dc-contract-card__no-resale-msg'>{getCardLabels().RESALE_NOT_OFFERED}</div>
)}
</React.Fragment>
)
<Button
className={classNames('dc-btn--sell', {
'dc-btn--loading': is_sell_requested,
})}
is_disabled={is_sell_requested}
text={getCardLabels().SELL}
onClick={onClick}
secondary
/>
);
};

Expand Down
48 changes: 24 additions & 24 deletions packages/components/src/components/tabs/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@ import Tab from './tab';
import { useConstructor } from '../../hooks';
import ThemedScrollbars from '../themed-scrollbars/themed-scrollbars';

type TTabsProps = RouteComponentProps & {
active_icon_color: string;
active_index?: number;
background_color: string;
bottom: boolean;
center: boolean;
children: React.ReactElement & React.ReactElement[];
className?: string;
fit_content: boolean;
has_active_line?: boolean;
has_bottom_line?: boolean;
header_fit_content: boolean;
history: History;
icon_color: string;
icon_size: number;
is_100vw: boolean;
is_full_width: boolean;
is_overflow_hidden: boolean;
is_scrollable: boolean;
onTabItemClick: (active_tab_index: number) => void;
should_update_hash: boolean;
single_tab_has_no_label: boolean;
top: boolean;
};
type TTabsProps = RouteComponentProps &
React.PropsWithChildren<{
active_icon_color: string;
active_index?: number;
background_color: string;
bottom: boolean;
center: boolean;
className?: string;
fit_content: boolean;
has_active_line?: boolean;
has_bottom_line?: boolean;
header_fit_content: boolean;
history: History;
icon_color: string;
icon_size: number;
is_100vw: boolean;
is_full_width: boolean;
is_overflow_hidden: boolean;
is_scrollable: boolean;
onTabItemClick: (active_tab_index: number) => void;
should_update_hash: boolean;
single_tab_has_no_label: boolean;
top: boolean;
}>;

const Tabs = ({
active_icon_color,
Expand Down
8 changes: 4 additions & 4 deletions packages/reports/src/Containers/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import OpenPositions from './open-positions.jsx';
import ProfitTable from './profit-table.jsx';
import Statement from './statement.jsx';
import Reports from './reports.jsx';
import OpenPositions from './open-positions';
import ProfitTable from './profit-table';
import Statement from './statement';
import Reports from './reports';

export default {
OpenPositions,
Expand Down
Loading