From 1e606d2f268e796a3efd2a995713c70a000daf62 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 25 May 2020 03:14:41 +0300 Subject: split modal's content into another component, add lazy loading --- .../settings_modal/settings_modal_content.js | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/components/settings_modal/settings_modal_content.js (limited to 'src/components/settings_modal/settings_modal_content.js') diff --git a/src/components/settings_modal/settings_modal_content.js b/src/components/settings_modal/settings_modal_content.js new file mode 100644 index 00000000..bd8df672 --- /dev/null +++ b/src/components/settings_modal/settings_modal_content.js @@ -0,0 +1,42 @@ +import TabSwitcher from 'src/components/tab_switcher/tab_switcher.js' + +import DataImportExportTab from './tabs/data_import_export_tab.vue' +import MutesAndBlocksTab from './tabs/mutes_and_blocks_tab.vue' +import NotificationsTab from './tabs/notifications_tab.vue' +import FilteringTab from './tabs/filtering_tab.vue' +import SecurityTab from './tabs/security_tab/security_tab.vue' +import ProfileTab from './tabs/profile_tab.vue' +import GeneralTab from './tabs/general_tab.vue' +import VersionTab from './tabs/version_tab.vue' +import ThemeTab from './tabs/theme_tab/theme_tab.vue' + +const SettingsModalContent = { + components: { + TabSwitcher, + + DataImportExportTab, + MutesAndBlocksTab, + NotificationsTab, + FilteringTab, + SecurityTab, + ProfileTab, + GeneralTab, + VersionTab, + ThemeTab + }, + computed: { + isLoggedIn () { + return !!this.$store.state.users.currentUser + } + }, + methods: { + closeModal () { + this.$store.dispatch('closeSettingsModal') + }, + peekModal () { + this.$store.dispatch('togglePeekSettingsModal') + } + } +} + +export default SettingsModalContent -- cgit v1.2.3-70-g09d2 From 6a4ad1fe624b2e2da68707ffffcc6a4cbe7e5e03 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 25 May 2020 14:04:36 +0300 Subject: added "settings saved" notice back --- .../settings_modal/settings_modal_content.js | 3 +++ .../settings_modal/settings_modal_content.vue | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'src/components/settings_modal/settings_modal_content.js') diff --git a/src/components/settings_modal/settings_modal_content.js b/src/components/settings_modal/settings_modal_content.js index bd8df672..b842ec7d 100644 --- a/src/components/settings_modal/settings_modal_content.js +++ b/src/components/settings_modal/settings_modal_content.js @@ -25,6 +25,9 @@ const SettingsModalContent = { ThemeTab }, computed: { + currentSaveStateNotice () { + return this.$store.state.interface.settings.currentSaveStateNotice + }, isLoggedIn () { return !!this.$store.state.users.currentUser } diff --git a/src/components/settings_modal/settings_modal_content.vue b/src/components/settings_modal/settings_modal_content.vue index 013bf34f..737c3637 100644 --- a/src/components/settings_modal/settings_modal_content.vue +++ b/src/components/settings_modal/settings_modal_content.vue @@ -4,6 +4,25 @@ {{ $t('settings.settings') }} + + + + + +
+ +
+ diff --git a/src/components/settings_modal/settings_modal_content.js b/src/components/settings_modal/settings_modal_content.js index b842ec7d..b27fbd28 100644 --- a/src/components/settings_modal/settings_modal_content.js +++ b/src/components/settings_modal/settings_modal_content.js @@ -31,14 +31,6 @@ const SettingsModalContent = { isLoggedIn () { return !!this.$store.state.users.currentUser } - }, - methods: { - closeModal () { - this.$store.dispatch('closeSettingsModal') - }, - peekModal () { - this.$store.dispatch('togglePeekSettingsModal') - } } } diff --git a/src/components/settings_modal/settings_modal_content.scss b/src/components/settings_modal/settings_modal_content.scss index 92e167a2..f80306c6 100644 --- a/src/components/settings_modal/settings_modal_content.scss +++ b/src/components/settings_modal/settings_modal_content.scss @@ -1,32 +1,6 @@ @import 'src/_variables.scss'; - -.settings-modal-panel { - overflow: hidden; - transition: transform; - transition-timing-function: ease-in-out; - transition-duration: 300ms; - width: 1000px; - max-width: 90vw; - height: 90vh; - - @media all and (max-width: 800px) { - max-width: 100vw; - height: 100vh; - } - - .settings_tab-switcher { - height: 100%; - } - .panel-body { - height: 100%; - overflow-y: hidden; - - .btn { - min-height: 28px; - min-width: 10em; - padding: 0 2em; - } - } +.settings_tab-switcher { + height: 100%; .full-height { height: 100%; diff --git a/src/components/settings_modal/settings_modal_content.vue b/src/components/settings_modal/settings_modal_content.vue index 865a2adf..3e06148f 100644 --- a/src/components/settings_modal/settings_modal_content.vue +++ b/src/components/settings_modal/settings_modal_content.vue @@ -1,112 +1,72 @@ diff --git a/src/i18n/en.json b/src/i18n/en.json index e3dc75d7..062af2c7 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -59,8 +59,10 @@ "apply": "Apply", "submit": "Submit", "more": "More", + "loading": "Loading…", "generic_error": "An error occured", "error_retry": "Please try again", + "retry": "Try again", "optional": "optional", "show_more": "Show more", "show_less": "Show less", -- cgit v1.2.3-70-g09d2 From 5ffcddd3b9b4b6600e4e51066b9410d7e852df11 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 27 May 2020 03:32:57 +0300 Subject: fixes. sorry for bad commit message i'm tired --- src/components/settings_modal/settings_modal.js | 3 + .../settings_modal/settings_modal_content.js | 3 - .../settings_modal/settings_modal_content.vue | 2 +- .../settings_modal/tabs/theme_tab/theme_tab.scss | 19 ++++-- .../settings_modal/tabs/theme_tab/theme_tab.vue | 26 ++++---- src/components/tab_switcher/tab_switcher.js | 19 +++++- src/components/tab_switcher/tab_switcher.scss | 74 +++++++++++++++------- 7 files changed, 96 insertions(+), 50 deletions(-) (limited to 'src/components/settings_modal/settings_modal_content.js') diff --git a/src/components/settings_modal/settings_modal.js b/src/components/settings_modal/settings_modal.js index 32ef38d6..caa7c48c 100644 --- a/src/components/settings_modal/settings_modal.js +++ b/src/components/settings_modal/settings_modal.js @@ -24,6 +24,9 @@ const SettingsModal = { } }, computed: { + currentSaveStateNotice () { + return this.$store.state.interface.settings.currentSaveStateNotice + }, modalActivated () { return this.$store.state.interface.settingsModalState !== 'hidden' }, diff --git a/src/components/settings_modal/settings_modal_content.js b/src/components/settings_modal/settings_modal_content.js index b27fbd28..48101a90 100644 --- a/src/components/settings_modal/settings_modal_content.js +++ b/src/components/settings_modal/settings_modal_content.js @@ -25,9 +25,6 @@ const SettingsModalContent = { ThemeTab }, computed: { - currentSaveStateNotice () { - return this.$store.state.interface.settings.currentSaveStateNotice - }, isLoggedIn () { return !!this.$store.state.users.currentUser } diff --git a/src/components/settings_modal/settings_modal_content.vue b/src/components/settings_modal/settings_modal_content.vue index 8b83e48c..283b4ef8 100644 --- a/src/components/settings_modal/settings_modal_content.vue +++ b/src/components/settings_modal/settings_modal_content.vue @@ -40,7 +40,7 @@
diff --git a/src/components/settings_modal/tabs/theme_tab/theme_tab.scss b/src/components/settings_modal/tabs/theme_tab/theme_tab.scss index e0b1a2df..926eceff 100644 --- a/src/components/settings_modal/tabs/theme_tab/theme_tab.scss +++ b/src/components/settings_modal/tabs/theme_tab/theme_tab.scss @@ -95,20 +95,25 @@ align-items: baseline; width: 100%; min-height: 30px; - - .btn { - min-width: 1px; - flex: 0 auto; - padding: 0 1em; - } + margin-bottom: 1em; p { flex: 1; margin: 0; margin-right: .5em; } + } - margin-bottom: 1em; + .tab-header-buttons { + display: flex; + flex-direction: column; + + .btn { + min-width: 1px; + flex: 0 auto; + padding: 0 1em; + margin-bottom: .5em; + } } .shadow-selector { diff --git a/src/components/settings_modal/tabs/theme_tab/theme_tab.vue b/src/components/settings_modal/tabs/theme_tab/theme_tab.vue index 33098498..fcfad23b 100644 --- a/src/components/settings_modal/tabs/theme_tab/theme_tab.vue +++ b/src/components/settings_modal/tabs/theme_tab/theme_tab.vue @@ -126,18 +126,20 @@ >

{{ $t('settings.theme_help') }}

- - +
+ + +

{{ $t('settings.theme_help_v2_1') }}

{{ $t('settings.style.common_colors.main') }}

diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js index 2d04e15d..616f1a19 100644 --- a/src/components/tab_switcher/tab_switcher.js +++ b/src/components/tab_switcher/tab_switcher.js @@ -95,9 +95,12 @@ export default Vue.component('tab-switcher', { disabled={slot.data.attrs.disabled} onClick={this.activateTab(index)} class={classesTab.join(' ')} + type="button" > {!slot.data.attrs.icon ? '' : ()} - {slot.data.attrs.label} + + {slot.data.attrs.label} + ) @@ -110,13 +113,23 @@ export default Vue.component('tab-switcher', { if (slot.data.attrs.fullHeight) { classes.push('full-height') } + const newSlot = ( +
+ { + this.sideTabBar + ?

{slot.data.attrs.label}

+ : '' + } + {slot} +
+ ) if (this.renderOnlyFocused) { return active - ?
{slot}
+ ?
{newSlot}
:
} - return
{slot}
+ return
{newSlot}
}) return ( diff --git a/src/components/tab_switcher/tab_switcher.scss b/src/components/tab_switcher/tab_switcher.scss index d60e065b..db58f4cd 100644 --- a/src/components/tab_switcher/tab_switcher.scss +++ b/src/components/tab_switcher/tab_switcher.scss @@ -10,12 +10,14 @@ &.top-tabs { flex-direction: column; + > .tabs { width: 100%; overflow-y: hidden; overflow-x: auto; padding-top: 5px; flex-direction: row; + &::after, &::before { content: ''; flex: 1 1 auto; @@ -51,34 +53,47 @@ &.side-tabs { flex-direction: row; + @media all and (max-width: 800px) { overflow-x: auto; } + > .contents { - flex: 0 1 80%; - @media all and (max-width: 800px) { - min-width: 96vw; - } + flex: 1 1 auto; } + > .tabs { - flex: 1 0 auto; + flex: 0 0 auto; overflow-y: auto; overflow-x: hidden; flex-direction: column; + &::after, &::before { - flex: 1 0 .5em; + flex-shrink: 0; + flex-basis: .5em; content: ''; border-right: 1px solid; border-right-color: $fallback--border; border-right-color: var(--border, $fallback--border); } + + &::after { + flex-grow: 1; + } + &::before { flex-grow: 0; } + .tab-wrapper { min-width: 10em; display: flex; flex-direction: column; + + @media all and (max-width: 800px) { + min-width: 1em; + } + &:not(.active)::after { top: 0; right: 0; @@ -87,6 +102,7 @@ border-right-color: $fallback--border; border-right-color: var(--border, $fallback--border); } + &::before { flex: 0 0 6px; content: ''; @@ -94,6 +110,7 @@ border-right-color: $fallback--border; border-right-color: var(--border, $fallback--border); } + &:last-child .tab { margin-bottom: 0; } @@ -106,26 +123,23 @@ min-width: 1px; border-top-right-radius: 0; border-bottom-right-radius: 0; + padding-left: 1em; padding-right: calc(1em + 200px); - margin-right: 6px - 200px; - margin-left: 6px; - } - - .tab-wrapper { - min-width: 10em; - &:not(.active)::after { - top: 0; - right: 0; - bottom: 0; - border-right: 1px solid; - border-right-color: $fallback--border; - border-right-color: var(--border, $fallback--border); + margin-right: calc(1em - 200px); + margin-left: 1em; + @media all and (max-width: 800px) { + padding-left: .25em; + padding-right: calc(.25em + 200px); + margin-right: calc(.25em - 200px); + margin-left: .25em; + .text { + display: none + } } } } } - .contents { flex: 1 0 auto; min-height: 0px; @@ -142,14 +156,14 @@ .tab { position: relative; white-space: nowrap; - padding: 6px 1em; + background-color: $fallback--fg; + background-color: var(--tab, $fallback--fg); + &, &:active .tab-icon { color: $fallback--text; color: var(--tabText, $fallback--text); } - background-color: $fallback--fg; - background-color: var(--tab, $fallback--fg); &:not(.active) { z-index: 4; @@ -173,7 +187,6 @@ } } - .tabs { display: flex; position: relative; @@ -198,4 +211,17 @@ } } } + + .mobile-label { + padding-left: .3em; + padding-bottom: .25em; + margin-top: .5em; + margin-left: .2em; + margin-bottom: .25em; + border-bottom: 1px solid var(--border, $fallback--border); + + @media all and (min-width: 800px) { + display: none; + } + } } -- cgit v1.2.3-70-g09d2