feat(web): статус комнаты в шапке
Описание комнаты жило только в настройках: в шапке были имя и медленный режим, поэтому «статус комнаты» из матрицы 11.6 приходилось проверять по REST. Теперь описание показывается рядом с названием (длинное усекается, полный текст — в подсказке), а само поле приходит и в READY, и в событиях комнат (AGENT.md 7.5, 11.6). - `Channel.description` и разбор `description` в `parseChannelPayload`; - `channel-description` в шапке комнаты; - vitest `tests/channelHeader.test.tsx`: статус из снапшота, отсутствие статуса без описания и обновление по `CHANNEL_UPDATE` без перезагрузки.
This commit is contained in:
@@ -356,6 +356,11 @@ export function parseChannelPayload(value: unknown): Channel | null {
|
||||
if (typeof record['slowmode_seconds'] === 'number') {
|
||||
channel.slowmode_seconds = record['slowmode_seconds'];
|
||||
}
|
||||
// Статус комнаты: описание показывается в шапке рядом с названием (AGENT.md 7.5).
|
||||
const description = asString(record['description']);
|
||||
if (description !== undefined) {
|
||||
channel.description = description;
|
||||
}
|
||||
if (typeof record['can_send'] === 'boolean') {
|
||||
channel.can_send = record['can_send'];
|
||||
}
|
||||
|
||||
@@ -91,6 +91,8 @@ export interface Channel {
|
||||
name: string;
|
||||
type: ChannelType;
|
||||
position: number;
|
||||
/** Статус комнаты: описание показывается в шапке рядом с названием. */
|
||||
description?: string;
|
||||
parent_id?: string;
|
||||
user_limit?: number;
|
||||
slowmode_seconds?: number;
|
||||
|
||||
@@ -110,6 +110,17 @@ export default function GuildView() {
|
||||
{isVoice ? '🔊' : '#'}
|
||||
</span>
|
||||
<h2 className="text-sm font-semibold">{channel.name}</h2>
|
||||
{channel.description === undefined || channel.description === '' ? null : (
|
||||
// Статус комнаты: описание рядом с названием; длинное усекается, а
|
||||
// полный текст остаётся в подсказке (AGENT.md 7.5, 11.6).
|
||||
<span
|
||||
data-testid="channel-description"
|
||||
title={channel.description}
|
||||
className="min-w-0 truncate text-xs text-fg-muted"
|
||||
>
|
||||
{channel.description}
|
||||
</span>
|
||||
)}
|
||||
{channel.slowmode_seconds === undefined || channel.slowmode_seconds === 0 ? null : (
|
||||
<span className="text-xs text-fg-muted">
|
||||
{t('channels.slowmode', { seconds: channel.slowmode_seconds })}
|
||||
|
||||
Reference in New Issue
Block a user