Add link to feeds to home screen header

This commit is contained in:
Eric Bailey
2024-06-04 16:13:13 -05:00
parent 7de09063c5
commit 7632899d35
2 changed files with 31 additions and 43 deletions
+20 -31
View File
@@ -1,22 +1,18 @@
import React from 'react' import React from 'react'
import {StyleSheet, View} from 'react-native' import {StyleSheet, View} from 'react-native'
import Animated from 'react-native-reanimated' import Animated from 'react-native-reanimated'
import {
FontAwesomeIcon,
FontAwesomeIconStyle,
} from '@fortawesome/react-native-fontawesome'
import {msg} from '@lingui/macro' import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import {CogIcon} from '#/lib/icons'
import {useSession} from '#/state/session' import {useSession} from '#/state/session'
import {useShellLayout} from '#/state/shell/shell-layout' import {useShellLayout} from '#/state/shell/shell-layout'
import {useMinimalShellMode} from 'lib/hooks/useMinimalShellMode' import {useMinimalShellMode} from 'lib/hooks/useMinimalShellMode'
import {usePalette} from 'lib/hooks/usePalette'
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
import {Logo} from '#/view/icons/Logo' import {Logo} from '#/view/icons/Logo'
import {atoms as a, useTheme} from '#/alf'
import {ListSparkle_Stroke2_Corner0_Rounded as ListSparkle} from '#/components/icons/ListSparkle'
import {Link} from '#/components/Link'
import {useKawaiiMode} from '../../../state/preferences/kawaii' import {useKawaiiMode} from '../../../state/preferences/kawaii'
import {Link} from '../util/Link'
import {HomeHeaderLayoutMobile} from './HomeHeaderLayoutMobile' import {HomeHeaderLayoutMobile} from './HomeHeaderLayoutMobile'
export function HomeHeaderLayout(props: { export function HomeHeaderLayout(props: {
@@ -38,7 +34,7 @@ function HomeHeaderLayoutDesktopAndTablet({
children: React.ReactNode children: React.ReactNode
tabBarAnchor: JSX.Element | null | undefined tabBarAnchor: JSX.Element | null | undefined
}) { }) {
const pal = usePalette('default') const t = useTheme()
const {headerMinimalShellTransform} = useMinimalShellMode() const {headerMinimalShellTransform} = useMinimalShellMode()
const {headerHeight} = useShellLayout() const {headerHeight} = useShellLayout()
const {hasSession} = useSession() const {hasSession} = useSession()
@@ -51,31 +47,24 @@ function HomeHeaderLayoutDesktopAndTablet({
{hasSession && ( {hasSession && (
<View <View
style={[ style={[
pal.view, a.relative,
pal.border, a.flex_row,
a.justify_between,
a.align_center,
a.pt_lg,
a.px_lg,
a.pb_sm,
t.atoms.bg,
t.atoms.border_contrast_low,
styles.bar, styles.bar,
styles.topBar, kawaii && {paddingTop: 4, paddingBottom: 0, paddingLeft: 10},
kawaii && {paddingTop: 4, paddingBottom: 0},
]}> ]}>
<Logo width={kawaii ? 60 : 22} />
<Link <Link
href="/settings/following-feed" to="/feeds"
hitSlop={10} hitSlop={10}
accessibilityRole="button" label={_(msg`View your feeds and explore more`)}>
accessibilityLabel={_(msg`Following Feed Preferences`)} <ListSparkle size="lg" fill={t.atoms.text_contrast_medium.color} />
accessibilityHint="">
<FontAwesomeIcon
icon="sliders"
style={pal.textLight as FontAwesomeIconStyle}
/>
</Link>
<Logo width={kawaii ? 60 : 28} />
<Link
href="/settings/saved-feeds"
hitSlop={10}
accessibilityRole="button"
accessibilityLabel={_(msg`Edit Saved Feeds`)}
accessibilityHint={_(msg`Opens screen to edit Saved Feeds`)}>
<CogIcon size={22} strokeWidth={2} style={pal.textLight} />
</Link> </Link>
</View> </View>
)} )}
@@ -85,8 +74,8 @@ function HomeHeaderLayoutDesktopAndTablet({
headerHeight.value = e.nativeEvent.layout.height headerHeight.value = e.nativeEvent.layout.height
}} }}
style={[ style={[
pal.view, t.atoms.bg,
pal.border, t.atoms.border_contrast_low,
styles.bar, styles.bar,
styles.tabBar, styles.tabBar,
headerMinimalShellTransform, headerMinimalShellTransform,
+11 -12
View File
@@ -2,7 +2,6 @@ import React from 'react'
import {StyleSheet, TouchableOpacity, View} from 'react-native' import {StyleSheet, TouchableOpacity, View} from 'react-native'
import Animated from 'react-native-reanimated' import Animated from 'react-native-reanimated'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {FontAwesomeIconStyle} from '@fortawesome/react-native-fontawesome'
import {msg} from '@lingui/macro' import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
@@ -15,10 +14,11 @@ import {usePalette} from 'lib/hooks/usePalette'
import {isWeb} from 'platform/detection' import {isWeb} from 'platform/detection'
import {Logo} from '#/view/icons/Logo' import {Logo} from '#/view/icons/Logo'
import {atoms} from '#/alf' import {atoms} from '#/alf'
import {useTheme} from '#/alf'
import {ColorPalette_Stroke2_Corner0_Rounded as ColorPalette} from '#/components/icons/ColorPalette' import {ColorPalette_Stroke2_Corner0_Rounded as ColorPalette} from '#/components/icons/ColorPalette'
import {Link as Link2} from '#/components/Link' import {ListSparkle_Stroke2_Corner0_Rounded as ListSparkle} from '#/components/icons/ListSparkle'
import {Link} from '#/components/Link'
import {IS_DEV} from '#/env' import {IS_DEV} from '#/env'
import {Link} from '../util/Link'
export function HomeHeaderLayoutMobile({ export function HomeHeaderLayoutMobile({
children, children,
@@ -26,6 +26,7 @@ export function HomeHeaderLayoutMobile({
children: React.ReactNode children: React.ReactNode
tabBarAnchor: JSX.Element | null | undefined tabBarAnchor: JSX.Element | null | undefined
}) { }) {
const t = useTheme()
const pal = usePalette('default') const pal = usePalette('default')
const {_} = useLingui() const {_} = useLingui()
const setDrawerOpen = useSetDrawerOpen() const setDrawerOpen = useSetDrawerOpen()
@@ -74,21 +75,19 @@ export function HomeHeaderLayoutMobile({
{width: 100}, {width: 100},
]}> ]}>
{IS_DEV && ( {IS_DEV && (
<Link2 to="/sys/debug"> <Link to="/sys/debug">
<ColorPalette size="md" /> <ColorPalette size="md" />
</Link2> </Link>
)} )}
{hasSession && ( {hasSession && (
<Link <Link
testID="viewHeaderHomeFeedPrefsBtn" testID="viewHeaderHomeFeedPrefsBtn"
href="/settings/following-feed" to="/feeds"
hitSlop={HITSLOP_10} hitSlop={HITSLOP_10}
accessibilityRole="button" label={_(msg`View your feeds and explore more`)}>
accessibilityLabel={_(msg`Following Feed Preferences`)} <ListSparkle
accessibilityHint=""> size="lg"
<FontAwesomeIcon fill={t.atoms.text_contrast_medium.color}
icon="sliders"
style={pal.textLight as FontAwesomeIconStyle}
/> />
</Link> </Link>
)} )}