Skip to content

A full-featured download manager.

feat: preference responsive subnav switcher

Dr_rOot7d4eec6b02dc
diff --git a/src/renderer/components/Preference/Advanced.vue b/src/renderer/components/Preference/Advanced.vue
index 4765f62a..a6acd217 100644
--- a/src/renderer/components/Preference/Advanced.vue
+++ b/src/renderer/components/Preference/Advanced.vue
@@ -1,7 +1,12 @@
<template>
<el-container class="content panel" direction="vertical">
<el-header class="panel-header" height="84">
- <h4>{{ title }}</h4>
+ <h4 class="hidden-xs-only">{{ title }}</h4>
+ <mo-subnav-switcher
+ :title="title"
+ :subnavs="subnavs"
+ class="hidden-sm-and-up"
+ />
</el-header>
<el-main class="panel-content">
<el-form
@@ -179,6 +184,7 @@
import randomize from 'randomatic'
import * as clipboard from 'clipboard-polyfill'
import ShowInFolder from '@/components/Native/ShowInFolder'
+ import SubnavSwitcher from '@/components/Subnav/SubnavSwitcher'
import userAgentMap from '@shared/ua'
import {
buildRpcUrl,
@@ -227,6 +233,7 @@
export default {
name: 'mo-preference-advanced',
components: {
+ [SubnavSwitcher.name]: SubnavSwitcher,
[ShowInFolder.name]: ShowInFolder
},
data () {
@@ -247,6 +254,25 @@
title () {
return this.$t('preferences.advanced')
},
+ subnavs: function () {
+ return [
+ {
+ key: 'basic',
+ title: this.$t('preferences.basic'),
+ route: '/preference/basic'
+ },
+ {
+ key: 'advanced',
+ title: this.$t('preferences.advanced'),
+ route: '/preference/advanced'
+ },
+ {
+ key: 'lab',
+ title: this.$t('preferences.lab'),
+ route: '/preference/lab'
+ }
+ ]
+ },
...mapState('preference', {
config: state => state.config,
logPath: state => state.config.logPath,
diff --git a/src/renderer/components/Preference/Basic.vue b/src/renderer/components/Preference/Basic.vue
index 69f0dbbb..d8b40d2d 100644
--- a/src/renderer/components/Preference/Basic.vue
+++ b/src/renderer/components/Preference/Basic.vue
@@ -1,7 +1,12 @@
<template>
<el-container class="content panel" direction="vertical">
<el-header class="panel-header" height="84">
- <h4>{{ title }}</h4>
+ <h4 class="hidden-xs-only">{{ title }}</h4>
+ <mo-subnav-switcher
+ :title="title"
+ :subnavs="subnavs"
+ class="hidden-sm-and-up"
+ />
</el-header>
<el-main class="panel-content">
<el-form
@@ -146,6 +151,7 @@
import is from 'electron-is'
import { mapState } from 'vuex'
import { cloneDeep } from 'lodash'
+ import SubnavSwitcher from '@/components/Subnav/SubnavSwitcher'
import SelectDirectory from '@/components/Native/SelectDirectory'
import ThemeSwitcher from '@/components/Preference/ThemeSwitcher'
import { availableLanguages, getLanguage } from '@shared/locales'
@@ -197,6 +203,7 @@
export default {
name: 'mo-preference-basic',
components: {
+ [SubnavSwitcher.name]: SubnavSwitcher,
[SelectDirectory.name]: SelectDirectory,
[ThemeSwitcher.name]: ThemeSwitcher
},
@@ -218,6 +225,25 @@
title () {
return this.$t('preferences.basic')
},
+ subnavs: function () {
+ return [
+ {
+ key: 'basic',
+ title: this.$t('preferences.basic'),
+ route: '/preference/basic'
+ },
+ {
+ key: 'advanced',
+ title: this.$t('preferences.advanced'),
+ route: '/preference/advanced'
+ },
+ {
+ key: 'lab',
+ title: this.$t('preferences.lab'),
+ route: '/preference/lab'
+ }
+ ]
+ },
showHideAppMenuOption () {
return is.windows() || is.linux()
},
diff --git a/src/renderer/components/Preference/Index.vue b/src/renderer/components/Preference/Index.vue
index 14ec5a15..7f9a6614 100644
--- a/src/renderer/components/Preference/Index.vue
+++ b/src/renderer/components/Preference/Index.vue
@@ -1,6 +1,6 @@
<template>
<el-container class="content panel" direction="horizontal">
- <el-aside width="200px" class="subnav">
+ <el-aside width="200px" class="subnav hidden-xs-only">
<router-view name="subnav" />
</el-aside>
<router-view name="form" />
diff --git a/src/renderer/components/Preference/Lab.vue b/src/renderer/components/Preference/Lab.vue
index 66b540e6..8dfd1528 100644
--- a/src/renderer/components/Preference/Lab.vue
+++ b/src/renderer/components/Preference/Lab.vue
@@ -1,7 +1,12 @@
<template>
<el-container class="content panel" direction="vertical">
<el-header class="panel-header" height="84">
- <h4>{{ title }}</h4>
+ <h4 class="hidden-xs-only">{{ title }}</h4>
+ <mo-subnav-switcher
+ :title="title"
+ :subnavs="subnavs"
+ class="hidden-sm-and-up"
+ />
</el-header>
<el-main class="panel-content">
<el-form
@@ -43,6 +48,7 @@
import is from 'electron-is'
import { mapState } from 'vuex'
import { cloneDeep } from 'lodash'
+ import SubnavSwitcher from '@/components/Subnav/SubnavSwitcher'
import '@/components/Icons/info-square'
import {
calcFormLabelWidth,
@@ -59,6 +65,9 @@
export default {
name: 'mo-preference-lab',
+ components: {
+ [SubnavSwitcher.name]: SubnavSwitcher
+ },
data () {
const { locale } = this.$store.state.preference.config
const form = initialForm(this.$store.state.preference.config)
@@ -75,6 +84,25 @@
title () {
return this.$t('preferences.lab')
},
+ subnavs: function () {
+ return [
+ {
+ key: 'basic',
+ title: this.$t('preferences.basic'),
+ route: '/preference/basic'
+ },
+ {
+ key: 'advanced',
+ title: this.$t('preferences.advanced'),
+ route: '/preference/advanced'
+ },
+ {
+ key: 'lab',
+ title: this.$t('preferences.lab'),
+ route: '/preference/lab'
+ }
+ ]
+ },
...mapState('preference', {
config: state => state.config
})