tooot/src/screens/Me/Root.tsx

36 lines
922 B
TypeScript
Raw Normal View History

2020-11-21 13:19:05 +01:00
import React from 'react'
2020-11-22 00:46:23 +01:00
import { ScrollView } from 'react-native'
2020-11-21 13:32:29 +01:00
import { useSelector } from 'react-redux'
2020-11-22 00:46:23 +01:00
import { RootState, store } from 'src/store'
import { getLocalAccountId } from 'src/utils/slices/instancesSlice'
2020-11-21 13:19:05 +01:00
import Login from './Root/Login'
2020-11-22 00:46:23 +01:00
import MyInfo from './Root/MyInfo'
import MyCollections from './Root/MyCollections'
import Settings from './Root/Settings'
2020-11-24 00:18:47 +01:00
import Logout from './Root/Logout'
2020-11-21 13:19:05 +01:00
const ScreenMeRoot: React.FC = () => {
2020-11-21 13:32:29 +01:00
const localRegistered = useSelector(
(state: RootState) => state.instances.local.url
)
2020-11-21 13:19:05 +01:00
2020-11-22 00:46:23 +01:00
return (
<ScrollView>
{localRegistered ? (
<MyInfo id={getLocalAccountId(store.getState())!} />
) : (
<Login />
)}
{localRegistered && (
<MyCollections id={getLocalAccountId(store.getState())!} />
)}
<Settings />
2020-11-24 00:18:47 +01:00
{localRegistered && <Logout />}
2020-11-22 00:46:23 +01:00
</ScrollView>
)
2020-11-21 13:19:05 +01:00
}
export default ScreenMeRoot