Compare commits
1 commit
develop
...
experiment
Author | SHA1 | Date | |
---|---|---|---|
|
bd49108d29 |
6 changed files with 87 additions and 48 deletions
19
src/App.js
19
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 UserReportingModal from './components/user_reporting_modal/user_reporting_modal.vue'
|
||||||
import PostStatusModal from './components/post_status_modal/post_status_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 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 {
|
export default {
|
||||||
name: 'app',
|
name: 'app',
|
||||||
|
@ -43,10 +43,10 @@ export default {
|
||||||
// Load the locale from the storage
|
// Load the locale from the storage
|
||||||
const val = this.$store.getters.mergedConfig.interfaceLanguage
|
const val = this.$store.getters.mergedConfig.interfaceLanguage
|
||||||
this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
|
this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
|
||||||
window.addEventListener('resize', this.updateMobileState)
|
window.addEventListener('resize', this.updateLayoutState)
|
||||||
},
|
},
|
||||||
destroyed () {
|
destroyed () {
|
||||||
window.removeEventListener('resize', this.updateMobileState)
|
window.removeEventListener('resize', this.updateLayoutState)
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
currentUser () { return this.$store.state.users.currentUser },
|
currentUser () { return this.$store.state.users.currentUser },
|
||||||
|
@ -71,7 +71,9 @@ export default {
|
||||||
this.$store.state.instance.instanceSpecificPanelContent
|
this.$store.state.instance.instanceSpecificPanelContent
|
||||||
},
|
},
|
||||||
showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel },
|
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 },
|
privateMode () { return this.$store.state.instance.private },
|
||||||
sidebarAlign () {
|
sidebarAlign () {
|
||||||
return {
|
return {
|
||||||
|
@ -80,12 +82,13 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
updateMobileState () {
|
updateLayoutState () {
|
||||||
const mobileLayout = windowWidth() <= 800
|
const width = windowWidth()
|
||||||
|
const layout = getLayout(width)
|
||||||
const layoutHeight = windowHeight()
|
const layoutHeight = windowHeight()
|
||||||
const changed = mobileLayout !== this.isMobileLayout
|
const changed = layout !== this.layout
|
||||||
if (changed) {
|
if (changed) {
|
||||||
this.$store.dispatch('setMobileLayout', mobileLayout)
|
this.$store.dispatch('setLayout', layout)
|
||||||
}
|
}
|
||||||
this.$store.dispatch('setLayoutHeight', layoutHeight)
|
this.$store.dispatch('setLayoutHeight', layoutHeight)
|
||||||
}
|
}
|
||||||
|
|
36
src/App.scss
36
src/App.scss
|
@ -25,14 +25,46 @@ h4 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#content {
|
.main-layout {
|
||||||
|
display: grid;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding-top: 60px;
|
padding-top: 60px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
max-width: 980px;
|
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 {
|
.underlay {
|
||||||
background-color: rgba(0,0,0,0.15);
|
background-color: rgba(0,0,0,0.15);
|
||||||
background-color: var(--underlay, rgba(0,0,0,0.15));
|
background-color: var(--underlay, rgba(0,0,0,0.15));
|
||||||
|
|
24
src/App.vue
24
src/App.vue
|
@ -13,14 +13,8 @@
|
||||||
<div class="app-bg-wrapper app-container-wrapper" />
|
<div class="app-bg-wrapper app-container-wrapper" />
|
||||||
<div
|
<div
|
||||||
id="content"
|
id="content"
|
||||||
class="container underlay"
|
class="main-layout underlay"
|
||||||
>
|
>
|
||||||
<div
|
|
||||||
class="sidebar-flexer mobile-hidden"
|
|
||||||
:style="sidebarAlign"
|
|
||||||
>
|
|
||||||
<div class="sidebar-bounds">
|
|
||||||
<div class="sidebar-scroller">
|
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<user-panel />
|
<user-panel />
|
||||||
<div v-if="!isMobileLayout">
|
<div v-if="!isMobileLayout">
|
||||||
|
@ -28,13 +22,14 @@
|
||||||
<instance-specific-panel v-if="showInstanceSpecificPanel" />
|
<instance-specific-panel v-if="showInstanceSpecificPanel" />
|
||||||
<features-panel v-if="!currentUser && showFeaturesPanel" />
|
<features-panel v-if="!currentUser && showFeaturesPanel" />
|
||||||
<who-to-follow-panel v-if="currentUser && suggestionsEnabled" />
|
<who-to-follow-panel v-if="currentUser && suggestionsEnabled" />
|
||||||
<notifications v-if="currentUser" />
|
<portal to="notifications-3rd-column" :disabled="!is3ColumnLayout">
|
||||||
|
<keep-alive>
|
||||||
|
<notifications v-if="currentUser"/>
|
||||||
|
</keep-alive>
|
||||||
|
</portal>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<portal-target class="column-3" name="notifications-3rd-column" />
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="main">
|
|
||||||
<div
|
<div
|
||||||
v-if="!currentUser"
|
v-if="!currentUser"
|
||||||
class="login-hint panel panel-default"
|
class="login-hint panel panel-default"
|
||||||
|
@ -46,9 +41,7 @@
|
||||||
{{ $t("login.hint") }}
|
{{ $t("login.hint") }}
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
<router-view />
|
<router-view class="content" />
|
||||||
</div>
|
|
||||||
<media-modal />
|
|
||||||
</div>
|
</div>
|
||||||
<chat-panel
|
<chat-panel
|
||||||
v-if="currentUser && chat"
|
v-if="currentUser && chat"
|
||||||
|
@ -59,6 +52,7 @@
|
||||||
<UserReportingModal />
|
<UserReportingModal />
|
||||||
<PostStatusModal />
|
<PostStatusModal />
|
||||||
<SettingsModal />
|
<SettingsModal />
|
||||||
|
<media-modal />
|
||||||
<portal-target name="modal" />
|
<portal-target name="modal" />
|
||||||
<GlobalNoticeList />
|
<GlobalNoticeList />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,7 +2,7 @@ import Vue from 'vue'
|
||||||
import VueRouter from 'vue-router'
|
import VueRouter from 'vue-router'
|
||||||
import routes from './routes'
|
import routes from './routes'
|
||||||
import App from '../App.vue'
|
import App from '../App.vue'
|
||||||
import { windowWidth } from '../services/window_utils/window_utils'
|
import { windowWidth, getLayout } from '../services/window_utils/window_utils'
|
||||||
import { getOrCreateApp, getClientToken } from '../services/new_api/oauth.js'
|
import { getOrCreateApp, getClientToken } from '../services/new_api/oauth.js'
|
||||||
import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js'
|
import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js'
|
||||||
import { CURRENT_VERSION } from '../services/theme_data/theme_data.service.js'
|
import { CURRENT_VERSION } from '../services/theme_data/theme_data.service.js'
|
||||||
|
@ -324,7 +324,7 @@ const checkOAuthToken = async ({ store }) => {
|
||||||
|
|
||||||
const afterStoreSetup = async ({ store, i18n }) => {
|
const afterStoreSetup = async ({ store, i18n }) => {
|
||||||
const width = windowWidth()
|
const width = windowWidth()
|
||||||
store.dispatch('setMobileLayout', width <= 800)
|
store.dispatch('setLayout', getLayout(width))
|
||||||
|
|
||||||
const overrides = window.___pleromafe_dev_overrides || {}
|
const overrides = window.___pleromafe_dev_overrides || {}
|
||||||
const server = (typeof overrides.target !== 'undefined') ? overrides.target : window.location.origin
|
const server = (typeof overrides.target !== 'undefined') ? overrides.target : window.location.origin
|
||||||
|
|
|
@ -15,7 +15,7 @@ const defaultState = {
|
||||||
window.CSS.supports('-webkit-filter', 'drop-shadow(0 0)')
|
window.CSS.supports('-webkit-filter', 'drop-shadow(0 0)')
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
mobileLayout: false,
|
layout: false,
|
||||||
globalNotices: [],
|
globalNotices: [],
|
||||||
layoutHeight: 0,
|
layoutHeight: 0,
|
||||||
lastTimeline: null
|
lastTimeline: null
|
||||||
|
@ -39,8 +39,8 @@ const interfaceMod = {
|
||||||
setNotificationPermission (state, permission) {
|
setNotificationPermission (state, permission) {
|
||||||
state.notificationPermission = permission
|
state.notificationPermission = permission
|
||||||
},
|
},
|
||||||
setMobileLayout (state, value) {
|
setLayout (state, value) {
|
||||||
state.mobileLayout = value
|
state.layout = value
|
||||||
},
|
},
|
||||||
closeSettingsModal (state) {
|
closeSettingsModal (state) {
|
||||||
state.settingsModalState = 'hidden'
|
state.settingsModalState = 'hidden'
|
||||||
|
@ -89,8 +89,8 @@ const interfaceMod = {
|
||||||
setNotificationPermission ({ commit }, permission) {
|
setNotificationPermission ({ commit }, permission) {
|
||||||
commit('setNotificationPermission', permission)
|
commit('setNotificationPermission', permission)
|
||||||
},
|
},
|
||||||
setMobileLayout ({ commit }, value) {
|
setLayout ({ commit }, value) {
|
||||||
commit('setMobileLayout', value)
|
commit('setLayout', value)
|
||||||
},
|
},
|
||||||
closeSettingsModal ({ commit }) {
|
closeSettingsModal ({ commit }) {
|
||||||
commit('closeSettingsModal')
|
commit('closeSettingsModal')
|
||||||
|
|
|
@ -8,3 +8,13 @@ export const windowHeight = () =>
|
||||||
window.innerHeight ||
|
window.innerHeight ||
|
||||||
document.documentElement.clientHeight ||
|
document.documentElement.clientHeight ||
|
||||||
document.body.clientHeight
|
document.body.clientHeight
|
||||||
|
|
||||||
|
export const getLayout = (w, h) => {
|
||||||
|
if (w > 1200) {
|
||||||
|
return '3column'
|
||||||
|
} else if (w > 800) {
|
||||||
|
return '2column'
|
||||||
|
} else {
|
||||||
|
return '1column'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue