|
|
|
@ -15,6 +15,7 @@ import { renderI18nObject } from '@/i18n'
|
|
|
|
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
|
|
|
|
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
|
|
|
|
import Partner from '../base/badges/partner'
|
|
|
|
import Partner from '../base/badges/partner'
|
|
|
|
import Verified from '../base/badges/verified'
|
|
|
|
import Verified from '../base/badges/verified'
|
|
|
|
|
|
|
|
import { RiAlertFill } from '@remixicon/react'
|
|
|
|
|
|
|
|
|
|
|
|
export type Props = {
|
|
|
|
export type Props = {
|
|
|
|
className?: string
|
|
|
|
className?: string
|
|
|
|
@ -28,7 +29,7 @@ export type Props = {
|
|
|
|
isLoading?: boolean
|
|
|
|
isLoading?: boolean
|
|
|
|
loadingFileName?: string
|
|
|
|
loadingFileName?: string
|
|
|
|
locale?: string
|
|
|
|
locale?: string
|
|
|
|
showLimitWarning?: boolean
|
|
|
|
limitedInstall?: boolean
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const Card = ({
|
|
|
|
const Card = ({
|
|
|
|
@ -43,7 +44,7 @@ const Card = ({
|
|
|
|
isLoading = false,
|
|
|
|
isLoading = false,
|
|
|
|
loadingFileName,
|
|
|
|
loadingFileName,
|
|
|
|
locale: localeFromProps,
|
|
|
|
locale: localeFromProps,
|
|
|
|
showLimitWarning = false,
|
|
|
|
limitedInstall = false,
|
|
|
|
}: Props) => {
|
|
|
|
}: Props) => {
|
|
|
|
const defaultLocale = useGetLanguage()
|
|
|
|
const defaultLocale = useGetLanguage()
|
|
|
|
const locale = localeFromProps ? getLanguage(localeFromProps) : defaultLocale
|
|
|
|
const locale = localeFromProps ? getLanguage(localeFromProps) : defaultLocale
|
|
|
|
@ -56,7 +57,7 @@ const Card = ({
|
|
|
|
obj ? renderI18nObject(obj, locale) : ''
|
|
|
|
obj ? renderI18nObject(obj, locale) : ''
|
|
|
|
const isPartner = badges.includes('partner')
|
|
|
|
const isPartner = badges.includes('partner')
|
|
|
|
|
|
|
|
|
|
|
|
const wrapClassName = cn('hover-bg-components-panel-on-panel-item-bg relative rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg p-4 pb-3 shadow-xs', className)
|
|
|
|
const wrapClassName = cn('hover-bg-components-panel-on-panel-item-bg relative overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg shadow-xs', className)
|
|
|
|
if (isLoading) {
|
|
|
|
if (isLoading) {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Placeholder
|
|
|
|
<Placeholder
|
|
|
|
@ -68,31 +69,39 @@ const Card = ({
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className={wrapClassName}>
|
|
|
|
<div className={wrapClassName}>
|
|
|
|
{!hideCornerMark && <CornerMark text={cornerMark} />}
|
|
|
|
<div className={cn('p-4 pb-3', limitedInstall && 'pb-1')}>
|
|
|
|
{/* Header */}
|
|
|
|
{!hideCornerMark && <CornerMark text={cornerMark} />}
|
|
|
|
<div className="flex">
|
|
|
|
{/* Header */}
|
|
|
|
<Icon src={icon} installed={installed} installFailed={installFailed} />
|
|
|
|
<div className="flex">
|
|
|
|
<div className="ml-3 w-0 grow">
|
|
|
|
<Icon src={icon} installed={installed} installFailed={installFailed} />
|
|
|
|
<div className="flex h-5 items-center">
|
|
|
|
<div className="ml-3 w-0 grow">
|
|
|
|
<Title title={getLocalizedText(label)} />
|
|
|
|
<div className="flex h-5 items-center">
|
|
|
|
{isPartner && <Partner className='ml-0.5 h-4 w-4' text={t('plugin.marketplace.partnerTip')} />}
|
|
|
|
<Title title={getLocalizedText(label)} />
|
|
|
|
{verified && <Verified className='ml-0.5 h-4 w-4' text={t('plugin.marketplace.verifiedTip')} />}
|
|
|
|
{isPartner && <Partner className='ml-0.5 h-4 w-4' text={t('plugin.marketplace.partnerTip')} />}
|
|
|
|
{titleLeft} {/* This can be version badge */}
|
|
|
|
{verified && <Verified className='ml-0.5 h-4 w-4' text={t('plugin.marketplace.verifiedTip')} />}
|
|
|
|
|
|
|
|
{titleLeft} {/* This can be version badge */}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<OrgInfo
|
|
|
|
|
|
|
|
className="mt-0.5"
|
|
|
|
|
|
|
|
orgName={org}
|
|
|
|
|
|
|
|
packageName={name}
|
|
|
|
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<OrgInfo
|
|
|
|
|
|
|
|
className="mt-0.5"
|
|
|
|
|
|
|
|
orgName={org}
|
|
|
|
|
|
|
|
packageName={name}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<Description
|
|
|
|
|
|
|
|
className="mt-3"
|
|
|
|
|
|
|
|
text={getLocalizedText(brief)}
|
|
|
|
|
|
|
|
descriptionLineRows={descriptionLineRows}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
{footer && <div>{footer}</div>}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<Description
|
|
|
|
{limitedInstall
|
|
|
|
className="mt-3"
|
|
|
|
&& <div className='relative flex h-8 items-center gap-x-2 px-3 after:absolute after:bottom-0 after:left-0 after:right-0 after:top-0 after:bg-toast-warning-bg after:opacity-40'>
|
|
|
|
text={getLocalizedText(brief)}
|
|
|
|
<RiAlertFill className='h-3 w-3 shrink-0 text-text-warning-secondary' />
|
|
|
|
descriptionLineRows={descriptionLineRows}
|
|
|
|
<p className='system-xs-regular z-10 grow text-text-secondary'>
|
|
|
|
/>
|
|
|
|
{t('plugin.installModal.installWarning')}
|
|
|
|
{showLimitWarning && <div>{t('plugin.installModal.installWarning')}</div>}
|
|
|
|
</p>
|
|
|
|
{footer && <div>{footer}</div>}
|
|
|
|
</div>}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|