Files
nahodka-front/src/components/chat/ChatInputBar.jsx
SlimusMinus 5c48067842 fix chat list image taken from the clicked card instead of the chat
createOrGetChat stored the clicked card's post for the returned chat id,
even when the backend returned an existing chat about another ad. The
chat then showed the new ad's image until the next list fetch replaced
it with the real one. The backend's chat.post is now the source of truth;
card data only adds the emoji for the same ad.

Also limit the chat input to 4000 characters, matching the backend.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 01:23:12 +03:00

28 lines
733 B
JavaScript

// Тот же лимит, что ChatService.MAX_MESSAGE_LENGTH на бэкенде
const MAX_MESSAGE_LENGTH = 4000;
export default function ChatInputBar({
input,
onInputChange,
onSend,
connected,
placeholder,
}) {
return (
<div className="chat-input-area">
<form onSubmit={onSend} className="chat-input-row">
<input
value={input}
onChange={(e) => onInputChange(e.target.value)}
placeholder={placeholder}
className="chat-input"
maxLength={MAX_MESSAGE_LENGTH}
/>
<button type="submit" className="chat-send-btn" disabled={!connected}>
➤
</button>
</form>
</div>
);
}