Skip to content

Commit

Permalink
Merge pull request #107 from iuricmp:refactor/106
Browse files Browse the repository at this point in the history
refactor: replacing copyrighted words
  • Loading branch information
iuricmp authored Jun 20, 2024
2 parents afaa5ab + e09dbce commit dca5b71
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 38 deletions.
10 changes: 5 additions & 5 deletions mobile/app/post/[post_id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Button from "@gno/components/button";
import Spacer from "@gno/components/spacer";
import Alert from "@gno/components/alert";
import { useGnoNativeContext } from "@gnolang/gnonative";
import { Tweet } from "@gno/components/feed/tweet";
import { PostRow } from "@gno/components/feed/post-row";
import { FlatList, KeyboardAvoidingView, View, Alert as RNAlert } from "react-native";
import { Post } from "@gno/types";
import { useFeed } from "@gno/hooks/use-feed";
Expand Down Expand Up @@ -73,8 +73,8 @@ function Page() {
}
};

const onPressTweet = (item: Post) => {
// TODO: on press a tweet inside the reply thread
const onPressPost = (post: Post) => {
// TODO: on press a post inside the reply thread
};

const onGnod = async (post: Post) => {
Expand Down Expand Up @@ -105,7 +105,7 @@ function Page() {
<Layout.Container>
<Layout.Header title="Post" iconType="back" />
<Layout.Body>
<Tweet post={post} showFooter={false} />
<PostRow post={post} showFooter={false} />

<View style={{ flex: 1 }}>
{loading ? (
Expand All @@ -116,7 +116,7 @@ function Page() {
data={thread}
keyExtractor={(item) => `${item.id}`}
contentContainerStyle={{ width: "100%", paddingBottom: 20 }}
renderItem={({ item }) => <Tweet post={item} onPress={onPressTweet} onGnod={onGnod} />}
renderItem={({ item }) => <PostRow post={item} onPress={onPressPost} onGnod={onGnod} />}
onEndReachedThreshold={0.1}
/>
)}
Expand Down
4 changes: 2 additions & 2 deletions mobile/app/repost/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Button from "@gno/components/button";
import { Tweet } from "@gno/components/feed/tweet";
import { PostRow } from "@gno/components/feed/post-row";
import Layout from "@gno/components/layout";
import TextInput from "@gno/components/textinput";
import { selectPostToReply, useAppSelector } from "@gno/redux";
Expand Down Expand Up @@ -67,7 +67,7 @@ export default function Page() {
style={{ height: 80 }}
/>

<Tweet post={post} showFooter={false} />
<PostRow post={post} showFooter={false} />
</Layout.Body>
</Layout.Container>
);
Expand Down
23 changes: 0 additions & 23 deletions mobile/components/feed/like-button.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import RepostButton from "./repost-button";
import { setPostToReply, useAppDispatch } from "@gno/redux";
import { useRouter } from "expo-router";
import RepostLabel from "./repost-label";
import { TweetRepost } from "./tweet-repost";
import { RepostRow } from "./repost-row";
import GnodLabel from "./gnod-label";

interface FeedProps {
Expand All @@ -20,7 +20,7 @@ interface FeedProps {

const func = () => {};

export function Tweet({ post, onPress = func, onGnod = func, showFooter = true }: FeedProps) {
export function PostRow({ post, onPress = func, onGnod = func, showFooter = true }: FeedProps) {
const router = useRouter();
const dispatch = useAppDispatch();
const isRepost = post?.repost_parent;
Expand Down Expand Up @@ -52,7 +52,7 @@ export function Tweet({ post, onPress = func, onGnod = func, showFooter = true }
</View>

<Text.Body selectable>{post.post}</Text.Body>
{isRepost ? <TweetRepost post={post.repost_parent} onPress={onPress} showFooter={false} /> : null}
{isRepost ? <RepostRow post={post.repost_parent} onPress={onPress} showFooter={false} /> : null}
</View>
</View>
{showFooter ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface FeedProps {

const func = () => {};

export function TweetRepost({ post, onPress = func, showFooter = true }: FeedProps) {
export function RepostRow({ post, onPress = func, showFooter = true }: FeedProps) {
const router = useRouter();
const dispatch = useAppDispatch();

Expand Down Expand Up @@ -52,7 +52,6 @@ export function TweetRepost({ post, onPress = func, showFooter = true }: FeedPro
</View>
{showFooter ? (
<View style={[styles.footer]}>
{/* <LikeButton style={styles.reply} onPressRepost={() => onPressRepost(post)} /> */}
<RepostButton style={styles.reply} post={post} onPressRepost={onPressRepost} />
<RepliesLabel replyCount={post.n_replies} style={styles.reply} />
</View>
Expand Down
4 changes: 2 additions & 2 deletions mobile/components/view/feed/feed-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Layout from "@gno/components/layout";
import { Post } from "@gno/types";
import useScrollToTop from "@gno/components/utils/useScrollToTopWithOffset";
import EmptyFeedList from "@gno/components/feed/empty-feed-list";
import { Tweet } from "@gno/components/feed/tweet";
import { PostRow } from "@gno/components/feed/post-row";

type Props = {
totalPosts: number;
Expand Down Expand Up @@ -118,7 +118,7 @@ export default function FeedView({ totalPosts, onPress, onGnod, address, type }:
ListEmptyComponent={<EmptyFeedList />}
keyExtractor={(item) => `${item.id}`}
contentContainerStyle={styles.flatListContent}
renderItem={({ item }) => <Tweet post={item} onPress={onPress} onGnod={onGnod} />}
renderItem={({ item }) => <PostRow post={item} onPress={onPress} onGnod={onGnod} />}
onEndReached={handleEndReached}
onEndReachedThreshold={0.1}
/>
Expand Down
2 changes: 1 addition & 1 deletion mobile/src/hooks/use-feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useUserCache } from "./use-user-cache";
import useGnoJsonParser from "./use-gno-json-parser";
import { useIndexerContext } from "@gno/provider/indexer-provider";
import { Alert } from "react-native";
import base64 from "base-64";

interface ThreadPosts {
data: Post[];
n_posts: number;
Expand Down

0 comments on commit dca5b71

Please sign in to comment.