feat: user name display in settings

This commit is contained in:
Xc165543337 2024-05-23 13:51:22 +02:00
parent 66501cc595
commit ab6af07a31
2 changed files with 35 additions and 3 deletions

View File

@ -1,10 +1,11 @@
import { Button } from "react-native-paper"
import { Button, Text } from "react-native-paper"
import { View } from "react-native"
import { About } from "@/presentation/react-native/components/About"
import { useAuthentication } from "@/presentation/react/contexts/Authentication"
const SettingsPage: React.FC = () => {
const { logout, authenticationPresenter } = useAuthentication()
const { logout, authenticationPresenter, user } = useAuthentication()
const handleLogout = async (): Promise<void> => {
await authenticationPresenter.logout()
@ -23,6 +24,34 @@ const SettingsPage: React.FC = () => {
Logout
</Button>
}
footer={
<View
style={{
alignItems: "center",
marginVertical: 20,
}}
>
<Text
style={{
fontWeight: "bold",
fontSize: 18,
textAlign: "center",
}}
>
Currenty logged in as
</Text>
<Text
style={{
marginTop: 6,
fontWeight: "bold",
fontSize: 16,
textAlign: "center",
}}
>
{user?.displayName}
</Text>
</View>
}
/>
)
}

View File

@ -7,10 +7,11 @@ import { getVersion } from "@/utils/version"
export interface AboutProps {
actionButton: React.ReactNode
footer?: React.ReactNode
}
export const About: React.FC<AboutProps> = (props) => {
const { actionButton } = props
const { actionButton, footer } = props
const version = getVersion()
@ -67,6 +68,8 @@ export const About: React.FC<AboutProps> = (props) => {
P61 Mobile Development
</Text>
{footer}
<View
style={{
justifyContent: "center",