From c0f31fcb8f0a2b91acc7f53bb3397790c0137d90 Mon Sep 17 00:00:00 2001 From: naskya Date: Fri, 1 Sep 2023 23:16:23 +0000 Subject: [PATCH] chore, refactor: remove unused, fix some type errors (client/src/pages) --- packages/client/src/filters/bytes.ts | 2 +- packages/client/src/pages/_empty_.vue | 4 +- packages/client/src/pages/_error_.vue | 13 +-- packages/client/src/pages/about-firefish.vue | 4 +- packages/client/src/pages/about.emojis.vue | 3 +- .../client/src/pages/about.federation.vue | 6 +- packages/client/src/pages/about.vue | 14 +-- packages/client/src/pages/admin-file.vue | 9 +- packages/client/src/pages/admin/_header_.vue | 17 +-- packages/client/src/pages/admin/abuses.vue | 16 ++- .../client/src/pages/admin/announcements.vue | 2 +- .../client/src/pages/admin/bot-protection.vue | 10 +- .../client/src/pages/admin/custom-css.vue | 10 +- packages/client/src/pages/admin/database.vue | 1 - .../client/src/pages/admin/email-settings.vue | 15 ++- .../src/pages/admin/emoji-edit-dialog.vue | 14 ++- packages/client/src/pages/admin/emojis.vue | 9 +- .../client/src/pages/admin/experiments.vue | 5 +- packages/client/src/pages/admin/files.vue | 16 ++- packages/client/src/pages/admin/hashtags.vue | 3 +- packages/client/src/pages/admin/index.vue | 25 ++--- .../client/src/pages/admin/instance-block.vue | 7 +- .../src/pages/admin/integrations.discord.vue | 9 +- .../src/pages/admin/integrations.github.vue | 9 +- .../client/src/pages/admin/integrations.vue | 7 +- .../client/src/pages/admin/object-storage.vue | 27 +++-- .../client/src/pages/admin/other-settings.vue | 1 - .../src/pages/admin/overview.active-users.vue | 20 +--- .../src/pages/admin/overview.ap-requests.vue | 12 +-- .../src/pages/admin/overview.federation.vue | 19 ++-- .../src/pages/admin/overview.heatmap.vue | 2 +- .../src/pages/admin/overview.instances.vue | 2 +- .../src/pages/admin/overview.metrics.vue | 18 ++-- .../src/pages/admin/overview.moderators.vue | 8 +- .../client/src/pages/admin/overview.pie.vue | 8 +- .../src/pages/admin/overview.queue-chart.vue | 21 ++-- .../src/pages/admin/overview.queue.chart.vue | 16 ++- .../client/src/pages/admin/overview.queue.vue | 26 +++-- .../client/src/pages/admin/overview.stats.vue | 16 ++- .../client/src/pages/admin/overview.user.vue | 2 +- .../client/src/pages/admin/overview.users.vue | 8 +- packages/client/src/pages/admin/overview.vue | 40 ++----- .../client/src/pages/admin/promotions.vue | 5 +- .../client/src/pages/admin/proxy-account.vue | 5 +- .../src/pages/admin/queue.chart.chart.vue | 8 +- .../client/src/pages/admin/queue.chart.vue | 8 +- packages/client/src/pages/admin/queue.vue | 25 +---- packages/client/src/pages/admin/relays.vue | 3 +- packages/client/src/pages/admin/security.vue | 26 +++-- packages/client/src/pages/admin/settings.vue | 78 +++++++------- packages/client/src/pages/admin/users.vue | 12 +-- .../client/src/pages/antenna-timeline.vue | 53 +++------- packages/client/src/pages/auth.form.vue | 1 - packages/client/src/pages/auth.vue | 2 - packages/client/src/pages/channel-editor.vue | 14 ++- packages/client/src/pages/channel.vue | 7 +- packages/client/src/pages/channels.vue | 15 ++- packages/client/src/pages/clip.vue | 2 +- packages/client/src/pages/drive.vue | 7 +- packages/client/src/pages/emojis.emoji.vue | 1 - .../client/src/pages/explore.featured.vue | 8 +- packages/client/src/pages/explore.users.vue | 10 +- packages/client/src/pages/explore.vue | 2 +- packages/client/src/pages/follow-requests.vue | 4 - packages/client/src/pages/follow.vue | 1 - packages/client/src/pages/gallery/edit.vue | 12 +-- packages/client/src/pages/gallery/index.vue | 6 +- packages/client/src/pages/gallery/post.vue | 6 +- packages/client/src/pages/instance-info.vue | 18 ++-- packages/client/src/pages/messaging/index.vue | 28 +---- .../pages/messaging/messaging-room.form.vue | 16 +-- .../messaging/messaging-room.message.vue | 1 - .../src/pages/messaging/messaging-room.vue | 22 ++-- packages/client/src/pages/mfm-cheat-sheet.vue | 100 +++++++++--------- packages/client/src/pages/miauth.vue | 3 +- .../client/src/pages/my-antennas/create.vue | 4 +- .../client/src/pages/my-antennas/edit.vue | 10 +- .../client/src/pages/my-antennas/editor.vue | 28 ++--- packages/client/src/pages/my-clips/index.vue | 10 -- packages/client/src/pages/my-lists/index.vue | 1 - packages/client/src/pages/my-lists/list.vue | 4 +- packages/client/src/pages/not-found.vue | 6 -- packages/client/src/pages/note.vue | 18 ++-- packages/client/src/pages/notifications.vue | 5 +- .../page-editor/els/page-editor.el.button.vue | 1 - .../page-editor/els/page-editor.el.canvas.vue | 1 - .../els/page-editor.el.counter.vue | 1 - .../page-editor/els/page-editor.el.image.vue | 2 +- .../page-editor/els/page-editor.el.note.vue | 4 +- .../els/page-editor.el.number-input.vue | 1 - .../page-editor/els/page-editor.el.post.vue | 1 - .../els/page-editor.el.radio-button.vue | 2 +- .../page-editor/els/page-editor.el.switch.vue | 1 - .../els/page-editor.el.text-input.vue | 1 - .../page-editor/els/page-editor.el.text.vue | 1 - .../els/page-editor.el.textarea-input.vue | 1 - .../els/page-editor.el.textarea.vue | 1 - .../pages/page-editor/page-editor.blocks.vue | 3 +- .../src/pages/page-editor/page-editor.vue | 40 +++---- packages/client/src/pages/page.vue | 6 +- packages/client/src/pages/pages.vue | 2 +- packages/client/src/pages/preview.vue | 4 - packages/client/src/pages/registry.keys.vue | 2 +- packages/client/src/pages/registry.value.vue | 8 +- packages/client/src/pages/registry.vue | 6 +- packages/client/src/pages/reset-password.vue | 4 +- packages/client/src/pages/scratchpad.vue | 6 +- packages/client/src/pages/search.vue | 2 +- .../src/pages/settings/account-info.vue | 6 +- .../client/src/pages/settings/accounts.vue | 6 +- packages/client/src/pages/settings/api.vue | 6 +- packages/client/src/pages/settings/apps.vue | 6 +- .../client/src/pages/settings/custom-css.vue | 6 +- .../src/pages/settings/custom-katex-macro.vue | 4 - packages/client/src/pages/settings/deck.vue | 10 +- .../src/pages/settings/delete-account.vue | 6 -- packages/client/src/pages/settings/drive.vue | 9 +- packages/client/src/pages/settings/email.vue | 6 +- .../client/src/pages/settings/general.vue | 6 +- .../src/pages/settings/import-export.vue | 6 +- packages/client/src/pages/settings/index.vue | 26 +---- .../src/pages/settings/instance-mute.vue | 8 +- .../client/src/pages/settings/integration.vue | 12 --- .../client/src/pages/settings/migration.vue | 4 +- .../client/src/pages/settings/mute-block.vue | 10 +- packages/client/src/pages/settings/navbar.vue | 4 - .../src/pages/settings/notifications.vue | 11 +- packages/client/src/pages/settings/other.vue | 10 -- .../src/pages/settings/plugin.install.vue | 6 +- packages/client/src/pages/settings/plugin.vue | 8 +- .../pages/settings/preferences-backups.vue | 2 +- .../client/src/pages/settings/privacy.vue | 31 +++--- .../client/src/pages/settings/profile.vue | 8 +- .../client/src/pages/settings/reaction.vue | 6 +- .../client/src/pages/settings/security.vue | 6 -- packages/client/src/pages/settings/sounds.vue | 10 -- .../pages/settings/statusbar.statusbar.vue | 3 +- .../client/src/pages/settings/statusbar.vue | 10 +- .../src/pages/settings/theme.install.vue | 9 +- .../src/pages/settings/theme.manage.vue | 4 - packages/client/src/pages/settings/theme.vue | 4 - .../src/pages/settings/webhook.edit.vue | 29 +++-- .../client/src/pages/settings/webhook.new.vue | 27 ++--- .../client/src/pages/settings/webhook.vue | 10 -- .../client/src/pages/settings/word-mute.vue | 6 +- packages/client/src/pages/share.vue | 20 ++-- packages/client/src/pages/signup-complete.vue | 6 +- packages/client/src/pages/tag.vue | 2 +- packages/client/src/pages/theme-editor.vue | 8 +- packages/client/src/pages/timeline.vue | 9 -- packages/client/src/pages/user-info.vue | 48 +++------ .../client/src/pages/user-list-timeline.vue | 8 +- packages/client/src/pages/user/followers.vue | 16 +-- packages/client/src/pages/user/following.vue | 14 +-- packages/client/src/pages/user/home.vue | 17 ++- .../client/src/pages/user/index.activity.vue | 3 +- .../client/src/pages/user/index.photos.vue | 4 +- .../client/src/pages/user/index.timeline.vue | 1 - packages/client/src/pages/user/index.vue | 13 +-- packages/client/src/pages/user/pages.vue | 2 - packages/client/src/pages/verify-email.vue | 6 +- .../client/src/pages/welcome.entrance.a.vue | 16 ++- packages/client/src/pages/welcome.setup.vue | 7 +- packages/client/src/pages/welcome.vue | 6 +- packages/client/src/store.ts | 2 +- 165 files changed, 582 insertions(+), 1139 deletions(-) diff --git a/packages/client/src/filters/bytes.ts b/packages/client/src/filters/bytes.ts index 45cd7bfcc3..723625932a 100644 --- a/packages/client/src/filters/bytes.ts +++ b/packages/client/src/filters/bytes.ts @@ -7,7 +7,7 @@ export default (v, digits = 0) => { const i = Math.floor(Math.log(v) / Math.log(1024)); return ( (isMinus ? "-" : "") + - (v / Math.pow(1024, i)).toFixed(digits).replace(/\.0+$/, "") + + (v / 1024 ** i).toFixed(digits).replace(/\.0+$/, "") + sizes[i] ); }; diff --git a/packages/client/src/pages/_empty_.vue b/packages/client/src/pages/_empty_.vue index 3dee6cd459..3892edbd3d 100644 --- a/packages/client/src/pages/_empty_.vue +++ b/packages/client/src/pages/_empty_.vue @@ -2,6 +2,4 @@
- + diff --git a/packages/client/src/pages/_error_.vue b/packages/client/src/pages/_error_.vue index 7bc79fdf3c..da7cc266ec 100644 --- a/packages/client/src/pages/_error_.vue +++ b/packages/client/src/pages/_error_.vue @@ -35,9 +35,8 @@ diff --git a/packages/client/src/pages/admin/overview.queue-chart.vue b/packages/client/src/pages/admin/overview.queue-chart.vue index 1348bde98e..4ed66f545e 100644 --- a/packages/client/src/pages/admin/overview.queue-chart.vue +++ b/packages/client/src/pages/admin/overview.queue-chart.vue @@ -3,7 +3,7 @@ - - diff --git a/packages/client/src/pages/admin/overview.queue.chart.vue b/packages/client/src/pages/admin/overview.queue.chart.vue index 01a0d0ec07..f39315e3e3 100644 --- a/packages/client/src/pages/admin/overview.queue.chart.vue +++ b/packages/client/src/pages/admin/overview.queue.chart.vue @@ -3,10 +3,8 @@ - - diff --git a/packages/client/src/pages/admin/overview.queue.vue b/packages/client/src/pages/admin/overview.queue.vue index 1084f2e397..bf6a45ee5d 100644 --- a/packages/client/src/pages/admin/overview.queue.vue +++ b/packages/client/src/pages/admin/overview.queue.vue @@ -45,9 +45,7 @@ import { markRaw, onMounted, onUnmounted, ref, shallowRef } from "vue"; import XChart from "./overview.queue.chart.vue"; import number from "@/filters/number"; -import * as os from "@/os"; import { stream } from "@/stream"; -import { i18n } from "@/i18n"; const connection = markRaw(stream.useChannel("queueStats")); @@ -55,10 +53,10 @@ const activeSincePrevTick = ref(0); const active = ref(0); const delayed = ref(0); const waiting = ref(0); -let chartProcess = shallowRef>(); -let chartActive = shallowRef>(); -let chartDelayed = shallowRef>(); -let chartWaiting = shallowRef>(); +const chartProcess = shallowRef>(); +const chartActive = shallowRef>(); +const chartDelayed = shallowRef>(); +const chartWaiting = shallowRef>(); const props = defineProps<{ domain: string; @@ -70,10 +68,10 @@ const onStats = (stats) => { delayed.value = stats[props.domain].delayed; waiting.value = stats[props.domain].waiting; - chartProcess.value.pushData(stats[props.domain].activeSincePrevTick); - chartActive.value.pushData(stats[props.domain].active); - chartDelayed.value.pushData(stats[props.domain].delayed); - chartWaiting.value.pushData(stats[props.domain].waiting); + chartProcess.value?.pushData(stats[props.domain].activeSincePrevTick); + chartActive.value?.pushData(stats[props.domain].active); + chartDelayed.value?.pushData(stats[props.domain].delayed); + chartWaiting.value?.pushData(stats[props.domain].waiting); }; const onStatsLog = (statsLog) => { @@ -89,10 +87,10 @@ const onStatsLog = (statsLog) => { dataWaiting.push(stats[props.domain].waiting); } - chartProcess.value.setData(dataProcess); - chartActive.value.setData(dataActive); - chartDelayed.value.setData(dataDelayed); - chartWaiting.value.setData(dataWaiting); + chartProcess.value?.setData(dataProcess); + chartActive.value?.setData(dataActive); + chartDelayed.value?.setData(dataDelayed); + chartWaiting.value?.setData(dataWaiting); }; onMounted(() => { diff --git a/packages/client/src/pages/admin/overview.stats.vue b/packages/client/src/pages/admin/overview.stats.vue index de301b0b9b..81d90d93e3 100644 --- a/packages/client/src/pages/admin/overview.stats.vue +++ b/packages/client/src/pages/admin/overview.stats.vue @@ -94,20 +94,18 @@ - - diff --git a/packages/client/src/pages/admin/queue.chart.vue b/packages/client/src/pages/admin/queue.chart.vue index b220201d3d..d26605788b 100644 --- a/packages/client/src/pages/admin/queue.chart.vue +++ b/packages/client/src/pages/admin/queue.chart.vue @@ -72,10 +72,10 @@ const active = ref(0); const delayed = ref(0); const waiting = ref(0); const jobs = ref([]); -let chartProcess = ref>(); -let chartActive = ref>(); -let chartDelayed = ref>(); -let chartWaiting = ref>(); +const chartProcess = ref>(); +const chartActive = ref>(); +const chartDelayed = ref>(); +const chartWaiting = ref>(); const props = defineProps<{ domain: string; diff --git a/packages/client/src/pages/admin/queue.vue b/packages/client/src/pages/admin/queue.vue index 15a6bdcf02..bba49e505f 100644 --- a/packages/client/src/pages/admin/queue.vue +++ b/packages/client/src/pages/admin/queue.vue @@ -15,34 +15,13 @@ - - diff --git a/packages/client/src/pages/channel-editor.vue b/packages/client/src/pages/channel-editor.vue index 5492dac296..403a791cd7 100644 --- a/packages/client/src/pages/channel-editor.vue +++ b/packages/client/src/pages/channel-editor.vue @@ -40,7 +40,7 @@ - - diff --git a/packages/client/src/pages/channel.vue b/packages/client/src/pages/channel.vue index 974c779320..086056f85f 100644 --- a/packages/client/src/pages/channel.vue +++ b/packages/client/src/pages/channel.vue @@ -101,8 +101,7 @@ diff --git a/packages/client/src/pages/explore.users.vue b/packages/client/src/pages/explore.users.vue index 07403a2ba9..a3ec0e3171 100644 --- a/packages/client/src/pages/explore.users.vue +++ b/packages/client/src/pages/explore.users.vue @@ -145,20 +145,18 @@ import { computed, watch, ref } from "vue"; import XUserList from "@/components/MkUserList.vue"; import MkFolder from "@/components/MkFolder.vue"; import MkTab from "@/components/MkTab.vue"; -import number from "@/filters/number"; import * as os from "@/os"; import { i18n } from "@/i18n"; import { $i } from "@/account"; -import { instance } from "@/instance"; const props = defineProps<{ tag?: string; }>(); -let origin = ref("local"); -let tagsEl = ref>(); -let tagsLocal = ref([]); -let tagsRemote = ref([]); +const origin = ref("local"); +const tagsEl = ref>(); +const tagsLocal = ref([]); +const tagsRemote = ref([]); watch( () => props.tag, diff --git a/packages/client/src/pages/explore.vue b/packages/client/src/pages/explore.vue index d68dd5d6ab..b858f8437b 100644 --- a/packages/client/src/pages/explore.vue +++ b/packages/client/src/pages/explore.vue @@ -50,7 +50,7 @@ import "swiper/scss"; import "swiper/scss/virtual"; const tabs = ["users", "featured"]; -let tab = ref(tabs[0]); +const tab = ref(tabs[0]); watch(tab, () => syncSlide(tabs.indexOf(tab.value))); const headerActions = computed(() => []); diff --git a/packages/client/src/pages/follow-requests.vue b/packages/client/src/pages/follow-requests.vue index dd323f7b0f..762353b807 100644 --- a/packages/client/src/pages/follow-requests.vue +++ b/packages/client/src/pages/follow-requests.vue @@ -109,10 +109,6 @@ function reject(user) { }); } -const headerActions = computed(() => []); - -const headerTabs = computed(() => []); - definePageMetadata( computed(() => ({ title: i18n.ts.followRequests, diff --git a/packages/client/src/pages/follow.vue b/packages/client/src/pages/follow.vue index fe8d642a9c..fb771fad54 100644 --- a/packages/client/src/pages/follow.vue +++ b/packages/client/src/pages/follow.vue @@ -3,7 +3,6 @@ - - diff --git a/packages/client/src/pages/my-antennas/edit.vue b/packages/client/src/pages/my-antennas/edit.vue index 3b64f3f7aa..386d21f3cb 100644 --- a/packages/client/src/pages/my-antennas/edit.vue +++ b/packages/client/src/pages/my-antennas/edit.vue @@ -9,7 +9,7 @@ - - diff --git a/packages/client/src/pages/my-antennas/editor.vue b/packages/client/src/pages/my-antennas/editor.vue index a9e58807c3..01a711b3ed 100644 --- a/packages/client/src/pages/my-antennas/editor.vue +++ b/packages/client/src/pages/my-antennas/editor.vue @@ -134,24 +134,24 @@ const emit = defineEmits<{ (ev: "deleted"): void; }>(); -let name: string = ref(props.antenna.name); -let src: string = ref(props.antenna.src); -let userListId: any = ref(props.antenna.userListId); -let userGroupId: any = ref(props.antenna.userGroupId); -let users: string = ref(props.antenna.users.join("\n")); -let instances: string = ref(props.antenna.instances.join("\n")); -let keywords: string = ref( +const name = ref(props.antenna.name); +const src = ref(props.antenna.src); +const userListId = ref(props.antenna.userListId); +const userGroupId = ref(props.antenna.userGroupId); +const users = ref(props.antenna.users.join("\n")); +const instances = ref(props.antenna.instances.join("\n")); +const keywords = ref( props.antenna.keywords.map((x) => x.join(" ")).join("\n"), ); -let excludeKeywords: string = ref( +const excludeKeywords = ref( props.antenna.excludeKeywords.map((x) => x.join(" ")).join("\n"), ); -let caseSensitive: boolean = ref(props.antenna.caseSensitive); -let withReplies: boolean = ref(props.antenna.withReplies); -let withFile: boolean = ref(props.antenna.withFile); -let notify: boolean = ref(props.antenna.notify); -let userLists: any = ref(null); -let userGroups: any = ref(null); +const caseSensitive = ref(props.antenna.caseSensitive); +const withReplies = ref(props.antenna.withReplies); +const withFile = ref(props.antenna.withFile); +const notify = ref(props.antenna.notify); +const userLists = ref(null); +const userGroups = ref(null); watch( () => src.value, diff --git a/packages/client/src/pages/my-clips/index.vue b/packages/client/src/pages/my-clips/index.vue index fdfaf509d1..428ac62463 100644 --- a/packages/client/src/pages/my-clips/index.vue +++ b/packages/client/src/pages/my-clips/index.vue @@ -40,9 +40,7 @@ - - diff --git a/packages/client/src/pages/registry.vue b/packages/client/src/pages/registry.vue index 1da5a56a7e..ad409a26cf 100644 --- a/packages/client/src/pages/registry.vue +++ b/packages/client/src/pages/registry.vue @@ -24,7 +24,7 @@ - - diff --git a/packages/client/src/pages/reset-password.vue b/packages/client/src/pages/reset-password.vue index 4c8de5cd70..c7983ebe50 100644 --- a/packages/client/src/pages/reset-password.vue +++ b/packages/client/src/pages/reset-password.vue @@ -42,7 +42,7 @@ const props = defineProps<{ token?: string; }>(); -let password = ref(""); +const password = ref(""); async function save() { await os.apiWithDialog("reset-password", { @@ -75,5 +75,3 @@ definePageMetadata({ icon: "ph-lock ph-bold ph-lg", }); - - diff --git a/packages/client/src/pages/scratchpad.vue b/packages/client/src/pages/scratchpad.vue index 91a43f1501..a63c7f5682 100644 --- a/packages/client/src/pages/scratchpad.vue +++ b/packages/client/src/pages/scratchpad.vue @@ -37,7 +37,7 @@ - - diff --git a/packages/client/src/pages/settings/preferences-backups.vue b/packages/client/src/pages/settings/preferences-backups.vue index bb37e9aa5f..857c3282fa 100644 --- a/packages/client/src/pages/settings/preferences-backups.vue +++ b/packages/client/src/pages/settings/preferences-backups.vue @@ -161,7 +161,7 @@ type Profile = { const connection = $i && stream.useChannel("main"); -let profiles = ref | null>(null); +const profiles = ref | null>(null); os.api("i/registry/get-all", { scope }).then((res) => { profiles.value = res || {}; diff --git a/packages/client/src/pages/settings/privacy.vue b/packages/client/src/pages/settings/privacy.vue index 0d13923559..291b0be2a0 100644 --- a/packages/client/src/pages/settings/privacy.vue +++ b/packages/client/src/pages/settings/privacy.vue @@ -142,7 +142,6 @@ - - diff --git a/packages/client/src/pages/user/following.vue b/packages/client/src/pages/user/following.vue index ce4a48ebed..46d234e3a8 100644 --- a/packages/client/src/pages/user/following.vue +++ b/packages/client/src/pages/user/following.vue @@ -16,15 +16,7 @@ - - diff --git a/packages/client/src/pages/verify-email.vue b/packages/client/src/pages/verify-email.vue index 0b9f256083..46b18b6130 100644 --- a/packages/client/src/pages/verify-email.vue +++ b/packages/client/src/pages/verify-email.vue @@ -5,7 +5,7 @@