Skip to content

Commit 5fda804

Browse files
authored
refactor(desktop-ui): login to credential (#150)
1 parent b3a5375 commit 5fda804

15 files changed

Lines changed: 53 additions & 44 deletions

File tree

nym-vpn-desktop/src/i18n/config.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,35 @@ import settings from './en/settings.json';
66
import nodeLocation from './en/node-location.json';
77
import backendMessages from './en/backend-messages.json';
88
import display from './en/display.json';
9-
import login from './en/login.json';
9+
import addCredential from './en/add-credential.json';
1010

11-
const defaultNS = 'common';
11+
export const defaultNS = 'common';
12+
export const resources = {
13+
en: {
14+
common,
15+
home,
16+
settings,
17+
nodeLocation,
18+
backendMessages,
19+
display,
20+
addCredential,
21+
},
22+
} as const;
1223

1324
i18n.use(initReactI18next).init({
1425
lng: 'en',
1526
debug: import.meta.env.DEV,
16-
resources: {
17-
en: {
18-
common,
19-
home,
20-
settings,
21-
nodeLocation,
22-
backendMessages,
23-
display,
24-
login,
25-
},
26-
},
27+
defaultNS,
28+
resources,
2729
ns: [
30+
'addCredential',
2831
'common',
2932
'home',
3033
'settings',
3134
'nodeLocation',
3235
'backendMessages',
3336
'display',
34-
'login',
3537
],
36-
defaultNS,
3738

3839
interpolation: {
3940
escapeValue: false, // not needed for react as it escapes by default
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"welcome": "Welcome!",
3+
"description1": "Enter your credential to get started",
4+
"description2": "To generate a new credential, please use the link provided in the alpha phase invitation email.",
5+
"input-label": "Credential",
6+
"add-button": "Add credential",
7+
"error": "Invalid recovery phrase"
8+
}

nym-vpn-desktop/src/i18n/en/common.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"legal": "Legal",
1111
"support": "Support",
1212
"fastest": "Fastest",
13-
"login": "Login",
1413
"ui-mode": {
1514
"dark": "Dark mode",
1615
"light": "Light mode"

nym-vpn-desktop/src/i18n/en/login.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

nym-vpn-desktop/src/i18n/en/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@
3535
"display-theme": "Display theme",
3636
"logs": "Logs",
3737
"quit": "Quit NymVPN",
38-
"login-button": "Log in to view your account"
38+
"add-credential-button": "Add credential to connect"
3939
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defaultNS, resources } from './config';
2+
3+
// based on https://www.i18next.com/overview/typescript
4+
declare module 'i18next' {
5+
interface CustomTypeOptions {
6+
defaultNS: typeof defaultNS;
7+
resources: (typeof resources)['en'];
8+
}
9+
}

nym-vpn-desktop/src/pages/login/LogIn.tsx renamed to nym-vpn-desktop/src/pages/credential/AddCredential.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { useTranslation } from 'react-i18next';
33
import { NymIcon } from '../../assets/icons';
44
import { Button, TextArea } from '../../ui';
55

6-
function LogIn() {
6+
function AddCredential() {
77
const [phrase, setPhrase] = useState('');
88

9-
const { t } = useTranslation('login');
9+
const { t } = useTranslation('addCredential');
1010

1111
const onChange = (phrase: string) => {
1212
setPhrase(phrase);
@@ -22,7 +22,7 @@ function LogIn() {
2222
<h2 className="text-center dark:text-laughing-jack">
2323
{t('description1')}
2424
</h2>
25-
<p className="text-xs text-center text-dim-gray dark:text-mercury-mist w-3/5">
25+
<p className="text-xs text-center text-dim-gray dark:text-mercury-mist w-4/5">
2626
{t('description2')}
2727
</p>
2828
</div>
@@ -31,12 +31,12 @@ function LogIn() {
3131
onChange={onChange}
3232
spellCheck={false}
3333
resize="none"
34-
rows={5}
34+
rows={10}
3535
label={t('input-label')}
3636
/>
37-
<Button onClick={handleClick}>{t('login-button')}</Button>
37+
<Button onClick={handleClick}>{t('add-button')}</Button>
3838
</div>
3939
);
4040
}
4141

42-
export default LogIn;
42+
export default AddCredential;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as AddCredential } from './AddCredential';

nym-vpn-desktop/src/pages/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ export * from './home';
22
export * from './settings';
33
export { default as MainLayout } from './MainLayout';
44
export * from './location';
5-
export * from './login';
5+
export * from './credential';
66
export { default as Error } from './Error';

nym-vpn-desktop/src/pages/login/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)