update definitions

This commit is contained in:
Gerzon Z 2022-01-17 10:18:32 -04:00
parent e010d804d5
commit 18da04ba08
8 changed files with 17 additions and 30 deletions

View File

@ -41,25 +41,23 @@ const styles = StyleSheet.create({
interface IThreadDetails { interface IThreadDetails {
item: { item: {
tcount: number | string; tcount?: string | number;
replies?: any; replies?: any;
id: string; id: string;
}; };
user: { user: {
id: string; id: string;
}; };
badgeColor: string; badgeColor?: string;
toggleFollowThread: Function; toggleFollowThread: Function;
thread: boolean;
time: string;
style: ViewStyle; style: ViewStyle;
} }
const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style }: IThreadDetails) => { const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style }: IThreadDetails): JSX.Element => {
const { theme } = useTheme(); const { theme } = useTheme();
let { tcount } = item; let { tcount } = item;
if (tcount >= 1000) { if (tcount! >= 1000) {
tcount = '+999'; tcount = '+999';
} }

View File

@ -24,10 +24,8 @@ const Thread = React.memo(
item={{ item={{
tcount, tcount,
replies, replies,
tlm,
id id
}} }}
thread
user={user} user={user}
badgeColor={threadBadgeColor} badgeColor={threadBadgeColor}
toggleFollowThread={toggleFollowThread} toggleFollowThread={toggleFollowThread}

View File

@ -61,10 +61,10 @@ export interface IThread {
reactions?: IReaction[]; reactions?: IReaction[];
role?: string; role?: string;
drid?: string; drid?: string;
dcount?: number; dcount?: number | string;
dlm?: number; dlm?: number;
tmid?: string; tmid?: string;
tcount?: number; tcount?: number | string;
tlm?: Date; tlm?: Date;
replies?: string[]; replies?: string[];
mentions?: IUserMention[]; mentions?: IUserMention[];

View File

@ -56,6 +56,7 @@ export type ModalStackParamList = {
rid: string; rid: string;
room: ISubscription; room: ISubscription;
}; };
DiscussionsView: undefined;
SearchMessagesView: { SearchMessagesView: {
rid: string; rid: string;
t: SubscriptionType; t: SubscriptionType;

View File

@ -53,6 +53,7 @@ export type ChatsStackParamList = {
rid: string; rid: string;
room: ISubscription; room: ISubscription;
}; };
DiscussionsView: undefined;
SearchMessagesView: { SearchMessagesView: {
rid: string; rid: string;
t: SubscriptionType; t: SubscriptionType;

View File

@ -80,10 +80,10 @@ const ChangePasscodeView = React.memo(() => {
return ( return (
<Modal useNativeDriver isVisible={visible} hideModalContentWhileAnimating style={styles.modal}> <Modal useNativeDriver isVisible={visible} hideModalContentWhileAnimating style={styles.modal}>
<PasscodeChoose theme={theme} finishProcess={onSubmit} force={data?.force} /> <PasscodeChoose theme={theme!} finishProcess={onSubmit} force={data?.force} />
{!data?.force ? ( {!data?.force ? (
<Touchable onPress={onCancel} style={styles.close}> <Touchable onPress={onCancel} style={styles.close}>
<CustomIcon name='close' color={themes[theme].passcodePrimary} size={30} /> <CustomIcon name='close' color={themes[theme!].passcodePrimary} size={30} />
</Touchable> </Touchable>
) : null} ) : null}
</Modal> </Modal>

View File

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import { StyleSheet, Text, View, ViewStyle } from 'react-native'; import { StyleSheet, Text, View, ViewStyle } from 'react-native';
import { TThreadModel } from '../../definitions/IThread';
import { CustomIcon } from '../../lib/Icons'; import { CustomIcon } from '../../lib/Icons';
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
import sharedStyles from '../Styles'; import sharedStyles from '../Styles';
@ -29,11 +30,7 @@ const styles = StyleSheet.create({
}); });
interface IDiscussionDetails { interface IDiscussionDetails {
item: { item: TThreadModel;
dcount: number | string;
replies?: any;
id: string;
};
user: { user: {
id: string; id: string;
}; };
@ -45,7 +42,7 @@ const DiscussionDetails = ({ item, time, style }: IDiscussionDetails) => {
const { theme } = useTheme(); const { theme } = useTheme();
let { dcount } = item; let { dcount } = item;
if (dcount >= 1000) { if (dcount! >= 1000) {
dcount = '+999'; dcount = '+999';
} }

View File

@ -9,6 +9,7 @@ import { themes } from '../../constants/colors';
import Markdown from '../../containers/markdown'; import Markdown from '../../containers/markdown';
import { formatDateThreads, makeThreadName } from '../../utils/room'; import { formatDateThreads, makeThreadName } from '../../utils/room';
import DiscussionDetails from './DiscussionDetails'; import DiscussionDetails from './DiscussionDetails';
import { TThreadModel } from '../../definitions/IThread';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
@ -49,16 +50,7 @@ const styles = StyleSheet.create({
}); });
interface IItem { interface IItem {
item: { item: TThreadModel;
id: string;
u: {
username: string;
};
dcount: string | number;
replies?: any;
msg: string;
ts: string;
};
baseUrl: string; baseUrl: string;
user: { user: {
id: string; id: string;
@ -92,9 +84,9 @@ const Item = ({ item, baseUrl, user, onPress }: IItem): JSX.Element => {
<View style={styles.messageContainer}> <View style={styles.messageContainer}>
{/* @ts-ignore */} {/* @ts-ignore */}
<Markdown <Markdown
msg={makeThreadName(item)} msg={makeThreadName(item)!}
baseUrl={baseUrl} baseUrl={baseUrl}
username={username} username={username!}
theme={theme!} theme={theme!}
numberOfLines={2} numberOfLines={2}
style={[styles.markdown]} style={[styles.markdown]}