'use client' import { Search, FileText } from 'lucide-react' import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyContent } from '@/components/ui/empty' import { KbEntryRow } from '../components/kb-entry-row' import type { AclRoleOption, KbEntry } from '../types' // ─── KB / Processes Panel ────────────────────────────────────────────────────── // Shared body for the "Knowledge Base" and "Processes" tabs. The KB variant // splits pinned/critical entries into their own section; the processes variant // renders a single flat list. Both receive already-filtered entries. export function KbPanel({ variant, entries, search, onAdd, onEdit, onDelete, canManageAcl, aclRoleOptions, aclByEntity, }: { variant: 'kb' | 'processes' entries: KbEntry[] search: string onAdd: () => void onEdit: (e: KbEntry) => void onDelete: (id: string) => void canManageAcl?: boolean aclRoleOptions?: AclRoleOption[] aclByEntity?: Record }) { if (variant === 'processes') { return (
{entries.length > 0 ? (
{entries.map(entry => ( ))}
) : ( {search ? : } {search ? `No results for "${search}"` : 'No process entries yet'} {!search && ( )} )}
) } const pinnedKb = entries.filter(e => e.is_pinned) const unpinnedKb = entries.filter(e => !e.is_pinned) return (
{pinnedKb.length > 0 && (

Pinned / Critical

{pinnedKb.map(entry => ( ))}
)} {unpinnedKb.length > 0 && (

All Entries

{unpinnedKb.map(entry => ( ))}
)} {entries.length === 0 && ( {search ? : } {search ? `No results for "${search}"` : 'No knowledge base entries yet'} {!search && ( )} )}
) }