From b980171c0bc743f504d695fec36f47a6d12f4764 Mon Sep 17 00:00:00 2001 From: Fairy-Phy Date: Thu, 30 Nov 2023 04:28:32 +0900 Subject: [PATCH] feat: pull-to-refresh Co-authored-by: syuilo Co-authored-by: u1-liquid <17376330+u1-liquid@users.noreply.github.com> Co-authored-by: naskya --- README.md | 1 + locales/en-US.yml | 4 + locales/ja-JP.yml | 4 + packages/client/src/components/MkDrive.vue | 4 +- .../client/src/components/MkFollowButton.vue | 3 +- .../client/src/components/MkNoteDetailed.vue | 4 +- packages/client/src/components/MkNotes.vue | 3 +- .../client/src/components/MkNotification.vue | 4 +- .../client/src/components/MkNotifications.vue | 111 ++++---- .../client/src/components/MkPageWindow.vue | 1 + .../client/src/components/MkPagination.vue | 36 +-- packages/client/src/components/MkPostForm.vue | 4 +- .../client/src/components/MkPullToRefresh.vue | 252 ++++++++++++++++++ packages/client/src/components/MkTimeline.vue | 202 +++++++------- packages/client/src/init.ts | 4 +- .../src/pages/admin/overview.metrics.vue | 4 +- .../client/src/pages/admin/overview.queue.vue | 3 +- packages/client/src/pages/admin/overview.vue | 4 +- .../client/src/pages/admin/queue.chart.vue | 3 +- packages/client/src/pages/messaging/index.vue | 3 +- .../pages/messaging/messaging-room.form.vue | 4 +- .../src/pages/messaging/messaging-room.vue | 4 +- packages/client/src/pages/notifications.vue | 14 +- .../client/src/pages/settings/general.vue | 7 + .../pages/settings/preferences-backups.vue | 3 +- packages/client/src/pages/timeline.vue | 24 +- packages/client/src/pizzax.ts | 3 +- packages/client/src/scripts/select-file.ts | 4 +- .../client/src/scripts/use-note-capture.ts | 3 +- packages/client/src/store.ts | 6 +- packages/client/src/stream.ts | 46 +++- packages/client/src/ui/_common_/common.vue | 4 +- .../src/ui/_common_/stream-indicator.vue | 4 +- packages/client/src/ui/universal.vue | 2 +- packages/client/src/widgets/job-queue.vue | 3 +- packages/client/src/widgets/photos.vue | 3 +- .../src/widgets/server-metric/index.vue | 3 +- packages/firefish-js/src/streaming.ts | 2 +- 38 files changed, 596 insertions(+), 197 deletions(-) create mode 100644 packages/client/src/components/MkPullToRefresh.vue diff --git a/README.md b/README.md index a4f9031e..d8f038cb 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,7 @@ うまく動いていそうだったら本家に push されます +- 画面を下に引いてタイムラインなどを更新する機能を追加(Misskey から取り込み) - Docker ユーザーも PWA のアイコンを変更できるように - 以下の画像ファイルを追加して Docker コンテナを再起動し、ブラウザのキャッシュを削除して PWA をインストールしてみてください - `custom/assets/favicon.png` diff --git a/locales/en-US.yml b/locales/en-US.yml index efb021ca..0620cf58 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1165,6 +1165,10 @@ detectPostLanguage: "Automatically detect the language and show a translate butt vibrate: "Play vibrations" openServerInfo: "Show server information by clicking the server ticker on a post" iconSet: "Icon set" +releaseToReload: "Release to reload" +reloading: "Reloading" +pullDownToReload: "Pull down to reload" +enableTimelineStreaming: "Update timelines automatically" _sensitiveMediaDetection: description: "Reduces the effort of server moderation through automatically recognizing diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 8b17ccb3..5ee78a86 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2032,3 +2032,7 @@ _iconSets: duotone: "2色" moreUrls: "固定するページ" moreUrlsDescription: "左下のヘルプメニューに固定したいページを以下の形式で、改行区切りで入力してください:\n\"表示名\": https://example.com/" +releaseToReload: "離して再読み込み" +reloading: "読み込み中" +pullDownToReload: "下に引っ張って再読み込み" +enableTimelineStreaming: "タイムラインを自動で更新する" diff --git a/packages/client/src/components/MkDrive.vue b/packages/client/src/components/MkDrive.vue index 1c0a46ab..d984c709 100644 --- a/packages/client/src/components/MkDrive.vue +++ b/packages/client/src/components/MkDrive.vue @@ -145,7 +145,7 @@ import XNavFolder from "@/components/MkDrive.navFolder.vue"; import XFolder from "@/components/MkDrive.folder.vue"; import XFile from "@/components/MkDrive.file.vue"; import * as os from "@/os"; -import { stream } from "@/stream"; +import { useStream } from "@/stream"; import { defaultStore } from "@/store"; import { i18n } from "@/i18n"; import { uploadFile, uploads } from "@/scripts/upload"; @@ -178,6 +178,8 @@ const emit = defineEmits<{ (ev: "open-folder", v: firefish.entities.DriveFolder): void; }>(); +const stream = useStream(); + const loadMoreFiles = ref>(); const fileInput = ref(); diff --git a/packages/client/src/components/MkFollowButton.vue b/packages/client/src/components/MkFollowButton.vue index 9a98c766..46599947 100644 --- a/packages/client/src/components/MkFollowButton.vue +++ b/packages/client/src/components/MkFollowButton.vue @@ -64,7 +64,7 @@ import { computed, onBeforeUnmount, onMounted, ref } from "vue"; import type * as firefish from "firefish-js"; import * as os from "@/os"; -import { stream } from "@/stream"; +import { useStream } from "@/stream"; import { i18n } from "@/i18n"; import { $i } from "@/reactiveAccount"; import { getUserMenu } from "@/scripts/get-user-menu"; @@ -73,6 +73,7 @@ import { vibrate } from "@/scripts/vibrate"; import icon from "@/scripts/icon"; const router = useRouter(); +const stream = useStream(); const emit = defineEmits(["refresh"]); const props = withDefaults( diff --git a/packages/client/src/components/MkNoteDetailed.vue b/packages/client/src/components/MkNoteDetailed.vue index 6704eee4..0bbae02e 100644 --- a/packages/client/src/components/MkNoteDetailed.vue +++ b/packages/client/src/components/MkNoteDetailed.vue @@ -186,7 +186,7 @@ import { i18n } from "@/i18n"; import { getNoteMenu } from "@/scripts/get-note-menu"; import { useNoteCapture } from "@/scripts/use-note-capture"; import { deepClone } from "@/scripts/clone"; -import { stream } from "@/stream"; +import { useStream } from "@/stream"; // import icon from "@/scripts/icon"; const props = defineProps<{ @@ -194,6 +194,8 @@ const props = defineProps<{ pinned?: boolean; }>(); +const stream = useStream(); + const tab = ref("replies"); const note = ref(deepClone(props.note)); diff --git a/packages/client/src/components/MkNotes.vue b/packages/client/src/components/MkNotes.vue index f64100a6..8ec25c64 100644 --- a/packages/client/src/components/MkNotes.vue +++ b/packages/client/src/components/MkNotes.vue @@ -1,5 +1,5 @@ - +
{