29 lines
1.5 KiB
TypeScript
29 lines
1.5 KiB
TypeScript
// Metro module 15194 (f15195).
|
|
import { View } from "react-native";
|
|
import LocaleStore from "../../user_settings/LocaleStore";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
|
|
import MentionsBadge from "./MentionsBadge";
|
|
import NewBadge from "../../channel_list_v2/native/components/NewBadge";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { humanizeValue } from "../../../utils/NumberUtils";
|
|
const useStyles = createStyles(() => ({
|
|
channelInfoContainer: {
|
|
paddingStart: 4
|
|
}
|
|
}));
|
|
export default function ChannelBadge(props) {
|
|
const { mentionCount, isMentionLowImportance, isNewChannel, postsWithUnreadsCount, muted } = props;
|
|
const styles = useStyles();
|
|
const stateFromStores = useStateFromStores([LocaleStore], () => LocaleStore.locale);
|
|
return mentionCount != null && mentionCount > 0 ? <View style={styles.channelInfoContainer}>
|
|
<MentionsBadge mentionsCount={mentionCount} isMentionLowImportance={isMentionLowImportance} />
|
|
</View> : isNewChannel ? <View style={styles.channelInfoContainer}>
|
|
<NewBadge />
|
|
</View> : muted != null ? muted ? null : postsWithUnreadsCount != null ? postsWithUnreadsCount > 0 ? <View style={styles.channelInfoContainer}>
|
|
<Text variant="text-xs/semibold" color="text-muted">
|
|
{humanizeValue(postsWithUnreadsCount, stateFromStores)}
|
|
</Text>
|
|
</View> : null : null : null;
|
|
};
|