-
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 'ExceededCommentLength.js' component to TypeScript #31520
[TS migration] Migrate 'ExceededCommentLength.js' component to TypeScript #31520
Conversation
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.
One small comment, LGTM!
|
||
/** Text Comment */ | ||
comment: PropTypes.string, | ||
comment: 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.
comment: string; | |
comment?: string; |
const styles = useThemeStyles(); | ||
const {numberFormat, translate} = useLocalize(); | ||
const [commentLength, setCommentLength] = useState(0); | ||
const updateCommentLength = useMemo( | ||
() => | ||
debounce((comment, onExceededMaxCommentLength) => { | ||
const newCommentLength = ReportUtils.getCommentLength(comment); | ||
debounce((newComment, onExceededMaxCommentLengthCallabck) => { |
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.
debounce((newComment, onExceededMaxCommentLengthCallabck) => { | |
debounce((newComment, onExceededMaxCommentLengthCallback) => { |
typo 😅
Done! @fabioh8010 |
Reviewer Checklist
Screenshots/VideosAndroid: Native31520.Android.mp4Android: mWeb Chrome31520.mWeb-Android.mp4iOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.17.2.-.2023-12-16.at.03.55.57.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.17.2.-.2023-12-16.at.03.57.31.mp4MacOS: Chrome / Safari31520.Web.mp4MacOS: Desktop31520.Desktop.mp4 |
@BartoszGrajdek Could you resolve the conflicts? Thank you! |
@mollfpr Done! |
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 #25018 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
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.
Approving since I don't know if you wanna make the updates I'm suggesting in this PR, or if we should do it separately. Let me know and I can merge
const defaultProps = {}; | ||
|
||
function ExceededCommentLength(props) { | ||
function ExceededCommentLength({shouldShowError}: ExceededCommentLengthProps) { |
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 know this is a migration issue, but If feel like a component called ExceededCommentLength
shouldn't check on a shouldShowError boolean to display a message about a comment exceeding the max length.
Instead, we should check shouldShowError
outside of the component, and only render it if it's true
function ExceededCommentLength({shouldShowError}: ExceededCommentLengthProps) { | |
function ExceededCommentLength() { |
if (!shouldShowError) { | ||
return null; | ||
} | ||
|
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.
if (!shouldShowError) { | |
return null; | |
} |
type ExceededCommentLengthProps = { | ||
/** Show error when comment length is exceeded */ | ||
shouldShowError: boolean; | ||
}; | ||
|
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.
type ExceededCommentLengthProps = { | |
/** Show error when comment length is exceeded */ | |
shouldShowError: boolean; | |
}; |
It is a fairly easy change, let's do it in this PR 👍 cc @BartoszGrajdek |
@cead22 I've added the changes you suggested, let me know if it's alright 😄 |
Thank you |
✋ 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/cead22 in version: 1.4.14-0 🚀
|
🚀 Deployed to staging by https://github.com/cead22 in version: 1.4.14-0 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.4.14-6 🚀
|
Details
Migrate 'ExceededCommentLength.js' component file to TypeScript
Fixed Issues
$ #25018
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(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
chrome.mov
iOS: Native
iOS: mWeb Safari
safari.mov
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4