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

chore: migrated filter component and fix some issues with composite-c… #20

Merged
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import CalendarIcon from './calendar-icon';
import CompositeCalendar from './composite-calendar.jsx';

export default CalendarIcon;
export default CompositeCalendar;
Copy link
Owner

Choose a reason for hiding this comment

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

why you change this file?

Copy link

@akmal-deriv akmal-deriv Jan 13, 2023

Choose a reason for hiding this comment

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

I assume the file should export CompositeCalendar since it's in the respective folder, but mistakenly it was written to export the wrong component, so the issue is being fixed here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That was my bad, I'll change it 🙏🏼

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { toMoment } from '@deriv/shared';
import ListItem from './list-item.tsx';
import ListItem from './list-item';

type TItem = {
value: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FilterDropdown } from '@deriv/components';
import { localize } from '@deriv/translations';
import { connect } from 'Stores/connect';
import CompositeCalendar from './Form/CompositeCalendar';

type TFilterComponent = {
action_type: string;
date_from: number;
date_to: number;
filtered_date_range: object;
Copy link
Owner

Choose a reason for hiding this comment

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

better to expand this object and add keys

handleDateChange: () => void;
handleFilterChange: () => void;
suffix_icon: string;
};

const FilterComponent = ({
action_type,
date_from,
date_to,
handleFilterChange,
handleDateChange,
filtered_date_range,
}) => {
}: TFilterComponent) => {
const filter_list = [
{
text: localize('All transactions'),
Expand Down Expand Up @@ -58,17 +67,7 @@ const FilterComponent = ({
);
};

FilterComponent.propTypes = {
action_type: PropTypes.string,
date_from: PropTypes.number,
date_to: PropTypes.number,
filtered_date_range: PropTypes.object,
handleDateChange: PropTypes.func,
handleFilterChange: PropTypes.func,
suffix_icon: PropTypes.string,
};

export default connect(({ modules }) => ({
export default connect(({ modules }: any) => ({

Choose a reason for hiding this comment

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

Suggested change
export default connect(({ modules }: any) => ({
export default connect(({ modules }: RootStore) => ({

Choose a reason for hiding this comment

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

Declare RootStore in the top of the file: import RootStore from '../Stores/index';

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will change this 🙏🏼 to RootStore thanks @akmal-deriv @niloofar-deriv

Copy link
Owner

Choose a reason for hiding this comment

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

@aizad-deriv please change the rootstore type to the Farzin's suggestion
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mahdiyeh-deriv there's a PR regarding the root store here by Sergei which has not yet been merged.

Choose a reason for hiding this comment

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

@mahdiyeh-deriv I believe this is already done by @sergei-deriv in #40, And I think he has also done it in another PR 😅
Can we merge that PR if there is no concern about it so others can update their branches and use the TRootStore?

cc: @aizad-deriv @niloofar-deriv

Copy link
Owner

Choose a reason for hiding this comment

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

@farzin-deriv that PR as circle-ci issue, I'v asked sergei to fix that an I will merge it to the current branch we have for the reports then we can you it for reports migration. About using this changes in other packages @niloofar-deriv could help more.

Choose a reason for hiding this comment

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

Yes I meant for @deriv/reports TS migration, Awesome, Thank you @mahdiyeh-deriv 🌹

Choose a reason for hiding this comment

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

sure will help to changing them

action_type: modules.statement.action_type,
data: modules.statement.data,
date_from: modules.statement.date_from,
Expand Down
2 changes: 1 addition & 1 deletion packages/reports/src/Containers/statement.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { connect } from 'Stores/connect';
import { getStatementTableColumnsTemplate } from '../Constants/data-table-constants';
import PlaceholderComponent from '../Components/placeholder-component.jsx';
import AccountStatistics from '../Components/account-statistics.jsx';
import FilterComponent from '../Components/filter-component.jsx';
import FilterComponent from '../Components/filter-component';
import { ReportsMeta } from '../Components/reports-meta';
import EmptyTradeHistoryMessage from '../Components/empty-trade-history-message';

Expand Down