Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

♻️ refactor(taskTemplate): use string icon identifiers (#14302)

YuTengjinga099749b4113
diff --git a/packages/const/src/taskTemplate.ts b/packages/const/src/taskTemplate.ts
index 6c2e77f43ad..1ca3cdae953 100644
--- a/packages/const/src/taskTemplate.ts
+++ b/packages/const/src/taskTemplate.ts
@@ -1,7 +1,3 @@
-import type { IconType } from '@icons-pack/react-simple-icons';
-import { SiGithub } from '@icons-pack/react-simple-icons';
-import type { LucideIcon } from 'lucide-react';
-
/**
* Task Template catalog used by home "Try following tasks" recommendation.
* I18n keys: `taskTemplate:${id}.title|description|prompt`.
@@ -9,11 +5,21 @@ import type { LucideIcon } from 'lucide-react';
* `interests` values must be keys from `INTEREST_AREAS` in
* `src/routes/onboarding/config.ts` — that's what `users.interests` stores.
*/
+
+/**
+ * Identifier for a per-template icon override. The renderer maps each value to
+ * a concrete icon component; keep this union small and stable so consumers can
+ * exhaustively type their registries.
+ */
+export const TASK_TEMPLATE_ICONS = ['github'] as const;
+
+export type TaskTemplateIcon = (typeof TASK_TEMPLATE_ICONS)[number];
+
export interface TaskTemplate {
category: TaskTemplateCategory;
cronPattern: string;
- /** Per-template icon override. Falls back to a category-level default when omitted. */
- icon?: IconType | LucideIcon;
+ /** Optional icon identifier; consumers resolve it to a component. */
+ icon?: TaskTemplateIcon;
id: string;
interests: string[];
/** Skills that enrich the brief but are not required to run it. */
@@ -114,7 +120,7 @@ export const taskTemplates: TaskTemplate[] = [
id: 'oss-intel-daily',
category: 'engineering',
cronPattern: '0 9 * * *',
- icon: SiGithub,
+ icon: 'github',
interests: ['coding'],
},
{
diff --git a/src/business/client/RecommendTaskTemplates.tsx b/src/business/client/RecommendTaskTemplates.tsx
index e372b7ddf31..3431a209b8f 100644
--- a/src/business/client/RecommendTaskTemplates.tsx
+++ b/src/business/client/RecommendTaskTemplates.tsx
@@ -1,5 +1,3 @@
import { memo } from 'react';
-const RecommendTaskTemplates = memo(() => null);
-
-export default RecommendTaskTemplates;
+export const RecommendTaskTemplates = memo(() => null);
diff --git a/src/routes/(main)/home/features/index.tsx b/src/routes/(main)/home/features/index.tsx
index f5fce3e91c1..b089cb5c4bc 100644
--- a/src/routes/(main)/home/features/index.tsx
+++ b/src/routes/(main)/home/features/index.tsx
@@ -3,7 +3,7 @@
import { Flexbox } from '@lobehub/ui';
import { memo } from 'react';
-import RecommendTaskTemplates from '@/business/client/RecommendTaskTemplates';
+import { RecommendTaskTemplates } from '@/business/client/RecommendTaskTemplates';
import DailyBrief from '@/features/DailyBrief';
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
import { useUserStore } from '@/store/user';