This repository has been archived on 2024-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
p61-project/app/application/users/settings.tsx

60 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-05-23 13:51:22 +02:00
import { Button, Text } from "react-native-paper"
import { View } from "react-native"
2024-05-20 15:05:34 +02:00
import { About } from "@/presentation/react-native/components/About"
import { useAuthentication } from "@/presentation/react/contexts/Authentication"
const SettingsPage: React.FC = () => {
2024-05-23 13:51:22 +02:00
const { logout, authenticationPresenter, user } = useAuthentication()
const handleLogout = async (): Promise<void> => {
await authenticationPresenter.logout()
}
return (
2024-05-20 15:05:34 +02:00
<About
actionButton={
<Button
mode="contained"
labelStyle={{ fontSize: 18 }}
onPress={handleLogout}
loading={logout.state === "loading"}
disabled={logout.state === "loading"}
>
Logout
</Button>
}
2024-05-23 13:51:22 +02:00
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>
}
2024-05-20 15:05:34 +02:00
/>
)
}
export default SettingsPage