fix: update creator links to use singular form

This commit is contained in:
yessenia
2026-02-12 23:12:38 +08:00
parent e4f5c8f710
commit 0f4b578462
5 changed files with 18 additions and 14 deletions

View File

@ -29,7 +29,7 @@ const OrgInfo = ({
{linkToOrg
? (
<Link
href={`/creators/${orgName}`}
href={`/creator/${orgName}`}
target="_blank"
rel="noopener noreferrer"
className="hover:text-text-secondary hover:underline"

View File

@ -226,7 +226,7 @@ describe('TemplateCard', () => {
const { getByText } = render(<TemplateCard template={template} />)
const creatorLink = getByText('test-publisher').closest('a')
expect(creatorLink).toHaveAttribute('href', '/creators/test-publisher?publisher_type=organization')
expect(creatorLink).toHaveAttribute('href', '/creator/test-publisher?publisher_type=organization')
})
})

View File

@ -4,7 +4,7 @@ import type { Template } from '../types'
import { useLocale, useTranslation } from '#i18n'
import Link from 'next/link'
import * as React from 'react'
import { useCallback } from 'react'
import { useMemo } from 'react'
import AppIcon from '@/app/components/base/app-icon'
import CornerMark from '@/app/components/plugins/card/base/corner-mark'
import { MARKETPLACE_URL_PREFIX } from '@/config'
@ -36,17 +36,16 @@ const TemplateCardComponent = ({
const isSandbox = kind === 'sandboxed'
const iconUrl = getTemplateIconUrl(template)
const handleClick = useCallback(() => {
const href = useMemo(() => {
const queryParams = {
theme,
language: locale,
templateId: id,
creationType: 'templates',
}
const url = includeSource
return includeSource
? getMarketplaceUrl(`/template/${publisher_handle}/${template_name}`, queryParams)
: `${MARKETPLACE_URL_PREFIX}/template/${publisher_handle}/${template_name}?${new URLSearchParams(queryParams).toString()}`
window.open(url, '_blank')
}, [publisher_handle, template_name, theme, locale, id, includeSource])
const visibleDepsPlugins = deps_plugins?.slice(0, MAX_VISIBLE_DEPS_PLUGINS) || []
@ -60,7 +59,6 @@ const TemplateCardComponent = ({
'hover-bg-components-panel-on-panel-item-bg relative flex h-full cursor-pointer flex-col overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg pb-3 shadow-xs',
className,
)}
onClick={handleClick}
>
{isSandbox && <CornerMark text="Sandbox" />}
{/* Header */}
@ -75,16 +73,22 @@ const TemplateCardComponent = ({
/>
{/* Title */}
<div className="flex min-w-0 flex-1 flex-col justify-center gap-0.5">
<p className="system-md-medium truncate text-text-primary">{template_name}</p>
<a
href={href}
target="_blank"
rel="noopener noreferrer"
className="system-md-medium truncate text-text-primary after:absolute after:inset-0"
>
{template_name}
</a>
<div className="system-xs-regular flex items-center gap-2 text-text-tertiary">
<span className="flex shrink-0 items-center gap-1">
<span className="relative z-[1] flex shrink-0 items-center gap-1">
<span className="shrink-0">{t('marketplace.templateCard.by', { ns: 'plugin' })}</span>
<Link
href={`/creators/${publisher_handle}?publisher_type=${encodeURIComponent(publisher_type || 'individual')}`}
href={`/creator/${publisher_handle}?publisher_type=${encodeURIComponent(publisher_type || 'individual')}`}
target="_blank"
rel="noopener noreferrer"
className="truncate hover:text-text-secondary hover:underline"
onClick={e => e.stopPropagation()}
>
{publisher_handle}
</Link>

View File

@ -275,7 +275,7 @@ function CreatorsSection({ creators, t }: {
<a
key={creator.unique_handle}
className="flex items-center gap-2 rounded-lg px-3 py-2 hover:bg-state-base-hover"
href={getMarketplaceUrl(`/creators/${creator.unique_handle}`)}
href={getMarketplaceUrl(`/creator/${creator.unique_handle}`)}
>
<div className="flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full border-[0.5px] border-divider-regular">
<img

View File

@ -1,9 +1,9 @@
'use client'
import type { Creator } from '../types'
import { getCreatorAvatarUrl } from '../utils'
import { useTranslation } from '#i18n'
import { getMarketplaceUrl } from '@/utils/var'
import { getCreatorAvatarUrl } from '../utils'
type CreatorCardProps = {
creator: Creator
@ -11,7 +11,7 @@ type CreatorCardProps = {
const CreatorCard = ({ creator }: CreatorCardProps) => {
const { t } = useTranslation()
const href = getMarketplaceUrl(`/creators/${creator.unique_handle}`)
const href = getMarketplaceUrl(`/creator/${creator.unique_handle}`)
const displayName = creator.display_name || creator.name
return (