mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-14 20:11:22 +00:00
Add type for Reaction
This commit is contained in:
parent
a3b5778da1
commit
d24e2ac3bc
@ -7,6 +7,15 @@ import { ChatOptions } from './ChatOptions';
|
|||||||
import ErrorBoundary from '../../common/ErrorBoundary';
|
import ErrorBoundary from '../../common/ErrorBoundary';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
type ReactionItem = {
|
||||||
|
sender: string;
|
||||||
|
senderName?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ReactionsMap = {
|
||||||
|
[reactionType: string]: ReactionItem[];
|
||||||
|
};
|
||||||
|
|
||||||
export const ChatList = ({
|
export const ChatList = ({
|
||||||
initialMessages,
|
initialMessages,
|
||||||
myAddress,
|
myAddress,
|
||||||
@ -236,7 +245,7 @@ export const ChatList = ({
|
|||||||
let message = messages[index] || null; // Safeguard against undefined
|
let message = messages[index] || null; // Safeguard against undefined
|
||||||
let replyIndex = -1;
|
let replyIndex = -1;
|
||||||
let reply = null;
|
let reply = null;
|
||||||
let reactions = null;
|
let reactions: ReactionsMap | null = null;
|
||||||
let isUpdating = false;
|
let isUpdating = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -53,6 +53,7 @@ import {
|
|||||||
messageHasImage,
|
messageHasImage,
|
||||||
} from '../../utils/chat';
|
} from '../../utils/chat';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { ReactionsMap } from './ChatList';
|
||||||
|
|
||||||
const getBadgeImg = (level) => {
|
const getBadgeImg = (level) => {
|
||||||
switch (level?.toString()) {
|
switch (level?.toString()) {
|
||||||
@ -105,14 +106,14 @@ type MessageItemProps = {
|
|||||||
isShowingAsReply?: boolean;
|
isShowingAsReply?: boolean;
|
||||||
isTemp: boolean;
|
isTemp: boolean;
|
||||||
isUpdating: boolean;
|
isUpdating: boolean;
|
||||||
lastSignature: any;
|
lastSignature: string;
|
||||||
message: any;
|
message: string;
|
||||||
myAddress: any;
|
myAddress: string;
|
||||||
onEdit: (messageId: string) => void;
|
onEdit: (messageId: string) => void;
|
||||||
onReply: (messageId: string) => void;
|
onReply: (messageId: string) => void;
|
||||||
onSeen: () => void;
|
onSeen: () => void;
|
||||||
reactions: any; // could be null, or type it more strictly
|
reactions: ReactionsMap | null;
|
||||||
reply: any; // same here
|
reply: string | null;
|
||||||
replyIndex: number;
|
replyIndex: number;
|
||||||
scrollToItem: (index: number) => void;
|
scrollToItem: (index: number) => void;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user