forked from mirrors/misskey
fix(frontend): Paginatorの型エラー解消 (#16230)
* fix(frontend): fix paginator type error * fix * refactor * fix * fix * fix(paginator): remove readonly type * fix * typo * fix: R -> E * remove any --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
@@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<option value="local">{{ i18n.ts.local }}</option>
|
||||
<option value="remote">{{ i18n.ts.remote }}</option>
|
||||
</MkSelect>
|
||||
<MkInput v-model="searchHost" :debounce="true" type="search" style="margin: 0; flex: 1;" :disabled="paginator.computedParams.value.origin === 'local'">
|
||||
<MkInput v-model="searchHost" :debounce="true" type="search" style="margin: 0; flex: 1;" :disabled="paginator.computedParams?.value?.origin === 'local'">
|
||||
<template #label>{{ i18n.ts.host }}</template>
|
||||
</MkInput>
|
||||
</div>
|
||||
@@ -44,7 +44,7 @@ import { i18n } from '@/i18n.js';
|
||||
import { definePage } from '@/page.js';
|
||||
import { Paginator } from '@/utility/paginator.js';
|
||||
|
||||
const origin = ref<Misskey.entities.AdminDriveFilesRequest['origin']>('local');
|
||||
const origin = ref<NonNullable<Misskey.entities.AdminDriveFilesRequest['origin']>>('local');
|
||||
const type = ref<string | null>(null);
|
||||
const searchHost = ref('');
|
||||
const userId = ref('');
|
||||
|
||||
@@ -44,7 +44,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<MkPagination :paginator="paginator">
|
||||
<template #default="{ items }">
|
||||
<div class="_gaps_s">
|
||||
<MkInviteCode v-for="item in items" :key="item.id" :invite="(item as any)" :onDeleted="deleted" moderator/>
|
||||
<MkInviteCode v-for="item in items" :key="item.id" :invite="item" :onDeleted="deleted" moderator/>
|
||||
</div>
|
||||
</template>
|
||||
</MkPagination>
|
||||
@@ -54,6 +54,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { computed, markRaw, ref, useTemplateRef } from 'vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import * as os from '@/os.js';
|
||||
@@ -68,8 +69,8 @@ import MkInviteCode from '@/components/MkInviteCode.vue';
|
||||
import { definePage } from '@/page.js';
|
||||
import { Paginator } from '@/utility/paginator.js';
|
||||
|
||||
const type = ref('all');
|
||||
const sort = ref('+createdAt');
|
||||
const type = ref<NonNullable<Misskey.entities.AdminInviteListRequest['type']>>('all');
|
||||
const sort = ref<NonNullable<Misskey.entities.AdminInviteListRequest['sort']>>('+createdAt');
|
||||
|
||||
const paginator = markRaw(new Paginator('admin/invite/list', {
|
||||
limit: 10,
|
||||
|
||||
@@ -28,7 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
<template #default="{ items }">
|
||||
<div class="_gaps_s">
|
||||
<div v-for="item in items" :key="item.user.id" :class="[$style.userItem, { [$style.userItemOpend]: expandedItems.includes(item.id) }]">
|
||||
<div v-for="item in items" :key="item.user.id" :class="[$style.userItem, { [$style.userItemOpened]: expandedItems.includes(item.id) }]">
|
||||
<div :class="$style.userItemMain">
|
||||
<MkA :class="$style.userItemMainBody" :to="`/admin/user/${item.user.id}`">
|
||||
<MkUserCardMini :user="item.user"/>
|
||||
@@ -76,12 +76,12 @@ const props = defineProps<{
|
||||
|
||||
const usersPaginator = markRaw(new Paginator('admin/roles/users', {
|
||||
limit: 20,
|
||||
computedParams: computed(() => ({
|
||||
computedParams: computed(() => props.id ? ({
|
||||
roleId: props.id,
|
||||
})),
|
||||
}) : undefined),
|
||||
}));
|
||||
|
||||
const expandedItems = ref([]);
|
||||
const expandedItems = ref<string[]>([]);
|
||||
|
||||
const role = reactive(await misskeyApi('admin/roles/show', {
|
||||
roleId: props.id,
|
||||
@@ -199,7 +199,7 @@ definePage(() => ({
|
||||
transition: transform 0.1s ease-out;
|
||||
}
|
||||
|
||||
.userItem.userItemOpend {
|
||||
.userItem.userItemOpened {
|
||||
.chevron {
|
||||
transform: rotateX(180deg);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<template #prefix>@</template>
|
||||
<template #label>{{ i18n.ts.username }}</template>
|
||||
</MkInput>
|
||||
<MkInput v-model="searchHost" style="flex: 1;" type="text" :spellcheck="false" :disabled="paginator.computedParams.value.origin === 'local'">
|
||||
<MkInput v-model="searchHost" style="flex: 1;" type="text" :spellcheck="false" :disabled="paginator.computedParams?.value?.origin === 'local'">
|
||||
<template #prefix>@</template>
|
||||
<template #label>{{ i18n.ts.host }}</template>
|
||||
</MkInput>
|
||||
@@ -46,7 +46,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
<MkPagination v-slot="{items}" :paginator="paginator">
|
||||
<div :class="$style.users">
|
||||
<MkA v-for="user in items" :key="user.id" v-tooltip.mfm="`Last posted: ${dateString(user.updatedAt)}`" :class="$style.user" :to="`/admin/user/${user.id}`">
|
||||
<MkA v-for="user in items" :key="user.id" v-tooltip.mfm="`Last posted: ${user.updatedAt ? dateString(user.updatedAt) : 'Unknown'}`" :class="$style.user" :to="`/admin/user/${user.id}`">
|
||||
<MkUserCardMini :user="user"/>
|
||||
</MkA>
|
||||
</div>
|
||||
|
||||
@@ -17,7 +17,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<MkPagination :paginator="paginator">
|
||||
<template #default="{ items }">
|
||||
<div class="_gaps_s">
|
||||
<MkInviteCode v-for="item in (items as Misskey.entities.InviteCode[])" :key="item.id" :invite="item" :onDeleted="deleted"/>
|
||||
<MkInviteCode v-for="item in items" :key="item.id" :invite="item" :onDeleted="deleted"/>
|
||||
</div>
|
||||
</template>
|
||||
</MkPagination>
|
||||
|
||||
@@ -100,7 +100,7 @@ const prevChannelPaginator = markRaw(new Paginator('channels/timeline', {
|
||||
limit: 10,
|
||||
initialId: props.noteId,
|
||||
initialDirection: 'older',
|
||||
computedParams: computed(() => note.value ? ({
|
||||
computedParams: computed(() => note.value && note.value.channelId != null ? ({
|
||||
channelId: note.value.channelId,
|
||||
}) : undefined),
|
||||
}));
|
||||
@@ -109,7 +109,7 @@ const nextChannelPaginator = markRaw(new Paginator('channels/timeline', {
|
||||
limit: 10,
|
||||
initialId: props.noteId,
|
||||
initialDirection: 'newer',
|
||||
computedParams: computed(() => note.value ? ({
|
||||
computedParams: computed(() => note.value && note.value.channelId != null ? ({
|
||||
channelId: note.value.channelId,
|
||||
}) : undefined),
|
||||
}));
|
||||
|
||||
@@ -135,9 +135,9 @@ const page = ref<Misskey.entities.Page | null>(null);
|
||||
const error = ref<any>(null);
|
||||
const otherPostsPaginator = markRaw(new Paginator('users/pages', {
|
||||
limit: 6,
|
||||
computedParams: computed(() => ({
|
||||
computedParams: computed(() => page.value ? ({
|
||||
userId: page.value.user.id,
|
||||
})),
|
||||
}) : undefined),
|
||||
}));
|
||||
const path = computed(() => props.username + '/' + props.pageName);
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { computed, markRaw, ref, watch } from 'vue';
|
||||
import tinycolor from 'tinycolor2';
|
||||
import type { StyleValue } from 'vue';
|
||||
@@ -62,7 +63,7 @@ import MkSelect from '@/components/MkSelect.vue';
|
||||
import { getDriveFileMenu } from '@/utility/get-drive-file-menu.js';
|
||||
import { Paginator } from '@/utility/paginator.js';
|
||||
|
||||
const sortMode = ref('+size');
|
||||
const sortMode = ref<Misskey.entities.DriveFilesRequest['sort']>('+size');
|
||||
const paginator = markRaw(new Paginator('drive/files', {
|
||||
limit: 10,
|
||||
computedParams: computed(() => ({ sort: sortMode.value })),
|
||||
|
||||
@@ -208,9 +208,9 @@ const blockingPaginator = markRaw(new Paginator('blocking/list', {
|
||||
limit: 10,
|
||||
}));
|
||||
|
||||
const expandedRenoteMuteItems = ref([]);
|
||||
const expandedMuteItems = ref([]);
|
||||
const expandedBlockItems = ref([]);
|
||||
const expandedRenoteMuteItems = ref<string[]>([]);
|
||||
const expandedMuteItems = ref<string[]>([]);
|
||||
const expandedBlockItems = ref<string[]>([]);
|
||||
|
||||
const showSoftWordMutedWord = prefer.model('showSoftWordMutedWord');
|
||||
|
||||
@@ -253,7 +253,7 @@ async function unblock(user, ev) {
|
||||
}], ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
||||
async function toggleRenoteMuteItem(item) {
|
||||
async function toggleRenoteMuteItem(item: { id: string }) {
|
||||
if (expandedRenoteMuteItems.value.includes(item.id)) {
|
||||
expandedRenoteMuteItems.value = expandedRenoteMuteItems.value.filter(x => x !== item.id);
|
||||
} else {
|
||||
@@ -261,7 +261,7 @@ async function toggleRenoteMuteItem(item) {
|
||||
}
|
||||
}
|
||||
|
||||
async function toggleMuteItem(item) {
|
||||
async function toggleMuteItem(item: { id: string }) {
|
||||
if (expandedMuteItems.value.includes(item.id)) {
|
||||
expandedMuteItems.value = expandedMuteItems.value.filter(x => x !== item.id);
|
||||
} else {
|
||||
@@ -269,7 +269,7 @@ async function toggleMuteItem(item) {
|
||||
}
|
||||
}
|
||||
|
||||
async function toggleBlockItem(item) {
|
||||
async function toggleBlockItem(item: { id: string }) {
|
||||
if (expandedBlockItems.value.includes(item.id)) {
|
||||
expandedBlockItems.value = expandedBlockItems.value.filter(x => x !== item.id);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user