diff --git a/front/API.ts b/front/API.ts
index 91854de..da93cb7 100644
--- a/front/API.ts
+++ b/front/API.ts
@@ -154,7 +154,9 @@ export default class API {
email: user.email as string,
xp: 0,
premium: false,
- metrics: {},
+ metrics: {
+ partyPlayed: user.partyPlayed as number,
+ },
settings: {
preferences: {
deviceId: 1,
diff --git a/front/i18n/Translations.ts b/front/i18n/Translations.ts
index 1bd5939..da8e797 100644
--- a/front/i18n/Translations.ts
+++ b/front/i18n/Translations.ts
@@ -107,6 +107,9 @@ export const en = {
changeEmail: 'Change email',
oldEmail: 'Old email',
newEmail: 'New email',
+
+ passwordUpdated: 'Password updated',
+ emailUpdated: 'Email updated',
};
export const fr: typeof en = {
@@ -141,7 +144,7 @@ export const fr: typeof en = {
mostPlayedSong: 'Chanson la plus jouée : ',
goodNotesPlayed: 'Bonnes notes jouées : ',
longestCombo: 'Combo le plus long : ',
- favoriteGenre: 'Genre favorit : ',
+ favoriteGenre: 'Genre favori : ',
// Difficulty settings
diffBtn: 'Difficulté',
@@ -214,6 +217,9 @@ export const fr: typeof en = {
errAlrdExst: "Utilisateur existe déjà",
unknownError: 'Erreur inconnue',
errIncrrct: 'Identifiant incorrect',
+
+ passwordUpdated: 'Mot de passe mis à jour',
+ emailUpdated: 'Email mis à jour',
};
export const sp: typeof en = {
@@ -320,9 +326,12 @@ export const sp: typeof en = {
errAlrdExst: "Ya existe",
errIncrrct: "credenciales incorrectas",
- changePassword: 'Change password',
- oldPassword: 'Old password',
- newPassword: 'New password',
- confirmNewPassword: 'Confirm new password',
- submitBtn: 'Submit',
+ changePassword: 'Cambio de contraseña',
+ oldPassword: 'Contraseña anterior',
+ newPassword: 'Nueva contraseña',
+ confirmNewPassword: 'Confirmar nueva contraseña',
+ submitBtn: 'Enviar',
+
+ passwordUpdated: 'Contraseña actualizada',
+ emailUpdated: 'Email actualizado',
};
\ No newline at end of file
diff --git a/front/models/Metrics.ts b/front/models/Metrics.ts
index 9e1a4f1..ab320b6 100644
--- a/front/models/Metrics.ts
+++ b/front/models/Metrics.ts
@@ -1,5 +1,5 @@
interface Metrics {
-
+ partyPlayed: number;
}
export default Metrics;
\ No newline at end of file
diff --git a/front/views/ProfileView.tsx b/front/views/ProfileView.tsx
index 3849b81..c1fb330 100644
--- a/front/views/ProfileView.tsx
+++ b/front/views/ProfileView.tsx
@@ -89,7 +89,7 @@ const ProfileView = () => {
navigation.navigate('Settings')}
+ onPress={() => navigation.navigate('Settings', {screen: 'Profile'})}
style={{margin: 10}}
translate={{ translationKey: 'settingsBtn' }}
/>
diff --git a/front/views/settings/SettingsProfileView.tsx b/front/views/settings/SettingsProfileView.tsx
new file mode 100644
index 0000000..500873e
--- /dev/null
+++ b/front/views/settings/SettingsProfileView.tsx
@@ -0,0 +1,42 @@
+import API from "../../API";
+import { useDispatch } from "react-redux";
+import { unsetAccessToken } from "../../state/UserSlice";
+
+import React, { useEffect, useState } from "react";
+import { Column, Text, Button, Icon, Box, Center, Heading } from "native-base";
+import User from "../../models/User";
+import TextButton from "../../components/TextButton";
+
+const ProfileSettings = ({ navigation }: { navigation: any }) => {
+ const [user, setUser] = useState(null);
+ const dispatch = useDispatch();
+
+ useEffect(() => {
+ API.getUserInfo().then((user) => {
+ setUser(user);
+ });
+ }, []);
+
+ return (
+
+ {user && (
+
+ Profile Settings
+
+ Username: {user.name}
+ ID: {user.id}
+ Email: {user.email}
+ Party played: {user.metrics.partyPlayed}
+
+ XP: {user.xp}
+
+ )}
+
+ dispatch(unsetAccessToken())} translate={{
+ translationKey: "signOutBtn",
+ }} />
+
+ );
+};
+
+export default ProfileSettings;
diff --git a/front/views/settings/SettingsView.tsx b/front/views/settings/SettingsView.tsx
index 42cd4bf..ad8dd7f 100644
--- a/front/views/settings/SettingsView.tsx
+++ b/front/views/settings/SettingsView.tsx
@@ -13,6 +13,7 @@ import createTabRowNavigator from '../../components/navigators/TabRowNavigator';
import { FontAwesome } from '@expo/vector-icons';
import ChangePasswordForm from '../../components/forms/changePasswordForm';
import ChangeEmailForm from '../../components/forms/changeEmailForm';
+import ProfileSettings from './SettingsProfileView';
import API, { APIError } from '../../API';
@@ -22,7 +23,7 @@ const SettingsStack = createNativeStackNavigator();
const handleChangeEmail = async (newEmail: string): Promise => {
try {
let response = await API.updateUserEmail(newEmail);
- return translate('emailChanged');
+ return translate('emailUpdated');
} catch (e) {
throw e;
}
@@ -31,7 +32,7 @@ const handleChangeEmail = async (newEmail: string): Promise => {
const handleChangePassword = async (oldPassword: string, newPassword: string): Promise => {
try {
let response = await API.updateUserPassword(oldPassword, newPassword);
- return translate('passwordChanged');
+ return translate('passwordUpdated');
} catch (e) {
throw e;
}
@@ -253,27 +254,13 @@ const SetttingsNavigator = () => {
{/* I'm doing this to be able to land on the summary of settings when clicking on settings and directly to the
wanted settings page if needed so I need to do special work with the 0 index */}
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
)
}