+ {/* Tabs */}
+
+ {(["open", "closed"] as const).map((t) => (
+
+ ))}
+
+
+ {/* Question list */}
+
+ {filtered.length === 0 && (
+
+ Нет вопросов
+
+ )}
+ {filtered.map((q) => (
+
+ ))}
+
+
+ {!detail ? (
+
+ ) : (
+ <>
+ {/* Thread header */}
+
+
+
+ {detail.title}
+
+
+ {detail.user.name} ·{" "}
+ {new Date(detail.createdAt).toLocaleDateString("ru", {
+ day: "numeric",
+ month: "long",
+ })}
+
+
+ {detail.status === "OPEN" && (
+
+ )}
+
+
+ {/* Messages */}
+
+ {detail.messages.map((msg) => {
+ const isMine = msg.authorId === currentUserId;
+ return (
+
+
+ {msg.author.name} · {formatDate(msg.createdAt)}
+
+
{msg.text}
+ {msg.files && msg.files.length > 0 && (
+
+ )}
+
+ );
+ })}
+
+
+ {/* Reply form */}
+
+
+ setReplyText(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" && !e.shiftKey) {
+ e.preventDefault();
+ handleReply();
+ }
+ }}
+ disabled={detail.status === "CLOSED"}
+ placeholder={
+ detail.status === "CLOSED" ? "Вопрос закрыт" : "Написать ответ..."
+ }
+ className="flex-1 text-sm px-3 py-2 outline-none"
+ style={{
+ border: "1px solid var(--border)",
+ background: "var(--background)",
+ color: "var(--foreground)",
+ }}
+ />
+
+
+ {error && (
+
+ {error}
+
+ )}
+
+ >
+ )}
+