import React from "react"; import { Database } from "lucide-react"; import { Card, Dropdown, Button, Tag, Tooltip } from "antd"; import type { ItemType } from "antd/es/menu/interface"; import AddTagPopover from "./AddTagPopover"; interface StatisticItem { icon: React.ReactNode; label: string; value: string | number; } interface OperationItem { key: string; label: string; icon?: React.ReactNode; isDropdown?: boolean; items?: ItemType[]; onMenuClick?: (key: string) => void; onClick?: () => void; danger?: boolean; } interface TagConfig { showAdd: boolean; tags: { id: number; name: string; color: string }[]; onFetchTags?: () => Promise<{ data: { id: number; name: string; color: string }[]; }>; onAddTag?: (tag: { id: number; name: string; color: string }) => void; onCreateAndTag?: (tagName: string) => void; } interface DetailHeaderProps { data: T; statistics: StatisticItem[]; operations: OperationItem[]; tagConfig?: TagConfig; } function DetailHeader({ data, statistics, operations, tagConfig, }: DetailHeaderProps): React.ReactNode { return (
{data?.icon || }

{data.name}

{data?.status && (
{data.status?.icon} {data.status?.label}
)}
{data?.tags && (
{data?.tags?.map((tag) => ( {tag.name} ))} {tagConfig?.showAdd && ( )}
)}

{data.description}

{statistics.map((stat) => (
{stat.icon} {stat.value}
))}
{operations.map((op) => { if (op.isDropdown) { return (
); } export default DetailHeader;