summaryrefslogtreecommitdiff
path: root/packages/frontend/src/pages/timeline.vue
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2024-09-23 21:50:30 +0900
committerGitHub <noreply@github.com>2024-09-23 21:50:30 +0900
commit0c6d1ec5245708f784fe5c74e7547f3f7317d5df (patch)
tree02c81d75e5bb70ff57a714ea6938a326735e2719 /packages/frontend/src/pages/timeline.vue
parentfix(backend): happy-domを使用後にcloseするように (#14615) (diff)
downloadmisskey-0c6d1ec5245708f784fe5c74e7547f3f7317d5df.tar.gz
misskey-0c6d1ec5245708f784fe5c74e7547f3f7317d5df.tar.bz2
misskey-0c6d1ec5245708f784fe5c74e7547f3f7317d5df.zip
refactor(frontend): popupMenuの項目作成時に三項演算子をなるべく使わないように (#14554)
* refactor(frontend): popupMenuの項目作成時に三項演算子をなるべく使わないように * type import * fix * lint
Diffstat (limited to 'packages/frontend/src/pages/timeline.vue')
-rw-r--r--packages/frontend/src/pages/timeline.vue30
1 files changed, 20 insertions, 10 deletions
diff --git a/packages/frontend/src/pages/timeline.vue b/packages/frontend/src/pages/timeline.vue
index cc1ed3d01f..12e2db2293 100644
--- a/packages/frontend/src/pages/timeline.vue
+++ b/packages/frontend/src/pages/timeline.vue
@@ -50,7 +50,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
import { antennasCache, userListsCache, favoritedChannelsCache } from '@/cache.js';
import { deviceKind } from '@/scripts/device-kind.js';
import { deepMerge } from '@/scripts/merge.js';
-import { MenuItem } from '@/types/menu.js';
+import type { MenuItem } from '@/types/menu.js';
import { miLocalStorage } from '@/local-storage.js';
import { availableBasicTimelines, hasWithReplies, isAvailableBasicTimeline, isBasicTimeline, basicTimelineIconClass } from '@/timelines.js';
import type { BasicTimelineType } from '@/timelines.js';
@@ -189,7 +189,7 @@ async function chooseChannel(ev: MouseEvent): Promise<void> {
}),
(channels.length === 0 ? undefined : { type: 'divider' }),
{
- type: 'link' as const,
+ type: 'link',
icon: 'ti ti-plus',
text: i18n.ts.createNew,
to: '/channels',
@@ -258,16 +258,24 @@ const headerActions = computed(() => {
icon: 'ti ti-dots',
text: i18n.ts.options,
handler: (ev) => {
- os.popupMenu([{
+ const menuItems: MenuItem[] = [];
+
+ menuItems.push({
type: 'switch',
text: i18n.ts.showRenotes,
ref: withRenotes,
- }, isBasicTimeline(src.value) && hasWithReplies(src.value) ? {
- type: 'switch',
- text: i18n.ts.showRepliesToOthersInTimeline,
- ref: withReplies,
- disabled: onlyFiles,
- } : undefined, {
+ });
+
+ if (isBasicTimeline(src.value) && hasWithReplies(src.value)) {
+ menuItems.push({
+ type: 'switch',
+ text: i18n.ts.showRepliesToOthersInTimeline,
+ ref: withReplies,
+ disabled: onlyFiles,
+ });
+ }
+
+ menuItems.push({
type: 'switch',
text: i18n.ts.withSensitive,
ref: withSensitive,
@@ -276,7 +284,9 @@ const headerActions = computed(() => {
text: i18n.ts.fileAttachedOnly,
ref: onlyFiles,
disabled: isBasicTimeline(src.value) && hasWithReplies(src.value) ? withReplies : false,
- }], ev.currentTarget ?? ev.target);
+ });
+
+ os.popupMenu(menuItems, ev.currentTarget ?? ev.target);
},
},
];