fix(admin-ui): убрать badge с «Справочники» — total count не actionable
Цифра у иконки словарей показывала общее число справочников (~40 на проде). Не меняется в течение работы юзера — не actionable, только визуальный шум. Actionable badges остаются: «Мои черновики», «На ревью», «Outbox», «Webhooks» — там цифра реально что-то означает (надо что-то сделать или разобраться). Заодно убрал unused dictsQuery / dictsCount + import useDictionaries из обоих сайдбаров (desktop + mobile). TSC noUnusedLocals чистый.
This commit is contained in:
@@ -19,7 +19,6 @@ import {
|
||||
useHasInternalScope,
|
||||
} from '@/auth/usePermissions'
|
||||
import {
|
||||
useDictionaries,
|
||||
useMyDrafts,
|
||||
useMySchemaDrafts,
|
||||
useOutboxStats,
|
||||
@@ -83,7 +82,6 @@ export function Sidebar() {
|
||||
const canReviewSchema = useCanReviewSchema()
|
||||
const canReviewRecord = useCanReviewRecord()
|
||||
const isReviewer = canReviewSchema || canReviewRecord
|
||||
const dictsQuery = useDictionaries()
|
||||
// Loaded just for сидбар counter — light request, кэшируется.
|
||||
// Badge "Мои черновики" суммирует record (/drafts/me) + schema
|
||||
// (/admin/schema-drafts/me) — maker не должен помнить разные типы.
|
||||
@@ -107,7 +105,6 @@ export function Sidebar() {
|
||||
const outboxStats = useOutboxStats(hasInternal)
|
||||
const webhooks = useWebhookSubscriptions(hasInternal)
|
||||
|
||||
const dictsCount = dictsQuery.data?.length ?? 0
|
||||
// Считаем только actionable-драфты (то же что tab-badge в ReviewsPage):
|
||||
// record → 'pending', schema → 'pending'|'wip'. APPROVED/REJECTED/WITHDRAWN
|
||||
// — терминальны, не считаем.
|
||||
@@ -140,7 +137,9 @@ export function Sidebar() {
|
||||
to: '/dictionaries',
|
||||
label: t('nav.dictionaries'),
|
||||
icon: Database,
|
||||
badge: dictsCount > 0 ? dictsCount : undefined,
|
||||
// Без badge: total count словарей — не actionable, только шумит
|
||||
// (на проде ~40 dicts, цифра не меняется в течение работы юзера).
|
||||
// Actionable badges остаются: «Мои черновики», «На ревью», «Outbox».
|
||||
},
|
||||
{
|
||||
to: '/my-drafts',
|
||||
@@ -485,7 +484,6 @@ export function MobileSidebar({ open, onClose }: { open: boolean; onClose: () =>
|
||||
const canReviewSchema = useCanReviewSchema()
|
||||
const canReviewRecord = useCanReviewRecord()
|
||||
const isReviewer = canReviewSchema || canReviewRecord
|
||||
const dictsQuery = useDictionaries()
|
||||
// size=50 (не size=1): см. desktop Sidebar — нужен .items[] для filter
|
||||
// по статусу (totalElements включает APPROVED/REJECTED).
|
||||
const myDrafts = useMyDrafts(0, 50)
|
||||
@@ -496,7 +494,6 @@ export function MobileSidebar({ open, onClose }: { open: boolean; onClose: () =>
|
||||
const outboxStats = useOutboxStats(hasInternal)
|
||||
const webhooks = useWebhookSubscriptions(hasInternal)
|
||||
|
||||
const dictsCount = dictsQuery.data?.length ?? 0
|
||||
// Считаем только actionable-драфты (то же что tab-badge в ReviewsPage):
|
||||
// record → 'pending', schema → 'pending'|'wip'. APPROVED/REJECTED/WITHDRAWN
|
||||
// — терминальны, не считаем.
|
||||
@@ -522,7 +519,9 @@ export function MobileSidebar({ open, onClose }: { open: boolean; onClose: () =>
|
||||
to: '/dictionaries',
|
||||
label: t('nav.dictionaries'),
|
||||
icon: Database,
|
||||
badge: dictsCount > 0 ? dictsCount : undefined,
|
||||
// Без badge: total count словарей — не actionable, только шумит
|
||||
// (на проде ~40 dicts, цифра не меняется в течение работы юзера).
|
||||
// Actionable badges остаются: «Мои черновики», «На ревью», «Outbox».
|
||||
},
|
||||
{
|
||||
to: '/my-drafts',
|
||||
|
||||
Reference in New Issue
Block a user