Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(web): respect marketplace flag for home template link (#45009)

Wu Tianwei18cec105d94a
diff --git a/web/features/home/home-content/templates-header.tsx b/web/features/home/home-content/templates-header.tsx
index 566755283bc..a4f71c9bf42 100644
--- a/web/features/home/home-content/templates-header.tsx
+++ b/web/features/home/home-content/templates-header.tsx
@@ -1,8 +1,10 @@
'use client'
+import { useSuspenseQuery } from '@tanstack/react-query'
import { useTranslation } from 'react-i18next'
import { SearchInput } from '@/app/components/base/search-input'
import Category from '@/app/components/explore/category'
+import { systemFeaturesQueryOptions } from '@/features/system-features/client'
export function HomeTemplatesHeader({
allCategoriesEn,
@@ -20,6 +22,10 @@ export function HomeTemplatesHeader({
onKeywordsChange: (keywords: string) => void
}) {
const { t } = useTranslation(['explore', 'app'])
+ const { data: enableMarketplace } = useSuspenseQuery({
+ ...systemFeaturesQueryOptions(),
+ select: ({ enable_marketplace }) => enable_marketplace,
+ })
return (
<div className="sticky top-0 z-10 bg-background-body">
@@ -30,18 +36,20 @@ export function HomeTemplatesHeader({
>
{t(($) => $['apps.title'], { ns: 'explore' })}
</h2>
- <a
- href="https://marketplace.dify.ai/templates"
- target="_blank"
- rel="noopener noreferrer"
- className="-my-1 -me-1 flex min-h-6 shrink-0 touch-manipulation items-center gap-1 rounded-md p-1 system-xs-medium text-text-tertiary outline-hidden transition-colors hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid motion-reduce:transition-none"
- >
- {t(($) => $['apps.viewMore'], { ns: 'explore' })}
- <span
- className="i-ri-arrow-right-line size-3 shrink-0 rtl:rotate-180"
- aria-hidden="true"
- />
- </a>
+ {enableMarketplace && (
+ <a
+ href="https://marketplace.dify.ai/templates"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="-my-1 -me-1 flex min-h-6 shrink-0 touch-manipulation items-center gap-1 rounded-md p-1 system-xs-medium text-text-tertiary outline-hidden transition-colors hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid motion-reduce:transition-none"
+ >
+ {t(($) => $['apps.viewMore'], { ns: 'explore' })}
+ <span
+ className="i-ri-arrow-right-line size-3 shrink-0 rtl:rotate-180"
+ aria-hidden="true"
+ />
+ </a>
+ )}
</div>
<div className="flex items-start justify-between gap-2 px-8 pt-3 pb-3">