Skip to content

Commit bc58f43

Browse files
committed
⭐️ Add Agent Space categories logo
1 parent 4dc1f11 commit bc58f43

File tree

4 files changed

+49
-8
lines changed

4 files changed

+49
-8
lines changed

frontend/app/[locale]/market/MarketContent.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,7 @@ export default function MarketContent({
262262
},
263263
...categories.map((cat) => ({
264264
key: cat.name,
265-
label: (
266-
<span className="flex items-center gap-2">
267-
<span>{cat.icon}</span>
268-
<span>{isZh ? cat.display_name_zh : cat.display_name}</span>
269-
</span>
270-
),
265+
label: isZh ? cat.display_name_zh : cat.display_name,
271266
})),
272267
];
273268

frontend/app/[locale]/market/components/AgentMarketCard.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Download, Tag, Wrench } from "lucide-react";
66
import { MarketAgentListItem } from "@/types/market";
77
import { useTranslation } from "react-i18next";
88
import { getGenericLabel } from "@/lib/agentLabelMapper";
9+
import { getCategoryIcon } from "@/const/marketConfig";
910

1011
interface AgentMarketCardProps {
1112
agent: MarketAgentListItem;
@@ -34,6 +35,11 @@ export function AgentMarketCard({
3435
onViewDetails(agent);
3536
};
3637

38+
// Get category icon: prefer API icon, then fallback to default mapping by name
39+
const categoryIcon = agent.category
40+
? agent.category.icon || getCategoryIcon(agent.category.name)
41+
: "📦";
42+
3743
return (
3844
<motion.div
3945
whileHover={{ y: -4 }}
@@ -45,7 +51,7 @@ export function AgentMarketCard({
4551
<div className="flex items-center justify-between mb-2">
4652
<div className="flex items-center gap-2">
4753
<span className="text-2xl">
48-
{agent.category?.icon || "📦"}
54+
{categoryIcon}
4955
</span>
5056
<span className="text-xs font-medium text-purple-600 dark:text-purple-400">
5157
{agent.category

frontend/app/[locale]/market/components/MarketAgentDetailModal.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from "lucide-react";
1414
import { MarketAgentDetail } from "@/types/market";
1515
import { getToolSourceLabel, getGenericLabel } from "@/lib/agentLabelMapper";
16+
import { getCategoryIcon } from "@/const/marketConfig";
1617

1718
interface MarketAgentDetailModalProps {
1819
visible: boolean;
@@ -97,7 +98,10 @@ export default function MarketAgentDetailModal({
9798
>
9899
{agentDetails?.category ? (
99100
<Tag color="purple" className="inline-flex items-center gap-1">
100-
<span>{agentDetails.category.icon || "📦"}</span>
101+
<span>
102+
{agentDetails.category.icon ||
103+
getCategoryIcon(agentDetails.category.name)}
104+
</span>
101105
<span>
102106
{isZh
103107
? agentDetails.category.display_name_zh

frontend/const/marketConfig.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// ========== Market Configuration Constants ==========
2+
3+
/**
4+
* Default icons for market agent categories
5+
* Maps category name field to their corresponding icons
6+
*/
7+
export const MARKET_CATEGORY_ICONS: Record<string, string> = {
8+
research: "🔬",
9+
content: "✍️",
10+
development: "💻",
11+
business: "📈",
12+
automation: "⚙️",
13+
education: "📚",
14+
communication: "💬",
15+
data: "📊",
16+
creative: "🎨",
17+
other: "📦",
18+
} as const;
19+
20+
/**
21+
* Get icon for a category by name field
22+
* @param categoryName - Category name field (e.g., "research", "content")
23+
* @param fallbackIcon - Fallback icon if category not found (default: 📦)
24+
* @returns Icon emoji string
25+
*/
26+
export function getCategoryIcon(
27+
categoryName: string | null | undefined,
28+
fallbackIcon: string = "📦"
29+
): string {
30+
if (!categoryName) {
31+
return fallbackIcon;
32+
}
33+
34+
return MARKET_CATEGORY_ICONS[categoryName] || fallbackIcon;
35+
}
36+

0 commit comments

Comments
 (0)