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

[TS migration] Migrate 'ReportActionItemTaskAction.js' component to TypeScript #32560

Merged
Show file tree
Hide file tree
Changes from 3 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
34 changes: 0 additions & 34 deletions src/components/ReportActionItem/TaskAction.js

This file was deleted.

24 changes: 24 additions & 0 deletions src/components/ReportActionItem/TaskAction.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import {View} from 'react-native';
import Text from '@components/Text';
import * as TaskUtils from '@libs/TaskUtils';
import useThemeStyles from '@styles/useThemeStyles';

type TaskActionProps = {
/** Name of the reportAction action */
actionName: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

i notice we are passing a value to taskReportID for this component, should we add it in this prop type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@getusha I think taskReportID is not used anymore in this component

Copy link
Contributor

Choose a reason for hiding this comment

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

@VickyStash i noticed this comment above taskReportID in proptypes
// eslint-disable-next-line react/no-unused-prop-types -- This is used in the withOnyx HOC, so you're saying it is not used anymore in withOnyx HOC?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@getusha This component doesn't have withOnyx HOC where taskReportID was used, it was removed some time ago.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After some time taskReportID was also used in another place, but it also was updated

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we remove this if that's the case, it is kind of confusing.

taskReportID={props.action.originalMessage.taskReportID.toString()}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@getusha Done!

};

function TaskAction({actionName}: TaskActionProps) {
const styles = useThemeStyles();

return (
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>
<Text style={[styles.chatItemMessage, styles.colorMuted]}>{TaskUtils.getTaskReportActionMessage(actionName)}</Text>
</View>
);
}

TaskAction.displayName = 'TaskAction';

export default TaskAction;