-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 'AvatarWithImagePicker.js' component to TypeSc… #35847
[TS migration] Migrate 'AvatarWithImagePicker.js' component to TypeSc… #35847
Conversation
685e4f7
to
059ea8b
Compare
type ErrorData = { | ||
validationError?: TranslationPaths | null | ''; | ||
phraseParam: Record<string, unknown>; | ||
}; |
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.
Maybe we can make ErrorData type more specific, up to you...
type ErrorData = { | |
validationError?: TranslationPaths | null | ''; | |
phraseParam: Record<string, unknown>; | |
}; | |
type PhraseParam<TKey extends TranslationPaths> = PhraseParameters<Phrase<TKey>>[0]; | |
type ErrorData<TKey extends TranslationPaths | null = null> = { | |
validationError: TKey; | |
phraseParam: TKey extends TranslationPaths ? PhraseParam<TKey> : EmptyObject; | |
}; |
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 that in this case it will be overcomplicated and better to keep simplicity here
059ea8b
to
80fc188
Compare
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🚀
5d81b29
to
80fc188
Compare
Reviewer Checklist
Screenshots/VideosAndroid: Native35847.Android.mp4Android: mWeb Chrome35847.mWeb-Chrome.mp4iOS: Native35847.iOS.mp4iOS: mWeb Safari35847.mWeb-Safari.mp4MacOS: Chrome / Safari35847.Web.-.Profile.mp435847.Web.-.Workspace.mp4MacOS: Desktop35847.Desktop.mp4 |
We did not find an internal engineer to review this PR, trying to assign a random engineer to #25122 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
return _.contains(CONST.AVATAR_ALLOWED_EXTENSIONS, fileExtension.toLowerCase()); | ||
const isValidExtension = (image: File): boolean => { | ||
const {fileExtension} = FileUtils.splitExtensionFromFileName(image?.name ?? ''); | ||
return CONST.AVATAR_ALLOWED_EXTENSIONS.some((extension) => extension === fileExtension.toLowerCase()); |
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:
return CONST.AVATAR_ALLOWED_EXTENSIONS.some((extension) => extension === fileExtension.toLowerCase()); | |
return CONST.AVATAR_ALLOWED_EXTENSIONS.includes(fileExtension.toLowerCase()); |
@@ -432,7 +397,8 @@ function AvatarWithImagePicker({ | |||
{errorData.validationError && ( | |||
<DotIndicatorMessage | |||
style={[styles.mt6]} | |||
messages={{0: [errorData.validationError, errorData.phraseParam]}} | |||
// eslint-disable-next-line @typescript-eslint/naming-convention | |||
messages={{0: translate(errorData.validationError, errorData.phraseParam as never)}} |
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.
not your fault but this code is confusing. Not sure why messages
is an object instead of just being an array.
🚀 Deployed to staging by https://github.com/roryabraham in version: 1.4.44-0 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.44-13 🚀
|
…ript
Details
Fixed Issues
$ #25122
PROPOSAL:
Tests
Offline tests
QA Steps
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-native-converted.webm
Android: mWeb Chrome
android-web-converted.webm
iOS: Native
ios-native-converted.mp4
iOS: mWeb Safari
ios-web-converted.mp4
MacOS: Chrome / Safari
desktop-web-converted.mov
MacOS: Desktop
desktop-native-converted.mov