diff options
Diffstat (limited to 'src/view')
-rw-r--r-- | src/view/com/post/Post.tsx | 8 | ||||
-rw-r--r-- | src/view/shell/Drawer.tsx | 37 | ||||
-rw-r--r-- | src/view/shell/desktop/LeftNav.tsx | 19 |
3 files changed, 63 insertions, 1 deletions
diff --git a/src/view/com/post/Post.tsx b/src/view/com/post/Post.tsx index f41f48e40..58cb40f71 100644 --- a/src/view/com/post/Post.tsx +++ b/src/view/com/post/Post.tsx @@ -43,11 +43,13 @@ export function Post({ showReplyLine, hideTopBorder, style, + onBeforePress, }: { post: AppBskyFeedDefs.PostView showReplyLine?: boolean hideTopBorder?: boolean style?: StyleProp<ViewStyle> + onBeforePress?: () => void }) { const moderationOpts = useModerationOpts() const record = useMemo<AppBskyFeedPost.Record | undefined>( @@ -85,6 +87,7 @@ export function Post({ showReplyLine={showReplyLine} hideTopBorder={hideTopBorder} style={style} + onBeforePress={onBeforePress} /> ) } @@ -99,6 +102,7 @@ function PostInner({ showReplyLine, hideTopBorder, style, + onBeforePress: outerOnBeforePress, }: { post: Shadow<AppBskyFeedDefs.PostView> record: AppBskyFeedPost.Record @@ -107,6 +111,7 @@ function PostInner({ showReplyLine?: boolean hideTopBorder?: boolean style?: StyleProp<ViewStyle> + onBeforePress?: () => void }) { const queryClient = useQueryClient() const pal = usePalette('default') @@ -142,7 +147,8 @@ function PostInner({ const onBeforePress = useCallback(() => { unstableCacheProfileView(queryClient, post.author) - }, [queryClient, post.author]) + outerOnBeforePress?.() + }, [queryClient, post.author, outerOnBeforePress]) const [hover, setHover] = useState(false) return ( diff --git a/src/view/shell/Drawer.tsx b/src/view/shell/Drawer.tsx index 79d8a21ae..10817407f 100644 --- a/src/view/shell/Drawer.tsx +++ b/src/view/shell/Drawer.tsx @@ -30,6 +30,7 @@ import { Bell_Filled_Corner0_Rounded as BellFilled, Bell_Stroke2_Corner0_Rounded as Bell, } from '#/components/icons/Bell' +import {Bookmark, BookmarkFilled} from '#/components/icons/Bookmark' import {BulletList_Stroke2_Corner0_Rounded as List} from '#/components/icons/BulletList' import { Hashtag_Filled_Corner0_Rounded as HashtagFilled, @@ -150,6 +151,7 @@ let DrawerContent = ({}: React.PropsWithoutRef<{}>): React.ReactNode => { isAtHome, isAtSearch, isAtFeeds, + isAtBookmarks, isAtNotifications, isAtMyProfile, isAtMessages, @@ -231,6 +233,11 @@ let DrawerContent = ({}: React.PropsWithoutRef<{}>): React.ReactNode => { setDrawerOpen(false) }, [navigation, setDrawerOpen]) + const onPressBookmarks = React.useCallback(() => { + navigation.navigate('Bookmarks') + setDrawerOpen(false) + }, [navigation, setDrawerOpen]) + const onPressSettings = React.useCallback(() => { navigation.navigate('Settings') setDrawerOpen(false) @@ -292,6 +299,10 @@ let DrawerContent = ({}: React.PropsWithoutRef<{}>): React.ReactNode => { /> <FeedsMenuItem isActive={isAtFeeds} onPress={onPressMyFeeds} /> <ListsMenuItem onPress={onPressLists} /> + <BookmarksMenuItem + isActive={isAtBookmarks} + onPress={onPressBookmarks} + /> <ProfileMenuItem isActive={isAtMyProfile} onPress={onPressProfile} @@ -538,6 +549,32 @@ let ListsMenuItem = ({onPress}: {onPress: () => void}): React.ReactNode => { } ListsMenuItem = React.memo(ListsMenuItem) +let BookmarksMenuItem = ({ + isActive, + onPress, +}: { + isActive: boolean + onPress: () => void +}): React.ReactNode => { + const {_} = useLingui() + const t = useTheme() + + return ( + <MenuItem + icon={ + isActive ? ( + <BookmarkFilled style={[t.atoms.text]} width={iconWidth} /> + ) : ( + <Bookmark style={[t.atoms.text]} width={iconWidth} /> + ) + } + label={_(msg`Saved`)} + onPress={onPress} + /> + ) +} +BookmarksMenuItem = React.memo(BookmarksMenuItem) + let ProfileMenuItem = ({ isActive, onPress, diff --git a/src/view/shell/desktop/LeftNav.tsx b/src/view/shell/desktop/LeftNav.tsx index cf1ff8425..c1e429c73 100644 --- a/src/view/shell/desktop/LeftNav.tsx +++ b/src/view/shell/desktop/LeftNav.tsx @@ -40,6 +40,7 @@ import { Bell_Filled_Corner0_Rounded as BellFilled, Bell_Stroke2_Corner0_Rounded as Bell, } from '#/components/icons/Bell' +import {Bookmark, BookmarkFilled} from '#/components/icons/Bookmark' import { BulletList_Filled_Corner0_Rounded as ListFilled, BulletList_Stroke2_Corner0_Rounded as List, @@ -744,6 +745,24 @@ export function DesktopLeftNav() { label={_(msg`Lists`)} /> <NavItem + href="/saved" + icon={ + <Bookmark + style={pal.text} + aria-hidden={true} + width={NAV_ICON_WIDTH} + /> + } + iconFilled={ + <BookmarkFilled + style={pal.text} + aria-hidden={true} + width={NAV_ICON_WIDTH} + /> + } + label={_(msg`Saved`)} + /> + <NavItem href={currentAccount ? makeProfileLink(currentAccount) : '/'} icon={ <UserCircle |