Slightly less verbose variable

This commit is contained in:
Paul Frazee 2023-11-29 17:37:15 -08:00
parent 4c7b9652db
commit 1140b05b83
3 changed files with 7 additions and 7 deletions

View file

@ -248,7 +248,7 @@ const FOLLOWING_FEED_STUB: FeedSourceInfo = {
export function usePinnedFeedsInfos(): { export function usePinnedFeedsInfos(): {
feeds: FeedSourceInfo[] feeds: FeedSourceInfo[]
hasPinnedCustomFeedOrList: boolean hasPinnedCustom: boolean
} { } {
const queryClient = useQueryClient() const queryClient = useQueryClient()
const [tabs, setTabs] = React.useState<FeedSourceInfo[]>([ const [tabs, setTabs] = React.useState<FeedSourceInfo[]>([
@ -256,7 +256,7 @@ export function usePinnedFeedsInfos(): {
]) ])
const {data: preferences} = usePreferencesQuery() const {data: preferences} = usePreferencesQuery()
const hasPinnedCustomFeedOrList = React.useMemo<boolean>(() => { const hasPinnedCustom = React.useMemo<boolean>(() => {
return tabs.some(tab => tab !== FOLLOWING_FEED_STUB) return tabs.some(tab => tab !== FOLLOWING_FEED_STUB)
}, [tabs]) }, [tabs])
@ -307,5 +307,5 @@ export function usePinnedFeedsInfos(): {
fetchFeedInfo() fetchFeedInfo()
}, [queryClient, setTabs, preferences?.feeds?.pinned]) }, [queryClient, setTabs, preferences?.feeds?.pinned])
return {feeds: tabs, hasPinnedCustomFeedOrList} return {feeds: tabs, hasPinnedCustom}
} }

View file

@ -82,14 +82,14 @@ function FeedsTabBarPublic() {
function FeedsTabBarTablet( function FeedsTabBarTablet(
props: RenderTabBarFnProps & {testID?: string; onPressSelected: () => void}, props: RenderTabBarFnProps & {testID?: string; onPressSelected: () => void},
) { ) {
const {feeds, hasPinnedCustomFeedOrList} = usePinnedFeedsInfos() const {feeds, hasPinnedCustom} = usePinnedFeedsInfos()
const pal = usePalette('default') const pal = usePalette('default')
const {hasSession} = useSession() const {hasSession} = useSession()
const navigation = useNavigation<NavigationProp>() const navigation = useNavigation<NavigationProp>()
const {headerMinimalShellTransform} = useMinimalShellMode() const {headerMinimalShellTransform} = useMinimalShellMode()
const {headerHeight} = useShellLayout() const {headerHeight} = useShellLayout()
const pinnedDisplayNames = hasSession ? feeds.map(f => f.displayName) : [] const pinnedDisplayNames = hasSession ? feeds.map(f => f.displayName) : []
const showFeedsLinkInTabBar = hasSession && !hasPinnedCustomFeedOrList const showFeedsLinkInTabBar = hasSession && !hasPinnedCustom
const items = showFeedsLinkInTabBar const items = showFeedsLinkInTabBar
? pinnedDisplayNames.concat('Feeds ✨') ? pinnedDisplayNames.concat('Feeds ✨')
: pinnedDisplayNames : pinnedDisplayNames

View file

@ -30,12 +30,12 @@ export function FeedsTabBar(
const {_} = useLingui() const {_} = useLingui()
const setDrawerOpen = useSetDrawerOpen() const setDrawerOpen = useSetDrawerOpen()
const navigation = useNavigation<NavigationProp>() const navigation = useNavigation<NavigationProp>()
const {feeds, hasPinnedCustomFeedOrList} = usePinnedFeedsInfos() const {feeds, hasPinnedCustom} = usePinnedFeedsInfos()
const brandBlue = useColorSchemeStyle(s.brandBlue, s.blue3) const brandBlue = useColorSchemeStyle(s.brandBlue, s.blue3)
const {headerHeight} = useShellLayout() const {headerHeight} = useShellLayout()
const {headerMinimalShellTransform} = useMinimalShellMode() const {headerMinimalShellTransform} = useMinimalShellMode()
const pinnedDisplayNames = hasSession ? feeds.map(f => f.displayName) : [] const pinnedDisplayNames = hasSession ? feeds.map(f => f.displayName) : []
const showFeedsLinkInTabBar = hasSession && !hasPinnedCustomFeedOrList const showFeedsLinkInTabBar = hasSession && !hasPinnedCustom
const items = showFeedsLinkInTabBar const items = showFeedsLinkInTabBar
? pinnedDisplayNames.concat('Feeds ✨') ? pinnedDisplayNames.concat('Feeds ✨')
: pinnedDisplayNames : pinnedDisplayNames