diff --git a/src/view/shell/desktop/Feeds.tsx b/src/view/shell/desktop/Feeds.tsx index 641b90f3e3..b8a53982b0 100644 --- a/src/view/shell/desktop/Feeds.tsx +++ b/src/view/shell/desktop/Feeds.tsx @@ -1,4 +1,4 @@ -import {View} from 'react-native' +import {Pressable, View} from 'react-native' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useNavigation, useNavigationState} from '@react-navigation/native' @@ -7,10 +7,18 @@ import {getCurrentRoute} from '#/lib/routes/helpers' import {type NavigationProp} from '#/lib/routes/types' import {logger} from '#/logger' import {emitSoftReset} from '#/state/events' -import {usePinnedFeedsInfos} from '#/state/queries/feed' +import { + type SavedFeedSourceInfo, + usePinnedFeedsInfos, +} from '#/state/queries/feed' import {useSelectedFeed, useSetSelectedFeed} from '#/state/shell/selected-feed' +import {UserAvatar} from '#/view/com/util/UserAvatar' import {atoms as a, useTheme, web} from '#/alf' -import {createStaticClick, InlineLinkText} from '#/components/Link' +import {useInteractionState} from '#/components/hooks/useInteractionState' +import {FilterTimeline_Stroke2_Corner0_Rounded as FilterTimeline} from '#/components/icons/FilterTimeline' +import {PlusSmall_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus' +import {Link} from '#/components/Link' +import {Text} from '#/components/Typography' export function DesktopFeeds() { const t = useTheme() @@ -57,13 +65,12 @@ export function DesktopFeeds() { style={[ a.flex_1, web({ - gap: 10, + gap: 2, /* * Small padding prevents overflow prior to actually overflowing the * height of the screen with lots of feeds. */ paddingVertical: 2, - marginHorizontal: -2, overflowY: 'auto', }), ]}> @@ -72,10 +79,11 @@ export function DesktopFeeds() { const current = route.name === 'Home' && feed === selectedFeed return ( - { + feedInfo={feedInfo} + current={current} + onPress={() => { logger.metric( 'desktopFeeds:feed:click', { @@ -89,39 +97,133 @@ export function DesktopFeeds() { if (route.name === 'Home' && feed === selectedFeed) { emitSoftReset() } - })} - style={[ - a.text_md, - a.leading_snug, - a.flex_shrink_0, - current - ? [a.font_semi_bold, t.atoms.text] - : [t.atoms.text_contrast_medium], - web({ - marginHorizontal: 2, - width: 'calc(100% - 4px)', - }), - ]} - numberOfLines={1}> - {feedInfo.displayName} - + }} + /> ) })} - - {_(msg`More feeds`)} - + a.flex_row, + a.align_center, + a.gap_sm, + a.self_start, + a.rounded_sm, + {paddingVertical: 6, paddingHorizontal: 8}, + ]}> + {({hovered}) => ( + <> + + + + + {_(msg`More feeds`)} + + + )} + ) } + +function FeedItem({ + feedInfo, + current, + onPress, +}: { + feedInfo: SavedFeedSourceInfo + current: boolean + onPress: () => void +}) { + const t = useTheme() + const { + state: hovered, + onIn: onHoverIn, + onOut: onHoverOut, + } = useInteractionState() + const isFollowing = feedInfo.feedDescriptor === 'following' + + return ( + + {isFollowing ? ( + + + + ) : ( + + )} + + {feedInfo.displayName} + + + ) +} diff --git a/src/view/shell/desktop/SidebarTrendingTopics.tsx b/src/view/shell/desktop/SidebarTrendingTopics.tsx index c8b277ffa9..1d28e49f56 100644 --- a/src/view/shell/desktop/SidebarTrendingTopics.tsx +++ b/src/view/shell/desktop/SidebarTrendingTopics.tsx @@ -12,16 +12,13 @@ import {useTrendingTopics} from '#/state/queries/trending/useTrendingTopics' import {useTrendingConfig} from '#/state/service-config' import {atoms as a, useTheme} from '#/alf' import {Button, ButtonIcon} from '#/components/Button' -import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times' +import {DotGrid_Stroke2_Corner0_Rounded as Ellipsis} from '#/components/icons/DotGrid' +import {Trending3_Stroke2_Corner1_Rounded as TrendingIcon} from '#/components/icons/Trending' import * as Prompt from '#/components/Prompt' -import { - TrendingTopic, - TrendingTopicLink, - TrendingTopicSkeleton, -} from '#/components/TrendingTopics' +import {TrendingTopicLink} from '#/components/TrendingTopics' import {Text} from '#/components/Typography' -const TRENDING_LIMIT = 6 +const TRENDING_LIMIT = 5 export function SidebarTrendingTopics() { const {enabled} = useTrendingConfig() @@ -46,22 +43,17 @@ function Inner() { <> - - + + + Trending - + {isLoading ? ( Array(TRENDING_LIMIT) .fill(0) .map((_n, i) => ( - + + + {i + 1}. + + + )) ) : !trending?.topics ? null : ( <> - {trending.topics.slice(0, TRENDING_LIMIT).map(topic => ( + {trending.topics.slice(0, TRENDING_LIMIT).map((topic, i) => ( { logEvent('trendingTopic:click', {context: 'sidebar'}) }}> {({hovered}) => ( - + + + {i + 1}. + + + {topic.displayName ?? topic.topic} + + )} ))}