-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[No QA] refactor: extract OptionRow.Status leaf #89913
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
mountiny
merged 9 commits into
Expensify:main
from
callstack-internal:refactor/option-row-status
May 12, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b35d9b1
refactor: extract OptionRow.Status leaf
BartekObudzinski 5a4cfb9
Merge remote-tracking branch 'upstream/main' into refactor/option-row…
BartekObudzinski 6a722af
Merge remote-tracking branch 'upstream/main' into refactor/option-row…
BartekObudzinski 44c0c64
Merge branch 'main' into refactor/option-row-status
srikarparsi 2b55962
Merge branch 'main' into refactor/option-row-status
srikarparsi 6e71c6d
chore: remove unused Text import
BartekObudzinski 040510c
Merge remote-tracking branch 'upstream/main' into refactor/option-row…
BartekObudzinski 9a38623
docs: add JSDoc to StatusProps
BartekObudzinski 11a3079
Merge remote-tracking branch 'upstream/main' into refactor/option-row…
BartekObudzinski 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
44 changes: 44 additions & 0 deletions
44
src/components/LHNOptionsList/OptionRowLHN/OptionRow/Status.tsx
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 |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import React from 'react'; | ||
| import Text from '@components/Text'; | ||
| import Tooltip from '@components/Tooltip'; | ||
| import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import DateUtils from '@libs/DateUtils'; | ||
| import type {OptionData} from '@libs/ReportUtils'; | ||
| import CONST from '@src/CONST'; | ||
|
|
||
| type StatusProps = { | ||
| /** The option data for the report row. Status is only shown for 1:1 chats whose participant has set a status emoji. */ | ||
| optionItem: OptionData; | ||
| }; | ||
|
|
||
| function Status({optionItem}: StatusProps) { | ||
| const styles = useThemeStyles(); | ||
| const {translate} = useLocalize(); | ||
| const currentUserPersonalDetails = useCurrentUserPersonalDetails(); | ||
|
|
||
| const emojiCode = optionItem.status?.emojiCode ?? ''; | ||
| if (!emojiCode || !optionItem.isOneOnOneChat) { | ||
| return null; | ||
| } | ||
|
|
||
| const statusText = optionItem.status?.text ?? ''; | ||
| const statusClearAfterDate = optionItem.status?.clearAfter ?? ''; | ||
| const currentSelectedTimezone = currentUserPersonalDetails?.timezone?.selected ?? CONST.DEFAULT_TIME_ZONE.selected; | ||
| const formattedDate = DateUtils.getStatusUntilDate(translate, statusClearAfterDate, optionItem?.timezone?.selected ?? CONST.DEFAULT_TIME_ZONE.selected, currentSelectedTimezone); | ||
| const statusContent = formattedDate ? `${statusText ? `${statusText} ` : ''}(${formattedDate})` : statusText; | ||
|
|
||
| return ( | ||
| <Tooltip | ||
| text={statusContent} | ||
| shiftVertical={-4} | ||
| > | ||
| <Text style={styles.ml1}>{emojiCode}</Text> | ||
| </Tooltip> | ||
| ); | ||
| } | ||
|
|
||
| Status.displayName = 'OptionRow.Status'; | ||
|
|
||
| export default Status; | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.