Skip to content

Commit

Permalink
fix: gno ns + back return to feed
Browse files Browse the repository at this point in the history
  • Loading branch information
hthieu1110 committed Aug 9, 2023
1 parent 750d97e commit 794f182
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ export const SocialThreadCard: React.FC<{
const userInfo = useNSUserInfo(wallet?.userId);
const navigation = useAppNavigation();
const metadata: SocialFeedMetadata = JSON.parse(localPost.metadata);
const username = authorNSInfo?.metadata?.tokenId
? authorNSInfo?.metadata?.tokenId
: userAddress;
const username = authorNSInfo?.metadata?.tokenId || userAddress;

//TODO: Handle this later
// const communityHashtag = useMemo(() => {
Expand Down
2 changes: 2 additions & 0 deletions packages/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ export const getUserId = (
const network = getNetwork(networkId);
if (network?.kind === NetworkKind.Gno && address.startsWith("gno.land/")) {
address = address.substring("gno.land/".length).replaceAll("/", "-");
} else if (address.includes("-")) {
address = address.split("-")[1];
}
return `${network?.idPrefix}-${address}`;
};
Expand Down
4 changes: 3 additions & 1 deletion packages/screens/FeedPostView/FeedPostViewScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const FeedPostViewScreen: ScreenFC<"FeedPostView"> = ({
const authorNSInfo = useNSUserInfo(
getUserId(selectedNetworkId, postResult?.post_by)
);

const [, userAddress] = parseUserId(postResult?.post_by);
const feedInputRef = useRef<NewsFeedInputHandle>(null);
const [replyTo, setReplyTo] = useState<ReplyToType>();
Expand Down Expand Up @@ -172,7 +173,8 @@ export const FeedPostViewScreen: ScreenFC<"FeedPostView"> = ({
<BrandText style={fontSemibold20}>{headerLabel}</BrandText>
}
onBackPress={() =>
postResult?.parent_post_identifier
postResult?.parent_post_identifier &&
postResult?.parent_post_identifier !== "0"
? navigation.navigate("FeedPostView", {
id: postResult?.parent_post_identifier || "",
})
Expand Down

0 comments on commit 794f182

Please sign in to comment.