💄 Move offline indicator on desktop and mobile web

This commit is contained in:
Chowdhury Foysal Ahamed
2023-08-18 11:37:41 +02:00
parent 60088038ab
commit ecc4b13c8f
3 changed files with 19 additions and 10 deletions
+10 -8
View File
@@ -9,8 +9,7 @@ import {
import {usePalette} from 'lib/hooks/usePalette' import {usePalette} from 'lib/hooks/usePalette'
import {Text} from 'view/com/util/text/Text' import {Text} from 'view/com/util/text/Text'
import {s} from 'lib/styles' import {s} from 'lib/styles'
import {isNative} from 'platform/detection' import {isDesktopWeb, isNative} from 'platform/detection'
import {CenteredView} from './Views.web'
const Indicator = () => { const Indicator = () => {
const pal = usePalette('error') const pal = usePalette('error')
@@ -19,12 +18,9 @@ const Indicator = () => {
styles.container, styles.container,
s.flexRow, s.flexRow,
s.alignCenter, s.alignCenter,
pal.view,
] ]
if (!isNative) {
containerStyles.push(pal.view)
}
return ( return (
<View style={containerStyles}> <View style={containerStyles}>
<FontAwesomeIcon icon="wifi" style={s.white as FontAwesomeIconStyle} /> <FontAwesomeIcon icon="wifi" style={s.white as FontAwesomeIconStyle} />
@@ -50,9 +46,9 @@ export const OfflineIndicator = () => {
} }
return ( return (
<CenteredView> <View style={isDesktopWeb ? undefined : styles.mobileWrapper}>
<Indicator /> <Indicator />
</CenteredView> </View>
) )
} }
@@ -62,4 +58,10 @@ const styles = StyleSheet.create({
justifyContent: 'center', justifyContent: 'center',
height: 20, height: 20,
}, },
mobileWrapper: {
position: 'absolute',
left: 0,
bottom: 0,
width: '100%',
},
}) })
+2
View File
@@ -37,6 +37,7 @@ import {getCurrentRoute, isTab, isStateAtTabRoot} from 'lib/routes/helpers'
import {NavigationProp, CommonNavigatorParams} from 'lib/routes/types' import {NavigationProp, CommonNavigatorParams} from 'lib/routes/types'
import {router} from '../../../routes' import {router} from '../../../routes'
import {makeProfileLink} from 'lib/routes/links' import {makeProfileLink} from 'lib/routes/links'
import {OfflineIndicator} from 'view/com/util/OfflineIndicator'
const ProfileCard = observer(() => { const ProfileCard = observer(() => {
const store = useStores() const store = useStores()
@@ -179,6 +180,7 @@ export const DesktopLeftNav = observer(function DesktopLeftNav() {
return ( return (
<View style={[styles.leftNav, pal.view]}> <View style={[styles.leftNav, pal.view]}>
<OfflineIndicator />
{store.session.hasSession && <ProfileCard />} {store.session.hasSession && <ProfileCard />}
<BackBtn /> <BackBtn />
<NavItem <NavItem
+7 -2
View File
@@ -33,13 +33,13 @@ const ShellInner = observer(() => {
return ( return (
<> <>
<View style={s.hContentRegion}> <View style={s.hContentRegion}>
<OfflineIndicator />
<ErrorBoundary> <ErrorBoundary>
<FlatNavigator /> <FlatNavigator />
</ErrorBoundary> </ErrorBoundary>
</View> </View>
{isDesktop && store.session.hasSession && ( {isDesktop && store.session.hasSession && (
<> <>
<OfflineIndicator />
<DesktopLeftNav /> <DesktopLeftNav />
<DesktopRightNav /> <DesktopRightNav />
</> </>
@@ -52,7 +52,12 @@ const ShellInner = observer(() => {
quote={store.shell.composerOpts?.quote} quote={store.shell.composerOpts?.quote}
onPost={store.shell.composerOpts?.onPost} onPost={store.shell.composerOpts?.onPost}
/> />
{!isDesktop && <BottomBarWeb />} {!isDesktop && (
<>
<BottomBarWeb />
<OfflineIndicator />
</>
)}
<ModalsContainer /> <ModalsContainer />
<Lightbox /> <Lightbox />
{!isDesktop && store.shell.isDrawerOpen && ( {!isDesktop && store.shell.isDrawerOpen && (