Skip to content

Commit

Permalink
fix: only show network badge for non mainnet, adjust home position, ref
Browse files Browse the repository at this point in the history
  • Loading branch information
pete-watters committed Dec 9, 2024
1 parent ef8134f commit 4d9918c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { NetworkBadge } from '@/features/settings/network-badge';
import { AppRoutes } from '@/routes';
import { TestId } from '@/shared/test-id';
import { useSettings } from '@/store/settings/settings';
Expand All @@ -15,7 +14,6 @@ import {
} from '@leather.io/ui/native';

export function HeaderOptions() {
const { networkPreference } = useSettings();
const router = useRouter();
const { changePrivacyModePreference, privacyModePreference } = useSettings();

Expand All @@ -25,7 +23,6 @@ export function HeaderOptions() {

return (
<Box alignItems="center" flexDirection="row" justifyContent="center">
{networkPreference.id !== 'mainnet' && <NetworkBadge />}
<TouchableOpacity
p="2"
onPress={() => onUpdatePrivacyMode()}
Expand Down
16 changes: 15 additions & 1 deletion apps/mobile/src/components/headers/home-header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
import { NetworkBadge } from '@/features/settings/network-badge';

import { Box } from '@leather.io/ui/native';

import { HeaderLeatherLogo } from './components/header-leather-logo';
import { HeaderOptions } from './components/header-options';
import { HeaderLayout } from './header.layout';

export function HomeHeader() {
return <HeaderLayout leftElement={<HeaderLeatherLogo />} rightElement={<HeaderOptions />} />;
return (
<HeaderLayout
leftElement={
<Box flexDirection="row" alignItems="center">
<HeaderLeatherLogo />
<NetworkBadge px="0" ml="-1" />
</Box>
}
rightElement={<HeaderOptions />}
/>
);
}
8 changes: 5 additions & 3 deletions apps/mobile/src/features/settings/network-badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { useSettings } from '@/store/settings/settings';
import { useLingui } from '@lingui/react';
import { useRouter } from 'expo-router';

import { Badge } from '@leather.io/ui/native';
import { Badge, PressableProps } from '@leather.io/ui/native';

export function NetworkBadge() {
interface NetworkBadgeProps extends PressableProps {}
export function NetworkBadge(props: NetworkBadgeProps) {
const router = useRouter();
const { i18n } = useLingui();
const { networkPreference } = useSettings();

if (networkPreference.id === 'mainnet') return null;
return (
<Badge
variant="default"
Expand All @@ -20,6 +21,7 @@ export function NetworkBadge() {
message: '{network}',
values: { network: networkPreference.name },
})}
{...props}
/>
);
}

0 comments on commit 4d9918c

Please sign in to comment.