feat: auto-resize textarea, persistent token stats

This commit is contained in:
Alexej Wolff
2026-02-11 02:05:28 +01:00
parent 8c6d6591f8
commit 863cf7f6b6
3 changed files with 96 additions and 19 deletions
+6 -4
View File
@@ -420,9 +420,9 @@
.input-container textarea {
flex: 1;
min-height: 50px;
max-height: 120px;
padding: 0.875rem 1rem;
min-height: 44px;
max-height: 150px;
padding: 0.75rem 1rem;
background: #1a1a1a;
border: 2px solid #333;
border-radius: 12px;
@@ -430,7 +430,9 @@
font-size: 1rem;
font-family: inherit;
resize: none;
transition: border-color 0.2s;
transition: border-color 0.2s, height 0.1s ease;
overflow-y: auto;
line-height: 1.4;
}
.input-container textarea:focus {
+11 -2
View File
@@ -240,6 +240,10 @@ export default function GamePage() {
const tempSession = { ...session, messages: updatedMessages };
setSession(tempSession);
setInput("");
// Reset textarea height
if (inputRef.current) {
inputRef.current.style.height = "auto";
}
setIsLoading(true);
setError(null);
setStreamingContent("");
@@ -588,11 +592,16 @@ export default function GamePage() {
<textarea
ref={inputRef}
value={input}
onChange={(e) => setInput(e.target.value)}
onChange={(e) => {
setInput(e.target.value);
// Auto-resize
e.target.style.height = "auto";
e.target.style.height = Math.min(e.target.scrollHeight, 150) + "px";
}}
onKeyDown={handleKeyDown}
placeholder="Что ты хочешь сделать?..."
disabled={isLoading}
rows={2}
rows={1}
/>
{isLoading ? (
<button onClick={handleStop} className="send-btn stop-btn">