forked from mirrors/misskey
refactor(frontend): os.select, MkSelectのitem指定をオブジェクトによる定義に統一し、型を狭める (#16475)
* refactor(frontend): MkSelectのitem指定をオブジェクトによる定義に統一 * fix * spdx * fix * fix os.select * fix lint * add comment * fix * fix: os.select対応漏れを修正 * fix * fix * fix: MkSelectのmodelに対する型チェックを厳格化 * fix * fix * fix * Update packages/frontend/src/components/MkEmbedCodeGenDialog.vue Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> * fix * fix types * fix * fix * Update packages/frontend/src/pages/admin/roles.editor.vue Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> * fix: MkSelectに直接配列を指定している場合に正常に型が解決されるように --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
@@ -18,9 +18,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
<div class="_gaps_m">
|
||||
<SearchMarker :keywords="['language']">
|
||||
<MkSelect v-model="lang">
|
||||
<MkSelect v-model="lang" :items="langs.map(x => ({ label: x[1], value: x[0] }))">
|
||||
<template #label><SearchLabel>{{ i18n.ts.uiLanguage }}</SearchLabel></template>
|
||||
<option v-for="x in langs" :key="x[0]" :value="x[0]">{{ x[1] }}</option>
|
||||
<template #caption>
|
||||
<I18n :src="i18n.ts.i18nInfo" tag="span">
|
||||
<template #link>
|
||||
@@ -272,22 +271,31 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
<SearchMarker :keywords="['ticker', 'information', 'label', 'instance', 'server', 'host', 'federation']">
|
||||
<MkPreferenceContainer k="instanceTicker">
|
||||
<MkSelect v-if="instance.federation !== 'none'" v-model="instanceTicker">
|
||||
<MkSelect
|
||||
v-if="instance.federation !== 'none'"
|
||||
v-model="instanceTicker"
|
||||
:items="[
|
||||
{ label: i18n.ts._instanceTicker.none, value: 'none' },
|
||||
{ label: i18n.ts._instanceTicker.remote, value: 'remote' },
|
||||
{ label: i18n.ts._instanceTicker.always, value: 'always' },
|
||||
]"
|
||||
>
|
||||
<template #label><SearchLabel>{{ i18n.ts.instanceTicker }}</SearchLabel></template>
|
||||
<option value="none">{{ i18n.ts._instanceTicker.none }}</option>
|
||||
<option value="remote">{{ i18n.ts._instanceTicker.remote }}</option>
|
||||
<option value="always">{{ i18n.ts._instanceTicker.always }}</option>
|
||||
</MkSelect>
|
||||
</MkPreferenceContainer>
|
||||
</SearchMarker>
|
||||
|
||||
<SearchMarker :keywords="['attachment', 'image', 'photo', 'picture', 'media', 'thumbnail', 'nsfw', 'sensitive', 'display', 'show', 'hide', 'visibility']">
|
||||
<MkPreferenceContainer k="nsfw">
|
||||
<MkSelect v-model="nsfw">
|
||||
<MkSelect
|
||||
v-model="nsfw"
|
||||
:items="[
|
||||
{ label: i18n.ts._displayOfSensitiveMedia.respect, value: 'respect' },
|
||||
{ label: i18n.ts._displayOfSensitiveMedia.ignore, value: 'ignore' },
|
||||
{ label: i18n.ts._displayOfSensitiveMedia.force, value: 'force' },
|
||||
]"
|
||||
>
|
||||
<template #label><SearchLabel>{{ i18n.ts.displayOfSensitiveMedia }}</SearchLabel></template>
|
||||
<option value="respect">{{ i18n.ts._displayOfSensitiveMedia.respect }}</option>
|
||||
<option value="ignore">{{ i18n.ts._displayOfSensitiveMedia.ignore }}</option>
|
||||
<option value="force">{{ i18n.ts._displayOfSensitiveMedia.force }}</option>
|
||||
</MkSelect>
|
||||
</MkPreferenceContainer>
|
||||
</SearchMarker>
|
||||
@@ -339,11 +347,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
<div class="_gaps_m">
|
||||
<MkPreferenceContainer k="defaultNoteVisibility">
|
||||
<MkSelect v-model="defaultNoteVisibility">
|
||||
<option value="public">{{ i18n.ts._visibility.public }}</option>
|
||||
<option value="home">{{ i18n.ts._visibility.home }}</option>
|
||||
<option value="followers">{{ i18n.ts._visibility.followers }}</option>
|
||||
<option value="specified">{{ i18n.ts._visibility.specified }}</option>
|
||||
<MkSelect
|
||||
v-model="defaultNoteVisibility"
|
||||
:items="[
|
||||
{ label: i18n.ts._visibility.public, value: 'public' },
|
||||
{ label: i18n.ts._visibility.home, value: 'home' },
|
||||
{ label: i18n.ts._visibility.followers, value: 'followers' },
|
||||
{ label: i18n.ts._visibility.specified, value: 'specified' },
|
||||
]"
|
||||
>
|
||||
</MkSelect>
|
||||
</MkPreferenceContainer>
|
||||
|
||||
@@ -528,22 +540,30 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
<SearchMarker :keywords="['menu', 'style', 'popup', 'drawer']">
|
||||
<MkPreferenceContainer k="menuStyle">
|
||||
<MkSelect v-model="menuStyle">
|
||||
<MkSelect
|
||||
v-model="menuStyle"
|
||||
:items="[
|
||||
{ label: i18n.ts.auto, value: 'auto' },
|
||||
{ label: i18n.ts.popup, value: 'popup' },
|
||||
{ label: i18n.ts.drawer, value: 'drawer' },
|
||||
]"
|
||||
>
|
||||
<template #label><SearchLabel>{{ i18n.ts.menuStyle }}</SearchLabel></template>
|
||||
<option value="auto">{{ i18n.ts.auto }}</option>
|
||||
<option value="popup">{{ i18n.ts.popup }}</option>
|
||||
<option value="drawer">{{ i18n.ts.drawer }}</option>
|
||||
</MkSelect>
|
||||
</MkPreferenceContainer>
|
||||
</SearchMarker>
|
||||
|
||||
<SearchMarker :keywords="['contextmenu', 'system', 'native']">
|
||||
<MkPreferenceContainer k="contextMenu">
|
||||
<MkSelect v-model="contextMenu">
|
||||
<MkSelect
|
||||
v-model="contextMenu"
|
||||
:items="[
|
||||
{ label: i18n.ts._contextMenu.app, value: 'app' },
|
||||
{ label: i18n.ts._contextMenu.appWithShift, value: 'appWithShift' },
|
||||
{ label: i18n.ts._contextMenu.native, value: 'native' },
|
||||
]"
|
||||
>
|
||||
<template #label><SearchLabel>{{ i18n.ts._contextMenu.title }}</SearchLabel></template>
|
||||
<option value="app">{{ i18n.ts._contextMenu.app }}</option>
|
||||
<option value="appWithShift">{{ i18n.ts._contextMenu.appWithShift }}</option>
|
||||
<option value="native">{{ i18n.ts._contextMenu.native }}</option>
|
||||
</MkSelect>
|
||||
</MkPreferenceContainer>
|
||||
</SearchMarker>
|
||||
@@ -719,11 +739,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
<SearchMarker :keywords="['server', 'disconnect', 'reconnect', 'reload', 'streaming']">
|
||||
<MkPreferenceContainer k="serverDisconnectedBehavior">
|
||||
<MkSelect v-model="serverDisconnectedBehavior">
|
||||
<MkSelect
|
||||
v-model="serverDisconnectedBehavior"
|
||||
:items="[
|
||||
{ label: i18n.ts._serverDisconnectedBehavior.reload, value: 'reload' },
|
||||
{ label: i18n.ts._serverDisconnectedBehavior.dialog, value: 'dialog' },
|
||||
{ label: i18n.ts._serverDisconnectedBehavior.quiet, value: 'quiet' },
|
||||
]"
|
||||
>
|
||||
<template #label><SearchLabel>{{ i18n.ts.whenServerDisconnected }}</SearchLabel></template>
|
||||
<option value="reload">{{ i18n.ts._serverDisconnectedBehavior.reload }}</option>
|
||||
<option value="dialog">{{ i18n.ts._serverDisconnectedBehavior.dialog }}</option>
|
||||
<option value="quiet">{{ i18n.ts._serverDisconnectedBehavior.quiet }}</option>
|
||||
</MkSelect>
|
||||
</MkPreferenceContainer>
|
||||
</SearchMarker>
|
||||
@@ -984,16 +1008,15 @@ function removeEmojiIndex(lang: string) {
|
||||
|
||||
async function setPinnedList() {
|
||||
const lists = await misskeyApi('users/lists/list');
|
||||
const { canceled, result: list } = await os.select({
|
||||
const { canceled, result: listId } = await os.select({
|
||||
title: i18n.ts.selectList,
|
||||
items: lists.map(x => ({
|
||||
value: x, text: x.name,
|
||||
value: x.id, label: x.name,
|
||||
})),
|
||||
});
|
||||
if (canceled) return;
|
||||
if (list == null) return;
|
||||
if (canceled || listId == null) return;
|
||||
|
||||
prefer.commit('pinnedUserLists', [list]);
|
||||
prefer.commit('pinnedUserLists', [lists.find((x) => x.id === listId)!]);
|
||||
}
|
||||
|
||||
function removePinnedList() {
|
||||
|
||||
Reference in New Issue
Block a user