commit
02b4e13bea
@ -2,4 +2,5 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 24px;
|
gap: 24px;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,7 @@ export default function Metrics({
|
|||||||
|
|
||||||
// Yandex Metrica
|
// Yandex Metrica
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const interval = setInterval(() => {
|
const timeout = setTimeout(() => {
|
||||||
if (
|
if (
|
||||||
typeof window.ym === "function" &&
|
typeof window.ym === "function" &&
|
||||||
typeof window.klaviyo === "object" &&
|
typeof window.klaviyo === "object" &&
|
||||||
@ -49,18 +49,18 @@ export default function Metrics({
|
|||||||
|
|
||||||
window.ym(95799066, "reachGoal", "PaymentSuccess", {}, () => {
|
window.ym(95799066, "reachGoal", "PaymentSuccess", {}, () => {
|
||||||
// deleteYm()
|
// deleteYm()
|
||||||
setIsButtonVisible(true);
|
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error("YM error:", e);
|
console.error("YM error:", e);
|
||||||
} finally {
|
} finally {
|
||||||
clearInterval(interval);
|
clearTimeout(timeout);
|
||||||
|
setIsButtonVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
return () => clearTimeout(timeout);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
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 (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<TextareaAutoResize
|
<TextareaAutoResize
|
||||||
value={message}
|
value={message}
|
||||||
onChange={e => setMessage(e.target.value)}
|
onChange={e => setMessage(e.target.value)}
|
||||||
placeholder={t("message_input_placeholder")}
|
placeholder={t("message_input_placeholder")}
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
maxRows={5}
|
maxRows={5}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@ -3,4 +3,7 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
|
position: sticky;
|
||||||
|
top: 76px;
|
||||||
|
z-index: 100;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user