diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-06-06 09:02:47 +0900 |
|---|---|---|
| committer | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-06-06 09:02:47 +0900 |
| commit | 20b8148ddf3256c9fc3d5d4e8b9216212cc56b41 (patch) | |
| tree | 23e36f5314a85396a070ffe025f8d82774a1fecf /packages | |
| parent | Bump version to 2025.6.1-alpha.2 (diff) | |
| download | misskey-20b8148ddf3256c9fc3d5d4e8b9216212cc56b41.tar.gz misskey-20b8148ddf3256c9fc3d5d4e8b9216212cc56b41.tar.bz2 misskey-20b8148ddf3256c9fc3d5d4e8b9216212cc56b41.zip | |
chore(frontend): tweak ui
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/frontend/src/components/MkUploaderDialog.vue | 19 | ||||
| -rw-r--r-- | packages/frontend/src/types/menu.ts | 18 |
2 files changed, 27 insertions, 10 deletions
diff --git a/packages/frontend/src/components/MkUploaderDialog.vue b/packages/frontend/src/components/MkUploaderDialog.vue index 4c4bc26bfd..6a0909bded 100644 --- a/packages/frontend/src/components/MkUploaderDialog.vue +++ b/packages/frontend/src/components/MkUploaderDialog.vue @@ -90,10 +90,10 @@ export type UploaderDialogFeatures = { <script lang="ts" setup> import { computed, markRaw, onMounted, onUnmounted, ref, triggerRef, useTemplateRef, watch } from 'vue'; import * as Misskey from 'misskey-js'; -import { genId } from '@/utility/id.js'; import { readAndCompressImage } from '@misskey-dev/browser-image-resizer'; import isAnimated from 'is-file-animated'; import type { MenuItem } from '@/types/menu.js'; +import { genId } from '@/utility/id.js'; import MkModalWindow from '@/components/MkModalWindow.vue'; import { i18n } from '@/i18n.js'; import { prefer } from '@/preferences.js'; @@ -365,6 +365,7 @@ function showMenu(ev: MouseEvent, item: UploaderItem) { menu.push({ icon: 'ti ti-copyright', text: i18n.ts.watermark, + caption: computed(() => item.watermarkPresetId == null ? null : prefer.s.watermarkPresets.find(p => p.id === item.watermarkPresetId)?.name), type: 'parent', children: [{ type: 'radioOption', @@ -409,7 +410,21 @@ function showMenu(ev: MouseEvent, item: UploaderItem) { menu.push({ icon: 'ti ti-leaf', - text: i18n.ts.compress, + text: computed(() => { + let text = i18n.ts.compress; + + if (item.compressionLevel === 0 || item.compressionLevel == null) { + text += `: ${i18n.ts.none}`; + } else if (item.compressionLevel === 1) { + text += `: ${i18n.ts.low}`; + } else if (item.compressionLevel === 2) { + text += `: ${i18n.ts.medium}`; + } else if (item.compressionLevel === 3) { + text += `: ${i18n.ts.high}`; + } + + return text; + }), type: 'parent', children: [{ type: 'radioOption', diff --git a/packages/frontend/src/types/menu.ts b/packages/frontend/src/types/menu.ts index 820759ce61..fae7370341 100644 --- a/packages/frontend/src/types/menu.ts +++ b/packages/frontend/src/types/menu.ts @@ -11,20 +11,22 @@ type ComponentProps<T extends Component> = { [K in keyof CP<T>]: CP<T>[K] | Ref< type MenuRadioOptionsDef = Record<string, any>; +type Text = string | ComputedRef<string>; + export type MenuAction = (ev: MouseEvent) => void; export type MenuDivider = { type: 'divider' }; export type MenuNull = undefined; -export type MenuLabel = { type: 'label', text: string, caption?: string }; -export type MenuLink = { type: 'link', to: string, text: string, caption?: string, icon?: string, indicate?: boolean, avatar?: Misskey.entities.User }; -export type MenuA = { type: 'a', href: string, target?: string, download?: string, text: string, caption?: string, icon?: string, indicate?: boolean }; +export type MenuLabel = { type: 'label', text: Text, caption?: Text }; +export type MenuLink = { type: 'link', to: string, text: Text, caption?: Text, icon?: string, indicate?: boolean, avatar?: Misskey.entities.User }; +export type MenuA = { type: 'a', href: string, target?: string, download?: string, text: Text, caption?: Text, icon?: string, indicate?: boolean }; export type MenuUser = { type: 'user', user: Misskey.entities.User, active?: boolean, indicate?: boolean, action: MenuAction }; -export type MenuSwitch = { type: 'switch', ref: Ref<boolean>, text: string, caption?: string, icon?: string, disabled?: boolean | Ref<boolean> }; -export type MenuButton = { type?: 'button', text: string, caption?: string, icon?: string, indicate?: boolean, danger?: boolean, active?: boolean | ComputedRef<boolean>, avatar?: Misskey.entities.User; action: MenuAction }; -export type MenuRadio = { type: 'radio', text: string, caption?: string, icon?: string, ref: Ref<MenuRadioOptionsDef[keyof MenuRadioOptionsDef]>, options: MenuRadioOptionsDef, disabled?: boolean | Ref<boolean> }; -export type MenuRadioOption = { type: 'radioOption', text: string, caption?: string, action: MenuAction; active?: boolean | ComputedRef<boolean> }; +export type MenuSwitch = { type: 'switch', ref: Ref<boolean>, text: Text, caption?: Text, icon?: string, disabled?: boolean | Ref<boolean> }; +export type MenuButton = { type?: 'button', text: Text, caption?: Text, icon?: string, indicate?: boolean, danger?: boolean, active?: boolean | ComputedRef<boolean>, avatar?: Misskey.entities.User; action: MenuAction }; +export type MenuRadio = { type: 'radio', text: Text, caption?: Text, icon?: string, ref: Ref<MenuRadioOptionsDef[keyof MenuRadioOptionsDef]>, options: MenuRadioOptionsDef, disabled?: boolean | Ref<boolean> }; +export type MenuRadioOption = { type: 'radioOption', text: Text, caption?: Text, action: MenuAction; active?: boolean | ComputedRef<boolean> }; export type MenuComponent<T extends Component = any> = { type: 'component', component: T, props?: ComponentProps<T> }; -export type MenuParent = { type: 'parent', text: string, caption?: string, icon?: string, children: MenuItem[] | (() => Promise<MenuItem[]> | MenuItem[]) }; +export type MenuParent = { type: 'parent', text: Text, caption?: Text, icon?: string, children: MenuItem[] | (() => Promise<MenuItem[]> | MenuItem[]) }; export type MenuPending = { type: 'pending' }; |