feat(frontend): ページのタブバーを下部に表示できるように
This commit is contained in:
parent
2f13f923a8
commit
bb56b3b4f1
|
@ -25,6 +25,7 @@
|
|||
- `g` キーを連打する
|
||||
- URLに`?safemode=true`を付ける
|
||||
- PWAのショートカットで Safemode を選択して起動する
|
||||
- Feat: ページのタブバーを下部に表示できるように
|
||||
- Enhance: コントロールパネルを検索できるように
|
||||
- Enhance: トルコ語 (tr-TR) に対応
|
||||
- Fix: 一部の設定検索結果が存在しないパスになる問題を修正
|
||||
|
|
|
@ -5871,6 +5871,10 @@ export interface Locale extends ILocale {
|
|||
* 利用できるリアクションを先頭に表示
|
||||
*/
|
||||
"showAvailableReactionsFirstInNote": string;
|
||||
/**
|
||||
* ページのタブバーを下部に表示
|
||||
*/
|
||||
"showPageTabBarBottom": string;
|
||||
"_chat": {
|
||||
/**
|
||||
* 送信者の名前を表示
|
||||
|
|
|
@ -1469,6 +1469,7 @@ _settings:
|
|||
contentsUpdateFrequency_description2: "リアルタイムモードがオンのときは、この設定に関わらずリアルタイムでコンテンツが更新されます。"
|
||||
showUrlPreview: "URLプレビューを表示する"
|
||||
showAvailableReactionsFirstInNote: "利用できるリアクションを先頭に表示"
|
||||
showPageTabBarBottom: "ページのタブバーを下部に表示"
|
||||
|
||||
_chat:
|
||||
showSenderName: "送信者の名前を表示"
|
||||
|
|
|
@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div :class="$style.tabs">
|
||||
<div :class="[$style.tabs, { [$style.centered]: props.centered }]">
|
||||
<div :class="$style.tabsInner">
|
||||
<button
|
||||
v-for="t in tabs" :ref="(el) => tabRefs[t.key] = (el as HTMLElement)" v-tooltip.noDelay="t.title"
|
||||
|
@ -30,7 +30,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</div>
|
||||
<div
|
||||
ref="tabHighlightEl"
|
||||
:class="[$style.tabHighlight, { [$style.animate]: prefer.s.animation }]"
|
||||
:class="[$style.tabHighlight, { [$style.animate]: prefer.s.animation, [$style.tabHighlightUpper]: tabHighlightUpper }]"
|
||||
></div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -59,6 +59,8 @@ import { prefer } from '@/preferences.js';
|
|||
const props = withDefaults(defineProps<{
|
||||
tabs?: Tab[];
|
||||
tab?: string;
|
||||
centered?: boolean;
|
||||
tabHighlightUpper?: boolean;
|
||||
}>(), {
|
||||
tabs: () => ([] as Tab[]),
|
||||
});
|
||||
|
@ -169,6 +171,16 @@ onUnmounted(() => {
|
|||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
scrollbar-width: none;
|
||||
|
||||
&.centered {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
@container (max-width: 450px) {
|
||||
.tabs {
|
||||
font-size: 80%;
|
||||
}
|
||||
}
|
||||
|
||||
.tabsInner {
|
||||
|
@ -227,5 +239,10 @@ onUnmounted(() => {
|
|||
&.animate {
|
||||
transition: width 0.15s ease, left 0.15s ease;
|
||||
}
|
||||
|
||||
&.tabHighlightUpper {
|
||||
top: 0;
|
||||
bottom: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -6,14 +6,22 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template>
|
||||
<div ref="rootEl" :class="[$style.root, reversed ? '_pageScrollableReversed' : '_pageScrollable']">
|
||||
<MkStickyContainer>
|
||||
<template #header><MkPageHeader v-model:tab="tab" v-bind="pageHeaderProps"/></template>
|
||||
<template #header>
|
||||
<MkPageHeader v-if="prefer.s.showPageTabBarBottom && (props.tabs?.length ?? 0) > 0" v-bind="pageHeaderPropsWithoutTabs"/>
|
||||
<MkPageHeader v-else v-model:tab="tab" v-bind="pageHeaderProps"/>
|
||||
</template>
|
||||
<div :class="$style.body">
|
||||
<MkSwiper v-if="prefer.s.enableHorizontalSwipe && swipable && (props.tabs?.length ?? 1) > 1" v-model:tab="tab" :class="$style.swiper" :tabs="props.tabs">
|
||||
<slot></slot>
|
||||
</MkSwiper>
|
||||
<slot v-else></slot>
|
||||
</div>
|
||||
<template #footer><slot name="footer"></slot></template>
|
||||
<template #footer>
|
||||
<slot name="footer"></slot>
|
||||
<div v-if="prefer.s.showPageTabBarBottom && (props.tabs?.length ?? 0) > 0" :class="$style.footerTabs">
|
||||
<MkTabs v-model:tab="tab" :tabs="props.tabs" :centered="true" :tabHighlightUpper="true"/>
|
||||
</div>
|
||||
</template>
|
||||
</MkStickyContainer>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -26,6 +34,7 @@ import { useScrollPositionKeeper } from '@/composables/use-scroll-position-keepe
|
|||
import MkSwiper from '@/components/MkSwiper.vue';
|
||||
import { useRouter } from '@/router.js';
|
||||
import { prefer } from '@/preferences.js';
|
||||
import MkTabs from '@/components/MkTabs.vue';
|
||||
|
||||
const props = withDefaults(defineProps<PageHeaderProps & {
|
||||
reversed?: boolean;
|
||||
|
@ -40,6 +49,11 @@ const pageHeaderProps = computed(() => {
|
|||
return rest;
|
||||
});
|
||||
|
||||
const pageHeaderPropsWithoutTabs = computed(() => {
|
||||
const { reversed, tabs, ...rest } = props;
|
||||
return rest;
|
||||
});
|
||||
|
||||
const tab = defineModel<string>('tab');
|
||||
const rootEl = useTemplateRef('rootEl');
|
||||
|
||||
|
@ -68,4 +82,11 @@ defineExpose({
|
|||
.body, .swiper {
|
||||
min-height: calc(100cqh - (var(--MI-stickyTop, 0px) + var(--MI-stickyBottom, 0px)));
|
||||
}
|
||||
|
||||
.footerTabs {
|
||||
background: color(from var(--MI_THEME-pageHeaderBg) srgb r g b / 0.75);
|
||||
-webkit-backdrop-filter: var(--MI-blur, blur(15px));
|
||||
backdrop-filter: var(--MI-blur, blur(15px));
|
||||
border-top: solid 0.5px var(--MI_THEME-divider);
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -477,6 +477,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</MkPreferenceContainer>
|
||||
</SearchMarker>
|
||||
|
||||
<SearchMarker :keywords="['tabs', 'tabbar', 'bottom', 'under']">
|
||||
<MkPreferenceContainer k="showPageTabBarBottom">
|
||||
<MkSwitch v-model="showPageTabBarBottom">
|
||||
<template #label><SearchLabel>{{ i18n.ts._settings.showPageTabBarBottom }}</SearchLabel></template>
|
||||
</MkSwitch>
|
||||
</MkPreferenceContainer>
|
||||
</SearchMarker>
|
||||
|
||||
<SearchMarker :keywords="['swipe', 'horizontal', 'tab']">
|
||||
<MkPreferenceContainer k="enableHorizontalSwipe">
|
||||
<MkSwitch v-model="enableHorizontalSwipe">
|
||||
|
@ -866,6 +874,7 @@ const animatedMfm = prefer.model('animatedMfm');
|
|||
const disableShowingAnimatedImages = prefer.model('disableShowingAnimatedImages');
|
||||
const keepScreenOn = prefer.model('keepScreenOn');
|
||||
const enableHorizontalSwipe = prefer.model('enableHorizontalSwipe');
|
||||
const showPageTabBarBottom = prefer.model('showPageTabBarBottom');
|
||||
const enablePullToRefresh = prefer.model('enablePullToRefresh');
|
||||
const useNativeUiForVideoAudioPlayer = prefer.model('useNativeUiForVideoAudioPlayer');
|
||||
const contextMenu = prefer.model('contextMenu');
|
||||
|
@ -925,6 +934,7 @@ watch([
|
|||
useSystemFont,
|
||||
makeEveryTextElementsSelectable,
|
||||
enableHorizontalSwipe,
|
||||
showPageTabBarBottom,
|
||||
enablePullToRefresh,
|
||||
reduceAnimation,
|
||||
showAvailableReactionsFirstInNote,
|
||||
|
|
|
@ -381,6 +381,9 @@ export const PREF_DEF = definePreferences({
|
|||
showAvailableReactionsFirstInNote: {
|
||||
default: false,
|
||||
},
|
||||
showPageTabBarBottom: {
|
||||
default: false,
|
||||
},
|
||||
plugins: {
|
||||
default: [] as Plugin[],
|
||||
mergeStrategy: (a, b) => {
|
||||
|
|
|
@ -86,7 +86,7 @@ watch(rootEl, () => {
|
|||
box-sizing: border-box;
|
||||
background: var(--MI_THEME-navBg);
|
||||
color: var(--MI_THEME-navFg);
|
||||
box-shadow: 0px 0px 6px 6px #0000000f;
|
||||
border-top: solid 0.5px var(--MI_THEME-divider);
|
||||
}
|
||||
|
||||
.item {
|
||||
|
|
Loading…
Reference in New Issue