options to enable scrollbars and disable sticky headers

This commit is contained in:
Henry Jameson 2022-04-07 15:11:23 +03:00
parent d3d219f15d
commit b5ded67c06
7 changed files with 42 additions and 10 deletions

View file

@ -82,6 +82,8 @@ export default {
layoutType () { return this.$store.state.interface.layoutType }, layoutType () { return this.$store.state.interface.layoutType },
privateMode () { return this.$store.state.instance.private }, privateMode () { return this.$store.state.instance.private },
reverseLayout () { return this.$store.getters.mergedConfig.sidebarRight }, reverseLayout () { return this.$store.getters.mergedConfig.sidebarRight },
noSticky () { return this.$store.getters.mergedConfig.disableStickyHeaders },
showScrollbars () { return this.$store.getters.mergedConfig.showScrollbars },
...mapGetters(['mergedConfig']) ...mapGetters(['mergedConfig'])
}, },
methods: { methods: {

View file

@ -59,6 +59,7 @@ nav {
#content { #content {
overscroll-behavior-y: none; overscroll-behavior-y: none;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden;
position: sticky; position: sticky;
} }
@ -136,6 +137,19 @@ nav {
max-height: calc(100vh - var(--navbar-height)); max-height: calc(100vh - var(--navbar-height));
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
margin-left: -2em;
padding-left: 2.5em;
&:not(.-show-scrollbar) {
scrollbar-width: none;
margin-right: -2em;
padding-right: 2.5em;
&::-webkit-scrollbar {
display: block;
width: 0;
}
}
.panel-heading.-sticky { .panel-heading.-sticky {
top: -10px; top: -10px;
@ -143,6 +157,15 @@ nav {
} }
} }
&.-no-sticky-headers {
.column {
.panel-heading.-sticky {
position: relative;
top: 0;
}
}
}
.column-inner { .column-inner {
display: grid; display: grid;
grid-template-columns: 100%; grid-template-columns: 100%;
@ -186,10 +209,6 @@ nav {
#content, #content,
.column.-scrollable { .column.-scrollable {
&::-webkit-scrollbar {
display: block;
width: 0;
}
} }
.text-center { .text-center {

View file

@ -13,10 +13,10 @@
<div <div
id="content" id="content"
class="app-layout container" class="app-layout container"
:class="[{ '-reverse': reverseLayout }, '-' + layoutType]" :class="[{ '-reverse': reverseLayout, '-no-sticky-headers': noSticky }, '-' + layoutType]"
> >
<div class="underlay"/> <div class="underlay"/>
<div id="sidebar" class="column -scrollable"> <div id="sidebar" class="column -scrollable" :class="{ '-show-scrollbar': showScrollbars }">
<user-panel /> <user-panel />
<template v-if="layoutType !== 'mobile'"> <template v-if="layoutType !== 'mobile'">
<nav-panel /> <nav-panel />
@ -40,7 +40,7 @@
</div> </div>
<router-view /> <router-view />
</div> </div>
<div id="notifs-column" class="column -scrollable"/> <div id="notifs-column" class="column -scrollable" :class="{ '-show-scrollbar': showScrollbars }"/>
<media-modal /> <media-modal />
</div> </div>
<shout-panel <shout-panel

View file

@ -60,6 +60,16 @@
{{ $t('settings.virtual_scrolling') }} {{ $t('settings.virtual_scrolling') }}
</BooleanSetting> </BooleanSetting>
</li> </li>
<li>
<BooleanSetting path="disableStickyHeaders">
{{ $t('settings.disable_sticky_headers') }}
</BooleanSetting>
</li>
<li>
<BooleanSetting path="showScrollbars">
{{ $t('settings.show_scrollbars') }}
</BooleanSetting>
</li>
<li> <li>
<BooleanSetting <BooleanSetting
path="alwaysShowNewPostButton" path="alwaysShowNewPostButton"

View file

@ -91,7 +91,7 @@ const Timeline = {
const credentials = store.state.users.currentUser.credentials const credentials = store.state.users.currentUser.credentials
const showImmediately = this.timeline.visibleStatuses.length === 0 const showImmediately = this.timeline.visibleStatuses.length === 0
scroller().addEventListener('scroll', this.handleScroll) scroller() && scroller().addEventListener('scroll', this.handleScroll)
if (store.state.api.fetchers[this.timelineName]) { return false } if (store.state.api.fetchers[this.timelineName]) { return false }

View file

@ -73,6 +73,8 @@ export const defaultState = {
playVideosInModal: false, playVideosInModal: false,
useOneClickNsfw: false, useOneClickNsfw: false,
useContainFit: true, useContainFit: true,
disableStickyHeaders: false,
showScrollbars: false,
greentext: undefined, // instance default greentext: undefined, // instance default
useAtIcon: undefined, // instance default useAtIcon: undefined, // instance default
mentionLinkDisplay: undefined, // instance default mentionLinkDisplay: undefined, // instance default

View file

@ -28,8 +28,7 @@
.panel-body:empty::before { .panel-body:empty::before {
content: "¯\\_(ツ)_/¯"; // Could use words but it'd require translations content: "¯\\_(ツ)_/¯"; // Could use words but it'd require translations
display: block; display: block; margin: 1em;
margin: 1em;
text-align: center; text-align: center;
} }