diff --git a/front/API.ts b/front/API.ts index 3fa2696..50e6222 100644 --- a/front/API.ts +++ b/front/API.ts @@ -160,6 +160,7 @@ export default class API { name: (user.username ?? user.name) as string, email: user.email as string, premium: false, + isGuest: user.isGuest as boolean, data: { partyPlayed: user.partyPlayed as number, xp: 0, diff --git a/front/views/settings/SettingsProfileView.tsx b/front/views/settings/SettingsProfileView.tsx index 79a9348..4151799 100644 --- a/front/views/settings/SettingsProfileView.tsx +++ b/front/views/settings/SettingsProfileView.tsx @@ -15,12 +15,14 @@ import { Center, Heading, Avatar, + Popover, } from "native-base"; import { FontAwesome5 } from "@expo/vector-icons"; import User from "../../models/User"; import TextButton from "../../components/TextButton"; import LoadingComponent from "../../components/Loading"; import ElementList from "../../components/GtkUI/ElementList"; +import { translate } from "../../i18n/i18n"; const getInitials = (name: string) => { const names = name.split(" "); @@ -92,7 +94,7 @@ const ProfileSettings = ({ navigation }: { navigation: any }) => { console.log("Go to email settings"); }, data: { - text: user.email, + text: user.email || "Aucun email associé", }, }, { @@ -164,12 +166,56 @@ const ProfileSettings = ({ navigation }: { navigation: any }) => { /> - dispatch(unsetAccessToken())} - translate={{ - translationKey: "signOutBtn", - }} - /> + + {!user.isGuest && ( + dispatch(unsetAccessToken())} + translate={{ + translationKey: "signOutBtn", + }} + /> + )} + {user.isGuest && ( + ( + + )} + > + + + + + Attention + + + Vous êtes connecté avec un compte invité temporaire, si vous + vous déconnectez, vous perdrez vos données. + + + Vous pouvez sauvegarder votre progression en transférant votre + compte invité vers un compte classique. + + + + + + + + + )} + ); };