-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54804 from Krishna2323/krishna2323/issue/53617
Tweak UI for deleted message and expense
- Loading branch information
Showing
14 changed files
with
152 additions
and
92 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
57 changes: 57 additions & 0 deletions
57
src/components/HTMLEngineProvider/HTMLRenderers/DeletedActionRenderer.tsx
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import type {CustomRendererProps, TPhrasing, TText} from 'react-native-render-html'; | ||
import {TNodeChildrenRenderer} from 'react-native-render-html'; | ||
import Icon from '@components/Icon'; | ||
import * as Expensicons from '@components/Icon/Expensicons'; | ||
import Text from '@components/Text'; | ||
import useTheme from '@hooks/useTheme'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import variables from '@styles/variables'; | ||
import CONST from '@src/CONST'; | ||
|
||
function DeletedActionRenderer({tnode}: CustomRendererProps<TText | TPhrasing>) { | ||
const styles = useThemeStyles(); | ||
const theme = useTheme(); | ||
const htmlAttribs = tnode.attributes; | ||
|
||
const reversedTransactionValue = htmlAttribs[CONST.REVERSED_TRANSACTION_ATTRIBUTE]; | ||
const hiddenMessageValue = htmlAttribs[CONST.HIDDEN_MESSAGE_ATTRIBUTE]; | ||
|
||
const getIcon = () => { | ||
if (reversedTransactionValue === 'true') { | ||
return Expensicons.ArrowsLeftRight; | ||
} | ||
if (hiddenMessageValue === 'true') { | ||
return Expensicons.EyeDisabled; | ||
} | ||
return Expensicons.Trashcan; | ||
}; | ||
|
||
return ( | ||
<View style={[styles.p4, styles.mt1, styles.appBG, styles.border, {borderColor: theme.border}, styles.flexRow, styles.justifyContentCenter, styles.alignItemsCenter, styles.gap2]}> | ||
<Icon | ||
width={variables.iconSizeMedium} | ||
height={variables.iconSizeMedium} | ||
fill={theme.icon} | ||
src={getIcon()} | ||
/> | ||
<TNodeChildrenRenderer | ||
tnode={tnode} | ||
renderChild={(props) => { | ||
const firstChild = props?.childTnode?.children?.at(0); | ||
const data = firstChild && 'data' in firstChild ? firstChild.data : null; | ||
|
||
if (typeof data === 'string') { | ||
return <Text style={(styles.textLabelSupporting, styles.textStrong)}>{data}</Text>; | ||
} | ||
return props.childElement; | ||
}} | ||
/> | ||
</View> | ||
); | ||
} | ||
|
||
DeletedActionRenderer.displayName = 'DeletedActionRenderer'; | ||
|
||
export default DeletedActionRenderer; |
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
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
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
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
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
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
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
Oops, something went wrong.