mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-24 08:04:08 +02:00
refactor(frontend): フロントエンドの型エラー解消(途中まで) (#16539)
* fix(frontend): FormLinkをボタンとして使用した際にエラーが出る問題を修正 * refactor(frontend): フロントエンドの型エラー解消 * remove unused ts-expect-error * migrate * remove unrelated changes * fix lint * more type fixes
This commit is contained in:
@@ -196,6 +196,7 @@ async function addSecurityKey() {
|
||||
if (auth.canceled) return;
|
||||
|
||||
const registrationOptions = parseCreationOptionsFromJSON({
|
||||
// @ts-expect-error misskey-js側に型がない
|
||||
publicKey: await os.apiWithDialog('i/2fa/register-key', {
|
||||
password: auth.result.password,
|
||||
token: auth.result.token,
|
||||
@@ -226,6 +227,7 @@ async function addSecurityKey() {
|
||||
password: auth.result.password,
|
||||
token: auth.result.token,
|
||||
name: name.result,
|
||||
// @ts-expect-error misskey-js側に型がない
|
||||
credential: credential.toJSON(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<template #label><SearchLabel>{{ i18n.ts._accountSettings.makeNotesFollowersOnlyBefore }}</SearchLabel></template>
|
||||
|
||||
<div class="_gaps_s">
|
||||
<MkSelect :modelValue="makeNotesFollowersOnlyBefore_type" @update:modelValue="makeNotesFollowersOnlyBefore = $event === 'relative' ? -604800 : $event === 'absolute' ? Math.floor(Date.now() / 1000) : null">
|
||||
<MkSelect v-model="makeNotesFollowersOnlyBefore_type">
|
||||
<option :value="null">{{ i18n.ts.none }}</option>
|
||||
<option value="relative">{{ i18n.ts._accountSettings.notesHavePassedSpecifiedPeriod }}</option>
|
||||
<option value="absolute">{{ i18n.ts._accountSettings.notesOlderThanSpecifiedDateAndTime }}</option>
|
||||
@@ -140,7 +140,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</MkInput>
|
||||
|
||||
<MkInput
|
||||
v-if="makeNotesFollowersOnlyBefore_type === 'absolute'"
|
||||
v-if="makeNotesFollowersOnlyBefore_type === 'absolute' && makeNotesFollowersOnlyBefore != null"
|
||||
:modelValue="formatDateTimeString(new Date(makeNotesFollowersOnlyBefore * 1000), 'yyyy-MM-dd')"
|
||||
type="date"
|
||||
:manualSave="true"
|
||||
@@ -161,6 +161,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
<div class="_gaps_s">
|
||||
<MkSelect
|
||||
v-model="makeNotesHiddenBefore_type"
|
||||
:items="[{
|
||||
value: null,
|
||||
label: i18n.ts.none
|
||||
@@ -170,7 +171,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
}, {
|
||||
value: 'absolute',
|
||||
label: i18n.ts._accountSettings.notesOlderThanSpecifiedDateAndTime
|
||||
}] as const" :modelValue="makeNotesHiddenBefore_type" @update:modelValue="makeNotesHiddenBefore = $event === 'relative' ? -604800 : $event === 'absolute' ? Math.floor(Date.now() / 1000) : null"
|
||||
}]"
|
||||
>
|
||||
</MkSelect>
|
||||
|
||||
@@ -189,7 +190,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</MkInput>
|
||||
|
||||
<MkInput
|
||||
v-if="makeNotesHiddenBefore_type === 'absolute'"
|
||||
v-if="makeNotesHiddenBefore_type === 'absolute' && makeNotesHiddenBefore != null"
|
||||
:modelValue="formatDateTimeString(new Date(makeNotesHiddenBefore * 1000), 'yyyy-MM-dd')"
|
||||
type="date"
|
||||
:manualSave="true"
|
||||
@@ -217,7 +218,6 @@ import { ref, computed, watch } from 'vue';
|
||||
import MkSwitch from '@/components/MkSwitch.vue';
|
||||
import MkSelect from '@/components/MkSelect.vue';
|
||||
import FormSection from '@/components/form/section.vue';
|
||||
import MkFolder from '@/components/MkFolder.vue';
|
||||
import { misskeyApi } from '@/utility/misskey-api.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { instance } from '@/instance.js';
|
||||
@@ -247,14 +247,25 @@ const followingVisibility = ref($i.followingVisibility);
|
||||
const followersVisibility = ref($i.followersVisibility);
|
||||
const chatScope = ref($i.chatScope);
|
||||
|
||||
const makeNotesFollowersOnlyBefore_type = computed(() => {
|
||||
if (makeNotesFollowersOnlyBefore.value == null) {
|
||||
return null;
|
||||
} else if (makeNotesFollowersOnlyBefore.value >= 0) {
|
||||
return 'absolute';
|
||||
} else {
|
||||
return 'relative';
|
||||
}
|
||||
const makeNotesFollowersOnlyBefore_type = computed({
|
||||
get: () => {
|
||||
if (makeNotesFollowersOnlyBefore.value == null) {
|
||||
return null;
|
||||
} else if (makeNotesFollowersOnlyBefore.value >= 0) {
|
||||
return 'absolute';
|
||||
} else {
|
||||
return 'relative';
|
||||
}
|
||||
},
|
||||
set(value) {
|
||||
if (value === 'relative') {
|
||||
makeNotesFollowersOnlyBefore.value = -604800;
|
||||
} else if (value === 'absolute') {
|
||||
makeNotesFollowersOnlyBefore.value = Math.floor(Date.now() / 1000);
|
||||
} else {
|
||||
makeNotesFollowersOnlyBefore.value = null;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const makeNotesFollowersOnlyBefore_presets = [
|
||||
@@ -288,14 +299,25 @@ const makeNotesFollowersOnlyBefore_customMonths = computed({
|
||||
},
|
||||
});
|
||||
|
||||
const makeNotesHiddenBefore_type = computed(() => {
|
||||
if (makeNotesHiddenBefore.value == null) {
|
||||
return null;
|
||||
} else if (makeNotesHiddenBefore.value >= 0) {
|
||||
return 'absolute';
|
||||
} else {
|
||||
return 'relative';
|
||||
}
|
||||
const makeNotesHiddenBefore_type = computed({
|
||||
get: () => {
|
||||
if (makeNotesHiddenBefore.value == null) {
|
||||
return null;
|
||||
} else if (makeNotesHiddenBefore.value >= 0) {
|
||||
return 'absolute';
|
||||
} else {
|
||||
return 'relative';
|
||||
}
|
||||
},
|
||||
set(value) {
|
||||
if (value === 'relative') {
|
||||
makeNotesHiddenBefore.value = -604800;
|
||||
} else if (value === 'absolute') {
|
||||
makeNotesHiddenBefore.value = Math.floor(Date.now() / 1000);
|
||||
} else {
|
||||
makeNotesHiddenBefore.value = null;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const makeNotesHiddenBefore_presets = [
|
||||
|
||||
@@ -41,25 +41,23 @@ import * as os from '@/os.js';
|
||||
import { misskeyApi } from '@/utility/misskey-api.js';
|
||||
import { playMisskeySfxFile, soundsTypes, getSoundDuration } from '@/utility/sound.js';
|
||||
import { selectFile } from '@/utility/drive.js';
|
||||
import type { SoundStore } from '@/preferences/def.js';
|
||||
|
||||
const props = defineProps<{
|
||||
type: SoundType;
|
||||
fileId?: string;
|
||||
fileUrl?: string;
|
||||
volume: number;
|
||||
def: SoundStore;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: 'update', result: { type: SoundType; fileId?: string; fileUrl?: string; volume: number; }): void;
|
||||
}>();
|
||||
|
||||
const type = ref<SoundType>(props.type);
|
||||
const fileId = ref(props.fileId);
|
||||
const fileUrl = ref(props.fileUrl);
|
||||
const type = ref<SoundType>(props.def.type);
|
||||
const fileId = ref('fileId' in props.def ? props.def.fileId : undefined);
|
||||
const fileUrl = ref('fileUrl' in props.def ? props.def.fileUrl : undefined);
|
||||
const fileName = ref<string>('');
|
||||
const driveFileError = ref(false);
|
||||
const hasChanged = ref(false);
|
||||
const volume = ref(props.volume);
|
||||
const volume = ref(props.def.volume);
|
||||
|
||||
if (type.value === '_driveFile_' && fileId.value) {
|
||||
await misskeyApi('drive/files/show', {
|
||||
|
||||
@@ -42,7 +42,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<template #suffix>{{ getSoundTypeName(sounds[type].type) }}</template>
|
||||
<Suspense>
|
||||
<template #default>
|
||||
<XSound :type="sounds[type].type" :volume="sounds[type].volume" :fileId="sounds[type].fileId" :fileUrl="sounds[type].fileUrl" @update="(res) => updated(type, res)"/>
|
||||
<XSound :def="sounds[type]" @update="(res) => updated(type, res)"/>
|
||||
</template>
|
||||
<template #fallback>
|
||||
<MkLoading/>
|
||||
|
||||
Reference in New Issue
Block a user