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 <tukon479@gmail.com>
This commit is contained in:
Innei
2025-03-20 14:19:25 +08:00
parent 18eef52fdb
commit f600ebbca9
3 changed files with 8 additions and 7 deletions
@@ -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 ? (
<Galeria urls={[image]}>
<Galeria.Image index={0}>{imageContent}</Galeria.Image>
</Galeria>
) : (
imageContent
)
}
@@ -61,7 +61,7 @@ export const EntryReadHistory = ({ entryId }: { entryId: string }) => {
],
}}
>
<UserAvatar size={25} name={user.name!} image={user.image} />
<UserAvatar preview={false} size={25} name={user.name!} image={user.image} />
</Pressable>
)
})}
+1 -1
View File
@@ -46,7 +46,7 @@ export function HomeLeftAction() {
name={user?.name}
className="rounded-full"
color={accentColor}
noPreview
preview={false}
/>
</TouchableOpacity>
</ActionGroup>