fix(ui): UserCell в changelog/events/history — ещё 6 мест

После !178 (record drawer + RecordHistoryDrawer + webhook detail) ещё
осталось 6 точек где раньше рендерился UUID. Все они в "истории
словаря" и tab "События":

1. ChangelogDiffModal:57 — header "автор: <name>" в diff modal.
   Было: `{data.publishedBy.name}` (тип ChangelogPublisher.name —
   docstring буквально говорит "Backend пока эхает sub").
   Стало: <UserCell uuid={data.publishedBy.sub} />.

2. TimeTravelModal:686 — список изменений, имя автора рядом с датой.
3. TimeTravelModal:898 — RIGHT panel "История этой версии", dt/dd
   pair с автором.
4. TimeTravelModal ComparePanel:414 — "· {author}" suffix,
   author там DictionaryDetail.updatedBy (тоже UUID).

5. dictionaries.$name.tsx:2263 (events tab, EventsTabContent row) —
   `{r.userId ?? 'anonymous'}` raw. Сменил на UserCell для не-null
   userId, anonymous-fallback оставил без UserCell (нечего lookup'ать).

6. dictionaries.$name.tsx:2399 (history tab, HistoryTabContent entry)
   — `{entry.publishedBy.name}` raw.

Всё через тот же useUserDisplay hook что и в !177 — backend
endpoint /admin/users/{sub}/display + JwtUserCaptureFilter cache.
Если sub нет в cache, UserCell fallback'ит на shortened UUID
(текущее поведение из !177).

ChangelogPublisher type comment в src/api/client.ts уже намекал что
.name это placeholder — useUserDisplay теперь реально резолвит.
This commit is contained in:
Andrei Zimin
2026-05-14 14:33:20 +03:00
parent 93b2676994
commit 455ca2ff26
3 changed files with 13 additions and 8 deletions
@@ -1,6 +1,7 @@
import { useTranslation } from 'react-i18next'
import { Badge, LoadingBlock, Modal, QueryErrorState } from '@/ui'
import { useChangelogDiff } from '@/api/queries'
import { UserCell } from '@/lib/useUserDisplay'
import { kindBadgeVariant, kindLabel } from './kind-meta'
/**
@@ -52,9 +53,9 @@ export function ChangelogDiffModal({
{/* Header strip — kind + author */}
<div className="flex flex-wrap items-center gap-2">
<Badge variant={kindBadgeVariant(data.kind)}>{kindLabel(data.kind, t)}</Badge>
<span className="text-cell text-mute">
<span className="text-cell text-mute inline-flex items-center gap-1">
{t('changelog.diff.by', { defaultValue: 'автор' })}:{' '}
<span className="text-ink font-mono">{data.publishedBy.name}</span>
<UserCell uuid={data.publishedBy.sub} />
</span>
</div>
@@ -6,6 +6,7 @@ import type { ChangelogEntry, DictionaryDetail, FlattenedRecord } from '@/api/cl
import { useChangelog, useChangelogDiff, useRecords } from '@/api/queries'
import { kindBadgeVariant, kindIcon, kindLabel } from '@/components/changelog/kind-meta'
import { ChangelogDiffModal } from '@/components/changelog/ChangelogDiffModal'
import { UserCell } from '@/lib/useUserDisplay'
import { cn } from '@/lib/utils'
/**
@@ -411,7 +412,9 @@ function ComparePanel({
· <span className="text-mono">{note}</span>
</span>
)}
{author && <span className="text-mute">· {author}</span>}
{author && (
<span className="text-mute inline-flex items-center gap-1">· <UserCell uuid={author} /></span>
)}
</div>
</div>
)
@@ -683,7 +686,7 @@ function ChangesTabContent({
<span className="tabular-nums">
{new Date(e.publishedAt).toLocaleString()}
</span>
<span className="font-mono">{e.publishedBy.name}</span>
<UserCell uuid={e.publishedBy.sub} />
<button
type="button"
onClick={() => onOpenDiff(e.id)}
@@ -895,7 +898,7 @@ function SchemaTabContent({
<dt className="text-cap text-mute uppercase tracking-wider">
{t('timeTravel.schema.author', { defaultValue: 'автор' })}
</dt>
<dd className="font-mono">{pickedEntry.publishedBy.name}</dd>
<dd><UserCell uuid={pickedEntry.publishedBy.sub} /></dd>
<dt className="text-cap text-mute uppercase tracking-wider">
{t('timeTravel.schema.date', { defaultValue: 'дата' })}
</dt>
@@ -56,6 +56,7 @@ import { TimeTravelModal } from '@/components/timetravel/TimeTravelModal'
import { ChangelogDiffModal } from '@/components/changelog/ChangelogDiffModal'
import { kindBadgeVariant, kindIcon, kindLabel, isVersioningKind } from '@/components/changelog/kind-meta'
import { CreateSchemaDraftModal } from '@/components/workflow/CreateSchemaDraftModal'
import { UserCell } from '@/lib/useUserDisplay'
import { nowIsoLocal } from '@/lib/dates'
import { recordDisplayName } from '@/lib/locales'
import { SCOPE_BORDER_TOP } from '@/lib/scope-style'
@@ -2258,8 +2259,8 @@ function EventsTabContent({ dictName }: { dictName: string }) {
{status}
</span>
</td>
<td className="px-3 py-2 text-mono text-cell text-ink-2">
{r.userId ?? 'anonymous'}
<td className="px-3 py-2 text-cell text-ink-2">
{r.userId ? <UserCell uuid={r.userId} /> : <span className="text-mono text-mute">anonymous</span>}
</td>
<td className="px-3 py-2 text-cell text-ink-2 max-w-md truncate">
{r.businessKey ? (
@@ -2396,7 +2397,7 @@ function ChangelogTimelineItem({
)}
<div className="flex items-center gap-3 mt-1 text-cell text-mute">
<span className="tabular-nums">{occurredAt.toLocaleString()}</span>
<span className="font-mono">{entry.publishedBy.name}</span>
<UserCell uuid={entry.publishedBy.sub} />
{entry.recordsAffected > 0 && (
<span>
{t('changelog.recordsAffected', {