mirror of
https://github.com/langgenius/dify.git
synced 2026-06-09 17:32:00 +08:00
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
import { cn } from '@/utils/classnames'
|
|
import DownloadCount from './download-count'
|
|
|
|
type Props = {
|
|
className?: string
|
|
orgName?: string
|
|
packageName?: string
|
|
packageNameClassName?: string
|
|
downloadCount?: number
|
|
}
|
|
|
|
const OrgInfo = ({
|
|
className,
|
|
orgName,
|
|
packageName,
|
|
packageNameClassName,
|
|
downloadCount,
|
|
}: Props) => {
|
|
// New format: "by {orgName} · {downloadCount} installs" (for marketplace cards)
|
|
if (downloadCount !== undefined) {
|
|
return (
|
|
<div className={cn('system-xs-regular flex h-4 items-center gap-2 text-text-tertiary', className)}>
|
|
{orgName && (
|
|
<span className="shrink-0">
|
|
by
|
|
{orgName}
|
|
</span>
|
|
)}
|
|
<span className="shrink-0">·</span>
|
|
<DownloadCount downloadCount={downloadCount} />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
// Legacy format: "{orgName} / {packageName}" (for plugin detail panels)
|
|
return (
|
|
<div className={cn('flex h-4 items-center space-x-0.5', className)}>
|
|
{orgName && (
|
|
<>
|
|
<span className="system-xs-regular shrink-0 text-text-tertiary">{orgName}</span>
|
|
<span className="system-xs-regular shrink-0 text-text-quaternary">/</span>
|
|
</>
|
|
)}
|
|
{packageName && (
|
|
<span className={cn('system-xs-regular w-0 shrink-0 grow truncate text-text-tertiary', packageNameClassName)}>
|
|
{packageName}
|
|
</span>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default OrgInfo
|