From 2cc86ae8cdc713c54e6c4459c7fcad92fd84aca9 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 12 Feb 2026 18:08:19 +0800 Subject: [PATCH] chore: fix with source problem --- .../plugins/marketplace/list/template-card.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/web/app/components/plugins/marketplace/list/template-card.tsx b/web/app/components/plugins/marketplace/list/template-card.tsx index dca5d06d48..b248942469 100644 --- a/web/app/components/plugins/marketplace/list/template-card.tsx +++ b/web/app/components/plugins/marketplace/list/template-card.tsx @@ -7,6 +7,7 @@ import * as React from 'react' import { useCallback } 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' import useTheme from '@/hooks/use-theme' import { cn } from '@/utils/classnames' import { getIconFromMarketPlace } from '@/utils/get-icon' @@ -17,6 +18,7 @@ import { getTemplateIconUrl } from '../utils' type TemplateCardProps = { template: Template className?: string + includeSource?: boolean } // Number of tag icons to show before showing "+X" @@ -25,6 +27,7 @@ const MAX_VISIBLE_DEPS_PLUGINS = 7 const TemplateCardComponent = ({ template, className, + includeSource = false, }: TemplateCardProps) => { const locale = useLocale() const { t } = useTranslation() @@ -34,14 +37,17 @@ const TemplateCardComponent = ({ const iconUrl = getTemplateIconUrl(template) const handleClick = useCallback(() => { - const url = getMarketplaceUrl(`/template/${publisher_handle}/${template_name}`, { + const queryParams = { theme, language: locale, templateId: id, creationType: 'templates', - }) + } + const url = 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]) + }, [publisher_handle, template_name, theme, locale, id, includeSource]) const visibleDepsPlugins = deps_plugins?.slice(0, MAX_VISIBLE_DEPS_PLUGINS) || [] const remainingDepsPluginsCount = deps_plugins ? Math.max(0, deps_plugins.length - MAX_VISIBLE_DEPS_PLUGINS) : 0