refactor(frontend): popupMenuの項目作成時に三項演算子をなるべく使わないように (#14554)
* refactor(frontend): popupMenuの項目作成時に三項演算子をなるべく使わないように * type import * fix * lint
This commit is contained in:
		| @@ -80,7 +80,7 @@ import { defaultStore } from '@/store.js'; | ||||
| import { $i } from '@/account.js'; | ||||
| import { isSupportShare } from '@/scripts/navigator.js'; | ||||
| import { copyToClipboard } from '@/scripts/copy-to-clipboard.js'; | ||||
| import { MenuItem } from '@/types/menu'; | ||||
| import type { MenuItem } from '@/types/menu.js'; | ||||
| import { pleaseLogin } from '@/scripts/please-login.js'; | ||||
|  | ||||
| const props = defineProps<{ | ||||
| @@ -104,18 +104,23 @@ function fetchFlash() { | ||||
| function share(ev: MouseEvent) { | ||||
| 	if (!flash.value) return; | ||||
|  | ||||
| 	os.popupMenu([ | ||||
| 		{ | ||||
| 			text: i18n.ts.shareWithNote, | ||||
| 			icon: 'ti ti-pencil', | ||||
| 			action: shareWithNote, | ||||
| 		}, | ||||
| 		...(isSupportShare() ? [{ | ||||
| 	const menuItems: MenuItem[] = []; | ||||
|  | ||||
| 	menuItems.push({ | ||||
| 		text: i18n.ts.shareWithNote, | ||||
| 		icon: 'ti ti-pencil', | ||||
| 		action: shareWithNote, | ||||
| 	}); | ||||
|  | ||||
| 	if (isSupportShare()) { | ||||
| 		menuItems.push({ | ||||
| 			text: i18n.ts.share, | ||||
| 			icon: 'ti ti-share', | ||||
| 			action: shareWithNavigator, | ||||
| 		}] : []), | ||||
| 	], ev.currentTarget ?? ev.target); | ||||
| 		}); | ||||
| 	} | ||||
|  | ||||
| 	os.popupMenu(menuItems, ev.currentTarget ?? ev.target); | ||||
| } | ||||
|  | ||||
| function copyLink() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 かっこかり
					かっこかり