commit
02b4e13bea
@ -2,4 +2,5 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ export default function Metrics({
|
||||
|
||||
// Yandex Metrica
|
||||
useEffect(() => {
|
||||
const interval = setInterval(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
if (
|
||||
typeof window.ym === "function" &&
|
||||
typeof window.klaviyo === "object" &&
|
||||
@ -49,18 +49,18 @@ export default function Metrics({
|
||||
|
||||
window.ym(95799066, "reachGoal", "PaymentSuccess", {}, () => {
|
||||
// deleteYm()
|
||||
setIsButtonVisible(true);
|
||||
});
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error("YM error:", e);
|
||||
} finally {
|
||||
clearInterval(interval);
|
||||
clearTimeout(timeout);
|
||||
setIsButtonVisible(true);
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
return () => clearTimeout(timeout);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
||||
@ -22,12 +22,37 @@ export default function MessageInput({ onSend }: MessageInputProps) {
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||
if (e.key === "Enter") {
|
||||
if (e.ctrlKey) {
|
||||
// Ctrl + Enter - добавляем перенос строки
|
||||
e.preventDefault();
|
||||
const target = e.target as HTMLTextAreaElement;
|
||||
const start = target.selectionStart;
|
||||
const end = target.selectionEnd;
|
||||
const newValue =
|
||||
message.substring(0, start) + "\n" + message.substring(end);
|
||||
setMessage(newValue);
|
||||
|
||||
// Устанавливаем курсор после переноса строки
|
||||
setTimeout(() => {
|
||||
target.selectionStart = target.selectionEnd = start + 1;
|
||||
}, 0);
|
||||
} else {
|
||||
// Enter без Ctrl - отправляем сообщение
|
||||
e.preventDefault();
|
||||
handleSend();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<TextareaAutoResize
|
||||
value={message}
|
||||
onChange={e => setMessage(e.target.value)}
|
||||
placeholder={t("message_input_placeholder")}
|
||||
onKeyDown={handleKeyDown}
|
||||
maxRows={5}
|
||||
/>
|
||||
<Button
|
||||
|
||||
@ -3,4 +3,7 @@
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 16px;
|
||||
position: sticky;
|
||||
top: 76px;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user