level 2 collapse

This commit is contained in:
Henry Jameson 2025-11-20 18:29:09 +02:00
commit 8e6800fd1e
6 changed files with 42 additions and 3 deletions

View file

@ -73,6 +73,11 @@ const SettingsModalContent = {
return useInterfaceStore().layoutType === 'mobile' return useInterfaceStore().layoutType === 'mobile'
} }
}, },
data () {
return {
navCollapsed: false
}
},
methods: { methods: {
onOpen () { onOpen () {
const targetTab = useInterfaceStore().settingsModalTargetTab const targetTab = useInterfaceStore().settingsModalTargetTab
@ -90,9 +95,11 @@ const SettingsModalContent = {
useInterfaceStore().clearSettingsModalTargetTab() useInterfaceStore().clearSettingsModalTargetTab()
}, },
nestedTooBig () { nestedTooBig () {
this.navCollapsed = false
this.$refs.tabSwitcher.showNav() this.$refs.tabSwitcher.showNav()
}, },
nestedTooSmall () { nestedTooSmall () {
this.navCollapsed = true
this.$refs.tabSwitcher.hideNav() this.$refs.tabSwitcher.hideNav()
} }
}, },

View file

@ -13,6 +13,7 @@
> >
<GeneralTab <GeneralTab
class="inner-tab -middle" class="inner-tab -middle"
:parent-collapsed="navCollapsed"
@too-small="() => nestedTooSmall()" @too-small="() => nestedTooSmall()"
@too-big="() => nestedTooBig()" @too-big="() => nestedTooBig()"
/> />

View file

@ -35,6 +35,12 @@ library.add(
) )
const GeneralTab = { const GeneralTab = {
props: {
parentCollapsed: {
required: true,
type: Boolean
}
},
data () { data () {
return { return {
subjectLineOptions: ['email', 'noop', 'masto'].map(mode => ({ subjectLineOptions: ['email', 'noop', 'masto'].map(mode => ({

View file

@ -3,6 +3,7 @@
:label="$t('settings.general')" :label="$t('settings.general')"
ref="tabSwitcher" ref="tabSwitcher"
class="settings_tab-switcher" class="settings_tab-switcher"
:parent-collapsed="parentCollapsed"
@too-small="() => $emit('tooSmall')" @too-small="() => $emit('tooSmall')"
@too-big="() => $emit('tooBig')" @too-big="() => $emit('tooBig')"
> >

View file

@ -32,6 +32,11 @@ export default {
required: false, required: false,
type: Boolean, type: Boolean,
default: false default: false
},
parentCollapsed: {
required: false,
type: Boolean,
default: false
} }
}, },
emits: ['tooBig', 'tooSmall'], emits: ['tooBig', 'tooSmall'],
@ -91,11 +96,18 @@ export default {
const navWidth = this.$refs.nav?.clientWidth const navWidth = this.$refs.nav?.clientWidth
const contentsWidth = this.$refs.contents?.clientWidth const contentsWidth = this.$refs.contents?.clientWidth
if (contentsWidth < tabContentWidth) { if (contentsWidth < tabContentWidth) {
this.$emit('tooSmall') if (this.parentCollapsed) {
this.hideNav()
} else {
this.$emit('tooSmall')
}
} else if (contentsWidth - navWidth >= tabContentWidth){ } else if (contentsWidth - navWidth >= tabContentWidth){
this.$emit('tooBig') if (this.parentCollapsed) {
this.$emit('tooBig')
} else {
this.showNav()
}
} }
}, },
// DO NOT put it to computed, it doesn't work (caching?) // DO NOT put it to computed, it doesn't work (caching?)

View file

@ -26,6 +26,10 @@
flex: 1 1 auto; flex: 1 1 auto;
overflow-x: hidden; overflow-x: hidden;
.tab-content-label {
display: none
}
.tab-content { .tab-content {
align-self: center; align-self: center;
@ -77,6 +81,14 @@
} }
&.-nav-content { &.-nav-content {
> .contents {
> .tab-content-wrapper {
> .tab-content-label {
display: block;
}
}
}
> .tabs { > .tabs {
position: absolute; position: absolute;
pointer-events: none; pointer-events: none;