Skip to content

Commit

Permalink
stop reposts in media tab
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzius committed Jul 13, 2023
1 parent 470de76 commit fc6176a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 31 deletions.
53 changes: 26 additions & 27 deletions apps/expo/src/app/composer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { useState } from "react";
import { Text, TextInput, TouchableOpacity, View } from "react-native";
import Animated, { FadeIn, FadeOut } from "react-native-reanimated";
import { Stack, useRouter } from "expo-router";
import { useTheme } from "@react-navigation/native";
import { Send } from "lucide-react-native";

import { RichTextWithoutFacets } from "../../components/rich-text";
import { cx } from "../../lib/utils/cx";

export default function ComposerScreen() {
const theme = useTheme();
Expand All @@ -17,6 +18,8 @@ export default function ComposerScreen() {
<View className="flex-1" style={{ backgroundColor: theme.colors.card }}>
<Stack.Screen
options={{
gestureEnabled: !hasContent,
headerTitle: "",
headerLeft: () => (
<TouchableOpacity onPress={() => router.push("../")}>
<Text style={{ color: theme.colors.primary }} className="text-lg">
Expand All @@ -25,36 +28,32 @@ export default function ComposerScreen() {
</TouchableOpacity>
),
headerRight: () => (
<View className="flex-row">
{!hasContent && (
<Animated.View entering={FadeIn} exiting={FadeOut}>
<TouchableOpacity
onPress={() => router.push("/composer/drafts")}
className="mr-6"
>
<Text
style={{ color: theme.colors.primary }}
className="text-lg"
>
Drafts
</Text>
</TouchableOpacity>
</Animated.View>
)}
<TouchableOpacity onPress={() => router.push("../")}>
<Text
style={{ color: theme.colors.primary }}
className="text-lg font-medium"
disabled={!hasContent}
>
Send
<TouchableOpacity
onPress={() => router.push("../")}
disabled={!hasContent}
>
<View
className={cx(
"flex-row items-center rounded-full px-4 py-1",
!hasContent && "opacity-50",
)}
style={{ backgroundColor: theme.colors.primary }}
>
<Text className="mr-2 text-base font-medium text-white dark:text-black">
Post
</Text>
</TouchableOpacity>
</View>
<Send size={12} className="text-white dark:text-black" />
</View>
</TouchableOpacity>
),
}}
/>
<TextInput onChange={(evt) => setContent(evt.nativeEvent.text)} multiline>
<TextInput
onChange={(evt) => setContent(evt.nativeEvent.text)}
multiline
className="min-h-full bg-red-500"
autoFocus
>
<RichTextWithoutFacets text={content} truncate={false} />
</TextInput>
</View>
Expand Down
6 changes: 3 additions & 3 deletions apps/expo/src/components/screens/profile/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ export const useProfilePosts = (
case "likes":
return [{ item, hasReply: false, filter }];
case "media":
return !item.post.embed?.images
? []
: [{ item, hasReply: false, filter }];
return item.post.embed?.images && !item.reason
? [{ item, hasReply: false, filter }]
: [];
}
})
.flat();
Expand Down
2 changes: 1 addition & 1 deletion apps/expo/src/components/screens/profile/profile-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export const ProfileInfo = ({ profile, backButton }: Props) => {
</View>
{profile.description && (
<View className="mt-3" pointerEvents="none">
<RichTextWithoutFacets text={profile.description} />
<RichTextWithoutFacets text={profile.description.trim()} />
</View>
)}
{profile.viewer?.muted && (
Expand Down

0 comments on commit fc6176a

Please sign in to comment.