fix: restore comment icon visibility for memos with no comments

The comment icon in MemoHeader was completely hidden when commentAmount
was 0 due to conditional rendering (introduced in 62646853). This
restores the previous behavior where the icon is rendered but hidden
via CSS, appearing on hover (desktop) so users can navigate to the
detail page to write the first comment.

Fixes #5592

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ZLX 2026-02-09 20:02:13 +08:00
parent b623162d37
commit 90d498f5f9
2 changed files with 9 additions and 3 deletions

3
.gitignore vendored
View File

@ -27,3 +27,6 @@ dist
# Git worktrees
.worktrees/
# Claude Code
CLAUDE.md

View File

@ -52,15 +52,18 @@ const MemoHeader: React.FC<MemoHeaderProps> = ({ showCreator, showVisibility, sh
/>
)}
{!isInMemoDetailPage && commentAmount > 0 && (
{!isInMemoDetailPage && (
<Link
className={cn("flex flex-row justify-start items-center rounded-md px-1 hover:opacity-80 gap-0.5")}
className={cn(
"flex flex-row justify-start items-center rounded-md px-1 hover:opacity-80 gap-0.5",
commentAmount === 0 && "hidden sm:group-hover:flex",
)}
to={`/${memo.name}#comments`}
viewTransition
state={{ from: parentPage }}
>
<MessageCircleMoreIcon className="w-4 h-4 mx-auto text-muted-foreground" />
<span className="text-xs text-muted-foreground">{commentAmount}</span>
{commentAmount > 0 && <span className="text-xs text-muted-foreground">{commentAmount}</span>}
</Link>
)}