Merge pull request #32 from pennyteenycat/edits-31-07

edits-31-07
This commit is contained in:
pennyteenycat 2025-08-01 16:34:44 +03:00 committed by GitHub
commit 02b4e13bea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 33 additions and 4 deletions

View File

@ -2,4 +2,5 @@
display: flex;
flex-direction: column;
gap: 24px;
position: relative;
}

View File

@ -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 (

View File

@ -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

View File

@ -3,4 +3,7 @@
flex-direction: column;
align-items: flex-end;
gap: 16px;
position: sticky;
top: 76px;
z-index: 100;
}