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(marketplace): render emoji-ID icons on marketplace banner recommend cards (#45066)

Hanqing Zhaofd5c3696b977
diff --git a/web/app/components/plugins/marketplace/home/__tests__/home-trending.spec.tsx b/web/app/components/plugins/marketplace/home/__tests__/home-trending.spec.tsx
index bfb500606e5..9fd90c03dbf 100644
--- a/web/app/components/plugins/marketplace/home/__tests__/home-trending.spec.tsx
+++ b/web/app/components/plugins/marketplace/home/__tests__/home-trending.spec.tsx
@@ -773,6 +773,57 @@ describe('HomeTrending', () => {
).not.toBeInTheDocument()
})
+ it('renders persisted emoji-mart IDs on recommend template cards as native emoji', () => {
+ const banner: PluginBanner = {
+ id: 'recommend-template-emoji',
+ style_type: 'recommend',
+ title: 'Trending',
+ sort: 0,
+ language: 'en',
+ content: {
+ theme_type: 'newest',
+ cards: [
+ {
+ item_type: 'template',
+ item_id: 'tpl-emoji-id',
+ display_name: 'Prompt Helper',
+ icon: 'face_with_monocle',
+ icon_background: '#FFEAD5',
+ link: '/templates/tpl-emoji-id',
+ card_position: 0,
+ },
+ {
+ item_type: 'template',
+ item_id: 'tpl-native-emoji',
+ display_name: 'Offer Arena',
+ icon: '🤖',
+ icon_background: '#FFEAD5',
+ link: '/templates/tpl-native-emoji',
+ card_position: 1,
+ },
+ ],
+ },
+ }
+
+ render(<HomeTrending banners={[banner]} isMarketplacePlatform page="templates" />)
+
+ const emojiIdCard = screen.getByRole('link', { name: 'Prompt Helper' })
+ expect(within(emojiIdCard).getByText('🧐')).toBeInTheDocument()
+ expect(within(emojiIdCard).queryByText('face_with_monocle')).not.toBeInTheDocument()
+ expect(
+ within(screen.getByRole('link', { name: 'Offer Arena' })).getByText('🤖'),
+ ).toBeInTheDocument()
+ })
+
+ it('keeps standalone recommend plugin cards on local detail routes', () => {
+ render(<HomeTrending banners={[banners[0]!]} isMarketplacePlatform page="plugins" />)
+
+ expect(screen.getByRole('link', { name: 'Dropbox' })).toHaveAttribute(
+ 'href',
+ '/plugin/langgenius/dropbox',
+ )
+ })
+
it('clamps the active slide when a refetch shrinks the banner list', async () => {
const user = userEvent.setup()
const { rerender } = render(
diff --git a/web/app/components/plugins/marketplace/home/home-trending-slides.tsx b/web/app/components/plugins/marketplace/home/home-trending-slides.tsx
index bf793040a25..017b9659781 100644
--- a/web/app/components/plugins/marketplace/home/home-trending-slides.tsx
+++ b/web/app/components/plugins/marketplace/home/home-trending-slides.tsx
@@ -28,6 +28,7 @@ import {
import Link from '@/next/link'
import { useRouter } from '@/next/navigation'
import { fetchPluginInfoFromMarketPlace } from '@/service/plugins'
+import { resolveEmoji } from '@/utils/emoji'
import {
rememberMarketplaceSiteReferrer,
trackMarketplaceSiteEvent,
@@ -279,7 +280,7 @@ function RecommendCardFace({ card }: { card: BannerRecommendCard }) {
className="size-full object-contain object-center"
/>
) : card.icon ? (
- <span className="text-xl leading-none">{card.icon}</span>
+ <span className="text-xl leading-none">{resolveEmoji(card.icon)}</span>
) : (
<span aria-hidden="true" className="i-ri-image-line size-5 text-text-quaternary" />
)}