mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 09:13:08 +02:00
refactor(frontend): remove $i
This commit is contained in:
parent
7a8a756789
commit
f16a7cbcf2
22 changed files with 34 additions and 19 deletions
3
packages/frontend/@types/vue.d.ts
vendored
3
packages/frontend/@types/vue.d.ts
vendored
|
@ -1,12 +1,9 @@
|
|||
/// <reference types="vue/macros-global" />
|
||||
|
||||
import type { $i } from '@/account';
|
||||
import type { instance } from '@/instance';
|
||||
import type { i18n } from '@/i18n';
|
||||
|
||||
declare module 'vue' {
|
||||
interface ComponentCustomProperties {
|
||||
$i: typeof $i;
|
||||
$t: typeof i18n['t'];
|
||||
$ts: typeof i18n['ts'];
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { } from 'vue';
|
||||
import { $i } from '@/account';
|
||||
|
||||
const props = defineProps<{
|
||||
text: string;
|
||||
|
|
|
@ -22,6 +22,7 @@ import * as misskey from 'misskey-js';
|
|||
import MkNoteHeader from '@/components/MkNoteHeader.vue';
|
||||
import MkSubNoteContent from '@/components/MkSubNoteContent.vue';
|
||||
import MkCwButton from '@/components/MkCwButton.vue';
|
||||
import { $i } from '@/account';
|
||||
|
||||
const props = defineProps<{
|
||||
note: misskey.entities.Note;
|
||||
|
|
|
@ -33,6 +33,7 @@ import MkCwButton from '@/components/MkCwButton.vue';
|
|||
import { notePage } from '@/filters/note';
|
||||
import * as os from '@/os';
|
||||
import { i18n } from '@/i18n';
|
||||
import { $i } from '@/account';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
note: misskey.entities.Note;
|
||||
|
|
|
@ -36,6 +36,7 @@ import MkTextarea from '@/components/MkTextarea.vue';
|
|||
import MkRadio from '@/components/MkRadio.vue';
|
||||
import * as os from '@/os';
|
||||
import * as config from '@/config';
|
||||
import { $i } from '@/account';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
|
@ -51,6 +52,7 @@ export default defineComponent({
|
|||
text: '',
|
||||
flag: true,
|
||||
radio: 'misskey',
|
||||
$i,
|
||||
mfm: `Hello world! This is an @example mention. BTW you are @${this.$i ? this.$i.username : 'guest'}.\nAlso, here is ${config.url} and [example link](${config.url}). for more details, see https://example.com.\nAs you know #misskey is open-source software.`,
|
||||
};
|
||||
},
|
||||
|
|
|
@ -27,6 +27,7 @@ import * as misskey from 'misskey-js';
|
|||
import MkMediaList from '@/components/MkMediaList.vue';
|
||||
import MkPoll from '@/components/MkPoll.vue';
|
||||
import { i18n } from '@/i18n';
|
||||
import { $i } from '@/account';
|
||||
|
||||
const props = defineProps<{
|
||||
note: misskey.entities.Note;
|
||||
|
|
|
@ -33,6 +33,7 @@ import * as misskey from 'misskey-js';
|
|||
import MkFollowButton from '@/components/MkFollowButton.vue';
|
||||
import { userPage } from '@/filters/user';
|
||||
import { i18n } from '@/i18n';
|
||||
import { $i } from '@/account';
|
||||
|
||||
defineProps<{
|
||||
user: misskey.entities.UserDetailed;
|
||||
|
|
|
@ -60,6 +60,7 @@ import { getUserMenu } from '@/scripts/get-user-menu';
|
|||
import number from '@/filters/number';
|
||||
import { i18n } from '@/i18n';
|
||||
import { defaultStore } from '@/store';
|
||||
import { $i } from '@/account';
|
||||
|
||||
const props = defineProps<{
|
||||
showing: boolean;
|
||||
|
|
|
@ -17,6 +17,7 @@ import * as os from '@/os';
|
|||
import { PostBlock } from '@/scripts/hpml/block';
|
||||
import { Hpml } from '@/scripts/hpml/evaluator';
|
||||
import { defaultStore } from '@/store';
|
||||
import { $i } from '@/account';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
|
@ -55,7 +56,7 @@ export default defineComponent({
|
|||
canvas.toBlob(blob => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', blob);
|
||||
formData.append('i', this.$i.token);
|
||||
formData.append('i', $i.token);
|
||||
if (defaultStore.state.uploadFolder) {
|
||||
formData.append('folderId', defaultStore.state.uploadFolder);
|
||||
}
|
||||
|
|
|
@ -6,11 +6,12 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { TextBlock } from '@/scripts/hpml/block';
|
||||
import { Hpml } from '@/scripts/hpml/evaluator';
|
||||
import { defineAsyncComponent, defineComponent, PropType } from 'vue';
|
||||
import * as mfm from 'mfm-js';
|
||||
import { TextBlock } from '@/scripts/hpml/block';
|
||||
import { Hpml } from '@/scripts/hpml/evaluator';
|
||||
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm';
|
||||
import { $i } from '@/account';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
|
@ -29,6 +30,7 @@ export default defineComponent({
|
|||
data() {
|
||||
return {
|
||||
text: this.hpml.interpolate(this.block.text),
|
||||
$i,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -200,7 +200,6 @@ if (_DEV_) {
|
|||
|
||||
// TODO: 廃止
|
||||
app.config.globalProperties = {
|
||||
$i,
|
||||
$t: i18n.t,
|
||||
$ts: i18n.ts,
|
||||
};
|
||||
|
|
|
@ -32,13 +32,14 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { watch } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import XEmoji from './emojis.emoji.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import MkInput from '@/components/MkInput.vue';
|
||||
import MkFoldableSection from '@/components/MkFoldableSection.vue';
|
||||
import { customEmojis, customEmojiCategories, getCustomEmojiTags } from '@/custom-emojis';
|
||||
import { i18n } from '@/i18n';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { $i } from '@/account';
|
||||
|
||||
const customEmojiTags = getCustomEmojiTags();
|
||||
let q = $ref('');
|
||||
|
|
|
@ -25,6 +25,7 @@ import MkButton from '@/components/MkButton.vue';
|
|||
import * as os from '@/os';
|
||||
import { i18n } from '@/i18n';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||
import { $i } from '@/account';
|
||||
|
||||
const pagination = {
|
||||
endpoint: 'announcements' as const,
|
||||
|
|
|
@ -64,6 +64,7 @@ import { createAiScriptEnv } from '@/scripts/aiscript/api';
|
|||
import MkFolder from '@/components/MkFolder.vue';
|
||||
import MkCode from '@/components/MkCode.vue';
|
||||
import { defaultStore } from '@/store';
|
||||
import { $i } from '@/account';
|
||||
|
||||
const props = defineProps<{
|
||||
id: string;
|
||||
|
|
|
@ -68,6 +68,7 @@ import { useRouter } from '@/router';
|
|||
import { i18n } from '@/i18n';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||
import { defaultStore } from '@/store';
|
||||
import { $i } from '@/account';
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ import { i18n } from '@/i18n';
|
|||
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||
import { pageViewInterruptors, defaultStore } from '@/store';
|
||||
import { deepClone } from '@/scripts/clone';
|
||||
import { $i } from '@/account';
|
||||
|
||||
const props = defineProps<{
|
||||
pageName: string;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
import FormInfo from '@/components/MkInfo.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import * as os from '@/os';
|
||||
import { signout } from '@/account';
|
||||
import { signout, $i } from '@/account';
|
||||
import { i18n } from '@/i18n';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ import { url } from '@/config';
|
|||
import { userPage, acct } from '@/filters/user';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||
import { i18n } from '@/i18n';
|
||||
import { iAmAdmin, iAmModerator } from '@/account';
|
||||
import { iAmAdmin, iAmModerator, $i } from '@/account';
|
||||
import MkRolePreview from '@/components/MkRolePreview.vue';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<MkMediaList :media-list="note.files"/>
|
||||
</div>
|
||||
<div v-if="note.poll">
|
||||
<MkPoll :note="note" :readOnly="true" />
|
||||
<MkPoll :note="note" :read-only="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<MkReactionsViewer ref="reactionsViewer" :note="note"/>
|
||||
|
@ -22,13 +22,14 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Note } from 'misskey-js/built/entities';
|
||||
import { onUpdated } from 'vue';
|
||||
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
|
||||
import MkMediaList from '@/components/MkMediaList.vue';
|
||||
import MkPoll from '@/components/MkPoll.vue';
|
||||
import * as os from '@/os';
|
||||
import { Note } from 'misskey-js/built/entities';
|
||||
import { onUpdated } from 'vue';
|
||||
import { getScrollContainer } from '@/scripts/scroll';
|
||||
import { $i } from '@/account';
|
||||
|
||||
let notes = $ref<Note[]>([]);
|
||||
let isScrolling = $ref(false);
|
||||
|
|
|
@ -47,7 +47,7 @@ import { computed, defineAsyncComponent, toRef } from 'vue';
|
|||
import { openInstanceMenu } from './common';
|
||||
import * as os from '@/os';
|
||||
import { navbarItemDef } from '@/navbar';
|
||||
import { openAccountMenu as openAccountMenu_ } from '@/account';
|
||||
import { $i, openAccountMenu as openAccountMenu_ } from '@/account';
|
||||
import { defaultStore } from '@/store';
|
||||
import { i18n } from '@/i18n';
|
||||
import { instance } from '@/instance';
|
||||
|
|
|
@ -47,7 +47,7 @@ import { openInstanceMenu } from './_common_/common';
|
|||
import { host } from '@/config';
|
||||
import * as os from '@/os';
|
||||
import { navbarItemDef } from '@/navbar';
|
||||
import { openAccountMenu } from '@/account';
|
||||
import { openAccountMenu, $i } from '@/account';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { mainRouter } from '@/router';
|
||||
import { defaultStore } from '@/store';
|
||||
|
@ -67,6 +67,7 @@ export default defineComponent({
|
|||
settingsWindowed: false,
|
||||
defaultStore,
|
||||
instance,
|
||||
$i,
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ import { openInstanceMenu } from './_common_/common';
|
|||
import { host } from '@/config';
|
||||
import * as os from '@/os';
|
||||
import { navbarItemDef } from '@/navbar';
|
||||
import { openAccountMenu } from '@/account';
|
||||
import { openAccountMenu, $i } from '@/account';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { StickySidebar } from '@/scripts/sticky-sidebar';
|
||||
import { mainRouter } from '@/router';
|
||||
|
@ -70,6 +70,7 @@ export default defineComponent({
|
|||
settingsWindowed: false,
|
||||
defaultStore,
|
||||
instance,
|
||||
$i,
|
||||
};
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue