Minor tweak
This commit is contained in:
parent
df480fb8ae
commit
d1d35c7a6e
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { StyleSheet, Text, View } from 'react-native';
|
import { StyleSheet, Text, View } from 'react-native';
|
||||||
import Touchable from 'react-native-platform-touchable';
|
import Touchable from 'react-native-platform-touchable';
|
||||||
|
@ -41,8 +42,8 @@ const styles = StyleSheet.create({
|
||||||
|
|
||||||
interface IThreadDetails {
|
interface IThreadDetails {
|
||||||
item: {
|
item: {
|
||||||
tcount: number | string;
|
tcount?: number | string;
|
||||||
dcount: number | string;
|
dcount?: number | string;
|
||||||
replies?: any;
|
replies?: any;
|
||||||
id: string;
|
id: string;
|
||||||
};
|
};
|
||||||
|
@ -58,19 +59,13 @@ interface IThreadDetails {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, thread, time, style, theme }: IThreadDetails) => {
|
const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, thread, time, style, theme }: IThreadDetails) => {
|
||||||
let { tcount, dcount } = item;
|
const { tcount, dcount } = item;
|
||||||
if (thread) {
|
let count = tcount || dcount;
|
||||||
if (tcount >= 1000) {
|
|
||||||
tcount = '+999';
|
|
||||||
} else if (tcount >= 100) {
|
|
||||||
tcount = '+99';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dcount >= 1000) {
|
if (count! >= 1000) {
|
||||||
dcount = '+999';
|
count = '+999';
|
||||||
} else if (dcount >= 100) {
|
} else if (count! >= 100) {
|
||||||
dcount = '+99';
|
count = '+99';
|
||||||
}
|
}
|
||||||
|
|
||||||
let replies = item?.replies?.length ?? 0;
|
let replies = item?.replies?.length ?? 0;
|
||||||
|
@ -88,7 +83,7 @@ const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, thread, tim
|
||||||
<View style={styles.detailContainer}>
|
<View style={styles.detailContainer}>
|
||||||
<CustomIcon name={thread ? 'threads' : 'discussions'} size={24} color={themes[theme].auxiliaryText} />
|
<CustomIcon name={thread ? 'threads' : 'discussions'} size={24} color={themes[theme].auxiliaryText} />
|
||||||
<Text style={[styles.detailText, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>
|
<Text style={[styles.detailText, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>
|
||||||
{thread ? tcount : dcount}
|
{count}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue