Add compose button to notifications, profile, and search

zio/stable
Paul Frazee 2022-11-15 13:00:00 -06:00
parent fe056a76ea
commit ccae52f612
3 changed files with 15 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import React, {useState, useEffect} from 'react' import React, {useState, useEffect} from 'react'
import {View} from 'react-native' import {View} from 'react-native'
import {ViewHeader} from '../com/util/ViewHeader' import {ViewHeader} from '../com/util/ViewHeader'
import {FAB} from '../com/util/FloatingActionButton'
import {Feed} from '../com/notifications/Feed' import {Feed} from '../com/notifications/Feed'
import {useStores} from '../../state' import {useStores} from '../../state'
import {NotificationsViewModel} from '../../state/models/notifications-view' import {NotificationsViewModel} from '../../state/models/notifications-view'
@ -36,6 +37,9 @@ export const Notifications = ({visible}: ScreenParams) => {
} }
}, [visible, store]) }, [visible, store])
const onComposePress = () => {
store.shell.openComposer({})
}
const onPressTryAgain = () => { const onPressTryAgain = () => {
notesView?.refresh() notesView?.refresh()
} }
@ -44,6 +48,7 @@ export const Notifications = ({visible}: ScreenParams) => {
<View style={{flex: 1}}> <View style={{flex: 1}}>
<ViewHeader title="Notifications" /> <ViewHeader title="Notifications" />
{notesView && <Feed view={notesView} onPressTryAgain={onPressTryAgain} />} {notesView && <Feed view={notesView} onPressTryAgain={onPressTryAgain} />}
<FAB icon="pen-nib" onPress={onComposePress} />
</View> </View>
) )
} }

View File

@ -3,6 +3,7 @@ import {StyleSheet, Text, View} from 'react-native'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {ViewSelector} from '../com/util/ViewSelector' import {ViewSelector} from '../com/util/ViewSelector'
import {FAB} from '../com/util/FloatingActionButton'
import {ScreenParams} from '../routes' import {ScreenParams} from '../routes'
import {ProfileUiModel, Sections} from '../../state/models/profile-ui' import {ProfileUiModel, Sections} from '../../state/models/profile-ui'
import {MembershipItem} from '../../state/models/memberships-view' import {MembershipItem} from '../../state/models/memberships-view'
@ -84,6 +85,9 @@ export const Profile = observer(({visible, params}: ScreenParams) => {
), ),
) )
} }
const onComposePress = () => {
store.shell.openComposer({})
}
// rendering // rendering
// = // =
@ -235,6 +239,7 @@ export const Profile = observer(({visible, params}: ScreenParams) => {
) : ( ) : (
renderHeader() renderHeader()
)} )}
<FAB icon="pen-nib" onPress={onComposePress} />
</View> </View>
) )
}) })

View File

@ -1,6 +1,7 @@
import React, {useEffect} from 'react' import React, {useEffect} from 'react'
import {StyleSheet, Text, View} from 'react-native' import {StyleSheet, Text, View} from 'react-native'
import {ViewHeader} from '../com/util/ViewHeader' import {ViewHeader} from '../com/util/ViewHeader'
import {FAB} from '../com/util/FloatingActionButton'
import {SuggestedFollows} from '../com/discover/SuggestedFollows' import {SuggestedFollows} from '../com/discover/SuggestedFollows'
import {ScreenParams} from '../routes' import {ScreenParams} from '../routes'
import {useStores} from '../../state' import {useStores} from '../../state'
@ -15,6 +16,9 @@ export const Search = ({visible, params}: ScreenParams) => {
store.nav.setTitle(`Search`) store.nav.setTitle(`Search`)
} }
}, [store, visible, name]) }, [store, visible, name])
const onComposePress = () => {
store.shell.openComposer({})
}
return ( return (
<View style={styles.container}> <View style={styles.container}>
@ -26,6 +30,7 @@ export const Search = ({visible, params}: ScreenParams) => {
</View> </View>
<Text style={styles.heading}>Suggested follows</Text> <Text style={styles.heading}>Suggested follows</Text>
<SuggestedFollows asLinks /> <SuggestedFollows asLinks />
<FAB icon="pen-nib" onPress={onComposePress} />
</View> </View>
) )
} }