From 114b8dab4172e7e77cb45aa570109ef3cdc3257d Mon Sep 17 00:00:00 2001 From: Swen van Zanten Date: Tue, 1 Sep 2020 19:55:47 +0200 Subject: [PATCH] pimp app settings view --- src/App.vue | 2 - src/assets/locales/ar.ts | 5 --- src/assets/locales/bn.ts | 5 --- src/assets/locales/de.ts | 5 ++- src/assets/locales/en.ts | 2 + src/assets/locales/es.ts | 5 ++- src/assets/locales/fr.ts | 5 ++- src/assets/locales/hi.ts | 5 --- src/assets/locales/hr.ts | 8 ++++ src/assets/locales/it.ts | 5 ++- src/assets/locales/ja.ts | 5 ++- src/assets/locales/nl.ts | 2 + src/assets/locales/pt.ts | 5 ++- src/assets/locales/ru.ts | 5 ++- src/assets/locales/sl.ts | 8 ++++ src/assets/locales/sv.ts | 8 ++++ src/assets/locales/tr.ts | 8 ++++ src/assets/locales/vi.ts | 8 ++++ src/assets/locales/zh.ts | 5 ++- src/components/layout/IconListBar.vue | 2 +- src/locale/locale.ts | 2 + src/locale/locales.ts | 10 +++-- src/utils/currencies.ts | 23 +++++++--- src/views/Settings/SettingsView.vue | 65 +++++++++++++-------------- src/views/TorStatus.vue | 4 +- 25 files changed, 137 insertions(+), 70 deletions(-) delete mode 100644 src/assets/locales/ar.ts delete mode 100644 src/assets/locales/bn.ts delete mode 100644 src/assets/locales/hi.ts create mode 100644 src/assets/locales/hr.ts create mode 100644 src/assets/locales/sl.ts create mode 100644 src/assets/locales/sv.ts create mode 100644 src/assets/locales/tr.ts create mode 100644 src/assets/locales/vi.ts diff --git a/src/App.vue b/src/App.vue index 71d0bef..be3982a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -57,8 +57,6 @@ export default { ipcRenderer.on('user-idle', () => { this.$authManager.lock() }) - - this.$router.push('wallets.create') } } diff --git a/src/assets/locales/ar.ts b/src/assets/locales/ar.ts deleted file mode 100644 index 661eb55..0000000 --- a/src/assets/locales/ar.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { LocaleDefinition } from '@/locale/locale' - -// @ts-ignore -const ar: LocaleDefinition = {} -export default ar diff --git a/src/assets/locales/bn.ts b/src/assets/locales/bn.ts deleted file mode 100644 index 5de407c..0000000 --- a/src/assets/locales/bn.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { LocaleDefinition } from '@/locale/locale' - -// @ts-ignore -const bn: LocaleDefinition = {} -export default bn diff --git a/src/assets/locales/de.ts b/src/assets/locales/de.ts index ed7622b..ec4e43a 100644 --- a/src/assets/locales/de.ts +++ b/src/assets/locales/de.ts @@ -1,5 +1,8 @@ import { LocaleDefinition } from '@/locale/locale' // @ts-ignore -const de: LocaleDefinition = {} +const de: LocaleDefinition = { + name: 'Deutsche' +} + export default de diff --git a/src/assets/locales/en.ts b/src/assets/locales/en.ts index 77655a5..97b6214 100644 --- a/src/assets/locales/en.ts +++ b/src/assets/locales/en.ts @@ -1,6 +1,7 @@ import { LocaleDefinition } from '@/locale/locale' const en: LocaleDefinition = { + name: 'English', main: { menu: { wallets: 'Wallets', @@ -227,6 +228,7 @@ const en: LocaleDefinition = { currency: 'Currency', currencyDetails: 'All fiat prices will be displayed in this currency', pin: 'PIN', + pinDetails: 'Secure MyVergies with a personal PIN code.', changePin: 'Change PIN', lockAfter: 'Lock after', lockAfterDetails: 'Lock application after the given amount of time', diff --git a/src/assets/locales/es.ts b/src/assets/locales/es.ts index 885428d..f5962b8 100644 --- a/src/assets/locales/es.ts +++ b/src/assets/locales/es.ts @@ -1,5 +1,8 @@ import { LocaleDefinition } from '@/locale/locale' // @ts-ignore -const es: LocaleDefinition = {} +const es: LocaleDefinition = { + name: 'Español' +} + export default es diff --git a/src/assets/locales/fr.ts b/src/assets/locales/fr.ts index f8b26ea..2e8864a 100644 --- a/src/assets/locales/fr.ts +++ b/src/assets/locales/fr.ts @@ -1,5 +1,8 @@ import { LocaleDefinition } from '@/locale/locale' // @ts-ignore -const fr: LocaleDefinition = {} +const fr: LocaleDefinition = { + name: 'français' +} + export default fr diff --git a/src/assets/locales/hi.ts b/src/assets/locales/hi.ts deleted file mode 100644 index 600b654..0000000 --- a/src/assets/locales/hi.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { LocaleDefinition } from '@/locale/locale' - -// @ts-ignore -const hi: LocaleDefinition = {} -export default hi diff --git a/src/assets/locales/hr.ts b/src/assets/locales/hr.ts new file mode 100644 index 0000000..0ec3362 --- /dev/null +++ b/src/assets/locales/hr.ts @@ -0,0 +1,8 @@ +import { LocaleDefinition } from '@/locale/locale' + +// @ts-ignore +const hr: LocaleDefinition = { + name: 'Hrvatski' +} + +export default hr diff --git a/src/assets/locales/it.ts b/src/assets/locales/it.ts index 812eb67..1b4297e 100644 --- a/src/assets/locales/it.ts +++ b/src/assets/locales/it.ts @@ -1,5 +1,8 @@ import { LocaleDefinition } from '@/locale/locale' // @ts-ignore -const it: LocaleDefinition = {} +const it: LocaleDefinition = { + name: 'italiano' +} + export default it diff --git a/src/assets/locales/ja.ts b/src/assets/locales/ja.ts index adfa3a5..602171e 100644 --- a/src/assets/locales/ja.ts +++ b/src/assets/locales/ja.ts @@ -1,5 +1,8 @@ import { LocaleDefinition } from '@/locale/locale' // @ts-ignore -const ja: LocaleDefinition = {} +const ja: LocaleDefinition = { + name: '日本人' +} + export default ja diff --git a/src/assets/locales/nl.ts b/src/assets/locales/nl.ts index 4d381ac..0f72398 100644 --- a/src/assets/locales/nl.ts +++ b/src/assets/locales/nl.ts @@ -1,6 +1,7 @@ import { LocaleDefinition } from '@/locale/locale' const nl: LocaleDefinition = { + name: 'Nederlands', main: { menu: { wallets: 'Wallets', @@ -227,6 +228,7 @@ const nl: LocaleDefinition = { currency: 'Valuta', currencyDetails: 'Alle fiat prijzen zullen worden getoond in deze valuta', pin: 'PIN', + pinDetails: 'Beveilig MyVergies met een persoonlijke PIN code.', changePin: 'Verander PIN', lockAfter: 'Vergrendel na', lockAfterDetails: 'Vergrendel applicatie na de opgegeven tijd is verstreken', diff --git a/src/assets/locales/pt.ts b/src/assets/locales/pt.ts index fe2f20f..d50fdcd 100644 --- a/src/assets/locales/pt.ts +++ b/src/assets/locales/pt.ts @@ -1,5 +1,8 @@ import { LocaleDefinition } from '@/locale/locale' // @ts-ignore -const pt: LocaleDefinition = {} +const pt: LocaleDefinition = { + name: 'Português' +} + export default pt diff --git a/src/assets/locales/ru.ts b/src/assets/locales/ru.ts index ccd4d6a..da62f4a 100644 --- a/src/assets/locales/ru.ts +++ b/src/assets/locales/ru.ts @@ -1,5 +1,8 @@ import { LocaleDefinition } from '@/locale/locale' // @ts-ignore -const ru: LocaleDefinition = {} +const ru: LocaleDefinition = { + name: 'русский' +} + export default ru diff --git a/src/assets/locales/sl.ts b/src/assets/locales/sl.ts new file mode 100644 index 0000000..21a5542 --- /dev/null +++ b/src/assets/locales/sl.ts @@ -0,0 +1,8 @@ +import { LocaleDefinition } from '@/locale/locale' + +// @ts-ignore +const sl: LocaleDefinition = { + name: 'Slovenščina' +} + +export default sl diff --git a/src/assets/locales/sv.ts b/src/assets/locales/sv.ts new file mode 100644 index 0000000..6c60027 --- /dev/null +++ b/src/assets/locales/sv.ts @@ -0,0 +1,8 @@ +import { LocaleDefinition } from '@/locale/locale' + +// @ts-ignore +const sv: LocaleDefinition = { + name: 'svenska' +} + +export default sv diff --git a/src/assets/locales/tr.ts b/src/assets/locales/tr.ts new file mode 100644 index 0000000..e2861e5 --- /dev/null +++ b/src/assets/locales/tr.ts @@ -0,0 +1,8 @@ +import { LocaleDefinition } from '@/locale/locale' + +// @ts-ignore +const tr: LocaleDefinition = { + name: 'Türk' +} + +export default tr diff --git a/src/assets/locales/vi.ts b/src/assets/locales/vi.ts new file mode 100644 index 0000000..2e4c0d0 --- /dev/null +++ b/src/assets/locales/vi.ts @@ -0,0 +1,8 @@ +import { LocaleDefinition } from '@/locale/locale' + +// @ts-ignore +const vi: LocaleDefinition = { + name: 'Tiếng Việt' +} + +export default vi diff --git a/src/assets/locales/zh.ts b/src/assets/locales/zh.ts index ad2f608..0106d36 100644 --- a/src/assets/locales/zh.ts +++ b/src/assets/locales/zh.ts @@ -1,5 +1,8 @@ import { LocaleDefinition } from '@/locale/locale' // @ts-ignore -const zh: LocaleDefinition = {} +const zh: LocaleDefinition = { + name: '简体中文' +} + export default zh diff --git a/src/components/layout/IconListBar.vue b/src/components/layout/IconListBar.vue index f36d2f1..c353002 100644 --- a/src/components/layout/IconListBar.vue +++ b/src/components/layout/IconListBar.vue @@ -12,7 +12,7 @@ - + diff --git a/src/locale/locale.ts b/src/locale/locale.ts index f7da448..7a0e40d 100644 --- a/src/locale/locale.ts +++ b/src/locale/locale.ts @@ -1,4 +1,5 @@ export interface LocaleDefinition { + name: string main: { menu: { wallets: string @@ -225,6 +226,7 @@ export interface LocaleDefinition { currency: string currencyDetails: string pin: string + pinDetails: string changePin: string lockAfter: string lockAfterDetails: string diff --git a/src/locale/locales.ts b/src/locale/locales.ts index 28f8405..ebe9ea1 100644 --- a/src/locale/locales.ts +++ b/src/locale/locales.ts @@ -1,10 +1,14 @@ const files = require.context('@/assets/locales/', false, /\.ts$/) -const locales = {} +const locales: any = {} +export const localeNames: any = {} files.keys().forEach(key => { if (key === './index.ts') return - // @ts-ignore - locales[key.replace(/(\.\/|\.ts)/g, '')] = files(key).default + + const langCode = key.replace(/(\.\/|\.ts)/g, '') + + locales[langCode] = files(key).default + localeNames[langCode] = files(key).default.name || langCode }) export default locales diff --git a/src/utils/currencies.ts b/src/utils/currencies.ts index 2150cc1..b2cfcc0 100644 --- a/src/utils/currencies.ts +++ b/src/utils/currencies.ts @@ -1,6 +1,17 @@ -import constants from '@/utils/constants' - -export default [ - constants.defaultCurrencyCode, - 'EUR' -] +export default { + AUD: 'Australian Dollar', + BRL: 'Brazilian Real', + CAD: 'Canadian Dollar', + CHF: 'Swiss Franc', + CNY: 'Chinese Yuan', + DKK: 'Danish krone', + EUR: 'Euro', + GBP: 'British Pound', + HKD: 'Hong Kong Dollar', + IDR: 'Indonesian Rupiah', + NZD: 'New Zealand Dollar', + RUB: 'Russian Ruble', + SGD: 'Singapore dollar', + THB: 'Thai Baht', + USD: 'United States Dollar' +} diff --git a/src/views/Settings/SettingsView.vue b/src/views/Settings/SettingsView.vue index a64a2dd..94c3114 100644 --- a/src/views/Settings/SettingsView.vue +++ b/src/views/Settings/SettingsView.vue @@ -4,38 +4,39 @@
- - - + - + - - + - - - - - + + import { mapActions, mapGetters } from 'vuex' -import locales from '@/locale/locales' +import { localeNames } from '@/locale/locales' import currencies from '@/utils/currencies' import NavigationHeader from '@/components/layout/NavigationHeader' +import FormBox from '@/components/layout/FormBox' import FormSection from '@/components/layout/FormSection' import ChangePinModal from '@/views/Settings/ChangePinModal' import VersionBlock from '@/components/VersionBlock' export default { name: 'settings-view', - components: { VersionBlock, FormSection, NavigationHeader }, + + components: { FormBox, VersionBlock, FormSection, NavigationHeader }, + data () { return { - langs: Object.keys(locales), - currencies: currencies, - lockAfter: '5m', - locks: { - '5m': '5 Minutes', - '10m': '10 Minutes', - '20m': '20 Minutes', - '30m': '30 Minutes' - } + langs: localeNames, + currencies: currencies } }, + computed: { language: { get () { @@ -98,6 +96,7 @@ export default { } } }, + methods: { ...mapGetters(['currentCurrencyCode', 'currentLanguageCode']), ...mapActions(['updateCurrency', 'updateLanguage']), diff --git a/src/views/TorStatus.vue b/src/views/TorStatus.vue index 8606cbc..b955867 100644 --- a/src/views/TorStatus.vue +++ b/src/views/TorStatus.vue @@ -106,13 +106,13 @@ export default { return fetch(constants.ipApi) .then(res => res.ok && res.json()) .then(networkData => { - Log.warn('Fetched IP address') + Log.info('Fetched IP address') this.networkData = networkData this.loading = false }) .catch(err => { - Log.warn("Couldn't load ip data. Reason:", err) + Log.error("Couldn't load ip data. Reason:", err) this.error = err this.networkData = null