Skip to content

Commit

Permalink
Limit # in sidebar, tweak spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
estrattonbailey committed Dec 17, 2024
1 parent dbadf04 commit 28d8314
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/view/shell/desktop/SidebarTrendingTopics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import {
useTrendingSettings,
useTrendingSettingsApi,
} from '#/state/preferences/trending'
import {
DEFAULT_LIMIT as TRENDING_TOPICS_COUNT,
useTrendingTopics,
} from '#/state/queries/trending/useTrendingTopics'
import {useTrendingTopics} from '#/state/queries/trending/useTrendingTopics'
import {useTrendingConfig} from '#/state/trending-config'
import {atoms as a, useTheme} from '#/alf'
import {Button, ButtonIcon} from '#/components/Button'
Expand All @@ -24,6 +21,8 @@ import {
} from '#/components/TrendingTopics'
import {Text} from '#/components/Typography'

const TRENDING_LIMIT = 6

export function SidebarTrendingTopics() {
const {enabled} = useTrendingConfig()
const {trendingDisabled} = useTrendingSettings()
Expand All @@ -40,7 +39,7 @@ function Inner() {

return error || noTopics ? null : (
<>
<View style={[a.gap_md]}>
<View style={[a.gap_sm, {paddingBottom: 2}]}>
<View style={[a.flex_row, a.align_center, a.gap_xs]}>
<Graph size="sm" />
<Text
Expand All @@ -65,14 +64,14 @@ function Inner() {

<View style={[a.flex_row, a.flex_wrap, a.gap_xs]}>
{isLoading ? (
Array(TRENDING_TOPICS_COUNT)
Array(TRENDING_LIMIT)
.fill(0)
.map((_n, i) => (
<TrendingTopicSkeleton key={i} size="small" index={i} />
))
) : !trending?.topics ? null : (
<>
{trending.topics.map(topic => (
{trending.topics.slice(0, TRENDING_LIMIT).map(topic => (
<TrendingTopicLink key={topic.link} topic={topic}>
{({hovered}) => (
<TrendingTopic
Expand Down

0 comments on commit 28d8314

Please sign in to comment.