From 18da04ba08a76505313faa2be7d1c4d453f0fe30 Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Mon, 17 Jan 2022 10:18:32 -0400 Subject: [PATCH] update definitions --- app/containers/ThreadDetails.tsx | 10 ++++------ app/containers/message/Thread.tsx | 2 -- app/definitions/IThread.ts | 4 ++-- app/stacks/MasterDetailStack/types.ts | 1 + app/stacks/types.ts | 1 + app/views/ChangePasscodeView.tsx | 4 ++-- app/views/DiscussionsView/DiscussionDetails.tsx | 9 +++------ app/views/DiscussionsView/Item.tsx | 16 ++++------------ 8 files changed, 17 insertions(+), 30 deletions(-) diff --git a/app/containers/ThreadDetails.tsx b/app/containers/ThreadDetails.tsx index ada6d12d..0bfe9175 100644 --- a/app/containers/ThreadDetails.tsx +++ b/app/containers/ThreadDetails.tsx @@ -41,25 +41,23 @@ const styles = StyleSheet.create({ interface IThreadDetails { item: { - tcount: number | string; + tcount?: string | number; replies?: any; id: string; }; user: { id: string; }; - badgeColor: string; + badgeColor?: string; toggleFollowThread: Function; - thread: boolean; - time: string; style: ViewStyle; } -const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style }: IThreadDetails) => { +const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style }: IThreadDetails): JSX.Element => { const { theme } = useTheme(); let { tcount } = item; - if (tcount >= 1000) { + if (tcount! >= 1000) { tcount = '+999'; } diff --git a/app/containers/message/Thread.tsx b/app/containers/message/Thread.tsx index 23a546f8..4ddfda3b 100644 --- a/app/containers/message/Thread.tsx +++ b/app/containers/message/Thread.tsx @@ -24,10 +24,8 @@ const Thread = React.memo( item={{ tcount, replies, - tlm, id }} - thread user={user} badgeColor={threadBadgeColor} toggleFollowThread={toggleFollowThread} diff --git a/app/definitions/IThread.ts b/app/definitions/IThread.ts index ad151283..7141af31 100644 --- a/app/definitions/IThread.ts +++ b/app/definitions/IThread.ts @@ -61,10 +61,10 @@ export interface IThread { reactions?: IReaction[]; role?: string; drid?: string; - dcount?: number; + dcount?: number | string; dlm?: number; tmid?: string; - tcount?: number; + tcount?: number | string; tlm?: Date; replies?: string[]; mentions?: IUserMention[]; diff --git a/app/stacks/MasterDetailStack/types.ts b/app/stacks/MasterDetailStack/types.ts index 242c13ba..0e260c37 100644 --- a/app/stacks/MasterDetailStack/types.ts +++ b/app/stacks/MasterDetailStack/types.ts @@ -56,6 +56,7 @@ export type ModalStackParamList = { rid: string; room: ISubscription; }; + DiscussionsView: undefined; SearchMessagesView: { rid: string; t: SubscriptionType; diff --git a/app/stacks/types.ts b/app/stacks/types.ts index c6016f2e..ba7ba575 100644 --- a/app/stacks/types.ts +++ b/app/stacks/types.ts @@ -53,6 +53,7 @@ export type ChatsStackParamList = { rid: string; room: ISubscription; }; + DiscussionsView: undefined; SearchMessagesView: { rid: string; t: SubscriptionType; diff --git a/app/views/ChangePasscodeView.tsx b/app/views/ChangePasscodeView.tsx index 5ed58a27..2768522c 100644 --- a/app/views/ChangePasscodeView.tsx +++ b/app/views/ChangePasscodeView.tsx @@ -80,10 +80,10 @@ const ChangePasscodeView = React.memo(() => { return ( - + {!data?.force ? ( - + ) : null} diff --git a/app/views/DiscussionsView/DiscussionDetails.tsx b/app/views/DiscussionsView/DiscussionDetails.tsx index 6e36f6b6..86b055c2 100644 --- a/app/views/DiscussionsView/DiscussionDetails.tsx +++ b/app/views/DiscussionsView/DiscussionDetails.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { StyleSheet, Text, View, ViewStyle } from 'react-native'; +import { TThreadModel } from '../../definitions/IThread'; import { CustomIcon } from '../../lib/Icons'; import { themes } from '../../constants/colors'; import sharedStyles from '../Styles'; @@ -29,11 +30,7 @@ const styles = StyleSheet.create({ }); interface IDiscussionDetails { - item: { - dcount: number | string; - replies?: any; - id: string; - }; + item: TThreadModel; user: { id: string; }; @@ -45,7 +42,7 @@ const DiscussionDetails = ({ item, time, style }: IDiscussionDetails) => { const { theme } = useTheme(); let { dcount } = item; - if (dcount >= 1000) { + if (dcount! >= 1000) { dcount = '+999'; } diff --git a/app/views/DiscussionsView/Item.tsx b/app/views/DiscussionsView/Item.tsx index a92b4c6c..612629cf 100644 --- a/app/views/DiscussionsView/Item.tsx +++ b/app/views/DiscussionsView/Item.tsx @@ -9,6 +9,7 @@ import { themes } from '../../constants/colors'; import Markdown from '../../containers/markdown'; import { formatDateThreads, makeThreadName } from '../../utils/room'; import DiscussionDetails from './DiscussionDetails'; +import { TThreadModel } from '../../definitions/IThread'; const styles = StyleSheet.create({ container: { @@ -49,16 +50,7 @@ const styles = StyleSheet.create({ }); interface IItem { - item: { - id: string; - u: { - username: string; - }; - dcount: string | number; - replies?: any; - msg: string; - ts: string; - }; + item: TThreadModel; baseUrl: string; user: { id: string; @@ -92,9 +84,9 @@ const Item = ({ item, baseUrl, user, onPress }: IItem): JSX.Element => { {/* @ts-ignore */}