drag to rearrange pinned items
This commit is contained in:
parent
139027ac5f
commit
53ca0cd626
7 changed files with 256 additions and 39 deletions
|
@ -24,13 +24,11 @@ const AlgoItem = observer(
|
|||
item,
|
||||
style,
|
||||
showBottom = true,
|
||||
onLongPress,
|
||||
reloadOnFocus = false,
|
||||
}: {
|
||||
item: AlgoItemModel
|
||||
style?: StyleProp<ViewStyle>
|
||||
showBottom?: boolean
|
||||
onLongPress?: () => void
|
||||
reloadOnFocus?: boolean
|
||||
}) => {
|
||||
const store = useStores()
|
||||
|
@ -54,7 +52,6 @@ const AlgoItem = observer(
|
|||
rkey: item.data.uri,
|
||||
})
|
||||
}}
|
||||
onLongPress={onLongPress}
|
||||
key={item.data.uri}>
|
||||
<View style={[styles.headerContainer]}>
|
||||
<View style={[s.mr10]}>
|
||||
|
@ -64,8 +61,9 @@ const AlgoItem = observer(
|
|||
<Text style={[pal.text, s.bold]}>
|
||||
{item.data.displayName ?? 'Feed name'}
|
||||
</Text>
|
||||
<Text style={[pal.textLight, styles.description]}>
|
||||
{item.data.description ?? 'Feed description'}
|
||||
<Text style={[pal.textLight, styles.description]} numberOfLines={5}>
|
||||
{item.data.description ??
|
||||
"Explore our Feed for the latest updates and insights! Dive into a world of intriguing articles, trending news, and exciting stories that cover a wide range of topics. From technology breakthroughs to lifestyle tips, there's something here for everyone. Stay informed and get inspired with us. Join the conversation now!"}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
|
50
src/view/com/algos/SavedFeedItem.tsx
Normal file
50
src/view/com/algos/SavedFeedItem.tsx
Normal file
|
@ -0,0 +1,50 @@
|
|||
import React from 'react'
|
||||
import {View, TouchableOpacity, StyleSheet} from 'react-native'
|
||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||
import {colors} from 'lib/styles'
|
||||
import {observer} from 'mobx-react-lite'
|
||||
import {AlgoItemModel} from 'state/models/feeds/algo/algo-item'
|
||||
import {SavedFeedsModel} from 'state/models/feeds/algo/saved'
|
||||
import AlgoItem from './AlgoItem'
|
||||
|
||||
export const SavedFeedItem = observer(
|
||||
({item, savedFeeds}: {item: AlgoItemModel; savedFeeds: SavedFeedsModel}) => {
|
||||
const isPinned = savedFeeds.isPinned(item)
|
||||
|
||||
return (
|
||||
<View style={styles.itemContainer}>
|
||||
<AlgoItem
|
||||
key={item.data.uri}
|
||||
item={item}
|
||||
showBottom={false}
|
||||
style={styles.item}
|
||||
/>
|
||||
<TouchableOpacity
|
||||
accessibilityRole="button"
|
||||
onPress={() => {
|
||||
savedFeeds.togglePinnedFeed(item)
|
||||
console.log('pinned', savedFeeds.pinned)
|
||||
console.log('isPinned', savedFeeds.isPinned(item))
|
||||
}}>
|
||||
<FontAwesomeIcon
|
||||
icon="thumb-tack"
|
||||
size={20}
|
||||
color={isPinned ? colors.blue3 : colors.gray3}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
itemContainer: {
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
marginRight: 18,
|
||||
},
|
||||
item: {
|
||||
borderTopWidth: 0,
|
||||
},
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue