mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-22 19:15:08 +03:00
Remove unused code
This commit is contained in:
@@ -1,23 +1,17 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useChat } from "../../hooks/useChat";
|
|
||||||
import { RichTextArea } from "../core/RichTextArea";
|
import { RichTextArea } from "../core/RichTextArea";
|
||||||
|
|
||||||
interface ChatInputWrapperProps {
|
interface ChatInputWrapperProps {
|
||||||
onSendMessage?: (message: string) => void;
|
onSendMessage: (message: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ChatInputWrapper({ onSendMessage }: ChatInputWrapperProps) {
|
export function ChatInputWrapper({ onSendMessage }: ChatInputWrapperProps) {
|
||||||
const [message, setMessage] = useState("");
|
const [message, setMessage] = useState("");
|
||||||
const { sendMessage } = useChat();
|
|
||||||
|
|
||||||
const handleSubmit = async (e: React.FormEvent) => {
|
const handleSubmit = async (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (message.trim()) {
|
if (message.trim()) {
|
||||||
if (onSendMessage) {
|
onSendMessage(message);
|
||||||
onSendMessage(message);
|
|
||||||
} else {
|
|
||||||
await sendMessage(message);
|
|
||||||
}
|
|
||||||
setMessage("");
|
setMessage("");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user