From 65858dab3e2656f44b0be668c994781cfb4b419d Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 8 Aug 2021 12:19:10 +0900 Subject: [PATCH] Improve client --- src/client/components/drive.file.vue | 2 +- src/client/components/drive.vue | 2 +- src/client/components/emoji-picker-dialog.vue | 14 +- src/client/components/note-detailed.vue | 8 +- src/client/components/note.vue | 8 +- src/client/components/post-form-attaches.vue | 2 +- src/client/components/post-form.vue | 2 +- src/client/components/sample.vue | 2 +- src/client/components/ui/button.vue | 2 +- src/client/components/ui/input.vue | 6 +- .../ui/{modal-menu.vue => popup-menu.vue} | 29 +-- src/client/components/ui/popup.vue | 208 ++++++++++++++++++ src/client/components/ui/select.vue | 6 +- src/client/components/ui/textarea.vue | 6 +- src/client/menu.ts | 2 +- src/client/os.ts | 4 +- src/client/pages/advanced-theme-editor.vue | 2 +- src/client/pages/clip.vue | 2 +- src/client/pages/emojis.vue | 2 +- src/client/pages/instance/emojis.vue | 2 +- src/client/pages/instance/index.vue | 2 +- src/client/pages/messaging/index.vue | 2 +- src/client/pages/messaging/messaging-room.vue | 2 +- src/client/pages/settings/accounts.vue | 4 +- src/client/pages/settings/reaction.vue | 2 +- src/client/pages/timeline.vue | 6 +- src/client/pages/user/index.vue | 2 +- src/client/pages/welcome.entrance.a.vue | 2 +- src/client/pages/welcome.entrance.b.vue | 2 +- src/client/pages/welcome.entrance.c.vue | 2 +- src/client/scripts/select-file.ts | 2 +- src/client/ui/_common_/header.vue | 4 +- src/client/ui/_common_/sidebar.vue | 4 +- src/client/ui/chat/note.vue | 8 +- src/client/ui/chat/pages/channel.vue | 2 +- src/client/ui/chat/post-form.vue | 2 +- src/client/ui/default.header.vue | 4 +- src/client/ui/default.sidebar.vue | 4 +- src/client/widgets/timeline.vue | 2 +- 39 files changed, 286 insertions(+), 83 deletions(-) rename src/client/components/ui/{modal-menu.vue => popup-menu.vue} (51%) create mode 100644 src/client/components/ui/popup.vue diff --git a/src/client/components/drive.file.vue b/src/client/components/drive.file.vue index 3d20de23e..b1be3d0ca 100644 --- a/src/client/components/drive.file.vue +++ b/src/client/components/drive.file.vue @@ -114,7 +114,7 @@ export default defineComponent({ if (this.selectMode) { this.$emit('chosen', this.file); } else { - os.modalMenu(this.getMenu(), ev.currentTarget || ev.target); + os.popupMenu(this.getMenu(), ev.currentTarget || ev.target); } }, diff --git a/src/client/components/drive.vue b/src/client/components/drive.vue index 98f7b5482..5dadf9a11 100644 --- a/src/client/components/drive.vue +++ b/src/client/components/drive.vue @@ -629,7 +629,7 @@ export default defineComponent({ }, showMenu(ev) { - os.modalMenu(this.getMenu(), ev.currentTarget || ev.target); + os.popupMenu(this.getMenu(), ev.currentTarget || ev.target); }, onContextmenu(ev) { diff --git a/src/client/components/emoji-picker-dialog.vue b/src/client/components/emoji-picker-dialog.vue index 9400819a1..5860acaa4 100644 --- a/src/client/components/emoji-picker-dialog.vue +++ b/src/client/components/emoji-picker-dialog.vue @@ -1,17 +1,17 @@ - - diff --git a/src/client/components/ui/popup.vue b/src/client/components/ui/popup.vue new file mode 100644 index 000000000..85df3f432 --- /dev/null +++ b/src/client/components/ui/popup.vue @@ -0,0 +1,208 @@ + + + + + diff --git a/src/client/components/ui/select.vue b/src/client/components/ui/select.vue index 987d4f194..e9d43d8a6 100644 --- a/src/client/components/ui/select.vue +++ b/src/client/components/ui/select.vue @@ -155,8 +155,7 @@ export default defineComponent({ > .label { font-size: 0.85em; - padding: 0 0 6px 6px; - font-weight: bold; + padding: 0 0 8px 12px; user-select: none; &:empty { @@ -166,7 +165,7 @@ export default defineComponent({ > .caption { font-size: 0.8em; - padding: 6px 0 0 6px; + padding: 8px 0 0 12px; color: var(--fgTransparentWeak); &:empty { @@ -197,6 +196,7 @@ export default defineComponent({ box-shadow: none; box-sizing: border-box; cursor: pointer; + transition: border-color 0.1s ease-out; &:hover { border-color: var(--inputBorderHover); diff --git a/src/client/components/ui/textarea.vue b/src/client/components/ui/textarea.vue index a61324f25..53a141f01 100644 --- a/src/client/components/ui/textarea.vue +++ b/src/client/components/ui/textarea.vue @@ -176,8 +176,7 @@ export default defineComponent({ > .label { font-size: 0.85em; - padding: 0 0 6px 6px; - font-weight: bold; + padding: 0 0 8px 12px; user-select: none; &:empty { @@ -187,7 +186,7 @@ export default defineComponent({ > .caption { font-size: 0.8em; - padding: 6px 0 0 6px; + padding: 8px 0 0 12px; color: var(--fgTransparentWeak); &:empty { @@ -218,6 +217,7 @@ export default defineComponent({ outline: none; box-shadow: none; box-sizing: border-box; + transition: border-color 0.1s ease-out; &:hover { border-color: var(--inputBorderHover); diff --git a/src/client/menu.ts b/src/client/menu.ts index 0b5341f97..8e65496cf 100644 --- a/src/client/menu.ts +++ b/src/client/menu.ts @@ -143,7 +143,7 @@ export const menuDef = { title: 'switchUi', icon: 'fas fa-columns', action: (ev) => { - os.modalMenu([{ + os.popupMenu([{ text: i18n.locale.default, action: () => { localStorage.setItem('ui', 'default'); diff --git a/src/client/os.ts b/src/client/os.ts index 987844b2d..284f982f0 100644 --- a/src/client/os.ts +++ b/src/client/os.ts @@ -368,10 +368,10 @@ export async function openEmojiPicker(src?: HTMLElement, opts, initialTextarea: }); } -export function modalMenu(items: any[], src?: HTMLElement, options?: { align?: string; viaKeyboard?: boolean }) { +export function popupMenu(items: any[], src?: HTMLElement, options?: { align?: string; viaKeyboard?: boolean }) { return new Promise((resolve, reject) => { let dispose; - popup(import('@client/components/ui/modal-menu.vue'), { + popup(import('@client/components/ui/popup-menu.vue'), { items, src, align: options?.align, diff --git a/src/client/pages/advanced-theme-editor.vue b/src/client/pages/advanced-theme-editor.vue index b40d9808c..c03d88b82 100644 --- a/src/client/pages/advanced-theme-editor.vue +++ b/src/client/pages/advanced-theme-editor.vue @@ -272,7 +272,7 @@ export default defineComponent({ showTypeMenu(e: MouseEvent) { return new Promise((resolve) => { - os.modalMenu([{ + os.popupMenu([{ text: this.$ts._theme.defaultValue, action: () => resolve(null), }, { diff --git a/src/client/pages/clip.vue b/src/client/pages/clip.vue index 877797555..e4b00d5e2 100644 --- a/src/client/pages/clip.vue +++ b/src/client/pages/clip.vue @@ -79,7 +79,7 @@ export default defineComponent({ methods: { menu(ev) { - os.modalMenu([this.isOwned ? { + os.popupMenu([this.isOwned ? { icon: 'fas fa-pencil-alt', text: this.$ts.edit, action: async () => { diff --git a/src/client/pages/emojis.vue b/src/client/pages/emojis.vue index 435727e19..391aff829 100644 --- a/src/client/pages/emojis.vue +++ b/src/client/pages/emojis.vue @@ -80,7 +80,7 @@ export default defineComponent({ methods: { menu(emoji, ev) { - os.modalMenu([{ + os.popupMenu([{ type: 'label', text: ':' + emoji.name + ':', }, { diff --git a/src/client/pages/instance/emojis.vue b/src/client/pages/instance/emojis.vue index e971ca942..7badc9da0 100644 --- a/src/client/pages/instance/emojis.vue +++ b/src/client/pages/instance/emojis.vue @@ -146,7 +146,7 @@ export default defineComponent({ }, remoteMenu(emoji, ev) { - os.modalMenu([{ + os.popupMenu([{ type: 'label', text: ':' + emoji.name + ':', }, { diff --git a/src/client/pages/instance/index.vue b/src/client/pages/instance/index.vue index 90dd29d55..612bfa762 100644 --- a/src/client/pages/instance/index.vue +++ b/src/client/pages/instance/index.vue @@ -167,7 +167,7 @@ export default defineComponent({ }; const lookup = (ev) => { - os.modalMenu([{ + os.popupMenu([{ text: i18n.locale.user, icon: 'fas fa-user', action: () => { diff --git a/src/client/pages/messaging/index.vue b/src/client/pages/messaging/index.vue index 1d4e816fb..1e0d4dc64 100644 --- a/src/client/pages/messaging/index.vue +++ b/src/client/pages/messaging/index.vue @@ -116,7 +116,7 @@ export default defineComponent({ }, start(ev) { - os.modalMenu([{ + os.popupMenu([{ text: this.$ts.messagingWithUser, icon: 'fas fa-user', action: () => { this.startUser() } diff --git a/src/client/pages/messaging/messaging-room.vue b/src/client/pages/messaging/messaging-room.vue index 24ed10591..b6a2fbd3d 100644 --- a/src/client/pages/messaging/messaging-room.vue +++ b/src/client/pages/messaging/messaging-room.vue @@ -320,7 +320,7 @@ const Component = defineComponent({ menu(ev) { const path = this.groupId ? `/my/messaging/group/${this.groupId}` : `/my/messaging/${this.userAcct}`; - os.modalMenu([this.inWindow ? undefined : { + os.popupMenu([this.inWindow ? undefined : { text: this.$ts.openInWindow, icon: 'fas fa-window-maximize', action: () => { diff --git a/src/client/pages/settings/accounts.vue b/src/client/pages/settings/accounts.vue index a3fa0d4eb..53e28bdf6 100644 --- a/src/client/pages/settings/accounts.vue +++ b/src/client/pages/settings/accounts.vue @@ -64,7 +64,7 @@ export default defineComponent({ methods: { menu(account, ev) { - os.modalMenu([{ + os.popupMenu([{ text: this.$ts.switch, icon: 'fas fa-exchange-alt', action: () => this.switchAccount(account), @@ -77,7 +77,7 @@ export default defineComponent({ }, addAccount(ev) { - os.modalMenu([{ + os.popupMenu([{ text: this.$ts.existingAccount, action: () => { this.addExistingAccount(); }, }, { diff --git a/src/client/pages/settings/reaction.vue b/src/client/pages/settings/reaction.vue index 9bffd5f90..a0024234e 100644 --- a/src/client/pages/settings/reaction.vue +++ b/src/client/pages/settings/reaction.vue @@ -94,7 +94,7 @@ export default defineComponent({ }, remove(reaction, ev) { - os.modalMenu([{ + os.popupMenu([{ text: this.$ts.remove, action: () => { this.reactions = this.reactions.filter(x => x !== reaction) diff --git a/src/client/pages/timeline.vue b/src/client/pages/timeline.vue index 55c474326..a6a0e6987 100644 --- a/src/client/pages/timeline.vue +++ b/src/client/pages/timeline.vue @@ -147,7 +147,7 @@ export default defineComponent({ this.saveSrc(); } })); - os.modalMenu(items, ev.currentTarget || ev.target); + os.popupMenu(items, ev.currentTarget || ev.target); }, async chooseAntenna(ev) { @@ -161,7 +161,7 @@ export default defineComponent({ this.saveSrc(); } })); - os.modalMenu(items, ev.currentTarget || ev.target); + os.popupMenu(items, ev.currentTarget || ev.target); }, async chooseChannel(ev) { @@ -177,7 +177,7 @@ export default defineComponent({ this.$router.push(`/channels/${channel.id}`); } })); - os.modalMenu(items, ev.currentTarget || ev.target); + os.popupMenu(items, ev.currentTarget || ev.target); }, saveSrc() { diff --git a/src/client/pages/user/index.vue b/src/client/pages/user/index.vue index dec5ec39e..9cf424b12 100644 --- a/src/client/pages/user/index.vue +++ b/src/client/pages/user/index.vue @@ -338,7 +338,7 @@ export default defineComponent({ }, menu(ev) { - os.modalMenu(getUserMenu(this.user), ev.currentTarget || ev.target); + os.popupMenu(getUserMenu(this.user), ev.currentTarget || ev.target); }, parallaxLoop() { diff --git a/src/client/pages/welcome.entrance.a.vue b/src/client/pages/welcome.entrance.a.vue index da3c69426..299271c34 100644 --- a/src/client/pages/welcome.entrance.a.vue +++ b/src/client/pages/welcome.entrance.a.vue @@ -117,7 +117,7 @@ export default defineComponent({ }, showMenu(ev) { - os.modalMenu([{ + os.popupMenu([{ text: this.$t('aboutX', { x: instanceName }), icon: 'fas fa-info-circle', action: () => { diff --git a/src/client/pages/welcome.entrance.b.vue b/src/client/pages/welcome.entrance.b.vue index d108eb7d9..a5c12f09e 100644 --- a/src/client/pages/welcome.entrance.b.vue +++ b/src/client/pages/welcome.entrance.b.vue @@ -101,7 +101,7 @@ export default defineComponent({ }, showMenu(ev) { - os.modalMenu([{ + os.popupMenu([{ text: this.$t('aboutX', { x: instanceName }), icon: 'fas fa-info-circle', action: () => { diff --git a/src/client/pages/welcome.entrance.c.vue b/src/client/pages/welcome.entrance.c.vue index 93811e98f..2c8db6e26 100644 --- a/src/client/pages/welcome.entrance.c.vue +++ b/src/client/pages/welcome.entrance.c.vue @@ -121,7 +121,7 @@ export default defineComponent({ }, showMenu(ev) { - os.modalMenu([{ + os.popupMenu([{ text: this.$t('aboutX', { x: instanceName }), icon: 'fas fa-info-circle', action: () => { diff --git a/src/client/scripts/select-file.ts b/src/client/scripts/select-file.ts index 9d7146e21..f7b971e11 100644 --- a/src/client/scripts/select-file.ts +++ b/src/client/scripts/select-file.ts @@ -69,7 +69,7 @@ export function selectFile(src: any, label: string | null, multiple = false) { }); }; - os.modalMenu([label ? { + os.popupMenu([label ? { text: label, type: 'label' } : undefined, { diff --git a/src/client/ui/_common_/header.vue b/src/client/ui/_common_/header.vue index 24b904671..67bb3abb9 100644 --- a/src/client/ui/_common_/header.vue +++ b/src/client/ui/_common_/header.vue @@ -31,7 +31,7 @@