diff --git a/mobile/app/[account]/index.tsx b/mobile/app/[account]/index.tsx index 9602023..8f677d5 100644 --- a/mobile/app/[account]/index.tsx +++ b/mobile/app/[account]/index.tsx @@ -44,11 +44,16 @@ export default function Page() { try { setLoading("Loading account..."); const response = await search.getJsonUserByName(accountName); - setUser(response); if (!response) { + setUser(undefined); setError(`The account '${accountName}' does not exist.`); return; + } else { + // TODO: add avatar to indexer and avoid querying on chain + const user = await userCache.getUser(response.address); + response.avatar = user.avatar; + setUser(response); } const { followers } = await search.GetJsonFollowers(response.address); diff --git a/mobile/components/view/account/index.tsx b/mobile/components/view/account/index.tsx index b791619..11ca7b5 100644 --- a/mobile/components/view/account/index.tsx +++ b/mobile/components/view/account/index.tsx @@ -1,11 +1,11 @@ import { useMemo } from "react"; -import { Image, StyleSheet, TouchableOpacity, View } from "react-native"; +import { StyleSheet, TouchableOpacity, View } from "react-native"; import Text from "@gno/components/text"; -import Layout from "@gno/components/layout"; import { colors } from "@gno/styles/colors"; import Button from "@gno/components/button"; import { Following, Post, User } from "@gno/types"; import FeedView from "../feed/feed-view"; +import Avatar from "@gno/components/avatar/avatar"; interface Props { onPressFollowing: () => void; @@ -39,11 +39,13 @@ function AccountView(props: Props) { const isFollowed = useMemo(() => followers.find((f) => f.address === currentUser.address) != null, [user, followers]); + const avarUri = user.avatar ? user.avatar : "https://www.gravatar.com/avatar/tmp"; + return ( <> - +