From 8f8c56133e4465e2c6e26904bbe584d0734a080c Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Fri, 21 Apr 2023 18:34:29 -0500 Subject: [PATCH] Improve app passwords on desktop web --- src/view/com/util/ViewHeader.tsx | 25 +++++++- src/view/screens/AppPasswords.tsx | 88 +++++++++++++++++++-------- src/view/screens/PostLikedBy.tsx | 2 +- src/view/screens/PostRepostedBy.tsx | 2 +- src/view/screens/ProfileFollowers.tsx | 2 +- src/view/screens/ProfileFollows.tsx | 2 +- src/view/screens/Settings.tsx | 2 +- 7 files changed, 92 insertions(+), 31 deletions(-) diff --git a/src/view/com/util/ViewHeader.tsx b/src/view/com/util/ViewHeader.tsx index ad0a5a1d2f..816c835ccc 100644 --- a/src/view/com/util/ViewHeader.tsx +++ b/src/view/com/util/ViewHeader.tsx @@ -3,6 +3,7 @@ import {observer} from 'mobx-react-lite' import {Animated, StyleSheet, TouchableOpacity, View} from 'react-native' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {useNavigation} from '@react-navigation/native' +import {CenteredView} from './Views' import {UserAvatar} from './UserAvatar' import {Text} from './text/Text' import {useStores} from 'state/index' @@ -18,10 +19,12 @@ export const ViewHeader = observer(function ({ title, canGoBack, hideOnScroll, + showOnDesktop, }: { title: string canGoBack?: boolean hideOnScroll?: boolean + showOnDesktop?: boolean }) { const pal = usePalette('default') const store = useStores() @@ -42,7 +45,10 @@ export const ViewHeader = observer(function ({ }, [track, store]) if (isDesktopWeb) { - return <> + if (showOnDesktop) { + return + } + return null } else { if (typeof canGoBack === 'undefined') { canGoBack = navigation.canGoBack() @@ -76,6 +82,19 @@ export const ViewHeader = observer(function ({ } }) +function DesktopWebHeader({title}: {title: string}) { + const pal = usePalette('default') + return ( + + + + {title} + + + + ) +} + const Container = observer( ({ children, @@ -133,6 +152,10 @@ const styles = StyleSheet.create({ top: 0, width: '100%', }, + desktopHeader: { + borderBottomWidth: 1, + paddingVertical: 12, + }, titleContainer: { marginLeft: 'auto', diff --git a/src/view/screens/AppPasswords.tsx b/src/view/screens/AppPasswords.tsx index 311deb235e..1a8df41162 100644 --- a/src/view/screens/AppPasswords.tsx +++ b/src/view/screens/AppPasswords.tsx @@ -1,13 +1,13 @@ import React from 'react' import {Alert, StyleSheet, TouchableOpacity, View} from 'react-native' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import {ScrollView} from 'react-native-gesture-handler' import {Text} from '../com/util/text/Text' import {Button} from '../com/util/forms/Button' import * as Toast from '../com/util/Toast' import {useStores} from 'state/index' import {usePalette} from 'lib/hooks/usePalette' import {isDesktopWeb} from 'platform/detection' -import {ScrollView} from 'react-native-gesture-handler' import {withAuthRequired} from 'view/com/auth/withAuthRequired' import {observer} from 'mobx-react-lite' import {NativeStackScreenProps} from '@react-navigation/native-stack' @@ -15,6 +15,7 @@ import {CommonNavigatorParams} from 'lib/routes/types' import {useAnalytics} from 'lib/analytics' import {useFocusEffect} from '@react-navigation/native' import {ViewHeader} from '../com/util/ViewHeader' +import {CenteredView} from 'view/com/util/Views' type Props = NativeStackScreenProps export const AppPasswords = withAuthRequired( @@ -37,7 +38,9 @@ export const AppPasswords = withAuthRequired( // no app passwords (empty) state if (store.me.appPasswords.length === 0) { return ( - + @@ -45,7 +48,7 @@ export const AppPasswords = withAuthRequired( pressing the button below. - + {!isDesktopWeb && }