diff --git a/net/web/src/constants/Strings.js b/net/web/src/constants/Strings.js index 46cf6bcf..a8aabf39 100644 --- a/net/web/src/constants/Strings.js +++ b/net/web/src/constants/Strings.js @@ -29,6 +29,38 @@ export const en = { default: 'Default', dark: 'Dark', light: 'Light', + + save: 'Save', + forget: 'Forget', + unlock: 'Unlock', + profile: 'Profile', + application: 'Application', + account: 'Account', + name: 'Name', + location: 'Location', + description: 'Description', + timeFormat: 'Time Format', + dateFormat: 'Date Format', + theme: 'Theme', + language: 'Language', + timeUs: '12h', + timeEu: '24h', + dateUs: 'mm/dd', + dateEu: 'dd/mm', + registry: 'Visible in Registry', + sealedTopics: 'Sealed Topics', + changeLogin: 'Change Login', + selectImage: 'Select Image', + profileImage: 'Profile Image', + profileDetails: 'Profile Details', + enableSealed: 'Enabled Sealed Topics', + password: 'Password', + newPassword: 'New Password', + confirmPassword: 'Confirm Password', + deleteKey: 'Type \'delete\' to remove key', + delete: 'delete', + username: 'Username', + updateProfile: 'Update Profile', }; export const fr = { @@ -62,5 +94,37 @@ export const fr = { default: 'Défaut', dark: 'Sombre', light: 'Lumineux', + + save: 'Enregistrer', + forget: 'Oublier', + unlock: 'Déverrouiller', + profile: 'Profil', + application: 'Application', + account: 'Compte', + name: 'Nom', + location: 'Emplacement', + description: 'Description', + timeFormat: 'Format de l\'heure', + dateFormat: 'Format de la date', + theme: 'Thème', + language: 'Langue', + timeUs: '12h', + timeEu: '24h', + dateUs: 'mm/jj', + dateEu: 'jj/mm', + registry: 'Visible dans le Registre', + sealedTopics: 'Sujets Sécurisé', + changeLogin: 'Changer Identifiants', + selectImage: 'Sélectionner une Image', + profileImage: 'Image de Profil', + profileDetails: 'Détails du Profil', + enableSealed: 'Activer les Sujets Sécurisé', + password: 'Mot de Passe', + newPassword: 'Nouveau Mot de Passe', + confirmPassword: 'Confirmer le Mot de Passe', + deleteKey: 'Tapez \'supprimer\' pour supprimer la clé', + delete: 'supprimer', + username: 'Nom d\'Utilisateur', + updateProfile: 'Mettre à Jour le Profil', }; diff --git a/net/web/src/session/account/Account.jsx b/net/web/src/session/account/Account.jsx index b8b123c6..90589d3c 100644 --- a/net/web/src/session/account/Account.jsx +++ b/net/web/src/session/account/Account.jsx @@ -2,13 +2,16 @@ import { AccountWrapper } from './Account.styled'; import { RightOutlined } from '@ant-design/icons'; import { SettingOutlined } from '@ant-design/icons'; import { AccountAccess } from './profile/accountAccess/AccountAccess'; +import { useAccount } from './useAccount.hook'; export function Account({ closeAccount, openProfile }) { + const { state, actions } = useAccount(); + return (
-
Settings
+
{state.strings.settings}
@@ -18,7 +21,7 @@ export function Account({ closeAccount, openProfile }) {
-
Update Profile
+
{state.strings.updateProfile}
diff --git a/net/web/src/session/account/profile/Profile.jsx b/net/web/src/session/account/profile/Profile.jsx index d6936e2d..c4a0c407 100644 --- a/net/web/src/session/account/profile/Profile.jsx +++ b/net/web/src/session/account/profile/Profile.jsx @@ -89,7 +89,7 @@ export function Profile({ closeProfile }) { { state.display !== 'xlarge' && (
{ state.handle }
-
Profile
+
{ state.strings.profile }
)}
@@ -107,7 +107,7 @@ export function Profile({ closeProfile }) {
{ state.name }
)} { !state.name && ( -
name
+
{ state.strings.name }
)}
@@ -119,7 +119,7 @@ export function Profile({ closeProfile }) {
{ state.location }
)} { !state.location && ( -
location
+
{ state.strings.location }
)}
@@ -128,7 +128,7 @@ export function Profile({ closeProfile }) {
{ state.description }
)} { !state.description && ( -
description
+
{ state.strings.description }
)}
@@ -139,7 +139,7 @@ export function Profile({ closeProfile }) { { state.display === 'small' && (
-
Logout
+
{ state.strings.logout }
)}
@@ -149,7 +149,7 @@ export function Profile({ closeProfile }) { bodyStyle={{ borderRadius: 8, padding: 16, ...state.menuStyle }} onCancel={actions.clearEditProfileImage}> -
Profile Image
+
{ state.strings.profileImage }
@@ -157,10 +157,10 @@ export function Profile({ closeProfile }) {
selected(e)} style={{display: 'none'}}/>
- +
- - + +
@@ -169,23 +169,23 @@ export function Profile({ closeProfile }) { bodyStyle={{ borderRadius: 8, padding: 16, ...state.menuStyle }} onCancel={actions.clearEditProfileDetails}> -
Profile Details
+
{ state.strings.profileDetails }
- actions.setEditName(e.target.value)} + actions.setEditName(e.target.value)} defaultValue={state.editName} autocapitalize="word" />
- actions.setEditLocation(e.target.value)} + actions.setEditLocation(e.target.value)} defaultValue={state.editLocation} autocapitalize="word" />
- actions.setEditDescription(e.target.value)} + actions.setEditDescription(e.target.value)} spellCheck="false" defaultValue={state.editDescription} autoSize={{ minRows: 2, maxRows: 6 }} />
- - + +
diff --git a/net/web/src/session/account/profile/Profile.styled.js b/net/web/src/session/account/profile/Profile.styled.js index 45ea32af..cb50922c 100644 --- a/net/web/src/session/account/profile/Profile.styled.js +++ b/net/web/src/session/account/profile/Profile.styled.js @@ -133,6 +133,7 @@ export const ProfileWrapper = styled.div` .notset { font-style: italic; color: ${props => props.theme.hintText}; + padding-top: 4px; } .name { diff --git a/net/web/src/session/account/profile/accountAccess/AccountAccess.jsx b/net/web/src/session/account/profile/accountAccess/AccountAccess.jsx index 20aa1fd3..0c5a70b3 100644 --- a/net/web/src/session/account/profile/accountAccess/AccountAccess.jsx +++ b/net/web/src/session/account/profile/accountAccess/AccountAccess.jsx @@ -56,24 +56,24 @@ export function AccountAccess() { { modalContext }
-
Application
+
{state.strings.application}
-
Time Format
+
{state.strings.timeFormat}
- 12h - 24h + {state.strings.timeUs} + {state.strings.timeEu}
-
Date Format
+
{state.strings.dateFormat}
- mm/dd - dd/mm + {state.strings.dateUs} + {state.strings.dateEu}
-
Theme
+
{state.strings.theme}
-
Account
+
{state.strings.account}
saveSearchable(enable)} /> -
Visible in Registry   
+
{state.strings.registry}
-
Sealed Topics
+
{state.strings.sealedTopics}
-
Change Login
+
{state.strings.changeLogin}
-
Topic Sealing Key
+
{state.strings.sealedTopics}
actions.enableSeal(enable)} /> -
Enable Sealed Topics
+
{state.strings.enableSealed}
{ (state.sealMode === 'updating' || state.sealMode === 'enabling') && (
- actions.setSealPassword(e.target.value)} + actions.setSealPassword(e.target.value)} autocomplete="new-password" prefix={} />
)} { (state.sealMode === 'updating' || state.sealMode === 'enabling') && (
- actions.setSealConfirm(e.target.value)} + actions.setSealConfirm(e.target.value)} autocomplete="new-password" prefix={} />
)} { state.sealMode === 'disabling' && (
- actions.setSealDelete(e.target.value)} + actions.setSealDelete(e.target.value)} prefix={} />
)} @@ -144,39 +144,39 @@ export function AccountAccess() { )} { state.sealMode === 'unlocking' && (
- actions.setSealUnlock(e.target.value)} + actions.setSealUnlock(e.target.value)} prefix={} />
)}
- + { state.sealMode === 'enabled' && ( - + )} { state.sealMode === 'unlocking' && ( - + )} { state.sealMode !== 'unlocking' && state.sealMode !== 'enabled' && ( - + )}
-
Change Login
- actions.setEditHandle(e.target.value)} +
{state.strings.changeLogin}
+ actions.setEditHandle(e.target.value)} defaultValue={state.editHandle} autocomplete="username" autocapitalize="none" prefix={} /> - actions.setEditPassword(e.target.value)} + actions.setEditPassword(e.target.value)} autocomplete="new-password" prefix={} /> - actions.setEditConfirm(e.target.value)} + actions.setEditConfirm(e.target.value)} autocomplete="new-password" prefix={} />
- + + disabled={!actions.canSaveLogin()} loading={state.busy}>{state.strings.save}
diff --git a/net/web/src/session/account/profile/accountAccess/AccountAccess.styled.js b/net/web/src/session/account/profile/accountAccess/AccountAccess.styled.js index 51a3bb9c..e9aa34a4 100644 --- a/net/web/src/session/account/profile/accountAccess/AccountAccess.styled.js +++ b/net/web/src/session/account/profile/accountAccess/AccountAccess.styled.js @@ -32,10 +32,12 @@ export const AccountAccessWrapper = styled.div` .label { padding-right: 16px; - min-width: 110px; + min-width: 130px; height: 28px; display: flex; align-items: center; + display: flex; + justify-content: flex-end; } } } @@ -138,6 +140,7 @@ export const SealModal = styled.div` background-color: ${props => props.theme.inputArea}; color: ${props => props.theme.mainText}; border-radius: 8px; + position: relative; .ant-input-affix-wrapper { background-color: ${props => props.theme.inputArea}; diff --git a/net/web/src/session/account/profile/accountAccess/useAccountAccess.hook.js b/net/web/src/session/account/profile/accountAccess/useAccountAccess.hook.js index 6001333d..f82fde6b 100644 --- a/net/web/src/session/account/profile/accountAccess/useAccountAccess.hook.js +++ b/net/web/src/session/account/profile/accountAccess/useAccountAccess.hook.js @@ -26,6 +26,7 @@ export function useAccountAccess() { sealDelete: null, sealUnlock: null, + strings: {}, menuStyle: {}, timeFormat: '12h', dateFormat: 'mm/dd', @@ -58,8 +59,8 @@ export function useAccountAccess() { }, [account.state]); useEffect(() => { - const { menuStyle, timeFormat, dateFormat, theme, themes, language, languages } = settings.state; - updateState({ menuStyle, timeFormat, dateFormat, theme, themes, language, languages }); + const { strings, menuStyle, timeFormat, dateFormat, theme, themes, language, languages } = settings.state; + updateState({ strings, menuStyle, timeFormat, dateFormat, theme, themes, language, languages }); }, [settings.state]); const sealUnlock = async () => { @@ -173,7 +174,7 @@ export function useAccountAccess() { updateState({ sealEnabled: enable, sealMode }); }, canSaveSeal: () => { - if (state.sealMode === 'disabling' && state.sealDelete === 'delete') { + if (state.sealMode === 'disabling' && state.sealDelete === state.strings.delete) { return true; } if (state.sealMode === 'enabling' && state.sealPassword && state.sealPassword === state.sealConfirm) { diff --git a/net/web/src/session/account/useAccount.hook.js b/net/web/src/session/account/useAccount.hook.js new file mode 100644 index 00000000..dc8c845b --- /dev/null +++ b/net/web/src/session/account/useAccount.hook.js @@ -0,0 +1,26 @@ +import { useState, useEffect, useContext } from 'react'; +import { SettingsContext } from 'context/SettingsContext'; + +export function useAccount() { + + const [state, setState] = useState({ + strings: {}, + }); + + const settings = useContext(SettingsContext); + + const updateState = (value) => { + setState((s) => ({ ...s, ...value })); + } + + useEffect(() => { + const { strings } = settings.state; + updateState({ strings }); + }, [settings.state]); + + const actions = { + }; + + return { state, actions }; +} +