-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 FlagCommentPage #34734
[TS Migration] Migrate FlagCommentPage #34734
Conversation
src/pages/FlagCommentPage.tsx
Outdated
type FlagCommentPageProps = WithReportAndReportActionOrNotFoundProps & FlagCommentPageWithOnyxProps; | ||
|
||
type FlagCommentRouteProp = RouteProp<{params: {reportID: string; reportActionID: string}}>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you will also need to update WithReportAndReportActionOrNotFoundProps
type
type FlagCommentPageProps = WithReportAndReportActionOrNotFoundProps & FlagCommentPageWithOnyxProps; | |
type FlagCommentRouteProp = RouteProp<{params: {reportID: string; reportActionID: string}}>; | |
type FlagCommentPageNavigationProps = StackScreenProps<FlagCommentNavigatorParamList, typeof SCREENS.FLAG_COMMENT_ROOT>; | |
type FlagCommentPageProps = WithReportAndReportActionOrNotFoundProps & FlagCommentPageWithOnyxProps & FlagCommentPageNavigationProps; |
src/pages/FlagCommentPage.tsx
Outdated
/** | ||
* Get the reportID for the associated chatReport | ||
*/ | ||
function getReportID(route: FlagCommentRouteProp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function getReportID(route: FlagCommentRouteProp) { | |
function getReportID(route: FlagCommentPageNavigationProps['route']) { |
src/pages/FlagCommentPage.tsx
Outdated
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
|
||
const severities = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's type this value
src/pages/FlagCommentPage.tsx
Outdated
}, | ||
]; | ||
|
||
const getActionToFlag = useCallback(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add return value
src/pages/FlagCommentPage.tsx
Outdated
|
||
// Handle threads if needed | ||
if (reportAction?.reportActionID === undefined) { | ||
reportAction = parentReportActions?.[report?.parentReportActionID ?? ''] ?? undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reportAction = parentReportActions?.[report?.parentReportActionID ?? ''] ?? undefined; | |
reportAction = parentReportActions?.[report?.parentReportActionID ?? '']; |
src/pages/FlagCommentPage.tsx
Outdated
return reportAction; | ||
}, [report, reportActions, route.params.reportActionID, parentReportActions]); | ||
|
||
const flagComment = (severity: ValueOf<typeof CONST.MODERATION>) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a type for ValueOf<typeof CONST.MODERATION>
src/pages/FlagCommentPage.tsx
Outdated
const flagComment = (severity: ValueOf<typeof CONST.MODERATION>) => { | ||
let reportID: string | undefined = getReportID(route); | ||
const reportAction = getActionToFlag(); | ||
const parentReportAction = parentReportActions?.[report?.parentReportActionID ?? ''] ?? undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const parentReportAction = parentReportActions?.[report?.parentReportActionID ?? ''] ?? undefined; | |
const parentReportAction = parentReportActions?.[report?.parentReportActionID ?? '']; |
src/pages/FlagCommentPage.tsx
Outdated
const actionToFlag = getActionToFlag(); | ||
const shouldShowFlagComment = actionToFlag && ReportUtils.shouldShowFlagComment(actionToFlag, report); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get rid of that changes making getActionToFlag
return null instead of undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@rushatgabhane Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
5da20fc
to
fbef230
Compare
Reviewer Checklist
Screenshots/VideosiOS: NativeScreen.Recording.2024-02-07.at.01.39.38.movMacOS: Chrome / SafariScreen.Recording.2024-02-07.at.01.28.57.movMacOS: DesktopScreen.Recording.2024-02-07.at.01.32.09.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
We did not find an internal engineer to review this PR, trying to assign a random engineer to #25184 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/danieldoglas in version: 1.4.39-0 🚀
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.4.39-8 🚀
|
Details
[TS migration] Migrate FlagCommentPage to TypeScript
Fixed Issues
$ #25184
PROPOSAL: N/A
Tests
Test FlagCommentPage:
Offline tests
N/A
QA Steps
Same as in the Tests section.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop