Files
jiang13-bbs/frontend/lib/badgeIcons.ts
freefire 4ae57d9392 feat: 用户徽章与等级体系,积分经济管理重构
- 新增徽章系统:badge 服务与 handler、管理端配置页、BadgeChip/LevelBadge 展示组件
- 新增等级模型:model/level 及前端 levels 元数据
- 管理端经济模块拆分为 points/badges/levels 独立页面,EconomySettings 迁入设置
- 积分、签到、评论等服务适配等级与徽章逻辑
2026-09-25 16:38:29 +08:00

48 lines
929 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { LucideIcon } from "lucide-react";
import {
Medal,
Award,
Trophy,
Crown,
Star,
Heart,
Zap,
Flame,
Gem,
Shield,
Rocket,
Sparkles,
ThumbsUp,
BookOpen,
Code,
Wrench,
} from "lucide-react";
/**
* 徽章图标白名单:后台管理以 lucide 图标名存储,前端仅渲染此表内的图标,
* 未知/空名回落 Medal(与后端 model.Badge.Icon 注释约定一致)。
*/
export const BADGE_ICONS: Record<string, LucideIcon> = {
medal: Medal,
award: Award,
trophy: Trophy,
crown: Crown,
star: Star,
heart: Heart,
zap: Zap,
flame: Flame,
gem: Gem,
shield: Shield,
rocket: Rocket,
sparkles: Sparkles,
thumbs_up: ThumbsUp,
book_open: BookOpen,
code: Code,
wrench: Wrench,
};
/** 取徽章图标组件;未知/空名回落 Medal */
export function badgeIcon(name?: string | null): LucideIcon {
return (name && BADGE_ICONS[name]) || Medal;
}