feat: partner badge in marketplace (#14258)

This commit is contained in:
Wu Tianwei
2025-02-25 12:09:37 +08:00
committed by GitHub
parent 28add22f20
commit 42b13bd312
31 changed files with 2288 additions and 31 deletions

View File

@@ -1,6 +1,5 @@
'use client'
import React from 'react'
import { RiVerifiedBadgeLine } from '@remixicon/react'
import type { Plugin } from '../types'
import Icon from '../card/base/card-icon'
import CornerMark from './base/corner-mark'
@@ -14,6 +13,8 @@ import { getLanguage } from '@/i18n/language'
import { useSingleCategories } from '../hooks'
import { renderI18nObject } from '@/hooks/use-i18n'
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
import Partner from '../base/badges/partner'
import Verified from '../base/badges/verified'
export type Props = {
className?: string
@@ -46,11 +47,12 @@ const Card = ({
const locale = localeFromProps ? getLanguage(localeFromProps) : defaultLocale
const { t } = useMixedTranslation(localeFromProps)
const { categoriesMap } = useSingleCategories(t)
const { category, type, name, org, label, brief, icon, verified } = payload
const { category, type, name, org, label, brief, icon, verified, badges = [] } = payload
const isBundle = !['plugin', 'model', 'tool', 'extension', 'agent-strategy'].includes(type)
const cornerMark = isBundle ? categoriesMap.bundle?.label : categoriesMap[category]?.label
const getLocalizedText = (obj: Record<string, string> | undefined) =>
obj ? renderI18nObject(obj, locale) : ''
const isPartner = badges.includes('partner')
const wrapClassName = cn('relative p-4 pb-3 border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg hover-bg-components-panel-on-panel-item-bg rounded-xl shadow-xs', className)
if (isLoading) {
@@ -71,7 +73,8 @@ const Card = ({
<div className="ml-3 w-0 grow">
<div className="flex items-center h-5">
<Title title={getLocalizedText(label)} />
{verified && <RiVerifiedBadgeLine className="shrink-0 ml-0.5 w-4 h-4 text-text-accent" />}
{isPartner && <Partner className='w-4 h-4 ml-0.5' />}
{verified && <Verified className='w-4 h-4 ml-0.5' />}
{titleLeft} {/* This can be version badge */}
</div>
<OrgInfo