-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[TS migration] Migrate 'ReportActionCompose' component to TypeScript #34646
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
Merged
luacmartins
merged 52 commits into
Expensify:main
from
kubabutkiewicz:ts-migration/ReportActionCompose
Feb 28, 2024
Merged
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
fab9c8e
fix: wip
kubabutkiewicz 25f6646
fix: finish working on migration
kubabutkiewicz 214e563
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 5e2f31c
fix: resolve comments
kubabutkiewicz 2a0e3e2
ref: move SuggestionMention, Suggestions to TS, fixes to MentionSugge…
kubabutkiewicz 717a5e8
fix: started migrating SuggestionEmoji component
kubabutkiewicz 7c71325
fix: migrate SuggestionEmoji
kubabutkiewicz be57be3
fix: SuggestionEmoji and Suggestions types, migrate SendButton
kubabutkiewicz 929a51a
fix: migrate AttachmentPickerWithMenuItems
kubabutkiewicz 0cc6502
fix: Migrate SilentCommentUpdater
kubabutkiewicz 8ed208c
fix: ComposerWithSuggestion migration
kubabutkiewicz fef68a4
fix: keep working on ComposerWithSuggestions
kubabutkiewicz 223fdd8
fix: wip
kubabutkiewicz 05bb0a5
fix: finished migrating ComposerWithSuggestions, removed unused files…
kubabutkiewicz cf84b3b
fix: move ReportTypingIndicator to TS
kubabutkiewicz 87f22f7
fix: migrate ParticipanLocalTime and ReportDropUI
kubabutkiewicz 035494a
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 63a63ad
fix: typecheck
kubabutkiewicz 1225d23
fix: minor fixes
kubabutkiewicz 4c5a938
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 4f907d2
fix: removed unused export
kubabutkiewicz cbdfb71
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz efa4178
fix: typecheck
kubabutkiewicz 99a4110
fix: typecheck
kubabutkiewicz 090c788
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 45c6530
fix: typecheck
kubabutkiewicz 61ad476
fix: resolve comments
kubabutkiewicz 52a4002
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz fad9490
fix: resolve comments
kubabutkiewicz 4d6af9a
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz b2a765d
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz f3b7ebd
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 5735f61
fix: resolve comments
kubabutkiewicz fb1c659
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 9d062b9
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 94f840c
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz f62ba72
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 022db8f
fix: resolve comments
kubabutkiewicz 64c9b39
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz f4ce52c
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 2c65a30
Merge branch 'main' into ts-migration/ReportActionCompose
kubabutkiewicz 4602602
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 2a71a34
fix: typecheck
kubabutkiewicz 761a2d1
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 2e7077d
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 2e829a1
fix: typecheck
kubabutkiewicz 5235288
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 1e19123
fix: typecheck
kubabutkiewicz 238bd8d
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 6f7f2d4
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz cb62bd4
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz 64368d5
fix: typecheck
kubabutkiewicz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,24 +1,23 @@ | ||||||||
| import lodashGet from 'lodash/get'; | ||||||||
| import React, {useEffect, useState} from 'react'; | ||||||||
| import {View} from 'react-native'; | ||||||||
| import participantPropTypes from '@components/participantPropTypes'; | ||||||||
| import Text from '@components/Text'; | ||||||||
| import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; | ||||||||
| import useLocalize from '@hooks/useLocalize'; | ||||||||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||||||||
| import DateUtils from '@libs/DateUtils'; | ||||||||
| import Timers from '@libs/Timers'; | ||||||||
| import type {Locale} from '@src/components/LocaleContextProvider'; | ||||||||
| import CONST from '@src/CONST'; | ||||||||
| import type {PersonalDetails} from '@src/types/onyx'; | ||||||||
|
|
||||||||
| const propTypes = { | ||||||||
| type ParticipantLocalTimeProps = { | ||||||||
| /** Personal details of the participant */ | ||||||||
| participant: participantPropTypes.isRequired, | ||||||||
|
|
||||||||
| ...withLocalizePropTypes, | ||||||||
| participant: PersonalDetails; | ||||||||
| }; | ||||||||
|
|
||||||||
| function getParticipantLocalTime(participant, preferredLocale) { | ||||||||
| const reportRecipientTimezone = lodashGet(participant, 'timezone', CONST.DEFAULT_TIME_ZONE); | ||||||||
| const reportTimezone = DateUtils.getLocalDateFromDatetime(preferredLocale, null, reportRecipientTimezone.selected); | ||||||||
| function getParticipantLocalTime(participant: PersonalDetails, preferredLocale: Locale) { | ||||||||
| // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- Disabling this line for safeness as nullish coalescing works only if the value is undefined or null | ||||||||
| const reportRecipientTimezone = participant.timezone || CONST.DEFAULT_TIME_ZONE; | ||||||||
| const reportTimezone = DateUtils.getLocalDateFromDatetime(preferredLocale, undefined, reportRecipientTimezone.selected); | ||||||||
| const currentTimezone = DateUtils.getLocalDateFromDatetime(preferredLocale); | ||||||||
| const reportRecipientDay = DateUtils.formatToDayOfWeek(reportTimezone); | ||||||||
| const currentUserDay = DateUtils.formatToDayOfWeek(currentTimezone); | ||||||||
|
|
@@ -28,9 +27,9 @@ function getParticipantLocalTime(participant, preferredLocale) { | |||||||
| return `${DateUtils.formatToLocalTime(reportTimezone)}`; | ||||||||
| } | ||||||||
|
|
||||||||
| function ParticipantLocalTime(props) { | ||||||||
| function ParticipantLocalTime({participant}: ParticipantLocalTimeProps) { | ||||||||
| const {translate, preferredLocale} = useLocalize(); | ||||||||
| const styles = useThemeStyles(); | ||||||||
| const {participant, preferredLocale, translate} = props; | ||||||||
|
|
||||||||
| const [localTime, setLocalTime] = useState(() => getParticipantLocalTime(participant, preferredLocale)); | ||||||||
| useEffect(() => { | ||||||||
|
|
@@ -44,7 +43,8 @@ function ParticipantLocalTime(props) { | |||||||
| }; | ||||||||
| }, [participant, preferredLocale]); | ||||||||
|
|
||||||||
| const reportRecipientDisplayName = lodashGet(props, 'participant.firstName') || lodashGet(props, 'participant.displayName'); | ||||||||
| // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- Disabling this line for safeness as nullish coalescing works only if the value is undefined or null | ||||||||
| const reportRecipientDisplayName = participant.firstName || participant.displayName; | ||||||||
|
Comment on lines
+46
to
+47
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
|
||||||||
| if (!reportRecipientDisplayName) { | ||||||||
| return null; | ||||||||
|
|
@@ -65,7 +65,6 @@ function ParticipantLocalTime(props) { | |||||||
| ); | ||||||||
| } | ||||||||
|
|
||||||||
| ParticipantLocalTime.propTypes = propTypes; | ||||||||
| ParticipantLocalTime.displayName = 'ParticipantLocalTime'; | ||||||||
|
|
||||||||
| export default withLocalize(ParticipantLocalTime); | ||||||||
| export default ParticipantLocalTime; | ||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
NAB
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.
@luacmartins I am not sure this is needed , if
participant.timezonewill be undefined or''the variable will be set toCONST.DEFAULT_TIME_ZONEso adding?? ''seems to me redundantThere 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.
yea, I agree. It was just a suggestion so we don't need to suppress the lint rule