diff --git a/src/config/locales/en/translation.json b/src/config/locales/en/translation.json index d1f0e954..9a9008ef 100644 --- a/src/config/locales/en/translation.json +++ b/src/config/locales/en/translation.json @@ -195,6 +195,15 @@ "cancel": "Cancel", "confirm_message": "Are you sure to remove all associations?" }, + "network": { + "title": "Network", + "proxy": { + "title": "Proxy Configuration", + "no": "No proxy", + "system": "Use system proxy", + "manual": "Manual proxy configuration" + } + }, "language": { "title": "Language", "language_description": "Choose the language you would like to use with Whalebird.", diff --git a/src/renderer/components/Preferences.vue b/src/renderer/components/Preferences.vue index 47813021..7c0a4813 100644 --- a/src/renderer/components/Preferences.vue +++ b/src/renderer/components/Preferences.vue @@ -36,6 +36,10 @@ {{ $t('preferences.account.title') }} + + + {{ $t('preferences.network.title') }} + {{ $t('preferences.language.title') }} diff --git a/src/renderer/components/Preferences/Network.vue b/src/renderer/components/Preferences/Network.vue new file mode 100644 index 00000000..0878ca42 --- /dev/null +++ b/src/renderer/components/Preferences/Network.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/src/renderer/router/index.ts b/src/renderer/router/index.ts index 0365f5fd..574e81ce 100644 --- a/src/renderer/router/index.ts +++ b/src/renderer/router/index.ts @@ -41,6 +41,11 @@ const router = new Router({ name: 'account', component: require('@/components/Preferences/Account').default }, + { + path: 'network', + name: 'network', + component: require('@/components/Preferences/Network').default + }, { path: 'language', name: 'language', diff --git a/src/renderer/store/Preferences.ts b/src/renderer/store/Preferences.ts index 1f7a1d04..79347c54 100644 --- a/src/renderer/store/Preferences.ts +++ b/src/renderer/store/Preferences.ts @@ -3,6 +3,7 @@ import Account, { AccountState } from './Preferences/Account' import Language, { LanguageState } from './Preferences/Language' import Appearance, { AppearanceState } from './Preferences/Appearance' import Notification, { NotificationState } from './Preferences/Notification' +import Network, { NetworkState } from './Preferences/Network' import { Module } from 'vuex' import { RootState } from '@/store' @@ -16,6 +17,7 @@ type PreferencesModule = { Language: LanguageState Notification: NotificationState Appearance: AppearanceState + Network: NetworkState } export type PreferencesModuleState = PreferencesState & PreferencesModule @@ -27,7 +29,8 @@ const Preferences: Module = { Account, Language, Notification, - Appearance + Appearance, + Network }, state: state } diff --git a/src/renderer/store/Preferences/Network.ts b/src/renderer/store/Preferences/Network.ts new file mode 100644 index 00000000..d08cbd39 --- /dev/null +++ b/src/renderer/store/Preferences/Network.ts @@ -0,0 +1,35 @@ +import { Module, MutationTree, ActionTree } from 'vuex' +import { RootState } from '@/store' + +export type NetworkState = { + source: 'no' | 'system' | 'manual' +} + +const state = (): NetworkState => { + return { + source: 'no' + } +} + +export const MUTATION_TYPES = { + CHANGE_SOURCE: 'changeSource' +} + +const mutations: MutationTree = { + [MUTATION_TYPES.CHANGE_SOURCE]: (state, source: 'no' | 'system' | 'manual') => { + state.source = source + } +} + +const actions: ActionTree = { + changeSource: ({ commit }, source: string) => { + commit(MUTATION_TYPES.CHANGE_SOURCE, source) + } +} + +export default { + namespaced: true, + state: state, + mutations: mutations, + actions: actions +} as Module