-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Show category / tag in Expense preview view #52758
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f72995c
Show category / tag in Expense preview view
mkzie2 74cdaa3
Merge branch 'main' into mkzie2-issue/52261
mkzie2 2a3b7a8
fix text style
mkzie2 fdca02e
merge main
mkzie2 27d6c62
update padding style
mkzie2 d6bebb7
Merge branch 'main' into mkzie2-issue/52261
mkzie2 119f4aa
only display the view if tag or category is available
mkzie2 8348b2f
merge main
mkzie2 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 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 |
---|---|---|
|
@@ -106,6 +106,8 @@ function MoneyRequestPreviewContent({ | |
currency: requestCurrency, | ||
comment: requestComment, | ||
merchant, | ||
tag, | ||
category, | ||
} = useMemo<Partial<TransactionDetails>>(() => ReportUtils.getTransactionDetails(transaction) ?? {}, [transaction]); | ||
|
||
const description = truncate(StringUtils.lineBreaksToSpaces(requestComment), {length: CONST.REQUEST_PREVIEW.MAX_LENGTH}); | ||
|
@@ -145,6 +147,7 @@ function MoneyRequestPreviewContent({ | |
// When there are no settled transactions in duplicates, show the "Keep this one" button | ||
const shouldShowKeepButton = !!(allDuplicates.length && duplicates.length && allDuplicates.length === duplicates.length); | ||
|
||
const shouldShowCategoryOrTag = !!tag || !!category; | ||
const shouldShowRBR = hasNoticeTypeViolations || hasWarningTypeViolations || hasViolations || hasFieldErrors || (!isFullySettled && !isFullyApproved && isOnHold); | ||
const showCashOrCard = isCardTransaction ? translate('iou.card') : translate('iou.cash'); | ||
// We don't use isOnHold because it's true for duplicated transaction too and we only want to show hold message if the transaction is truly on hold | ||
|
@@ -427,6 +430,43 @@ function MoneyRequestPreviewContent({ | |
</View> | ||
)} | ||
</View> | ||
{shouldShowCategoryOrTag && <View style={[styles.threadDividerLine, styles.ml0, styles.mr0, styles.mt1]} />} | ||
{shouldShowCategoryOrTag && ( | ||
<View style={[styles.flexRow, styles.pt1, styles.alignItemsCenter]}> | ||
{!!category && ( | ||
<View style={[styles.flexRow, styles.alignItemsCenter, styles.gap1, tag && styles.mw50, tag && styles.pr1, styles.flexShrink1]}> | ||
<Icon | ||
src={Expensicons.Folder} | ||
height={variables.iconSizeExtraSmall} | ||
width={variables.iconSizeExtraSmall} | ||
fill={theme.icon} | ||
/> | ||
<Text | ||
numberOfLines={1} | ||
style={[styles.textMicroSupporting, styles.pre, styles.flexShrink1]} | ||
> | ||
{category} | ||
</Text> | ||
</View> | ||
)} | ||
{!!tag && ( | ||
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter, styles.gap1, category && styles.pl1]}> | ||
<Icon | ||
src={Expensicons.Tag} | ||
height={variables.iconSizeExtraSmall} | ||
width={variables.iconSizeExtraSmall} | ||
fill={theme.icon} | ||
/> | ||
<Text | ||
numberOfLines={1} | ||
style={[styles.textMicroSupporting, styles.pre, styles.flexShrink1]} | ||
> | ||
{tag} | ||
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. We should use getCleanedTagName here to remove the unexpected name. Ref: #53248 |
||
</Text> | ||
</View> | ||
)} | ||
</View> | ||
)} | ||
</View> | ||
</View> | ||
</View> | ||
|
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.
coming from this issue #53454, here we’re displaying the tag name if tag value is available. However, this alone is not sufficient for display in the preview. Rooms created under a workspace with dependent tags enabled will also show the tags in the preview. That said, tags should only appear in the expense preview if the report is a policy expense chat. More details can be found here: #53454 (comment)