diff options
author | Samuel Newman <mozzius@protonmail.com> | 2025-02-25 09:20:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-25 09:20:37 -0800 |
commit | cc8369e868ec684120a220dfa66845dad324b4a1 (patch) | |
tree | 9a5abaaa526644d16785e3a530a16010ab2b0107 /src/view/shell/desktop/RightNav.tsx | |
parent | 04378386494fac38002fa7459464952040b58d55 (diff) | |
download | voidsky-cc8369e868ec684120a220dfa66845dad324b4a1.tar.zst |
Better tablet layout (#7656)
* better tablet layout * adjust left nav spacing * add right nav to pwi * clearer logic * fix a couple screens that don't need the tablet layout * fix horiz scroll bar * fix double trending * fix ts-ignore * fix labeller screen * don't offset things within dialogs * fix load latest button (and add scale animation) * center loader on home screen * adjust break points * adjust left nav spacing * fix load latest btn (again) * add lang select to right nav if left nav is minimal * fix double scrollbar on tiny screens * fix scrollbar * fix type errors
Diffstat (limited to 'src/view/shell/desktop/RightNav.tsx')
-rw-r--r-- | src/view/shell/desktop/RightNav.tsx | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/view/shell/desktop/RightNav.tsx b/src/view/shell/desktop/RightNav.tsx index 363294aa5..510d505cd 100644 --- a/src/view/shell/desktop/RightNav.tsx +++ b/src/view/shell/desktop/RightNav.tsx @@ -1,17 +1,23 @@ -import React from 'react' +import {useEffect, useState} from 'react' import {View} from 'react-native' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useNavigation} from '@react-navigation/core' import {FEEDBACK_FORM_URL, HELP_DESK_URL} from '#/lib/constants' -import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries' import {useKawaiiMode} from '#/state/preferences/kawaii' import {useSession} from '#/state/session' import {DesktopFeeds} from '#/view/shell/desktop/Feeds' import {DesktopSearch} from '#/view/shell/desktop/Search' import {SidebarTrendingTopics} from '#/view/shell/desktop/SidebarTrendingTopics' -import {atoms as a, useGutters, useTheme, web} from '#/alf' +import { + atoms as a, + useGutters, + useLayoutBreakpoints, + useTheme, + web, +} from '#/alf' +import {AppLanguageDropdown} from '#/components/AppLanguageDropdown' import {Divider} from '#/components/Divider' import {InlineLinkText} from '#/components/Link' import {ProgressGuideList} from '#/components/ProgressGuide/List' @@ -19,16 +25,15 @@ import {Text} from '#/components/Typography' function useWebQueryParams() { const navigation = useNavigation() - const [params, setParams] = React.useState<Record<string, string>>({}) + const [params, setParams] = useState<Record<string, string>>({}) - React.useEffect(() => { + useEffect(() => { return navigation.addListener('state', e => { try { const {state} = e.data const lastRoute = state.routes[state.routes.length - 1] - const {params} = lastRoute - setParams(params) - } catch (e) {} + setParams(lastRoute.params) + } catch (err) {} }) }, [navigation, setParams]) @@ -45,9 +50,10 @@ export function DesktopRightNav({routeName}: {routeName: string}) { const webqueryParams = useWebQueryParams() const searchQuery = webqueryParams?.q const showTrending = !isSearchScreen || (isSearchScreen && !!searchQuery) + const {rightNavVisible, centerColumnOffset, leftNavMinimal} = + useLayoutBreakpoints() - const {isTablet} = useWebMediaQueries() - if (isTablet) { + if (!rightNavVisible) { return null } @@ -60,9 +66,7 @@ export function DesktopRightNav({routeName}: {routeName: string}) { position: 'fixed', left: '50%', transform: [ - { - translateX: 300, - }, + {translateX: centerColumnOffset ? 150 : 300}, ...a.scrollbar_offset.transform, ], width: 300 + gutters.paddingLeft, @@ -125,6 +129,12 @@ export function DesktopRightNav({routeName}: {routeName: string}) { </Trans> </Text> )} + + {!hasSession && leftNavMinimal && ( + <View style={[a.w_full, {height: 32}]}> + <AppLanguageDropdown style={{marginTop: 0}} /> + </View> + )} </View> ) } |