diff --git a/apps/web/src/components/lookup/lookup-status-banner.tsx b/apps/web/src/components/lookup/lookup-status-banner.tsx new file mode 100644 index 0000000..b8f86d5 --- /dev/null +++ b/apps/web/src/components/lookup/lookup-status-banner.tsx @@ -0,0 +1,74 @@ +import { CircleAlert, CircleCheck, ShieldAlert } from 'lucide-react' + +import { Badge } from '@/components/reui/badge' +import { + Alert, + AlertDescription, + AlertTitle, +} from '@/components/reui/alert' + +/** + * Lookup result status plaque — ReUI Alert + Badge. + * @see https://reui.io/docs/components/base/alert + * @see https://reui.io/preview/base/components/c-alert-6 + * @see https://reui.io/docs/components/base/badge + */ +export function LookupStatusBanner({ + status, + normalized, + matchCount = 0, +}: { + status: 'found' | 'missing' | 'missing_denied' + normalized: string + matchCount?: number +}) { + if (status === 'found') { + return ( + + + + Найдено + + в списках + + + + «{normalized}» — {matchCount} совп. в entries / snapshots. + + + ) + } + + if (status === 'missing_denied') { + return ( + + + + Не найдено + + нет прав + + + + «{normalized}» отсутствует в списках. Для добавления нужно право{' '} + bgp:modules:write. + + + ) + } + + return ( + + + + Не найдено + + можно добавить + + + + «{normalized}» отсутствует в entries и snapshots. Добавить запись в модуль? + + + ) +} diff --git a/apps/web/src/components/lookup/lookup-wizard.tsx b/apps/web/src/components/lookup/lookup-wizard.tsx index c4289af..9fe53a0 100644 --- a/apps/web/src/components/lookup/lookup-wizard.tsx +++ b/apps/web/src/components/lookup/lookup-wizard.tsx @@ -1,12 +1,13 @@ import { useEffect, useState, type ReactNode } from 'react' import { useQuery, useQueryClient } from '@tanstack/react-query' -import { Check, Plus, Search, ShieldAlert } from 'lucide-react' +import { Check, Search } from 'lucide-react' import { Button } from '@evobgp/ui/components/button' import { LookupAddStep } from '@/components/lookup/lookup-add-step' import { LookupMatchesGrid } from '@/components/lookup/lookup-matches-grid' import { LookupSearchForm } from '@/components/lookup/lookup-search-form' +import { LookupStatusBanner } from '@/components/lookup/lookup-status-banner' import { EmptyState } from '@/components/empty-state' import { QueryState } from '@/components/query-state' import { @@ -235,14 +236,11 @@ export function LookupWizard({ {result.matched ? ( <> - - - Уже есть в списках - - «{result.normalized}» найден в entries и/или snapshots - ({result.match_count} совпад.). - - + ) : canWrite ? ( <> - - - Не найдено в списках - - «{result.normalized}» отсутствует. Добавить запись? - - +