diff --git a/src/App.js b/src/App.js index 52700319..932c3a4e 100644 --- a/src/App.js +++ b/src/App.js @@ -14,7 +14,7 @@ import DesktopNav from './components/desktop_nav/desktop_nav.vue' import UserReportingModal from './components/user_reporting_modal/user_reporting_modal.vue' import PostStatusModal from './components/post_status_modal/post_status_modal.vue' import GlobalNoticeList from './components/global_notice_list/global_notice_list.vue' -import { windowWidth, windowHeight } from './services/window_utils/window_utils' +import { windowWidth, windowHeight, getLayout } from './services/window_utils/window_utils' export default { name: 'app', @@ -43,10 +43,10 @@ export default { // Load the locale from the storage const val = this.$store.getters.mergedConfig.interfaceLanguage this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val }) - window.addEventListener('resize', this.updateMobileState) + window.addEventListener('resize', this.updateLayoutState) }, destroyed () { - window.removeEventListener('resize', this.updateMobileState) + window.removeEventListener('resize', this.updateLayoutState) }, computed: { currentUser () { return this.$store.state.users.currentUser }, @@ -71,7 +71,9 @@ export default { this.$store.state.instance.instanceSpecificPanelContent }, showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel }, - isMobileLayout () { return this.$store.state.interface.mobileLayout }, + layout () { return console.log(this.$store.state.interface.layout) || this.$store.state.interface.layout }, + isMobileLayout () { return this.$store.state.interface.layout === '1column' }, + is3ColumnLayout () { return this.$store.state.interface.layout === '3column' }, privateMode () { return this.$store.state.instance.private }, sidebarAlign () { return { @@ -80,12 +82,13 @@ export default { } }, methods: { - updateMobileState () { - const mobileLayout = windowWidth() <= 800 + updateLayoutState () { + const width = windowWidth() + const layout = getLayout(width) const layoutHeight = windowHeight() - const changed = mobileLayout !== this.isMobileLayout + const changed = layout !== this.layout if (changed) { - this.$store.dispatch('setMobileLayout', mobileLayout) + this.$store.dispatch('setLayout', layout) } this.$store.dispatch('setLayoutHeight', layoutHeight) } diff --git a/src/App.scss b/src/App.scss index 1800d816..ab43112c 100644 --- a/src/App.scss +++ b/src/App.scss @@ -25,14 +25,46 @@ h4 { margin: 0; } -#content { +.main-layout { + display: grid; box-sizing: border-box; padding-top: 60px; margin: auto; min-height: 100vh; max-width: 980px; - align-content: flex-start; + grid-template-columns: 365px 1fr; + grid-template-rows: auto 1fr; + grid-template-areas: + "post notice" + "post content"; + + .column-3 { + display: none; + } + + .content { + grid-area: content; + } + + .sidebar { + max-height: 100vh; + grid-area: post; + } + + @media all and (min-width: 1200px) { + grid-template-columns: 365px 1fr 1fr; + grid-template-rows: auto 1fr; + grid-template-areas: + "post notice notifications" + "post content notifications"; + + .column-3 { + display: block; + grid-area: notifications; + } + } } + .underlay { background-color: rgba(0,0,0,0.15); background-color: var(--underlay, rgba(0,0,0,0.15)); diff --git a/src/App.vue b/src/App.vue index b4eb0524..2039b7c2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -13,42 +13,35 @@