enhance(client): ヘッダー(MkPageHeader)関連 (#9869)
* MkPageHeader大改造 * ユーザーページのノート一覧をタブにするなど * ✌️ * 🎨 * fix * wheel * clean up * 🎨 * 🎨 * remove console.log * update CHANGELOG.md * fix * fix * fix * ✌️ * header avatar clickable * !hideTitle * Revert "!hideTitle" This reverts commit 19cad428c906f555b73730d602e401a1e943cdef. * fix changelog
This commit is contained in:
parent
6f33be6c75
commit
0138c3b00e
@ -12,13 +12,19 @@ You should also include the user name that made the change.
|
|||||||
## 13.x.x (unreleased)
|
## 13.x.x (unreleased)
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
- MkPageHeaderをごっそり変えた
|
||||||
|
* モバイルではヘッダーは上下に分割され、下段にタブが表示されるように
|
||||||
|
* iconOnlyのタブ項目がアクティブな場合にはタブのタイトルを表示するように
|
||||||
|
* メインタイムラインではタイトルを表示しない
|
||||||
|
* メインタイムラインかつモバイルで表示される左上のアバターを選択するとアカウントメニューが開くように
|
||||||
|
- ユーザーページのノート一覧をタブとして分離
|
||||||
- コンディショナルロールもバッジとして表示可能に
|
- コンディショナルロールもバッジとして表示可能に
|
||||||
- enhance(client): ロールをより簡単に付与できるように
|
- enhance(client): ロールをより簡単に付与できるように
|
||||||
- enhance(client): 一度見たノートのRenoteは省略して表示するように
|
- enhance(client): 一度見たノートのRenoteは省略して表示するように
|
||||||
- 一部のMFM構文をopt-outに
|
- 一部のMFM構文をopt-outに
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
-
|
- Client: ユーザーページでタブがほとんど見れないことがないように
|
||||||
|
|
||||||
## 13.5.6 (2023/02/10)
|
## 13.5.6 (2023/02/10)
|
||||||
|
|
||||||
|
@ -1,37 +1,62 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="show" ref="el" :class="[$style.root, { [$style.slim]: narrow, [$style.thin]: thin_ }]" :style="{ background: bg }" @click="onClick">
|
<div v-if="show" ref="el" :class="[$style.root]" :style="{ background: bg }">
|
||||||
<div v-if="narrow" :class="$style.buttonsLeft">
|
<div :class="[$style.upper, { [$style.slim]: narrow, [$style.thin]: thin_ }]">
|
||||||
<MkAvatar v-if="props.displayMyAvatar && $i" :class="$style.avatar" :user="$i"/>
|
<div v-if="narrow && props.displayMyAvatar && $i" class="_button" :class="$style.buttonsLeft" @click="openAccountMenu">
|
||||||
|
<MkAvatar :class="$style.avatar" :user="$i" />
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="narrow && !hideTitle" :class="$style.buttonsLeft" />
|
||||||
|
|
||||||
<template v-if="metadata">
|
<template v-if="metadata">
|
||||||
<div v-if="!hideTitle" :class="$style.titleContainer" @click="showTabsPopup">
|
<div v-if="!hideTitle" :class="$style.titleContainer" @click="top">
|
||||||
<MkAvatar v-if="metadata.avatar" :class="$style.titleAvatar" :user="metadata.avatar" indicator/>
|
<MkAvatar v-if="metadata.avatar" :class="$style.titleAvatar" :user="metadata.avatar" indicator/>
|
||||||
<i v-else-if="metadata.icon" :class="[$style.titleIcon, metadata.icon]"></i>
|
<i v-else-if="metadata.icon" :class="[$style.titleIcon, metadata.icon]"></i>
|
||||||
|
|
||||||
<div :class="$style.title">
|
<div :class="$style.title">
|
||||||
<MkUserName v-if="metadata.userName" :user="metadata.userName" :nowrap="true"/>
|
<MkUserName v-if="metadata.userName" :user="metadata.userName" :nowrap="true"/>
|
||||||
<div v-else-if="metadata.title">{{ metadata.title }}</div>
|
<div v-else-if="metadata.title">{{ metadata.title }}</div>
|
||||||
<div v-if="!narrow && metadata.subtitle" :class="$style.subtitle">
|
<div v-if="metadata.subtitle" :class="$style.subtitle">
|
||||||
{{ metadata.subtitle }}
|
{{ metadata.subtitle }}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="narrow && hasTabs" :class="[$style.subtitle, $style.activeTab]">
|
|
||||||
{{ tabs.find(tab => tab.key === props.tab)?.title }}
|
|
||||||
<i class="ti ti-chevron-down" :class="$style.chevron"></i>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="!narrow || hideTitle" :class="$style.tabs" @wheel="onTabWheel">
|
||||||
|
<div :class="$style.tabsInner">
|
||||||
|
<button v-for="t in tabs" :ref="(el) => tabRefs[t.key] = (el as HTMLElement)" v-tooltip.noDelay="t.title" class="_button" :class="[$style.tab, { [$style.active]: t.key != null && t.key === props.tab }]" @mousedown="(ev) => onTabMousedown(t, ev)" @click="(ev) => onTabClick(t, ev)">
|
||||||
|
<div :class="$style.tabInner">
|
||||||
|
<i v-if="t.icon" :class="[$style.tabIcon, t.icon]"></i>
|
||||||
|
<div v-if="!t.iconOnly" :class="$style.tabTitle">{{ t.title }}</div>
|
||||||
|
<Transition
|
||||||
|
v-else
|
||||||
|
@enter="enter"
|
||||||
|
@after-enter="afterEnter"
|
||||||
|
@leave="leave"
|
||||||
|
@after-leave="afterLeave"
|
||||||
|
mode="in-out"
|
||||||
|
>
|
||||||
|
<div v-if="t.key === tab" :class="$style.tabTitle">{{ t.title }}</div>
|
||||||
|
</Transition>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!narrow || hideTitle" :class="$style.tabs">
|
</button>
|
||||||
|
</div>
|
||||||
|
<div ref="tabHighlightEl" :class="$style.tabHighlight"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div v-if="(narrow && !hideTitle) || (actions && actions.length > 0)" :class="$style.buttonsRight">
|
||||||
|
<template v-for="action in actions">
|
||||||
|
<button v-tooltip.noDelay="action.text" class="_button" :class="[$style.button, { [$style.highlighted]: action.highlighted }]" @click.stop="action.handler" @touchstart="preventDrag"><i :class="action.icon"></i></button>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="(narrow && !hideTitle) && hasTabs" :class="[$style.lower, { [$style.slim]: narrow, [$style.thin]: thin_ }]">
|
||||||
|
<div :class="$style.tabs" @wheel="onTabWheel">
|
||||||
|
<div :class="$style.tabsInner">
|
||||||
<button v-for="tab in tabs" :ref="(el) => tabRefs[tab.key] = (el as HTMLElement)" v-tooltip.noDelay="tab.title" class="_button" :class="[$style.tab, { [$style.active]: tab.key != null && tab.key === props.tab }]" @mousedown="(ev) => onTabMousedown(tab, ev)" @click="(ev) => onTabClick(tab, ev)">
|
<button v-for="tab in tabs" :ref="(el) => tabRefs[tab.key] = (el as HTMLElement)" v-tooltip.noDelay="tab.title" class="_button" :class="[$style.tab, { [$style.active]: tab.key != null && tab.key === props.tab }]" @mousedown="(ev) => onTabMousedown(tab, ev)" @click="(ev) => onTabClick(tab, ev)">
|
||||||
<i v-if="tab.icon" :class="[$style.tabIcon, tab.icon]"></i>
|
<i v-if="tab.icon" :class="[$style.tabIcon, tab.icon]"></i>
|
||||||
<span v-if="!tab.iconOnly" :class="$style.tabTitle">{{ tab.title }}</span>
|
<span v-if="!tab.iconOnly" :class="$style.tabTitle">{{ tab.title }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
<div ref="tabHighlightEl" :class="$style.tabHighlight"></div>
|
<div ref="tabHighlightEl" :class="$style.tabHighlight"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
|
||||||
<div :class="$style.buttonsRight">
|
|
||||||
<template v-for="action in actions">
|
|
||||||
<button v-tooltip.noDelay="action.text" class="_button" :class="[$style.button, { [$style.highlighted]: action.highlighted }]" @click.stop="action.handler" @touchstart="preventDrag"><i :class="action.icon"></i></button>
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -39,11 +64,10 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, onUnmounted, ref, inject, watch, nextTick } from 'vue';
|
import { onMounted, onUnmounted, ref, inject, watch, nextTick } from 'vue';
|
||||||
import tinycolor from 'tinycolor2';
|
import tinycolor from 'tinycolor2';
|
||||||
import { popupMenu } from '@/os';
|
|
||||||
import { scrollToTop } from '@/scripts/scroll';
|
import { scrollToTop } from '@/scripts/scroll';
|
||||||
import { globalEvents } from '@/events';
|
import { globalEvents } from '@/events';
|
||||||
import { injectPageMetadata } from '@/scripts/page-metadata';
|
import { injectPageMetadata } from '@/scripts/page-metadata';
|
||||||
import { $i } from '@/account';
|
import { $i, openAccountMenu as openAccountMenu_ } from '@/account';
|
||||||
|
|
||||||
type Tab = {
|
type Tab = {
|
||||||
key: string;
|
key: string;
|
||||||
@ -77,9 +101,9 @@ const metadata = injectPageMetadata();
|
|||||||
const hideTitle = inject('shouldOmitHeaderTitle', false);
|
const hideTitle = inject('shouldOmitHeaderTitle', false);
|
||||||
const thin_ = props.thin || inject('shouldHeaderThin', false);
|
const thin_ = props.thin || inject('shouldHeaderThin', false);
|
||||||
|
|
||||||
const el = $shallowRef<HTMLElement | undefined>(undefined);
|
let el = $shallowRef<HTMLElement | undefined>(undefined);
|
||||||
const tabRefs: Record<string, HTMLElement | null> = {};
|
const tabRefs: Record<string, HTMLElement | null> = {};
|
||||||
const tabHighlightEl = $shallowRef<HTMLElement | null>(null);
|
let tabHighlightEl = $shallowRef<HTMLElement | null>(null);
|
||||||
const bg = ref<string | undefined>(undefined);
|
const bg = ref<string | undefined>(undefined);
|
||||||
let narrow = $ref(false);
|
let narrow = $ref(false);
|
||||||
const hasTabs = $computed(() => props.tabs.length > 0);
|
const hasTabs = $computed(() => props.tabs.length > 0);
|
||||||
@ -88,32 +112,22 @@ const show = $computed(() => {
|
|||||||
return !hideTitle || hasTabs || hasActions;
|
return !hideTitle || hasTabs || hasActions;
|
||||||
});
|
});
|
||||||
|
|
||||||
const showTabsPopup = (ev: MouseEvent) => {
|
|
||||||
if (!hasTabs) return;
|
|
||||||
if (!narrow) return;
|
|
||||||
ev.preventDefault();
|
|
||||||
ev.stopPropagation();
|
|
||||||
const menu = props.tabs.map(tab => ({
|
|
||||||
text: tab.title,
|
|
||||||
icon: tab.icon,
|
|
||||||
active: tab.key != null && tab.key === props.tab,
|
|
||||||
action: (ev) => {
|
|
||||||
onTabClick(tab, ev);
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
popupMenu(menu, (ev.currentTarget ?? ev.target) as HTMLElement);
|
|
||||||
};
|
|
||||||
|
|
||||||
const preventDrag = (ev: TouchEvent) => {
|
const preventDrag = (ev: TouchEvent) => {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClick = () => {
|
const top = () => {
|
||||||
if (el) {
|
if (el) {
|
||||||
scrollToTop(el as HTMLElement, { behavior: 'smooth' });
|
scrollToTop(el as HTMLElement, { behavior: 'smooth' });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function openAccountMenu(ev: MouseEvent) {
|
||||||
|
openAccountMenu_({
|
||||||
|
withExtraOperation: true,
|
||||||
|
}, ev);
|
||||||
|
}
|
||||||
|
|
||||||
function onTabMousedown(tab: Tab, ev: MouseEvent): void {
|
function onTabMousedown(tab: Tab, ev: MouseEvent): void {
|
||||||
// ユーザビリティの観点からmousedown時にはonClickは呼ばない
|
// ユーザビリティの観点からmousedown時にはonClickは呼ばない
|
||||||
if (tab.key) {
|
if (tab.key) {
|
||||||
@ -121,14 +135,17 @@ function onTabMousedown(tab: Tab, ev: MouseEvent): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTabClick(tab: Tab, ev: MouseEvent): void {
|
function onTabClick(t: Tab, ev: MouseEvent): void {
|
||||||
if (tab.onClick) {
|
if (t.key === props.tab) {
|
||||||
|
top();
|
||||||
|
} else if (t.onClick) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
tab.onClick(ev);
|
t.onClick(ev);
|
||||||
}
|
}
|
||||||
if (tab.key) {
|
|
||||||
emit('update:tab', tab.key);
|
if (t.key) {
|
||||||
|
emit('update:tab', t.key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,56 +156,124 @@ const calcBg = () => {
|
|||||||
bg.value = tinyBg.toRgbString();
|
bg.value = tinyBg.toRgbString();
|
||||||
};
|
};
|
||||||
|
|
||||||
let ro: ResizeObserver | null;
|
let ro1: ResizeObserver | null;
|
||||||
|
let ro2: ResizeObserver | null;
|
||||||
|
|
||||||
|
function renderTab() {
|
||||||
|
const tabEl = props.tab ? tabRefs[props.tab] : undefined;
|
||||||
|
if (tabEl && tabHighlightEl && tabHighlightEl.parentElement) {
|
||||||
|
// offsetWidth や offsetLeft は少数を丸めてしまうため getBoundingClientRect を使う必要がある
|
||||||
|
// https://developer.mozilla.org/ja/docs/Web/API/HTMLElement/offsetWidth#%E5%80%A4
|
||||||
|
const parentRect = tabHighlightEl.parentElement.getBoundingClientRect();
|
||||||
|
const rect = tabEl.getBoundingClientRect();
|
||||||
|
tabHighlightEl.style.width = rect.width + 'px';
|
||||||
|
tabHighlightEl.style.left = (rect.left - parentRect.left + tabHighlightEl.parentElement.scrollLeft) + 'px';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onTabWheel(ev: WheelEvent) {
|
||||||
|
if (ev.deltaY !== 0 && ev.deltaX === 0) {
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
(ev.currentTarget as HTMLElement).scrollBy({
|
||||||
|
left: ev.deltaY,
|
||||||
|
behavior: 'smooth',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function enter(el: HTMLElement) {
|
||||||
|
const elementWidth = el.getBoundingClientRect().width;
|
||||||
|
el.style.width = '0';
|
||||||
|
el.offsetWidth; // reflow
|
||||||
|
el.style.width = elementWidth + 'px';
|
||||||
|
setTimeout(renderTab, 70);
|
||||||
|
}
|
||||||
|
function afterEnter(el: HTMLElement) {
|
||||||
|
el.style.width = '';
|
||||||
|
nextTick(renderTab);
|
||||||
|
}
|
||||||
|
function leave(el: HTMLElement) {
|
||||||
|
const elementWidth = el.getBoundingClientRect().width;
|
||||||
|
el.style.width = elementWidth + 'px';
|
||||||
|
el.offsetWidth; // reflow
|
||||||
|
el.style.width = '0';
|
||||||
|
}
|
||||||
|
function afterLeave(el: HTMLElement) {
|
||||||
|
el.style.width = '';
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
calcBg();
|
calcBg();
|
||||||
globalEvents.on('themeChanged', calcBg);
|
globalEvents.on('themeChanged', calcBg);
|
||||||
|
|
||||||
watch(() => [props.tab, props.tabs], () => {
|
watch([() => props.tab, () => props.tabs], () => {
|
||||||
nextTick(() => {
|
nextTick(() => renderTab());
|
||||||
const tabEl = props.tab ? tabRefs[props.tab] : undefined;
|
|
||||||
if (tabEl && tabHighlightEl && tabEl.parentElement) {
|
|
||||||
// offsetWidth や offsetLeft は少数を丸めてしまうため getBoundingClientRect を使う必要がある
|
|
||||||
// https://developer.mozilla.org/ja/docs/Web/API/HTMLElement/offsetWidth#%E5%80%A4
|
|
||||||
const parentRect = tabEl.parentElement.getBoundingClientRect();
|
|
||||||
const rect = tabEl.getBoundingClientRect();
|
|
||||||
tabHighlightEl.style.width = rect.width + 'px';
|
|
||||||
tabHighlightEl.style.left = (rect.left - parentRect.left) + 'px';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, {
|
}, {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (el && el.parentElement) {
|
if (el && el.parentElement) {
|
||||||
narrow = el.parentElement.offsetWidth < 500;
|
narrow = el.parentElement.offsetWidth < 500;
|
||||||
ro = new ResizeObserver((entries, observer) => {
|
ro1 = new ResizeObserver((entries, observer) => {
|
||||||
if (el.parentElement && document.body.contains(el as HTMLElement)) {
|
if (el && el.parentElement && document.body.contains(el as HTMLElement)) {
|
||||||
narrow = el.parentElement.offsetWidth < 500;
|
narrow = el.parentElement.offsetWidth < 500;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ro.observe(el.parentElement as HTMLElement);
|
ro1.observe(el.parentElement as HTMLElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (el) {
|
||||||
|
ro2 = new ResizeObserver((entries, observer) => {
|
||||||
|
if (document.body.contains(el as HTMLElement)) {
|
||||||
|
nextTick(() => renderTab());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ro2.observe(el);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
globalEvents.off('themeChanged', calcBg);
|
globalEvents.off('themeChanged', calcBg);
|
||||||
if (ro) ro.disconnect();
|
if (ro1) ro1.disconnect();
|
||||||
|
if (ro2) ro2.disconnect();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" module>
|
<style lang="scss" module>
|
||||||
.root {
|
.root {
|
||||||
--height: 50px;
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
-webkit-backdrop-filter: var(--blur, blur(15px));
|
-webkit-backdrop-filter: var(--blur, blur(15px));
|
||||||
backdrop-filter: var(--blur, blur(15px));
|
backdrop-filter: var(--blur, blur(15px));
|
||||||
border-bottom: solid 0.5px var(--divider);
|
border-bottom: solid 0.5px var(--divider);
|
||||||
contain: strict;
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upper,
|
||||||
|
.lower {
|
||||||
|
width: 100%;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upper {
|
||||||
|
--height: 50px;
|
||||||
|
display: flex;
|
||||||
height: var(--height);
|
height: var(--height);
|
||||||
|
|
||||||
|
.tabs:first-child {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
.tabs:not(:first-child) {
|
||||||
|
padding-left: 16px;
|
||||||
|
mask-image: linear-gradient(90deg, rgba(0,0,0,0), rgb(0,0,0) 16px, rgb(0,0,0) 100%);
|
||||||
|
}
|
||||||
|
.tabs:last-child {
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
.tabs:not(:last-child) {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
&.thin {
|
&.thin {
|
||||||
--height: 42px;
|
--height: 42px;
|
||||||
|
|
||||||
@ -205,6 +290,7 @@ onUnmounted(() => {
|
|||||||
> .titleContainer {
|
> .titleContainer {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
max-width: 100%;
|
||||||
|
|
||||||
> *:first-child {
|
> *:first-child {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
@ -217,6 +303,11 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.lower {
|
||||||
|
--height: 40px;
|
||||||
|
height: var(--height);
|
||||||
|
}
|
||||||
|
|
||||||
.buttons {
|
.buttons {
|
||||||
--margin: 8px;
|
--margin: 8px;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -247,15 +338,14 @@ onUnmounted(() => {
|
|||||||
height: $size;
|
height: $size;
|
||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
margin: 0 8px;
|
margin: 0 8px;
|
||||||
pointer-events: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
height: calc(var(--height) - (var(--margin) * 2));
|
height: var(--height);
|
||||||
width: calc(var(--height) - (var(--margin) * 2));
|
width: calc(var(--height) - (var(--margin)));
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
@ -278,7 +368,7 @@ onUnmounted(() => {
|
|||||||
.titleContainer {
|
.titleContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
max-width: 400px;
|
max-width: min(30vw, 400px);
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@ -330,10 +420,24 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tabs {
|
.tabs {
|
||||||
|
display: block;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-left: 16px;
|
margin: 0;
|
||||||
|
height: var(--height);
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
overflow: auto;
|
text-align: center;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
scrollbar-width: none;
|
||||||
|
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabsInner {
|
||||||
|
display: inline-block;
|
||||||
|
height: var(--height);
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,6 +448,7 @@ onUnmounted(() => {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
|
transition: opacity 0.2s ease;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
@ -354,17 +459,27 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tabInner {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.tabIcon + .tabTitle {
|
.tabIcon + .tabTitle {
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tabTitle {
|
||||||
|
overflow: hidden;
|
||||||
|
transition: width 0.15s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
.tabHighlight {
|
.tabHighlight {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
height: 3px;
|
height: 3px;
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
transition: all 0.2s ease;
|
transition: width 0.15s ease, left 0.15s ease;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { defineAsyncComponent, computed, watch } from 'vue';
|
import { defineAsyncComponent, computed, watch, provide } from 'vue';
|
||||||
import XTimeline from '@/components/MkTimeline.vue';
|
import XTimeline from '@/components/MkTimeline.vue';
|
||||||
import MkPostForm from '@/components/MkPostForm.vue';
|
import MkPostForm from '@/components/MkPostForm.vue';
|
||||||
import { scroll } from '@/scripts/scroll';
|
import { scroll } from '@/scripts/scroll';
|
||||||
@ -33,6 +33,8 @@ import { instance } from '@/instance';
|
|||||||
import { $i } from '@/account';
|
import { $i } from '@/account';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||||
|
|
||||||
|
provide('shouldOmitHeaderTitle', true);
|
||||||
|
|
||||||
const XTutorial = defineAsyncComponent(() => import('./timeline.tutorial.vue'));
|
const XTutorial = defineAsyncComponent(() => import('./timeline.tutorial.vue'));
|
||||||
|
|
||||||
const isLocalTimelineAvailable = ($i == null && instance.policies.ltlAvailable) || ($i != null && $i.policies.ltlAvailable);
|
const isLocalTimelineAvailable = ($i == null && instance.policies.ltlAvailable) || ($i != null && $i.policies.ltlAvailable);
|
||||||
|
@ -101,9 +101,6 @@
|
|||||||
<XActivity :key="user.id" :user="user"/>
|
<XActivity :key="user.id" :user="user"/>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<XUserTimeline :user="user"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!narrow" class="sub _gaps" style="container-type: inline-size;">
|
<div v-if="!narrow" class="sub _gaps" style="container-type: inline-size;">
|
||||||
<XPhotos :key="user.id" :user="user"/>
|
<XPhotos :key="user.id" :user="user"/>
|
||||||
@ -117,7 +114,6 @@
|
|||||||
import { defineAsyncComponent, computed, inject, onMounted, onUnmounted, watch } from 'vue';
|
import { defineAsyncComponent, computed, inject, onMounted, onUnmounted, watch } from 'vue';
|
||||||
import calcAge from 's-age';
|
import calcAge from 's-age';
|
||||||
import * as misskey from 'misskey-js';
|
import * as misskey from 'misskey-js';
|
||||||
import XUserTimeline from './index.timeline.vue';
|
|
||||||
import XNote from '@/components/MkNote.vue';
|
import XNote from '@/components/MkNote.vue';
|
||||||
import MkFollowButton from '@/components/MkFollowButton.vue';
|
import MkFollowButton from '@/components/MkFollowButton.vue';
|
||||||
import MkContainer from '@/components/MkContainer.vue';
|
import MkContainer from '@/components/MkContainer.vue';
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<MkSpacer :content-max="800" style="padding-top: 0">
|
||||||
<MkStickyContainer>
|
<MkStickyContainer>
|
||||||
<template #header>
|
<template #header>
|
||||||
<MkTab v-model="include" :class="$style.tab">
|
<MkTab v-model="include" :class="$style.tab">
|
||||||
@ -7,8 +8,9 @@
|
|||||||
<option value="files">{{ i18n.ts.withFiles }}</option>
|
<option value="files">{{ i18n.ts.withFiles }}</option>
|
||||||
</MkTab>
|
</MkTab>
|
||||||
</template>
|
</template>
|
||||||
<XNotes :no-gap="true" :pagination="pagination"/>
|
<XNotes :no-gap="true" :pagination="pagination" :class="$style.tl"/>
|
||||||
</MkStickyContainer>
|
</MkStickyContainer>
|
||||||
|
</MkSpacer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
@ -42,4 +44,10 @@ const pagination = {
|
|||||||
padding: calc(var(--margin) / 2) 0;
|
padding: calc(var(--margin) / 2) 0;
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tl {
|
||||||
|
background: var(--bg);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
overflow: clip;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Transition name="fade" mode="out-in">
|
<Transition name="fade" mode="out-in">
|
||||||
<div v-if="user">
|
<div v-if="user">
|
||||||
<XHome v-if="tab === 'home'" :user="user"/>
|
<XHome v-if="tab === 'home'" :user="user"/>
|
||||||
<XActivity v-else-if="tab === 'activity'" :user="user"/>
|
<XTimeline v-else-if="tab === 'notes'" :user="user" />
|
||||||
<XAchievements v-else-if="tab === 'achievements'" :user="user"/>
|
<XAchievements v-else-if="tab === 'achievements'" :user="user"/>
|
||||||
<XReactions v-else-if="tab === 'reactions'" :user="user"/>
|
<XReactions v-else-if="tab === 'reactions'" :user="user"/>
|
||||||
<XClips v-else-if="tab === 'clips'" :user="user"/>
|
<XClips v-else-if="tab === 'clips'" :user="user"/>
|
||||||
@ -34,6 +34,7 @@ import { i18n } from '@/i18n';
|
|||||||
import { $i } from '@/account';
|
import { $i } from '@/account';
|
||||||
|
|
||||||
const XHome = defineAsyncComponent(() => import('./home.vue'));
|
const XHome = defineAsyncComponent(() => import('./home.vue'));
|
||||||
|
const XTimeline = defineAsyncComponent(() => import('./index.timeline.vue'));
|
||||||
const XActivity = defineAsyncComponent(() => import('./activity.vue'));
|
const XActivity = defineAsyncComponent(() => import('./activity.vue'));
|
||||||
const XAchievements = defineAsyncComponent(() => import('./achievements.vue'));
|
const XAchievements = defineAsyncComponent(() => import('./achievements.vue'));
|
||||||
const XReactions = defineAsyncComponent(() => import('./reactions.vue'));
|
const XReactions = defineAsyncComponent(() => import('./reactions.vue'));
|
||||||
@ -74,6 +75,10 @@ const headerTabs = $computed(() => user ? [{
|
|||||||
key: 'home',
|
key: 'home',
|
||||||
title: i18n.ts.overview,
|
title: i18n.ts.overview,
|
||||||
icon: 'ti ti-home',
|
icon: 'ti ti-home',
|
||||||
|
}, {
|
||||||
|
key: 'notes',
|
||||||
|
title: i18n.ts.notes,
|
||||||
|
icon: 'ti ti-pencil',
|
||||||
}, {
|
}, {
|
||||||
key: 'activity',
|
key: 'activity',
|
||||||
title: i18n.ts.activity,
|
title: i18n.ts.activity,
|
||||||
|
Loading…
Reference in New Issue
Block a user