From 7a8a7567894c9635bda1355763f69ae3853721b7 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 1 Apr 2023 13:46:04 +0900 Subject: [PATCH] refactor(frontend): remove $instance --- packages/frontend/@types/vue.d.ts | 2 -- packages/frontend/src/components/MkDonation.vue | 3 ++- packages/frontend/src/init.ts | 1 - packages/frontend/src/pages/about.vue | 17 +++++++++-------- packages/frontend/src/pages/admin/index.vue | 4 ++-- .../frontend/src/pages/welcome.entrance.a.vue | 2 +- .../src/ui/_common_/navbar-for-mobile.vue | 5 +++-- packages/frontend/src/ui/_common_/navbar.vue | 7 ++++--- packages/frontend/src/ui/classic.header.vue | 4 +++- packages/frontend/src/ui/classic.sidebar.vue | 4 +++- packages/frontend/src/ui/visitor/a.vue | 6 ++++-- packages/frontend/src/ui/visitor/kanban.vue | 4 +++- .../frontend/src/widgets/WidgetInstanceInfo.vue | 7 ++++--- 13 files changed, 38 insertions(+), 28 deletions(-) diff --git a/packages/frontend/@types/vue.d.ts b/packages/frontend/@types/vue.d.ts index 661f45570..13544a2f5 100644 --- a/packages/frontend/@types/vue.d.ts +++ b/packages/frontend/@types/vue.d.ts @@ -1,14 +1,12 @@ /// import type { $i } from '@/account'; -import type { defaultStore } from '@/store'; import type { instance } from '@/instance'; import type { i18n } from '@/i18n'; declare module 'vue' { interface ComponentCustomProperties { $i: typeof $i; - $instance: typeof instance; $t: typeof i18n['t']; $ts: typeof i18n['ts']; } diff --git a/packages/frontend/src/components/MkDonation.vue b/packages/frontend/src/components/MkDonation.vue index 9baa90ebf..b5ae4c6c4 100644 --- a/packages/frontend/src/components/MkDonation.vue +++ b/packages/frontend/src/components/MkDonation.vue @@ -14,7 +14,7 @@
@@ -37,6 +37,7 @@ import { host } from '@/config'; import { i18n } from '@/i18n'; import * as os from '@/os'; import { miLocalStorage } from '@/local-storage'; +import { instance } from '@/instance'; const emit = defineEmits<{ (ev: 'closed'): void; diff --git a/packages/frontend/src/init.ts b/packages/frontend/src/init.ts index 075a69dcd..87ba06d17 100644 --- a/packages/frontend/src/init.ts +++ b/packages/frontend/src/init.ts @@ -201,7 +201,6 @@ if (_DEV_) { // TODO: 廃止 app.config.globalProperties = { $i, - $instance: instance, $t: i18n.t, $ts: i18n.ts, }; diff --git a/packages/frontend/src/pages/about.vue b/packages/frontend/src/pages/about.vue index be0c1828a..d54d93eae 100644 --- a/packages/frontend/src/pages/about.vue +++ b/packages/frontend/src/pages/about.vue @@ -3,18 +3,18 @@
-
+
- +
- {{ $instance.name ?? host }} + {{ instance.name ?? host }}
- + @@ -23,7 +23,7 @@ -
+
{{ i18n.ts.aboutMisskey }}
@@ -34,14 +34,14 @@ - + - + - {{ i18n.ts.tos }} + {{ i18n.ts.tos }}
@@ -101,6 +101,7 @@ import number from '@/filters/number'; import { i18n } from '@/i18n'; import { definePageMetadata } from '@/scripts/page-metadata'; import { claimAchievement } from '@/scripts/achievements'; +import { instance } from '@/instance'; const props = withDefaults(defineProps<{ initialTab?: string; diff --git a/packages/frontend/src/pages/admin/index.vue b/packages/frontend/src/pages/admin/index.vue index 8aae39cba..963393d7e 100644 --- a/packages/frontend/src/pages/admin/index.vue +++ b/packages/frontend/src/pages/admin/index.vue @@ -4,7 +4,7 @@
{{ i18n.ts.thereIsUnresolvedAbuseReportWarning }} {{ i18n.ts.check }} @@ -221,7 +221,7 @@ onUnmounted(() => { }); watch(router.currentRef, (to) => { - if (to.route.path === "/admin" && to.child?.route.name == null && !narrow) { + if (to.route.path === '/admin' && to.child?.route.name == null && !narrow) { router.replace('/admin/overview'); } }); diff --git a/packages/frontend/src/pages/welcome.entrance.a.vue b/packages/frontend/src/pages/welcome.entrance.a.vue index b6f9b3eb2..4d8d76db1 100644 --- a/packages/frontend/src/pages/welcome.entrance.a.vue +++ b/packages/frontend/src/pages/welcome.entrance.a.vue @@ -14,7 +14,7 @@
- +

diff --git a/packages/frontend/src/ui/_common_/navbar-for-mobile.vue b/packages/frontend/src/ui/_common_/navbar-for-mobile.vue index 935aceea7..866b898f7 100644 --- a/packages/frontend/src/ui/_common_/navbar-for-mobile.vue +++ b/packages/frontend/src/ui/_common_/navbar-for-mobile.vue @@ -2,9 +2,9 @@
- +
@@ -50,6 +50,7 @@ import { navbarItemDef } from '@/navbar'; import { openAccountMenu as openAccountMenu_ } from '@/account'; import { defaultStore } from '@/store'; import { i18n } from '@/i18n'; +import { instance } from '@/instance'; const menu = toRef(defaultStore.state, 'menu'); const otherMenuItemIndicated = computed(() => { diff --git a/packages/frontend/src/ui/_common_/navbar.vue b/packages/frontend/src/ui/_common_/navbar.vue index 3c161f679..3b4b16142 100644 --- a/packages/frontend/src/ui/_common_/navbar.vue +++ b/packages/frontend/src/ui/_common_/navbar.vue @@ -2,9 +2,9 @@
- -
@@ -60,6 +60,7 @@ import { navbarItemDef } from '@/navbar'; import { $i, openAccountMenu as openAccountMenu_ } from '@/account'; import { defaultStore } from '@/store'; import { i18n } from '@/i18n'; +import { instance } from '@/instance'; const iconOnly = ref(false); diff --git a/packages/frontend/src/ui/classic.header.vue b/packages/frontend/src/ui/classic.header.vue index 6d331ceb3..a0255d1bc 100644 --- a/packages/frontend/src/ui/classic.header.vue +++ b/packages/frontend/src/ui/classic.header.vue @@ -3,7 +3,7 @@
@@ -51,6 +51,7 @@ import { openAccountMenu } from '@/account'; import MkButton from '@/components/MkButton.vue'; import { mainRouter } from '@/router'; import { defaultStore } from '@/store'; +import { instance } from '@/instance'; export default defineComponent({ components: { @@ -65,6 +66,7 @@ export default defineComponent({ navbarItemDef: navbarItemDef, settingsWindowed: false, defaultStore, + instance, }; }, diff --git a/packages/frontend/src/ui/classic.sidebar.vue b/packages/frontend/src/ui/classic.sidebar.vue index 30ec0dc29..14a81448f 100644 --- a/packages/frontend/src/ui/classic.sidebar.vue +++ b/packages/frontend/src/ui/classic.sidebar.vue @@ -33,7 +33,7 @@
@@ -52,6 +52,7 @@ import { StickySidebar } from '@/scripts/sticky-sidebar'; import { mainRouter } from '@/router'; //import MisskeyLogo from '@assets/client/misskey.svg'; import { defaultStore } from '@/store'; +import { instance } from '@/instance'; export default defineComponent({ components: { @@ -68,6 +69,7 @@ export default defineComponent({ iconOnly: false, settingsWindowed: false, defaultStore, + instance, }; }, diff --git a/packages/frontend/src/ui/visitor/a.vue b/packages/frontend/src/ui/visitor/a.vue index 272e03da6..1ac5decf4 100644 --- a/packages/frontend/src/ui/visitor/a.vue +++ b/packages/frontend/src/ui/visitor/a.vue @@ -1,6 +1,6 @@