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 React from 'react';
|
||||||
import { StyleSheet } from 'react-native';
|
import { StyleSheet } from 'react-native';
|
||||||
|
|
||||||
import UnreadBadge from '../../presentation/UnreadBadge';
|
import UnreadBadge from '../UnreadBadge';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
badgeContainer: {
|
badgeContainer: {
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
import { themes } from '../../lib/constants';
|
import { IUnreadBadge } from '.';
|
||||||
|
import { themes } from '../../lib/constants/colors';
|
||||||
import { TSupportedThemes } from '../../theme';
|
import { TSupportedThemes } from '../../theme';
|
||||||
|
|
||||||
interface IGetUnreadStyle {
|
interface IGetUnreadStyle extends Omit<IUnreadBadge, 'small' | 'style'> {
|
||||||
unread?: number;
|
|
||||||
userMentions?: number;
|
|
||||||
groupMentions?: number;
|
|
||||||
theme: TSupportedThemes;
|
theme: TSupportedThemes;
|
||||||
tunread?: [];
|
|
||||||
tunreadUser?: [];
|
|
||||||
tunreadGroup?: [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getUnreadStyle = ({
|
export const getUnreadStyle = ({
|
|
@ -29,7 +29,7 @@ const styles = StyleSheet.create({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
interface IUnreadBadge {
|
export interface IUnreadBadge {
|
||||||
unread?: number;
|
unread?: number;
|
||||||
userMentions?: number;
|
userMentions?: number;
|
||||||
groupMentions?: number;
|
groupMentions?: number;
|
||||||
|
@ -43,6 +43,7 @@ interface IUnreadBadge {
|
||||||
const UnreadBadge = React.memo(
|
const UnreadBadge = React.memo(
|
||||||
({ unread, userMentions, groupMentions, style, tunread, tunreadUser, tunreadGroup, small }: IUnreadBadge) => {
|
({ unread, userMentions, groupMentions, style, tunread, tunreadUser, tunreadGroup, small }: IUnreadBadge) => {
|
||||||
const { theme } = useTheme();
|
const { theme } = useTheme();
|
||||||
|
|
||||||
if ((!unread || unread <= 0) && !tunread?.length) {
|
if ((!unread || unread <= 0) && !tunread?.length) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@ import * as List from '../../../containers/List';
|
||||||
import styles from '../../../views/RoomsListView/styles';
|
import styles from '../../../views/RoomsListView/styles';
|
||||||
import { SWITCH_TRACK_COLOR, themes } from '../../../lib/constants';
|
import { SWITCH_TRACK_COLOR, themes } from '../../../lib/constants';
|
||||||
import { useTheme } from '../../../theme';
|
import { useTheme } from '../../../theme';
|
||||||
import UnreadBadge from '../../../presentation/UnreadBadge';
|
import UnreadBadge from '../../../containers/UnreadBadge';
|
||||||
import RocketChat from '../../../lib/rocketchat';
|
import RocketChat from '../../../lib/rocketchat';
|
||||||
import { changeLivechatStatus, isOmnichannelStatusAvailable } from '../lib';
|
import { changeLivechatStatus, isOmnichannelStatusAvailable } from '../lib';
|
||||||
import { IUser } from '../../../definitions/IUser';
|
import { IUser } from '../../../definitions/IUser';
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { View } from 'react-native';
|
||||||
|
|
||||||
import styles from './styles';
|
import styles from './styles';
|
||||||
import Wrapper from './Wrapper';
|
import Wrapper from './Wrapper';
|
||||||
import UnreadBadge from '../UnreadBadge';
|
import UnreadBadge from '../../containers/UnreadBadge';
|
||||||
import TypeIcon from './TypeIcon';
|
import TypeIcon from './TypeIcon';
|
||||||
import LastMessage from './LastMessage';
|
import LastMessage from './LastMessage';
|
||||||
import Title from './Title';
|
import Title from './Title';
|
||||||
|
|
|
@ -3,7 +3,7 @@ import React from 'react';
|
||||||
import { storiesOf } from '@storybook/react-native';
|
import { storiesOf } from '@storybook/react-native';
|
||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
|
|
||||||
import UnreadBadge from '../../app/presentation/UnreadBadge';
|
import UnreadBadge from '../../app/containers/UnreadBadge';
|
||||||
import { ThemeContext } from '../../app/theme';
|
import { ThemeContext } from '../../app/theme';
|
||||||
|
|
||||||
const stories = storiesOf('Unread Badge', module);
|
const stories = storiesOf('Unread Badge', module);
|
||||||
|
|
Loading…
Reference in New Issue