diff --git a/app/containers/HeaderButton/HeaderButtonItemBadge.tsx b/app/containers/HeaderButton/HeaderButtonItemBadge.tsx index 4bd2d2682..1a63a4efb 100644 --- a/app/containers/HeaderButton/HeaderButtonItemBadge.tsx +++ b/app/containers/HeaderButton/HeaderButtonItemBadge.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { StyleSheet } from 'react-native'; -import UnreadBadge from '../../presentation/UnreadBadge'; +import UnreadBadge from '../UnreadBadge'; const styles = StyleSheet.create({ badgeContainer: { diff --git a/app/presentation/UnreadBadge/getUnreadStyle.test.js b/app/containers/UnreadBadge/getUnreadStyle.test.js similarity index 100% rename from app/presentation/UnreadBadge/getUnreadStyle.test.js rename to app/containers/UnreadBadge/getUnreadStyle.test.js diff --git a/app/presentation/UnreadBadge/getUnreadStyle.ts b/app/containers/UnreadBadge/getUnreadStyle.ts similarity index 79% rename from app/presentation/UnreadBadge/getUnreadStyle.ts rename to app/containers/UnreadBadge/getUnreadStyle.ts index 263ae8453..5d7035c10 100644 --- a/app/presentation/UnreadBadge/getUnreadStyle.ts +++ b/app/containers/UnreadBadge/getUnreadStyle.ts @@ -1,14 +1,9 @@ -import { themes } from '../../lib/constants'; +import { IUnreadBadge } from '.'; +import { themes } from '../../lib/constants/colors'; import { TSupportedThemes } from '../../theme'; -interface IGetUnreadStyle { - unread?: number; - userMentions?: number; - groupMentions?: number; +interface IGetUnreadStyle extends Omit { theme: TSupportedThemes; - tunread?: []; - tunreadUser?: []; - tunreadGroup?: []; } export const getUnreadStyle = ({ diff --git a/app/presentation/UnreadBadge/index.tsx b/app/containers/UnreadBadge/index.tsx similarity index 98% rename from app/presentation/UnreadBadge/index.tsx rename to app/containers/UnreadBadge/index.tsx index 625cd9571..5a892653d 100644 --- a/app/presentation/UnreadBadge/index.tsx +++ b/app/containers/UnreadBadge/index.tsx @@ -29,7 +29,7 @@ const styles = StyleSheet.create({ } }); -interface IUnreadBadge { +export interface IUnreadBadge { unread?: number; userMentions?: number; groupMentions?: number; @@ -43,6 +43,7 @@ interface IUnreadBadge { const UnreadBadge = React.memo( ({ unread, userMentions, groupMentions, style, tunread, tunreadUser, tunreadGroup, small }: IUnreadBadge) => { const { theme } = useTheme(); + if ((!unread || unread <= 0) && !tunread?.length) { return null; } diff --git a/app/ee/omnichannel/containers/OmnichannelStatus.tsx b/app/ee/omnichannel/containers/OmnichannelStatus.tsx index 95ef0a0b2..ecdd1519d 100644 --- a/app/ee/omnichannel/containers/OmnichannelStatus.tsx +++ b/app/ee/omnichannel/containers/OmnichannelStatus.tsx @@ -5,7 +5,7 @@ import * as List from '../../../containers/List'; import styles from '../../../views/RoomsListView/styles'; import { SWITCH_TRACK_COLOR, themes } from '../../../lib/constants'; import { useTheme } from '../../../theme'; -import UnreadBadge from '../../../presentation/UnreadBadge'; +import UnreadBadge from '../../../containers/UnreadBadge'; import RocketChat from '../../../lib/rocketchat'; import { changeLivechatStatus, isOmnichannelStatusAvailable } from '../lib'; import { IUser } from '../../../definitions/IUser'; diff --git a/app/presentation/RoomItem/RoomItem.tsx b/app/presentation/RoomItem/RoomItem.tsx index de768484d..2892321c0 100644 --- a/app/presentation/RoomItem/RoomItem.tsx +++ b/app/presentation/RoomItem/RoomItem.tsx @@ -3,7 +3,7 @@ import { View } from 'react-native'; import styles from './styles'; import Wrapper from './Wrapper'; -import UnreadBadge from '../UnreadBadge'; +import UnreadBadge from '../../containers/UnreadBadge'; import TypeIcon from './TypeIcon'; import LastMessage from './LastMessage'; import Title from './Title'; diff --git a/storybook/stories/UnreadBadge.js b/storybook/stories/UnreadBadge.js index b19fa6292..2f98cd90c 100644 --- a/storybook/stories/UnreadBadge.js +++ b/storybook/stories/UnreadBadge.js @@ -3,7 +3,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react-native'; import { View } from 'react-native'; -import UnreadBadge from '../../app/presentation/UnreadBadge'; +import UnreadBadge from '../../app/containers/UnreadBadge'; import { ThemeContext } from '../../app/theme'; const stories = storiesOf('Unread Badge', module);