summaryrefslogtreecommitdiff
path: root/packages/frontend/src
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-03-29 15:00:29 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-03-29 15:00:29 +0900
commit1af40810900d0eea9be563f80be48a9d071026e2 (patch)
tree4a5f7336b3cb266c5ed7c49f0416a3f68102905d /packages/frontend/src
parentRevert "🎨" (diff)
downloadmisskey-1af40810900d0eea9be563f80be48a9d071026e2.tar.gz
misskey-1af40810900d0eea9be563f80be48a9d071026e2.tar.bz2
misskey-1af40810900d0eea9be563f80be48a9d071026e2.zip
enhance(frontend): disable horizontal swipe for timeline/notifications to improve ux
Diffstat (limited to 'packages/frontend/src')
-rw-r--r--packages/frontend/src/components/MkNote.vue2
-rw-r--r--packages/frontend/src/components/MkPagination.vue4
-rw-r--r--packages/frontend/src/components/global/PageWithHeader.vue11
-rw-r--r--packages/frontend/src/pages/antenna-timeline.vue4
-rw-r--r--packages/frontend/src/pages/notifications.vue20
-rw-r--r--packages/frontend/src/pages/timeline.vue47
-rw-r--r--packages/frontend/src/pages/user-list-timeline.vue4
7 files changed, 46 insertions, 46 deletions
diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue
index 07da1bd4d9..91aed351c5 100644
--- a/packages/frontend/src/components/MkNote.vue
+++ b/packages/frontend/src/components/MkNote.vue
@@ -14,8 +14,6 @@ SPDX-License-Identifier: AGPL-3.0-only
>
<MkNoteSub v-if="appearNote.reply && !renoteCollapsed" :note="appearNote.reply" :class="$style.replyTo"/>
<div v-if="pinned" :class="$style.tip"><i class="ti ti-pin"></i> {{ i18n.ts.pinnedNote }}</div>
- <!--<div v-if="appearNote._prId_" class="tip"><i class="ti ti-speakerphone"></i> {{ i18n.ts.promotion }}<button class="_textButton hide" @click="readPromo()">{{ i18n.ts.hideThisNote }} <i class="ti ti-x"></i></button></div>-->
- <!--<div v-if="appearNote._featuredId_" class="tip"><i class="ti ti-bolt"></i> {{ i18n.ts.featured }}</div>-->
<div v-if="isRenote" :class="$style.renote">
<div v-if="note.channel" :class="$style.colorBar" :style="{ background: note.channel.color }"></div>
<MkAvatar :class="$style.renoteAvatar" :user="note.user" link preview/>
diff --git a/packages/frontend/src/components/MkPagination.vue b/packages/frontend/src/components/MkPagination.vue
index d90db1748c..253397475b 100644
--- a/packages/frontend/src/components/MkPagination.vue
+++ b/packages/frontend/src/components/MkPagination.vue
@@ -46,7 +46,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, isRef, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onDeactivated, ref, useTemplateRef, watch } from 'vue';
import * as Misskey from 'misskey-js';
import { useDocumentVisibility } from '@@/js/use-document-visibility.js';
-import { onScrollTop, isHeadVisible, getBodyScrollHeight, getScrollContainer, onScrollBottom, scrollToBottom, scroll, isTailVisible } from '@@/js/scroll.js';
+import { onScrollTop, isHeadVisible, getBodyScrollHeight, getScrollContainer, onScrollBottom, scrollToBottom, scrollInContainer, isTailVisible } from '@@/js/scroll.js';
import type { ComputedRef } from 'vue';
import type { MisskeyEntity } from '@/types/date-separated-list.js';
import { misskeyApi } from '@/utility/misskey-api.js';
@@ -258,7 +258,7 @@ const fetchMore = async (): Promise<void> => {
return nextTick(() => {
if (scrollableElement.value) {
- scroll(scrollableElement.value, { top: oldScroll + (scrollableElement.value.scrollHeight - oldHeight), behavior: 'instant' });
+ scrollInContainer(scrollableElement.value, { top: oldScroll + (scrollableElement.value.scrollHeight - oldHeight), behavior: 'instant' });
} else {
window.scroll({ top: oldScroll + (getBodyScrollHeight() - oldHeight), behavior: 'instant' });
}
diff --git a/packages/frontend/src/components/global/PageWithHeader.vue b/packages/frontend/src/components/global/PageWithHeader.vue
index fb813689ba..7ea0b5c97f 100644
--- a/packages/frontend/src/components/global/PageWithHeader.vue
+++ b/packages/frontend/src/components/global/PageWithHeader.vue
@@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
-<div :class="[$style.root, reversed ? '_pageScrollableReversed' : '_pageScrollable']">
+<div ref="rootEl" :class="[$style.root, reversed ? '_pageScrollableReversed' : '_pageScrollable']">
<MkStickyContainer>
<template #header><MkPageHeader v-model:tab="tab" :actions="actions" :tabs="tabs"/></template>
<div :class="$style.body">
@@ -16,6 +16,8 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
+import { useTemplateRef } from 'vue';
+import { scrollInContainer } from '@@/js/scroll.js';
import type { PageHeaderItem } from '@/types/page-header.js';
import type { Tab } from './MkPageHeader.tabs.vue';
@@ -31,6 +33,13 @@ const props = withDefaults(defineProps<{
});
const tab = defineModel<string>('tab');
+const rootEl = useTemplateRef('rootEl');
+
+defineExpose({
+ scrollToTop: () => {
+ if (rootEl.value) scrollInContainer(rootEl.value, { top: 0, behavior: 'smooth' });
+ },
+});
</script>
<style lang="scss" module>
diff --git a/packages/frontend/src/pages/antenna-timeline.vue b/packages/frontend/src/pages/antenna-timeline.vue
index 672da04c7e..030a2a46ad 100644
--- a/packages/frontend/src/pages/antenna-timeline.vue
+++ b/packages/frontend/src/pages/antenna-timeline.vue
@@ -25,7 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, watch, ref, useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js';
-import { scroll } from '@@/js/scroll.js';
+import { scrollInContainer } from '@@/js/scroll.js';
import MkTimeline from '@/components/MkTimeline.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/utility/misskey-api.js';
@@ -49,7 +49,7 @@ function queueUpdated(q) {
}
function top() {
- scroll(rootEl.value, { top: 0 });
+ scrollInContainer(rootEl.value, { top: 0 });
}
async function timetravel() {
diff --git a/packages/frontend/src/pages/notifications.vue b/packages/frontend/src/pages/notifications.vue
index a7ff519a34..0a2bc02de5 100644
--- a/packages/frontend/src/pages/notifications.vue
+++ b/packages/frontend/src/pages/notifications.vue
@@ -6,17 +6,15 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<PageWithHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs">
<MkSpacer :contentMax="800">
- <MkHorizontalSwipe v-model:tab="tab" :tabs="headerTabs">
- <div v-if="tab === 'all'">
- <XNotifications :class="$style.notifications" :excludeTypes="excludeTypes"/>
- </div>
- <div v-else-if="tab === 'mentions'">
- <MkNotes :pagination="mentionsPagination"/>
- </div>
- <div v-else-if="tab === 'directNotes'">
- <MkNotes :pagination="directNotesPagination"/>
- </div>
- </MkHorizontalSwipe>
+ <div v-if="tab === 'all'">
+ <XNotifications :class="$style.notifications" :excludeTypes="excludeTypes"/>
+ </div>
+ <div v-else-if="tab === 'mentions'">
+ <MkNotes :pagination="mentionsPagination"/>
+ </div>
+ <div v-else-if="tab === 'directNotes'">
+ <MkNotes :pagination="directNotesPagination"/>
+ </div>
</MkSpacer>
</PageWithHeader>
</template>
diff --git a/packages/frontend/src/pages/timeline.vue b/packages/frontend/src/pages/timeline.vue
index a811f01ee3..7fdeacc96b 100644
--- a/packages/frontend/src/pages/timeline.vue
+++ b/packages/frontend/src/pages/timeline.vue
@@ -4,38 +4,33 @@ SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
-<PageWithHeader v-model:tab="src" :actions="headerActions" :tabs="$i ? headerTabs : headerTabsWhenNotLogin" :displayMyAvatar="true">
+<PageWithHeader ref="rootEl" v-model:tab="src" :actions="headerActions" :tabs="$i ? headerTabs : headerTabsWhenNotLogin" :displayMyAvatar="true">
<MkSpacer :contentMax="800">
- <MkHorizontalSwipe v-model:tab="src" :tabs="$i ? headerTabs : headerTabsWhenNotLogin">
- <div ref="rootEl">
- <MkInfo v-if="isBasicTimeline(src) && !store.r.timelineTutorials.value[src]" style="margin-bottom: var(--MI-margin);" closable @close="closeTutorial()">
- {{ i18n.ts._timelineDescription[src] }}
- </MkInfo>
- <MkPostForm v-if="prefer.r.showFixedPostForm.value" :class="$style.postForm" class="post-form _panel" fixed style="margin-bottom: var(--MI-margin);"/>
- <div v-if="queue > 0" :class="$style.new"><button class="_buttonPrimary" :class="$style.newButton" @click="top()">{{ i18n.ts.newNoteRecived }}</button></div>
- <div :class="$style.tl">
- <MkTimeline
- ref="tlComponent"
- :key="src + withRenotes + withReplies + onlyFiles + withSensitive"
- :src="src.split(':')[0]"
- :list="src.split(':')[1]"
- :withRenotes="withRenotes"
- :withReplies="withReplies"
- :withSensitive="withSensitive"
- :onlyFiles="onlyFiles"
- :sound="true"
- @queue="queueUpdated"
- />
- </div>
- </div>
- </MkHorizontalSwipe>
+ <MkInfo v-if="isBasicTimeline(src) && !store.r.timelineTutorials.value[src]" style="margin-bottom: var(--MI-margin);" closable @close="closeTutorial()">
+ {{ i18n.ts._timelineDescription[src] }}
+ </MkInfo>
+ <MkPostForm v-if="prefer.r.showFixedPostForm.value" :class="$style.postForm" class="post-form _panel" fixed style="margin-bottom: var(--MI-margin);"/>
+ <div v-if="queue > 0" :class="$style.new"><button class="_buttonPrimary" :class="$style.newButton" @click="top()">{{ i18n.ts.newNoteRecived }}</button></div>
+ <div :class="$style.tl">
+ <MkTimeline
+ ref="tlComponent"
+ :key="src + withRenotes + withReplies + onlyFiles + withSensitive"
+ :src="src.split(':')[0]"
+ :list="src.split(':')[1]"
+ :withRenotes="withRenotes"
+ :withReplies="withReplies"
+ :withSensitive="withSensitive"
+ :onlyFiles="onlyFiles"
+ :sound="true"
+ @queue="queueUpdated"
+ />
+ </div>
</MkSpacer>
</PageWithHeader>
</template>
<script lang="ts" setup>
import { computed, watch, provide, useTemplateRef, ref, onMounted, onActivated } from 'vue';
-import { scroll } from '@@/js/scroll.js';
import type { Tab } from '@/components/global/MkPageHeader.tabs.vue';
import type { MenuItem } from '@/types/menu.js';
import type { BasicTimelineType } from '@/timelines.js';
@@ -133,7 +128,7 @@ function queueUpdated(q: number): void {
}
function top(): void {
- if (rootEl.value) scroll(rootEl.value, { top: 0, behavior: 'smooth' });
+ if (rootEl.value) rootEl.value.scrollToTop();
}
async function chooseList(ev: MouseEvent): Promise<void> {
diff --git a/packages/frontend/src/pages/user-list-timeline.vue b/packages/frontend/src/pages/user-list-timeline.vue
index 8f5244ca1a..53081b0f16 100644
--- a/packages/frontend/src/pages/user-list-timeline.vue
+++ b/packages/frontend/src/pages/user-list-timeline.vue
@@ -25,7 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, watch, ref, useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js';
-import { scroll } from '@@/js/scroll.js';
+import { scrollInContainer } from '@@/js/scroll.js';
import MkTimeline from '@/components/MkTimeline.vue';
import { misskeyApi } from '@/utility/misskey-api.js';
import { definePage } from '@/page.js';
@@ -54,7 +54,7 @@ function queueUpdated(q) {
}
function top() {
- scroll(rootEl.value, { top: 0 });
+ scrollInContainer(rootEl.value, { top: 0 });
}
function settings() {