From 35cb4b09dc5d6a52da9eec55e96cdd8dab4f2151 Mon Sep 17 00:00:00 2001 From: Leonid Pershin Date: Wed, 29 Jul 2026 23:35:45 +0300 Subject: [PATCH] Enhance GroupDetail component to display show types on badges Updated the GroupDetail component to include a new function, elementLabelKey, which determines the appropriate label for badges based on the element kind and show kind. This change improves the clarity of displayed information by showing specific show types (e.g., "Film", "Series") instead of generic labels. Adjusted badge rendering to utilize the new function, enhancing the user interface for better understanding of group elements. --- .../src/features/admin/groups/GroupDetail.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/features/admin/groups/GroupDetail.tsx b/frontend/src/features/admin/groups/GroupDetail.tsx index ef461b9..e10b779 100644 --- a/frontend/src/features/admin/groups/GroupDetail.tsx +++ b/frontend/src/features/admin/groups/GroupDetail.tsx @@ -9,6 +9,7 @@ import type { GroupElementKind, GroupFilter, GroupMode, + ShowKind, } from '@/shared/api/types' import { useApiError } from '@/shared/lib/use-api-error' import { Badge } from '@/shared/ui/badge' @@ -30,6 +31,17 @@ import { import { DurationLabel } from './DurationLabel' import { GroupFilterPanel } from './GroupFilterPanel' +/** + * Что писать на бейдже позиции. Вид элемента («шоу») сам по себе бесполезен: в группе рекламы + * все строки — шоу, и подпись ничего не говорит. Показываем тип шоу, когда он известен: «Ролик», + * «Сериал», «Полнометражка», — и «Коллекция» для франшизы. + */ +function elementLabelKey(elementKind: GroupElementKind, showKind: ShowKind | null) { + return elementKind === 'Collection' || showKind === null + ? `admin.groups.elementKinds.${elementKind}` + : `admin.shows.kinds.${showKind}` +} + const EMPTY_FILTER: GroupFilter = {} export function GroupDetail({ groupId }: Readonly<{ groupId: string }>) { @@ -305,7 +317,7 @@ export function GroupDetail({ groupId }: Readonly<{ groupId: string }>) { {candidate.year} )} - {t(`admin.groups.elementKinds.${candidate.elementKind}`)} + {t(elementLabelKey(candidate.elementKind, candidate.showKind))} {candidate.alreadyInGroup && ( {t('admin.groups.alreadyIn')} @@ -360,7 +372,7 @@ export function GroupDetail({ groupId }: Readonly<{ groupId: string }>) { )} - {t(`admin.groups.elementKinds.${item.elementKind}`)} + {t(elementLabelKey(item.elementKind, item.showKind))} {t('admin.groups.units')}: {item.unitCount}