diff options
Diffstat (limited to 'src/view/screens')
-rw-r--r-- | src/view/screens/Home.tsx | 24 | ||||
-rw-r--r-- | src/view/screens/Profile.tsx | 13 |
2 files changed, 30 insertions, 7 deletions
diff --git a/src/view/screens/Home.tsx b/src/view/screens/Home.tsx index 09006a27f..de4179e7b 100644 --- a/src/view/screens/Home.tsx +++ b/src/view/screens/Home.tsx @@ -6,18 +6,21 @@ import {ViewHeader} from '../com/util/ViewHeader' import {Feed} from '../com/posts/Feed' import {LoadLatestBtn} from '../com/util/LoadLatestBtn' import {WelcomeBanner} from '../com/util/WelcomeBanner' +import {FAB} from '../com/util/FAB' import {useStores} from 'state/index' import {ScreenParams} from '../routes' -import {s} from 'lib/styles' +import {s, colors} from 'lib/styles' import {useOnMainScroll} from 'lib/hooks/useOnMainScroll' import {useAnalytics} from 'lib/analytics' +import {usePalette} from 'lib/hooks/usePalette' +import {ComposeIcon2} from 'lib/icons' const HEADER_HEIGHT = 42 export const Home = observer(function Home({navIdx, visible}: ScreenParams) { const store = useStores() const onMainScroll = useOnMainScroll(store) - const {screen} = useAnalytics() + const {screen, track} = useAnalytics() const scrollElRef = React.useRef<FlatList>(null) const [wasVisible, setWasVisible] = React.useState<boolean>(false) const {appState} = useAppState({ @@ -84,13 +87,17 @@ export const Home = observer(function Home({navIdx, visible}: ScreenParams) { screen, ]) - const onPressTryAgain = () => { + const onPressCompose = React.useCallback(() => { + track('HomeScreen:PressCompose') + store.shell.openComposer({}) + }, [store, track]) + const onPressTryAgain = React.useCallback(() => { store.me.mainFeed.refresh() - } - const onPressLoadLatest = () => { + }, [store]) + const onPressLoadLatest = React.useCallback(() => { store.me.mainFeed.refresh() scrollToTop() - } + }, [store, scrollToTop]) return ( <View style={s.hContentRegion}> @@ -112,6 +119,11 @@ export const Home = observer(function Home({navIdx, visible}: ScreenParams) { {store.me.mainFeed.hasNewLatest && !store.me.mainFeed.isRefreshing && ( <LoadLatestBtn onPress={onPressLoadLatest} /> )} + <FAB + testID="composeFAB" + onPress={onPressCompose} + icon={<ComposeIcon2 strokeWidth={1.5} size={29} style={s.white} />} + /> </View> ) }) diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index 7739814f5..fa0c04106 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -13,9 +13,11 @@ import {ErrorScreen} from '../com/util/error/ErrorScreen' import {ErrorMessage} from '../com/util/error/ErrorMessage' import {EmptyState} from '../com/util/EmptyState' import {Text} from '../com/util/text/Text' +import {FAB} from '../com/util/FAB' import {s, colors} from 'lib/styles' import {useOnMainScroll} from 'lib/hooks/useOnMainScroll' import {useAnalytics} from 'lib/analytics' +import {ComposeIcon2} from 'lib/icons' const LOADING_ITEM = {_reactKey: '__loading__'} const END_ITEM = {_reactKey: '__end__'} @@ -23,7 +25,7 @@ const EMPTY_ITEM = {_reactKey: '__empty__'} export const Profile = observer(({navIdx, visible, params}: ScreenParams) => { const store = useStores() - const {screen} = useAnalytics() + const {screen, track} = useAnalytics() useEffect(() => { screen('Profile') @@ -65,6 +67,10 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => { // events // = + const onPressCompose = React.useCallback(() => { + track('ProfileScreen:PressCompose') + store.shell.openComposer({}) + }, [store, track]) const onSelectView = (index: number) => { uiState.setSelectedViewIndex(index) } @@ -186,6 +192,11 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => { ) : ( <CenteredView>{renderHeader()}</CenteredView> )} + <FAB + testID="composeFAB" + onPress={onPressCompose} + icon={<ComposeIcon2 strokeWidth={1.5} size={29} style={s.white} />} + /> </View> ) }) |