From d1d35c7a6ec16b2e14a76e0be8975b64d84ca7f4 Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Fri, 17 Sep 2021 16:33:22 -0400 Subject: [PATCH] Minor tweak --- app/containers/ThreadDetails.tsx | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/app/containers/ThreadDetails.tsx b/app/containers/ThreadDetails.tsx index 6b000b9a2..ebda840b2 100644 --- a/app/containers/ThreadDetails.tsx +++ b/app/containers/ThreadDetails.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import Touchable from 'react-native-platform-touchable'; @@ -41,8 +42,8 @@ const styles = StyleSheet.create({ interface IThreadDetails { item: { - tcount: number | string; - dcount: number | string; + tcount?: number | string; + dcount?: number | string; replies?: any; id: string; }; @@ -58,19 +59,13 @@ interface IThreadDetails { } const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, thread, time, style, theme }: IThreadDetails) => { - let { tcount, dcount } = item; - if (thread) { - if (tcount >= 1000) { - tcount = '+999'; - } else if (tcount >= 100) { - tcount = '+99'; - } - } + const { tcount, dcount } = item; + let count = tcount || dcount; - if (dcount >= 1000) { - dcount = '+999'; - } else if (dcount >= 100) { - dcount = '+99'; + if (count! >= 1000) { + count = '+999'; + } else if (count! >= 100) { + count = '+99'; } let replies = item?.replies?.length ?? 0; @@ -88,7 +83,7 @@ const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, thread, tim - {thread ? tcount : dcount} + {count}