From f600ebbca9f9de4264cb33a6650a76b9e9215fc5 Mon Sep 17 00:00:00 2001 From: Innei Date: Thu, 20 Mar 2025 14:19:25 +0800 Subject: [PATCH] fix(mobile): hide UserAvatar preview - Replaced the noPreview prop with a new preview prop in the UserAvatar component, defaulting to true. - Updated the rendering logic to conditionally display the avatar based on the preview prop. - Adjusted instances of UserAvatar in EntryReadHistory and action.tsx to utilize the new preview prop. These changes enhance the flexibility of the UserAvatar component by allowing for more controlled rendering behavior. Signed-off-by: Innei --- apps/mobile/src/components/ui/avatar/UserAvatar.tsx | 11 ++++++----- .../src/modules/entry-content/EntryReadHistory.tsx | 2 +- apps/mobile/src/modules/screen/action.tsx | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/mobile/src/components/ui/avatar/UserAvatar.tsx b/apps/mobile/src/components/ui/avatar/UserAvatar.tsx index 93f0b37d7..da569ef28 100644 --- a/apps/mobile/src/components/ui/avatar/UserAvatar.tsx +++ b/apps/mobile/src/components/ui/avatar/UserAvatar.tsx @@ -12,7 +12,8 @@ interface UserAvatarProps { name?: string | null className?: string color?: string - noPreview?: boolean + + preview?: boolean } export const UserAvatar = ({ @@ -21,7 +22,7 @@ export const UserAvatar = ({ name, className, color, - noPreview, + preview = true, }: UserAvatarProps) => { if (!image) { return ( @@ -60,11 +61,11 @@ export const UserAvatar = ({ /> ) - return noPreview ? ( - imageContent - ) : ( + return preview ? ( {imageContent} + ) : ( + imageContent ) } diff --git a/apps/mobile/src/modules/entry-content/EntryReadHistory.tsx b/apps/mobile/src/modules/entry-content/EntryReadHistory.tsx index 6451c3286..60b15e063 100644 --- a/apps/mobile/src/modules/entry-content/EntryReadHistory.tsx +++ b/apps/mobile/src/modules/entry-content/EntryReadHistory.tsx @@ -61,7 +61,7 @@ export const EntryReadHistory = ({ entryId }: { entryId: string }) => { ], }} > - + ) })} diff --git a/apps/mobile/src/modules/screen/action.tsx b/apps/mobile/src/modules/screen/action.tsx index d059ff4e6..52123a44b 100644 --- a/apps/mobile/src/modules/screen/action.tsx +++ b/apps/mobile/src/modules/screen/action.tsx @@ -46,7 +46,7 @@ export function HomeLeftAction() { name={user?.name} className="rounded-full" color={accentColor} - noPreview + preview={false} />