summaryrefslogtreecommitdiff
path: root/packages/frontend/src/pages/settings/statusbar.statusbar.vue
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2025-09-13 21:00:33 +0900
committerGitHub <noreply@github.com>2025-09-13 21:00:33 +0900
commitd4654dd7bd5bf1c7faa74ed89f592448c0076be8 (patch)
treeb4f51e86f174717fef469fbedca48faa2a55e841 /packages/frontend/src/pages/settings/statusbar.statusbar.vue
parentfix(deps): update dependency vite [security] (#16535) (diff)
downloadmisskey-d4654dd7bd5bf1c7faa74ed89f592448c0076be8.tar.gz
misskey-d4654dd7bd5bf1c7faa74ed89f592448c0076be8.tar.bz2
misskey-d4654dd7bd5bf1c7faa74ed89f592448c0076be8.zip
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>
Diffstat (limited to 'packages/frontend/src/pages/settings/statusbar.statusbar.vue')
-rw-r--r--packages/frontend/src/pages/settings/statusbar.statusbar.vue31
1 files changed, 23 insertions, 8 deletions
diff --git a/packages/frontend/src/pages/settings/statusbar.statusbar.vue b/packages/frontend/src/pages/settings/statusbar.statusbar.vue
index 561d31148f..b69fd2596d 100644
--- a/packages/frontend/src/pages/settings/statusbar.statusbar.vue
+++ b/packages/frontend/src/pages/settings/statusbar.statusbar.vue
@@ -5,11 +5,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<div class="_gaps_m">
- <MkSelect v-model="statusbar.type" placeholder="Please select">
+ <MkSelect v-model="statusbar.type" :items="statusbarTypeDef">
<template #label>{{ i18n.ts.type }}</template>
- <option value="rss">RSS</option>
- <option v-if="instance.federation !== 'none'" value="federation">Federation</option>
- <option value="userList">User list timeline</option>
</MkSelect>
<MkInput v-model="statusbar.name" manualSave>
@@ -63,9 +60,8 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkSwitch>
</template>
<template v-else-if="statusbar.type === 'userList' && userLists != null">
- <MkSelect v-model="statusbar.props.userListId">
+ <MkSelect v-model="statusbar.props.userListId" :items="userListsDef">
<template #label>{{ i18n.ts.userList }}</template>
- <option v-for="list in userLists" :value="list.id">{{ list.name }}</option>
</MkSelect>
<MkInput v-model="statusbar.props.refreshIntervalSec" manualSave type="number">
<template #label>{{ i18n.ts.refreshInterval }}</template>
@@ -86,7 +82,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
-import { reactive, watch } from 'vue';
+import { reactive, computed, watch } from 'vue';
import * as Misskey from 'misskey-js';
import MkSelect from '@/components/MkSelect.vue';
import MkInput from '@/components/MkInput.vue';
@@ -98,13 +94,32 @@ import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';
import { deepClone } from '@/utility/clone.js';
import { prefer } from '@/preferences.js';
+import type { MkSelectItem } from '@/components/MkSelect.vue';
+import type { StatusbarStore } from '@/preferences/def.js';
const props = defineProps<{
_id: string;
userLists: Misskey.entities.UserList[] | null;
}>();
-const statusbar = reactive(deepClone(prefer.s.statusbars.find(x => x.id === props._id))!);
+const statusbar = reactive<StatusbarStore>(deepClone(prefer.s.statusbars.find(x => x.id === props._id)!));
+
+const statusbarTypeDef = computed(() => {
+ const items = [
+ { label: 'RSS', value: 'rss' },
+ ] satisfies MkSelectItem[];
+ if (instance.federation !== 'none') {
+ items.push({ label: 'Federation', value: 'federation' });
+ }
+ if (props.userLists != null) {
+ items.push({ label: i18n.ts.userList, value: 'userList' });
+ }
+ return items;
+});
+
+const userListsDef = computed(() => {
+ return (props.userLists ?? []).map(x => ({ label: x.name, value: x.id })) satisfies MkSelectItem[];
+});
watch(() => statusbar.type, () => {
if (statusbar.type === 'rss') {