Chore: Evaluate UnreadBadge to Typescript (#4018)

* Chore: Evaluate UserItem to Typescript and moved from presentation to container

* minor tweak
This commit is contained in:
Reinaldo Neto 2022-04-14 23:51:59 -03:00 committed by GitHub
parent b75ac1de8b
commit 064920e61b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 13 deletions

View File

@ -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: {

View File

@ -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 = ({

View File

@ -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;
}

View File

@ -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';

View File

@ -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';

View File

@ -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);