Skip to content

Commit c13f887

Browse files
yun-zhi-ztlvsxd
authored andcommitted
fix(web): remove starred badge from skill card
The starred badge in the top-right corner of skill cards looked cluttered. Removed it while keeping the subtle star highlight in the bottom stats area.
1 parent 8b9128e commit c13f887

File tree

1 file changed

+5
-47
lines changed

1 file changed

+5
-47
lines changed
Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import { useState } from 'react'
2-
import { useTranslation } from 'react-i18next'
31
import type { SkillSummary } from '@/api/types'
42
import { useAuth } from '@/features/auth/use-auth'
5-
import { useStar, useToggleStar } from '@/features/social/use-star'
6-
import { ConfirmDialog } from '@/shared/components/confirm-dialog'
3+
import { useStar } from '@/features/social/use-star'
74
import { Card } from '@/shared/ui/card'
85
import { NamespaceBadge } from '@/shared/components/namespace-badge'
96
import { getHeadlineVersion } from '@/shared/lib/skill-lifecycle'
@@ -17,29 +14,13 @@ interface SkillCardProps {
1714
}
1815

1916
export function SkillCard({ skill, onClick, highlightStarred = true }: SkillCardProps) {
20-
const { t } = useTranslation()
2117
const { isAuthenticated } = useAuth()
22-
const [confirmOpen, setConfirmOpen] = useState(false)
2318
const { data: starStatus } = useStar(skill.id, highlightStarred && isAuthenticated)
24-
const toggleStarMutation = useToggleStar(skill.id)
25-
const showStarredBadge = highlightStarred && isAuthenticated && starStatus?.starred
19+
const showStarredHighlight = highlightStarred && isAuthenticated && starStatus?.starred
2620
const headlineVersion = getHeadlineVersion(skill)
2721

28-
const handleStarredBadgeClick = (event: React.MouseEvent<HTMLButtonElement>) => {
29-
event.stopPropagation()
30-
setConfirmOpen(true)
31-
}
32-
33-
const handleConfirmUnstar = async () => {
34-
if (!starStatus?.starred) {
35-
return
36-
}
37-
await toggleStarMutation.mutateAsync(starStatus.starred)
38-
}
39-
4022
return (
41-
<>
42-
<Card
23+
<Card
4324
className="h-full p-5 cursor-pointer group relative overflow-hidden bg-white border shadow-sm transition-shadow hover:shadow-md"
4425
style={{ borderColor: 'hsl(var(--border-card))' }}
4526
onClick={onClick}
@@ -52,18 +33,6 @@ export function SkillCard({ skill, onClick, highlightStarred = true }: SkillCard
5233
</h3>
5334
</div>
5435
<div className="flex items-center gap-2">
55-
{showStarredBadge ? (
56-
<button
57-
type="button"
58-
className="inline-flex items-center gap-1 rounded-full border border-primary/25 bg-primary/12 px-2.5 py-1 text-[11px] font-semibold text-primary shadow-sm transition-colors hover:bg-primary/18"
59-
aria-label={t('skillCard.starred')}
60-
title={t('skillCard.starredAction')}
61-
onClick={handleStarredBadgeClick}
62-
>
63-
<Bookmark className="h-3.5 w-3.5 fill-current" />
64-
{t('skillCard.starred')}
65-
</button>
66-
) : null}
6736
<NamespaceBadge type="TEAM" name={`@${skill.namespace}`} />
6837
</div>
6938
</div>
@@ -87,10 +56,9 @@ export function SkillCard({ skill, onClick, highlightStarred = true }: SkillCard
8756
{formatCompactCount(skill.downloadCount)}
8857
</span>
8958
<span
90-
className={`flex items-center gap-1 ${showStarredBadge ? 'font-semibold text-primary' : ''}`}
91-
aria-label={showStarredBadge ? t('skillCard.starred') : undefined}
59+
className={`flex items-center gap-1 ${showStarredHighlight ? 'font-semibold text-primary' : ''}`}
9260
>
93-
<Bookmark className={`w-3.5 h-3.5 ${showStarredBadge ? 'fill-current' : ''}`} />
61+
<Bookmark className={`w-3.5 h-3.5 ${showStarredHighlight ? 'fill-current' : ''}`} />
9462
{skill.starCount}
9563
</span>
9664
{skill.ratingAvg !== undefined && skill.ratingCount > 0 && (
@@ -104,15 +72,5 @@ export function SkillCard({ skill, onClick, highlightStarred = true }: SkillCard
10472
</div>
10573
</div>
10674
</Card>
107-
108-
<ConfirmDialog
109-
open={confirmOpen}
110-
onOpenChange={setConfirmOpen}
111-
title={t('skillCard.unstarTitle')}
112-
description={t('skillCard.unstarDescription', { name: skill.displayName })}
113-
confirmText={t('skillCard.unstarConfirm')}
114-
onConfirm={handleConfirmUnstar}
115-
/>
116-
</>
11775
)
11876
}

0 commit comments

Comments
 (0)