Dont show save button in embed cards

zio/stable
Paul Frazee 2023-05-17 14:34:37 -05:00
parent fb03bbf288
commit 4e56d24a9d
3 changed files with 24 additions and 16 deletions

View File

@ -24,11 +24,13 @@ export const CustomFeed = observer(
({
item,
style,
showSaveBtn = false,
showLikes = false,
reloadOnFocus = false,
}: {
item: CustomFeedModel
style?: StyleProp<ViewStyle>
showSaveBtn?: boolean
showLikes?: boolean
reloadOnFocus?: boolean
}) => {
@ -66,21 +68,22 @@ export const CustomFeed = observer(
<Text style={[pal.text, s.bold]}>
{item.data.displayName ?? 'Feed name'}
</Text>
<Text style={[pal.textLight]}>by @{item.data.creator.handle}</Text>
</View>
<View>
<Button
type={item.isSaved ? 'default' : 'inverted'}
onPress={() => {
if (item.data.viewer?.saved) {
store.me.savedFeeds.unsave(item)
} else {
store.me.savedFeeds.save(item)
}
}}
label={item.data.viewer?.saved ? 'Unsave' : 'Save'}
/>
</View>
{showSaveBtn && (
<View>
<Button
type={item.isSaved ? 'default' : 'inverted'}
onPress={() => {
if (item.data.viewer?.saved) {
store.me.savedFeeds.unsave(item)
} else {
store.me.savedFeeds.save(item)
}
}}
label={item.data.viewer?.saved ? 'Unsave' : 'Save'}
/>
</View>
)}
</View>
{item.data.description ? (

View File

@ -19,7 +19,12 @@ export const SavedFeedItem = observer(
return (
<View style={styles.itemContainer}>
<CustomFeed key={item.data.uri} item={item} style={styles.item} />
<CustomFeed
key={item.data.uri}
item={item}
style={styles.item}
showSaveBtn
/>
<TouchableOpacity
accessibilityRole="button"
onPress={() => {

View File

@ -189,7 +189,7 @@ export const ProfileScreen = withAuthRequired(
<FeedSlice slice={item} ignoreMuteFor={uiState.profile.did} />
)
} else if (item instanceof CustomFeedModel) {
return <CustomFeed item={item} showLikes />
return <CustomFeed item={item} showSaveBtn showLikes />
}
}
return <View />