about summary refs log tree commit diff
path: root/src/view/com/util/ViewHeader.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-11-15 13:11:01 -0600
committerPaul Frazee <pfrazee@gmail.com>2022-11-15 13:11:01 -0600
commit60c72087ff0bc13453d2a1602b92b41baf1c2a6a (patch)
tree3e6bf6714f3e97c7b70f7b23374879f3a1a8ee42 /src/view/com/util/ViewHeader.tsx
parentccae52f61291e770c73723a96b516ba9d0c3898e (diff)
downloadvoidsky-60c72087ff0bc13453d2a1602b92b41baf1c2a6a.tar.zst
Add current user profile to header and enlarge the header
Diffstat (limited to 'src/view/com/util/ViewHeader.tsx')
-rw-r--r--src/view/com/util/ViewHeader.tsx37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/view/com/util/ViewHeader.tsx b/src/view/com/util/ViewHeader.tsx
index 46be1144f..fa9bc8f4c 100644
--- a/src/view/com/util/ViewHeader.tsx
+++ b/src/view/com/util/ViewHeader.tsx
@@ -1,7 +1,8 @@
 import React from 'react'
 import {StyleSheet, Text, TouchableOpacity, View} from 'react-native'
 import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
-import {s, colors} from '../../lib/styles'
+import {UserAvatar} from './UserAvatar'
+import {colors} from '../../lib/styles'
 import {useStores} from '../../../state'
 
 export function ViewHeader({
@@ -15,15 +16,16 @@ export function ViewHeader({
   const onPressBack = () => {
     store.nav.tab.goBack()
   }
+  const onPressAvatar = () => {
+    if (store.me.handle) {
+      store.nav.navigate(`/profile/${store.me.handle}`)
+    }
+  }
   return (
     <View style={styles.header}>
       {store.nav.tab.canGoBack ? (
-        <TouchableOpacity onPress={onPressBack}>
-          <FontAwesomeIcon
-            size={14}
-            icon="angle-left"
-            style={styles.backIcon}
-          />
+        <TouchableOpacity onPress={onPressBack} style={styles.backIcon}>
+          <FontAwesomeIcon size={18} icon="angle-left" style={{marginTop: 3}} />
         </TouchableOpacity>
       ) : (
         <View style={styles.cornerPlaceholder} />
@@ -36,7 +38,17 @@ export function ViewHeader({
           </Text>
         ) : undefined}
       </View>
-      <View style={styles.cornerPlaceholder} />
+      {store.me.did ? (
+        <TouchableOpacity onPress={onPressAvatar}>
+          <UserAvatar
+            size={24}
+            handle={store.me.handle || ''}
+            displayName={store.me.displayName}
+          />
+        </TouchableOpacity>
+      ) : (
+        <View style={styles.cornerPlaceholder} />
+      )}
     </View>
   )
 }
@@ -47,7 +59,8 @@ const styles = StyleSheet.create({
     alignItems: 'center',
     backgroundColor: colors.white,
     paddingHorizontal: 12,
-    paddingBottom: 6,
+    paddingTop: 2,
+    paddingBottom: 8,
     borderBottomColor: colors.gray1,
     borderBottomWidth: 1,
   },
@@ -70,8 +83,8 @@ const styles = StyleSheet.create({
   },
 
   cornerPlaceholder: {
-    width: 14,
-    height: 14,
+    width: 24,
+    height: 24,
   },
-  backIcon: {width: 14, height: 14},
+  backIcon: {width: 24, height: 24},
 })