Fix student questions pages: CSS tokens, scroll, upload guard, S3 path

- Replace non-existent --surface/--surface-muted/--border-strong with actual
  design-system tokens (--color-surface, --background, --foreground, --muted)
- Remove tmp/ segment from S3 upload key in question-upload route
- Add auto-scroll to bottom on new message in QuestionThread
- Block Send while file upload is in progress (uploading guard)
- Replace <a> with Next.js <Link> in new question page back-link
- Replace hardcoded #c00 error color with var(--destructive) in both files
- Replace hardcoded #E8E8E0/#F5F5F0 hex backgrounds with CSS tokens
This commit is contained in:
2026-05-19 13:40:05 +05:00
parent c5d2caa345
commit f7d428180b
4 changed files with 27 additions and 19 deletions
+6 -5
View File
@@ -2,6 +2,7 @@
import { useState } from "react";
import { useRouter } from "next/navigation";
import Link from "next/link";
export default function NewQuestionPage() {
const router = useRouter();
@@ -38,13 +39,13 @@ export default function NewQuestionPage() {
return (
<div className="max-w-xl mx-auto px-4 py-8">
<div className="flex items-center gap-3 mb-6">
<a
<Link
href="/questions"
className="text-sm"
style={{ color: "var(--muted-foreground)", textDecoration: "underline" }}
>
Все вопросы
</a>
</Link>
</div>
<h1 className="text-xl font-bold mb-6" style={{ color: "var(--foreground)" }}>
@@ -68,7 +69,7 @@ export default function NewQuestionPage() {
className="w-full text-sm px-3 py-2 outline-none"
style={{
border: "2px solid var(--border)",
background: "var(--surface)",
background: "var(--color-surface)",
color: "var(--foreground)",
}}
/>
@@ -90,14 +91,14 @@ export default function NewQuestionPage() {
className="w-full text-sm px-3 py-2 outline-none resize-none"
style={{
border: "2px solid var(--border)",
background: "var(--surface)",
background: "var(--color-surface)",
color: "var(--foreground)",
}}
/>
</div>
{error && (
<p className="text-sm" style={{ color: "#c00" }}>
<p className="text-sm" style={{ color: "var(--destructive)" }}>
{error}
</p>
)}
+5 -5
View File
@@ -37,8 +37,8 @@ export default async function QuestionsPage() {
href="/questions/new"
className="text-sm font-bold px-4 py-2"
style={{
background: "var(--surface)",
border: "2px solid var(--border-strong)",
background: "var(--color-surface)",
border: "2px solid var(--foreground)",
color: "var(--foreground)",
}}
>
@@ -62,8 +62,8 @@ export default async function QuestionsPage() {
href={`/questions/${q.id}`}
className="block p-3 rounded-sm transition-colors"
style={{
border: unread ? "2px solid var(--border-strong)" : "1px solid var(--border)",
background: q.status === "CLOSED" ? "var(--surface-muted)" : "var(--surface)",
border: unread ? "2px solid var(--foreground)" : "1px solid var(--border)",
background: q.status === "CLOSED" ? "var(--background)" : "var(--color-surface)",
opacity: q.status === "CLOSED" ? 0.7 : 1,
}}
>
@@ -82,7 +82,7 @@ export default async function QuestionsPage() {
style={
q.status === "OPEN"
? { background: "#E8F0D8", border: "1px solid var(--border)", color: "var(--foreground)" }
: { background: "var(--surface-muted)", color: "var(--muted-foreground)" }
: { background: "var(--background)", color: "var(--muted-foreground)" }
}
>
{q.status === "OPEN" ? "● ОТКРЫТ" : "✓ ЗАКРЫТ"}