Skip to content

Commit

Permalink
pimp app settings view
Browse files Browse the repository at this point in the history
  • Loading branch information
SwenVanZanten committed Sep 1, 2020
1 parent 71906c6 commit 114b8da
Show file tree
Hide file tree
Showing 25 changed files with 137 additions and 70 deletions.
2 changes: 0 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ export default {
ipcRenderer.on('user-idle', () => {
this.$authManager.lock()
})
this.$router.push('wallets.create')
}
}
</script>
Expand Down
5 changes: 0 additions & 5 deletions src/assets/locales/ar.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/assets/locales/bn.ts

This file was deleted.

5 changes: 4 additions & 1 deletion src/assets/locales/de.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { LocaleDefinition } from '@/locale/locale'

// @ts-ignore
const de: LocaleDefinition = {}
const de: LocaleDefinition = {
name: 'Deutsche'
}

export default de
2 changes: 2 additions & 0 deletions src/assets/locales/en.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { LocaleDefinition } from '@/locale/locale'

const en: LocaleDefinition = {
name: 'English',
main: {
menu: {
wallets: 'Wallets',
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 4 additions & 1 deletion src/assets/locales/es.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { LocaleDefinition } from '@/locale/locale'

// @ts-ignore
const es: LocaleDefinition = {}
const es: LocaleDefinition = {
name: 'Español'
}

export default es
5 changes: 4 additions & 1 deletion src/assets/locales/fr.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { LocaleDefinition } from '@/locale/locale'

// @ts-ignore
const fr: LocaleDefinition = {}
const fr: LocaleDefinition = {
name: 'français'
}

export default fr
5 changes: 0 additions & 5 deletions src/assets/locales/hi.ts

This file was deleted.

8 changes: 8 additions & 0 deletions src/assets/locales/hr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { LocaleDefinition } from '@/locale/locale'

// @ts-ignore
const hr: LocaleDefinition = {
name: 'Hrvatski'
}

export default hr
5 changes: 4 additions & 1 deletion src/assets/locales/it.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { LocaleDefinition } from '@/locale/locale'

// @ts-ignore
const it: LocaleDefinition = {}
const it: LocaleDefinition = {
name: 'italiano'
}

export default it
5 changes: 4 additions & 1 deletion src/assets/locales/ja.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { LocaleDefinition } from '@/locale/locale'

// @ts-ignore
const ja: LocaleDefinition = {}
const ja: LocaleDefinition = {
name: '日本人'
}

export default ja
2 changes: 2 additions & 0 deletions src/assets/locales/nl.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { LocaleDefinition } from '@/locale/locale'

const nl: LocaleDefinition = {
name: 'Nederlands',
main: {
menu: {
wallets: 'Wallets',
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 4 additions & 1 deletion src/assets/locales/pt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { LocaleDefinition } from '@/locale/locale'

// @ts-ignore
const pt: LocaleDefinition = {}
const pt: LocaleDefinition = {
name: 'Português'
}

export default pt
5 changes: 4 additions & 1 deletion src/assets/locales/ru.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { LocaleDefinition } from '@/locale/locale'

// @ts-ignore
const ru: LocaleDefinition = {}
const ru: LocaleDefinition = {
name: 'русский'
}

export default ru
8 changes: 8 additions & 0 deletions src/assets/locales/sl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { LocaleDefinition } from '@/locale/locale'

// @ts-ignore
const sl: LocaleDefinition = {
name: 'Slovenščina'
}

export default sl
8 changes: 8 additions & 0 deletions src/assets/locales/sv.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { LocaleDefinition } from '@/locale/locale'

// @ts-ignore
const sv: LocaleDefinition = {
name: 'svenska'
}

export default sv
8 changes: 8 additions & 0 deletions src/assets/locales/tr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { LocaleDefinition } from '@/locale/locale'

// @ts-ignore
const tr: LocaleDefinition = {
name: 'Türk'
}

export default tr
8 changes: 8 additions & 0 deletions src/assets/locales/vi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { LocaleDefinition } from '@/locale/locale'

// @ts-ignore
const vi: LocaleDefinition = {
name: 'Tiếng Việt'
}

export default vi
5 changes: 4 additions & 1 deletion src/assets/locales/zh.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { LocaleDefinition } from '@/locale/locale'

// @ts-ignore
const zh: LocaleDefinition = {}
const zh: LocaleDefinition = {
name: '简体中文'
}

export default zh
2 changes: 1 addition & 1 deletion src/components/layout/IconListBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<b-icon size="is-small" icon="cog" />
</span>
</router-link>
<router-link to="/help" class="button is-white is-not-draggable">
<router-link to="/" class="button is-white is-not-draggable">
<span class="icon has-text-grey-dark">
<b-icon size="is-small" icon="question-circle" />
</span>
Expand Down
2 changes: 2 additions & 0 deletions src/locale/locale.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface LocaleDefinition {
name: string
main: {
menu: {
wallets: string
Expand Down Expand Up @@ -225,6 +226,7 @@ export interface LocaleDefinition {
currency: string
currencyDetails: string
pin: string
pinDetails: string
changePin: string
lockAfter: string
lockAfterDetails: string
Expand Down
10 changes: 7 additions & 3 deletions src/locale/locales.ts
Original file line number Diff line number Diff line change
@@ -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
23 changes: 17 additions & 6 deletions src/utils/currencies.ts
Original file line number Diff line number Diff line change
@@ -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'
}
65 changes: 32 additions & 33 deletions src/views/Settings/SettingsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,39 @@
<div class="box">

<form-section :title="$i18n.t('settings.settings')" no-divider>
<b-field
horizontal
:label="$i18n.t('settings.language')"
message="Language, Taal, Idioma, Sprache, Langue, Língua, linguaggio, язык, 語言, 언어, لغة"
<form-box
:title="$i18n.t('settings.language')"
description="Language, Taal, Idioma, Sprache, Langue, Língua, linguaggio, язык, 語言, 언어, لغة"
:is-narrow="false"
>
<b-select v-model="language" expanded icon="globe">
<option v-for="(lang, i) in langs" :key="`Lang${i}`" :value="lang" v-html="lang"/>
<option v-for="(langName, lang) in langs" :key="`Lang${lang}`" :value="lang">
{{ langName }}
</option>
</b-select>
</b-field>
</form-box>

<b-field horizontal :label="$i18n.t('settings.currency')" :message="$i18n.t('settings.currencyDetails')">
<form-box
:title="$i18n.t('settings.currency')"
:description="$i18n.t('settings.currencyDetails')"
:is-narrow="false"
>
<b-select v-model="currency" expanded icon="money-bill">
<option v-for="(currency, i) in currencies" :key="`Currency${i}`" :value="currency" v-html="currency"/>
<option v-for="(currencyName, currency) in currencies" :key="`Currency${currency}`" :value="currency">
{{ currency }} - {{ currencyName }}
</option>
</b-select>
</b-field>
</form-box>
</form-section>

<form-section :title="$i18n.t('settings.security')">
<b-field horizontal :label="$i18n.t('settings.pin')">
<b-button v-html="$i18n.t('settings.changePin')" type="is-light" @click="changePin"/>
</b-field>

<b-field
horizontal
:label="$i18n.t('settings.lockAfter')"
:message="$i18n.t('settings.lockAfterDetails')"
class="is-hidden"
<form-box
:title="$i18n.t('settings.pin')"
:description="$i18n.t('settings.pinDetails')"
type="is-warning"
>
<b-select v-model="lockAfter" expanded icon="lock">
<option v-for="(lock, i) in locks" :key="`Currency${i}`" :value="i" v-html="lock"/>
</b-select>
</b-field>
<b-button v-html="$i18n.t('settings.changePin')" type="is-light" @click="changePin"/>
</form-box>
</form-section>

<form-section
Expand All @@ -55,29 +56,26 @@

<script>
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 () {
Expand All @@ -98,6 +96,7 @@ export default {
}
}
},
methods: {
...mapGetters(['currentCurrencyCode', 'currentLanguageCode']),
...mapActions(['updateCurrency', 'updateLanguage']),
Expand Down
4 changes: 2 additions & 2 deletions src/views/TorStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 114b8da

Please sign in to comment.