Chore: Evaluate UnreadBadge to Typescript (#4018)
* Chore: Evaluate UserItem to Typescript and moved from presentation to container * minor tweak
This commit is contained in:
parent
b75ac1de8b
commit
064920e61b
|
@ -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: {
|
||||
|
|
|
@ -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<IUnreadBadge, 'small' | 'style'> {
|
||||
theme: TSupportedThemes;
|
||||
tunread?: [];
|
||||
tunreadUser?: [];
|
||||
tunreadGroup?: [];
|
||||
}
|
||||
|
||||
export const getUnreadStyle = ({
|
|
@ -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;
|
||||
}
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue