From 098d960f100d0d305fbf8da1adb062f50f5a246c Mon Sep 17 00:00:00 2001 From: fuyu <54523771+mfmfuyu@users.noreply.github.com> Date: Sat, 25 Jul 2020 23:20:14 +0900 Subject: [PATCH] =?UTF-8?q?vue3:=20filter=E3=81=AE=E7=A7=BB=E8=A1=8C=20(#6?= =?UTF-8?q?590)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * bytes * notePage * number * acct, userName, userPage * Move methods property * fix * Delete unnecessary file --- src/client/components/autocomplete.vue | 7 +++-- src/client/components/avatar.vue | 11 +++++--- src/client/components/drive-window.vue | 9 ++++--- src/client/components/drive.file.vue | 7 +++-- src/client/components/instance-stats.vue | 27 ++++++++++--------- src/client/components/note-header.vue | 9 ++++++- src/client/components/note.vue | 7 +++-- src/client/components/notification.vue | 18 ++++++++----- src/client/components/page-preview.vue | 6 ++++- src/client/components/user-list.vue | 9 +++++-- src/client/components/user-preview.vue | 6 +++-- src/client/components/users-dialog.vue | 4 ++- src/client/filters/bytes.ts | 6 ++--- src/client/filters/note.ts | 6 ++--- src/client/filters/number.ts | 4 +-- src/client/filters/user.ts | 15 +++++------ src/client/pages/explore.vue | 3 ++- src/client/pages/follow-requests.vue | 9 ++++--- .../pages/instance/federation.instance.vue | 22 +++++++++------ src/client/pages/instance/index.vue | 19 +++++++------ src/client/pages/instance/queue.queue.vue | 13 +++++---- src/client/pages/instance/users.user.vue | 7 +++-- src/client/pages/instance/users.vue | 9 ++++--- src/client/pages/messaging/index.vue | 7 +++-- src/client/pages/my-settings/mute-block.vue | 9 +++++-- src/client/pages/user/follow-list.vue | 11 ++++++-- src/client/pages/user/index.photos.vue | 4 ++- src/client/pages/user/index.vue | 22 +++++++++------ 28 files changed, 183 insertions(+), 103 deletions(-) diff --git a/src/client/components/autocomplete.vue b/src/client/components/autocomplete.vue index 14a0f15779..f4f3909795 100644 --- a/src/client/components/autocomplete.vue +++ b/src/client/components/autocomplete.vue @@ -6,7 +6,7 @@ - @{{ user | acct }} + @{{ acct(user) }}
  • {{ $t('selectUser') }}
  • @@ -34,6 +34,7 @@ import contains from '../scripts/contains'; import { twemojiSvgBase } from '../../misc/twemoji-base'; import { getStaticImageUrl } from '../scripts/get-static-image-url'; import MkUserSelect from './user-select.vue'; +import { acct } from '../filters/user'; type EmojiDef = { emoji: string; @@ -381,7 +382,9 @@ export default defineComponent({ vm.$once('closed', () => { this.textarea.focus(); }); - } + }, + + acct } }); diff --git a/src/client/components/avatar.vue b/src/client/components/avatar.vue index 3a2cc35e38..004231c163 100644 --- a/src/client/components/avatar.vue +++ b/src/client/components/avatar.vue @@ -1,8 +1,8 @@ @@ -10,6 +10,7 @@ @@ -95,7 +98,7 @@ export default defineComponent({ transform: rotate(-37.5deg) skew(-30deg); } } - + .inner { position: absolute; bottom: 0; diff --git a/src/client/components/drive-window.vue b/src/client/components/drive-window.vue index c9dbb42968..7f976c22d5 100644 --- a/src/client/components/drive-window.vue +++ b/src/client/components/drive-window.vue @@ -2,7 +2,7 @@
    @@ -14,6 +14,7 @@ import { defineComponent } from 'vue'; import XDrive from './drive.vue'; import XWindow from './window.vue'; +import number from '../filters/number'; export default defineComponent({ components: { @@ -25,7 +26,7 @@ export default defineComponent({ type: { type: String, required: false, - default: 'file' + default: 'file' }, multiple: { type: Boolean, @@ -47,7 +48,9 @@ export default defineComponent({ onChangeSelection(xs) { this.selected = xs; - } + }, + + number } }); diff --git a/src/client/components/drive.file.vue b/src/client/components/drive.file.vue index cf6c4869a0..571b751ef4 100644 --- a/src/client/components/drive.file.vue +++ b/src/client/components/drive.file.vue @@ -37,6 +37,7 @@ import copyToClipboard from '../scripts/copy-to-clipboard'; //import updateBanner from '../api/update-banner'; import XFileThumbnail from './drive-file-thumbnail.vue'; import { faDownload, faLink, faICursor, faTrashAlt } from '@fortawesome/free-solid-svg-icons'; +import bytes from '../filters/bytes'; export default defineComponent({ components: { @@ -72,7 +73,7 @@ export default defineComponent({ return this.$parent; }, title(): string { - return `${this.file.name}\n${this.file.type} ${Vue.filter('bytes')(this.file.size)}`; + return `${this.file.name}\n${this.file.type} ${bytes(this.file.size)}`; } }, @@ -181,7 +182,9 @@ export default defineComponent({ this.$root.api('drive/files/delete', { fileId: this.file.id }); - } + }, + + bytes } }); diff --git a/src/client/components/instance-stats.vue b/src/client/components/instance-stats.vue index 851a5bbcd1..59ea57f61b 100644 --- a/src/client/components/instance-stats.vue +++ b/src/client/components/instance-stats.vue @@ -9,15 +9,15 @@
    {{ $t('total') }}
    -
    {{ info.originalUsersCount | number }}
    +
    {{ number(info.originalUsersCount) }}
    {{ $t('dayOverDayChanges') }}
    -
    {{ usersLocalDoD | number }}
    +
    {{ number(usersLocalDoD) }}
    {{ $t('weekOverWeekChanges') }}
    -
    {{ usersLocalWoW | number }}
    +
    {{ number(usersLocalWoW) }}
    @@ -29,15 +29,15 @@
    {{ $t('total') }}
    -
    {{ (info.usersCount - info.originalUsersCount) | number }}
    +
    {{ number((info.usersCount - info.originalUsersCount)) }}
    {{ $t('dayOverDayChanges') }}
    -
    {{ usersRemoteDoD | number }}
    +
    {{ number(usersRemoteDoD) }}
    {{ $t('weekOverWeekChanges') }}
    -
    {{ usersRemoteWoW | number }}
    +
    {{ number(usersRemoteWoW) }}
    @@ -49,15 +49,15 @@
    {{ $t('total') }}
    -
    {{ info.originalNotesCount | number }}
    +
    {{ number(info.originalNotesCount) }}
    {{ $t('dayOverDayChanges') }}
    -
    {{ notesLocalDoD | number }}
    +
    {{ number(notesLocalDoD) }}
    {{ $t('weekOverWeekChanges') }}
    -
    {{ notesLocalWoW | number }}
    +
    {{ number(notesLocalWoW) }}
    @@ -69,15 +69,15 @@
    {{ $t('total') }}
    -
    {{ (info.notesCount - info.originalNotesCount) | number }}
    +
    {{ number((info.notesCount - info.originalNotesCount)) }}
    {{ $t('dayOverDayChanges') }}
    -
    {{ notesRemoteDoD | number }}
    +
    {{ number(notesRemoteDoD) }}
    {{ $t('weekOverWeekChanges') }}
    -
    {{ notesRemoteWoW | number }}
    +
    {{ number(notesRemoteWoW) }}
    @@ -126,6 +126,7 @@ import { defineComponent } from 'vue'; import { faChartBar, faUser, faPencilAlt } from '@fortawesome/free-solid-svg-icons'; import Chart from 'chart.js'; import MkSelect from './ui/select.vue'; +import number from '../filters/number'; const chartLimit = 90; const sum = (...arr) => arr.reduce((r, a) => r.map((b, i) => a[i] + b)); @@ -580,6 +581,8 @@ export default defineComponent({ }] }; }, + + number } }); diff --git a/src/client/components/note-header.vue b/src/client/components/note-header.vue index 2cf06f2cd0..978f670fea 100644 --- a/src/client/components/note-header.vue +++ b/src/client/components/note-header.vue @@ -1,6 +1,6 @@