feat: public type

This commit is contained in:
Joel
2026-02-12 15:34:48 +08:00
parent 5d5a842f37
commit 791289dcf5
2 changed files with 12 additions and 2 deletions

View File

@ -220,6 +220,16 @@ describe('TemplateCard', () => {
})
})
describe('Creator Link', () => {
it('should append publisher_type query to creator link', () => {
const template = createMockTemplate({ publisher_type: 'organization' })
const { getByText } = render(<TemplateCard template={template} />)
const creatorLink = getByText('test-publisher').closest('a')
expect(creatorLink).toHaveAttribute('href', '/creators/test-publisher?publisher_type=organization')
})
})
describe('Deps Plugins', () => {
it('should render dep plugin icons', () => {
const template = createMockTemplate({

View File

@ -29,7 +29,7 @@ const TemplateCardComponent = ({
const locale = useLocale()
const { t } = useTranslation()
const { theme } = useTheme()
const { id, template_name, overview, icon, publisher_handle, usage_count, icon_background, deps_plugins, kind } = template
const { id, template_name, overview, icon, publisher_handle, publisher_type, usage_count, icon_background, deps_plugins, kind } = template
const isSandbox = kind === 'sandboxed'
const iconUrl = getTemplateIconUrl(template)
@ -74,7 +74,7 @@ const TemplateCardComponent = ({
<span className="flex shrink-0 items-center gap-1">
<span className="shrink-0">{t('marketplace.templateCard.by', { ns: 'plugin' })}</span>
<Link
href={`/creators/${publisher_handle}`}
href={`/creators/${publisher_handle}?publisher_type=${encodeURIComponent(publisher_type || 'individual')}`}
target="_blank"
rel="noopener noreferrer"
className="truncate hover:text-text-secondary hover:underline"