1+ import Icon from '@/src/common/components/Icon' ;
2+ import { Image } from 'expo-image' ;
13import { Link , router , useSegments } from 'expo-router' ;
4+ import { memo , type ReactNode } from 'react' ;
25import { Pressable , View } from 'react-native' ;
3- import { Atoms , Spacing , useTheme , withHexOpacity } from '../../theme' ;
4- import { Image } from 'expo-image' ;
5- import Icon from '@/src/common/components/Icon' ;
66import BLUE_LOGO from '../../assets/images/polycentric-logo-blue-256.png' ;
77import WHITE_LOGO from '../../assets/images/polycentric-logo-white-256.png' ;
8- import { ProfileAvatar , Text } from '../primitives' ;
98import { useCurrentIdentity } from '../../lib/polycentric-hooks' ;
10- import { memo , type ReactNode } from 'react' ;
9+ import { Atoms , Spacing , useTheme , withHexOpacity } from '../../theme' ;
10+ import { ProfileAvatar , Text } from '../primitives' ;
1111
1212const SIDE_WIDTH = 32 ;
1313
1414type TopbarProps = {
1515 title ?: string ;
16+ left ?: ReactNode ;
1617 /**
1718 * Replaces the default centred title/logo. Use this when the centre
1819 * slot needs a non-navigational element (e.g. a search bar).
@@ -22,7 +23,7 @@ type TopbarProps = {
2223 right ?: ReactNode ;
2324} ;
2425
25- function Topbar ( { title, center, right } : TopbarProps ) {
26+ function Topbar ( { title, left , center, right } : TopbarProps ) {
2627 const { identity : currentIdentity } = useCurrentIdentity ( ) ;
2728 const { theme } = useTheme ( ) ;
2829
@@ -56,32 +57,33 @@ function Topbar({ title, center, right }: TopbarProps) {
5657 Atoms . items_start ,
5758 ] }
5859 >
59- { canGoBack ? (
60- < Pressable
61- accessibilityRole = "button"
62- accessibilityLabel = "Go back"
63- onPress = { ( ) => router . back ( ) }
64- hitSlop = { Spacing [ 'lg' ] }
65- style = { ( { pressed } ) => [ pressed && { opacity : 0.5 } ] }
66- >
67- < Icon name = "chevronBack" size = { 24 } color = "neutral_900" />
68- </ Pressable >
69- ) : (
70- < ProfileAvatar
71- identityKey = { identityKey ?? '' }
72- size = "sm"
73- containerProps = { { hitSlop : Spacing [ 'lg' ] } }
74- onPress = {
75- identityKey
76- ? ( ) =>
77- router . push ( {
78- pathname : '/profile/[identityId]' ,
79- params : { identityId : identityKey } ,
80- } )
81- : undefined
82- }
83- />
84- ) }
60+ { left ??
61+ ( canGoBack ? (
62+ < Pressable
63+ accessibilityRole = "button"
64+ accessibilityLabel = "Go back"
65+ onPress = { ( ) => router . back ( ) }
66+ hitSlop = { Spacing [ 'lg' ] }
67+ style = { ( { pressed } ) => [ pressed && { opacity : 0.5 } ] }
68+ >
69+ < Icon name = "chevronBack" size = { 24 } color = "neutral_900" />
70+ </ Pressable >
71+ ) : (
72+ < ProfileAvatar
73+ identityKey = { identityKey ?? '' }
74+ size = "sm"
75+ containerProps = { { hitSlop : Spacing [ 'lg' ] } }
76+ onPress = {
77+ identityKey
78+ ? ( ) =>
79+ router . push ( {
80+ pathname : '/profile/[identityId]' ,
81+ params : { identityId : identityKey } ,
82+ } )
83+ : undefined
84+ }
85+ />
86+ ) ) }
8587 </ View >
8688 < View
8789 style = { [
0 commit comments