mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-23 03:25:07 +03:00
Start inline reply
This commit is contained in:
@@ -14,9 +14,10 @@ interface ChatMessagesProps {
|
||||
messages?: MessageType[];
|
||||
isDm?: boolean;
|
||||
children?: ReactNode;
|
||||
onReplySelect?: (message: MessageType) => void;
|
||||
}
|
||||
|
||||
export function ChatMessages({ messages: propMessages, children, isDm = false }: ChatMessagesProps) {
|
||||
export function ChatMessages({ messages: propMessages, children, isDm = false, onReplySelect }: ChatMessagesProps) {
|
||||
const { messages: hookMessages } = useChat();
|
||||
const { user } = useAppState();
|
||||
|
||||
@@ -87,25 +88,8 @@ export function ChatMessages({ messages: propMessages, children, isDm = false }:
|
||||
}
|
||||
};
|
||||
|
||||
const handleReply = async (message: MessageType) => {
|
||||
// This will be called when the reply dialog is sent
|
||||
if (!user.authToken) return;
|
||||
|
||||
try {
|
||||
await request({
|
||||
type: "replyMessage",
|
||||
data: {
|
||||
content: message.content, // This should be the reply content from the dialog
|
||||
reply_to_id: message.id
|
||||
},
|
||||
credentials: {
|
||||
scheme: "Bearer",
|
||||
credentials: user.authToken
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Failed to send reply:", error);
|
||||
}
|
||||
const handleReply = (message: MessageType) => {
|
||||
if (onReplySelect) onReplySelect(message);
|
||||
};
|
||||
|
||||
const handleDelete = async (message: MessageType) => {
|
||||
|
||||
Reference in New Issue
Block a user