-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync with fedibtc/fedi f2dd70deb07d5562846a88fc8e084bbebf7558b4 (#14)
Co-authored-by: Fedi CI <ci@fedi.xyz>
- Loading branch information
Showing
29 changed files
with
576 additions
and
2,417 deletions.
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
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
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
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,47 @@ | ||
import { useTheme, Theme, Text } from '@rneui/themed' | ||
import React from 'react' | ||
import { View, StyleSheet } from 'react-native' | ||
|
||
import { selectZendeskUnreadMessageCount } from '@fedi/common/redux/support' | ||
|
||
import { useAppSelector } from '../../../state/hooks' | ||
|
||
const ZendeskBadge: React.FC<{ title: string }> = ({ title }) => { | ||
const { theme } = useTheme() | ||
const unreadCount = useAppSelector(selectZendeskUnreadMessageCount) | ||
const style = styles(theme) | ||
|
||
// Show badge ONLY if title is "Ask Fedi" and count is > 0 | ||
if (title.toLowerCase() !== 'ask fedi' || unreadCount === 0) { | ||
return null | ||
} | ||
|
||
return ( | ||
<View style={style.badge}> | ||
<Text style={style.badgeText}>{unreadCount}</Text> | ||
</View> | ||
) | ||
} | ||
|
||
const styles = (theme: Theme) => | ||
StyleSheet.create({ | ||
badge: { | ||
position: 'absolute', | ||
zIndex: 1000, | ||
top: -3, | ||
right: 32, | ||
backgroundColor: theme.colors.red, | ||
borderRadius: 10, | ||
width: 20, | ||
height: 20, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
badgeText: { | ||
color: theme.colors.white, | ||
fontSize: 12, | ||
fontWeight: 'bold', | ||
}, | ||
}) | ||
|
||
export default ZendeskBadge |
Oops, something went wrong.