diff --git a/web/src/features/skill/skill-card.tsx b/web/src/features/skill/skill-card.tsx
index 7c20e776..8cd1e162 100644
--- a/web/src/features/skill/skill-card.tsx
+++ b/web/src/features/skill/skill-card.tsx
@@ -4,6 +4,7 @@ import { useAuth } from '@/features/auth/use-auth'
import { useStar } from '@/features/social/use-star'
import { Card } from '@/shared/ui/card'
import { NamespaceBadge } from '@/shared/components/namespace-badge'
+import { Bookmark } from 'lucide-react'
interface SkillCardProps {
skill: SkillSummary
@@ -11,10 +12,10 @@ interface SkillCardProps {
highlightStarred?: boolean
}
-export function SkillCard({ skill, onClick, highlightStarred = false }: SkillCardProps) {
+export function SkillCard({ skill, onClick, highlightStarred = true }: SkillCardProps) {
const { t } = useTranslation()
const { isAuthenticated } = useAuth()
- const { data: starStatus } = useStar(skill.id)
+ const { data: starStatus } = useStar(skill.id, highlightStarred && isAuthenticated)
const showStarredBadge = highlightStarred && isAuthenticated && starStatus?.starred
return (
@@ -32,7 +33,8 @@ export function SkillCard({ skill, onClick, highlightStarred = false }: SkillCar
{skill.displayName}
{showStarredBadge ? (
-
+
+
{t('skillCard.starred')}
) : null}
@@ -56,20 +58,20 @@ export function SkillCard({ skill, onClick, highlightStarred = false }: SkillCar
- {t('skillCard.downloads', { count: skill.downloadCount })}
+ {skill.downloadCount}
- {t('skillCard.stars', { count: skill.starCount })}
+ {skill.starCount}
{skill.ratingAvg !== undefined && skill.ratingCount > 0 && (
- {t('skillCard.rating', { score: skill.ratingAvg.toFixed(1), count: skill.ratingCount })}
+ {skill.ratingAvg.toFixed(1)}
)}
diff --git a/web/src/features/social/star-button.tsx b/web/src/features/social/star-button.tsx
index 0d6c06fd..f72ac481 100644
--- a/web/src/features/social/star-button.tsx
+++ b/web/src/features/social/star-button.tsx
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next'
import { Button } from '@/shared/ui/button'
import { useStar, useToggleStar } from './use-star'
-import { Star } from 'lucide-react'
+import { Bookmark } from 'lucide-react'
import { useAuth } from '@/features/auth/use-auth'
interface StarButtonProps {
@@ -34,10 +34,11 @@ export function StarButton({ skillId, starCount, onRequireLogin }: StarButtonPro
)
diff --git a/web/src/features/social/use-star.ts b/web/src/features/social/use-star.ts
index f5ab55e1..d12331b6 100644
--- a/web/src/features/social/use-star.ts
+++ b/web/src/features/social/use-star.ts
@@ -31,11 +31,11 @@ async function toggleStar(skillId: number, starred: boolean): Promise {
}
}
-export function useStar(skillId: number) {
+export function useStar(skillId: number, enabled = true) {
return useQuery({
queryKey: ['skills', skillId, 'star'],
queryFn: () => getStarStatus(skillId),
- enabled: !!skillId,
+ enabled: !!skillId && enabled,
})
}
diff --git a/web/src/i18n/locales/en.json b/web/src/i18n/locales/en.json
index ee124489..1f4cf42b 100644
--- a/web/src/i18n/locales/en.json
+++ b/web/src/i18n/locales/en.json
@@ -416,10 +416,7 @@
"star": "Star"
},
"skillCard": {
- "starred": "Starred",
- "downloads": "{{count}} downloads",
- "stars": "{{count}} stars",
- "rating": "Rating {{score}} ({{count}})"
+ "starred": "Starred"
},
"copyButton": {
"copied": "Copied",
diff --git a/web/src/i18n/locales/zh.json b/web/src/i18n/locales/zh.json
index 69057f8d..9e71b83e 100644
--- a/web/src/i18n/locales/zh.json
+++ b/web/src/i18n/locales/zh.json
@@ -416,10 +416,7 @@
"star": "收藏"
},
"skillCard": {
- "starred": "已收藏",
- "downloads": "下载 {{count}}",
- "stars": "收藏 {{count}}",
- "rating": "评分 {{score}} ({{count}})"
+ "starred": "已收藏"
},
"copyButton": {
"copied": "已复制",