Unverified Commit e00580d8 authored by Alex Junior's avatar Alex Junior Committed by GitHub
Browse files

Chore: Clean ThreadDetails - TypeScript (#3924)

parent e1038af2
......@@ -41,7 +41,7 @@ const styles = StyleSheet.create({
});
interface IThreadDetails {
item: Partial<TThreadModel>;
item: Pick<TThreadModel, 'tcount' | 'replies' | 'id'>;
user: {
id: string;
};
......@@ -62,21 +62,21 @@ const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style }: IT
replies = '+999';
}
const isFollowing = item.replies?.find((u: any) => u === user?.id);
const isFollowing = item.replies?.find((u: string) => u === user?.id);
return (
<View style={[styles.container, style]}>
<View style={styles.detailsContainer}>
<View style={styles.detailContainer}>
<CustomIcon name='threads' size={24} color={themes[theme!].auxiliaryText} />
<Text style={[styles.detailText, { color: themes[theme!].auxiliaryText }]} numberOfLines={1}>
<CustomIcon name='threads' size={24} color={themes[theme].auxiliaryText} />
<Text style={[styles.detailText, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>
{count}
</Text>
</View>
<View style={styles.detailContainer}>
<CustomIcon name='user' size={24} color={themes[theme!].auxiliaryText} />
<Text style={[styles.detailText, { color: themes[theme!].auxiliaryText }]} numberOfLines={1}>
<CustomIcon name='user' size={24} color={themes[theme].auxiliaryText} />
<Text style={[styles.detailText, { color: themes[theme].auxiliaryText }]} numberOfLines={1}>
{replies}
</Text>
</View>
......@@ -87,7 +87,7 @@ const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style }: IT
<CustomIcon
size={24}
name={isFollowing ? 'notification' : 'notification-disabled'}
color={themes[theme!].auxiliaryTintColor}
color={themes[theme].auxiliaryTintColor}
/>
</Touchable>
</View>
......
......@@ -70,7 +70,6 @@ const Item = ({ item, useRealName, user, badgeColor, onPress, toggleFollowThread
const username = (useRealName && item?.u?.name) || item?.u?.username;
let time;
if (item?.ts) {
// @ts-ignore TODO: to be fixed after we unify our types
time = formatDateThreads(item.ts);
}
......@@ -78,15 +77,15 @@ const Item = ({ item, useRealName, user, badgeColor, onPress, toggleFollowThread
<Touchable
onPress={() => onPress(item)}
testID={`thread-messages-view-${item.msg}`}
style={{ backgroundColor: themes[theme!].backgroundColor }}>
style={{ backgroundColor: themes[theme].backgroundColor }}>
<View style={styles.container}>
<Avatar style={styles.avatar} text={item?.u?.username} size={36} borderRadius={4} theme={theme} />
<View style={styles.contentContainer}>
<View style={styles.titleContainer}>
<Text style={[styles.title, { color: themes[theme!].titleText }]} numberOfLines={1}>
<Text style={[styles.title, { color: themes[theme].titleText }]} numberOfLines={1}>
{username}
</Text>
<Text style={[styles.time, { color: themes[theme!].auxiliaryText }]}>{time}</Text>
<Text style={[styles.time, { color: themes[theme].auxiliaryText }]}>{time}</Text>
</View>
<View style={styles.messageContainer}>
<MarkdownPreview msg={makeThreadName(item)} numberOfLines={2} style={[styles.markdown]} />
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment