2022-01-14 17:38:08 +00:00
|
|
|
import React from 'react';
|
2022-01-24 17:40:39 +00:00
|
|
|
import { StyleSheet, Text, View } from 'react-native';
|
2022-01-14 17:38:08 +00:00
|
|
|
|
|
|
|
import { CustomIcon } from '../../lib/Icons';
|
2022-04-07 14:10:03 +00:00
|
|
|
import { themes } from '../../lib/constants';
|
2022-01-14 17:38:08 +00:00
|
|
|
import sharedStyles from '../Styles';
|
|
|
|
import { useTheme } from '../../theme';
|
2022-03-08 17:09:45 +00:00
|
|
|
import { IMessageFromServer } from '../../definitions';
|
2022-01-14 17:38:08 +00:00
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
|
|
|
flex: 1,
|
2022-01-24 17:40:39 +00:00
|
|
|
marginTop: 8,
|
2022-01-14 17:38:08 +00:00
|
|
|
flexDirection: 'row',
|
|
|
|
alignItems: 'center'
|
|
|
|
},
|
|
|
|
detailsContainer: {
|
|
|
|
flex: 1,
|
|
|
|
flexDirection: 'row'
|
|
|
|
},
|
|
|
|
detailContainer: {
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignItems: 'center',
|
|
|
|
marginRight: 8
|
|
|
|
},
|
|
|
|
detailText: {
|
|
|
|
fontSize: 10,
|
|
|
|
marginLeft: 2,
|
|
|
|
...sharedStyles.textSemibold
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
interface IDiscussionDetails {
|
2022-03-08 17:09:45 +00:00
|
|
|
item: IMessageFromServer;
|
2022-01-24 15:51:31 +00:00
|
|
|
date: string;
|
2022-01-14 17:38:08 +00:00
|
|
|
}
|
|
|
|
|
2022-01-24 17:40:39 +00:00
|
|
|
const DiscussionDetails = ({ item, date }: IDiscussionDetails): JSX.Element => {
|
2022-01-14 17:38:08 +00:00
|
|
|
const { theme } = useTheme();
|
2022-03-02 14:18:01 +00:00
|
|
|
let count: string | number | undefined = item.dcount;
|
|
|
|
if (count && count >= 1000) {
|
|
|
|
count = '+999';
|
2022-01-14 17:38:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2022-01-24 17:40:39 +00:00
|
|
|
<View style={[styles.container]}>
|
2022-01-14 17:38:08 +00:00
|
|
|
<View style={styles.detailsContainer}>
|
|
|
|
<View style={styles.detailContainer}>
|
|
|
|
<CustomIcon name={'discussions'} size={24} color={themes[theme!].auxiliaryText} />
|
|
|
|
<Text style={[styles.detailText, { color: themes[theme!].auxiliaryText }]} numberOfLines={1}>
|
2022-03-02 14:18:01 +00:00
|
|
|
{count}
|
2022-01-14 17:38:08 +00:00
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
|
|
|
|
<View style={styles.detailContainer}>
|
|
|
|
<CustomIcon name={'clock'} size={24} color={themes[theme!].auxiliaryText} />
|
|
|
|
<Text style={[styles.detailText, { color: themes[theme!].auxiliaryText }]} numberOfLines={1}>
|
2022-01-24 15:51:31 +00:00
|
|
|
{date}
|
2022-01-14 17:38:08 +00:00
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default DiscussionDetails;
|