From 7be09a4af9f57981298cb20c32a69755241dc227 Mon Sep 17 00:00:00 2001 From: tamaina Date: Tue, 18 Jan 2022 23:06:16 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20Composition=20API=E3=81=B8=E7=A7=BB?= =?UTF-8?q?=E8=A1=8C=20(#8138)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * components/drive-file-thumbnail.vue * components/drive-select-dialog.vue * components/drive-window.vue * wip * wip drive.file.vue, drive.vue * fix prop * wip( * components/drive.folder.vue * maybe ok * :v: * fix variable * FIX FOLDER VARIABLE * components/emoji-picker-dialog.vue * Hate `$emit` * hate global property * components/emoji-picker-window.vue * components/emoji-picker.section.vue * fix * fixx * wip components/emoji-picker.vue * fix * defineExpose * ユニコード絵文字の型をもっといい感じに * components/featured-photos.vue * components/follow-button.vue * forgot-password.vue * forgot-password.vue * :art: * fix --- packages/client/src/components/dialog.vue | 7 +- .../src/components/drive-file-thumbnail.vue | 95 +- .../src/components/drive-select-dialog.vue | 81 +- .../client/src/components/drive-window.vue | 39 +- packages/client/src/components/drive.file.vue | 320 +++-- .../client/src/components/drive.folder.vue | 448 +++---- .../src/components/drive.nav-folder.vue | 187 ++- packages/client/src/components/drive.vue | 1176 ++++++++--------- .../src/components/emoji-picker-dialog.vue | 101 +- .../src/components/emoji-picker-window.vue | 53 +- .../src/components/emoji-picker.section.vue | 38 +- .../client/src/components/emoji-picker.vue | 531 ++++---- .../client/src/components/featured-photos.vue | 22 +- .../client/src/components/follow-button.vue | 183 ++- .../client/src/components/forgot-password.vue | 76 +- packages/client/src/os.ts | 2 +- packages/client/src/scripts/emojilist.ts | 12 +- 17 files changed, 1608 insertions(+), 1763 deletions(-) diff --git a/packages/client/src/components/dialog.vue b/packages/client/src/components/dialog.vue index 9cd523468..b6b649cde 100644 --- a/packages/client/src/components/dialog.vue +++ b/packages/client/src/components/dialog.vue @@ -1,5 +1,5 @@
- {{ (showCancelButton || input || select) ? $ts.ok : $ts.gotIt }} - {{ $ts.cancel }} + {{ (showCancelButton || input || select) ? i18n.locale.ok : i18n.locale.gotIt }} + {{ i18n.locale.cancel }}
{{ action.text }} @@ -44,6 +44,7 @@ import MkModal from '@/components/ui/modal.vue'; import MkButton from '@/components/ui/button.vue'; import MkInput from '@/components/form/input.vue'; import MkSelect from '@/components/form/select.vue'; +import { i18n } from '@/i18n'; type Input = { type: HTMLInputElement['type']; diff --git a/packages/client/src/components/drive-file-thumbnail.vue b/packages/client/src/components/drive-file-thumbnail.vue index e94b6b8bc..81b80e7e8 100644 --- a/packages/client/src/components/drive-file-thumbnail.vue +++ b/packages/client/src/components/drive-file-thumbnail.vue @@ -14,71 +14,42 @@
- diff --git a/packages/client/src/components/drive-select-dialog.vue b/packages/client/src/components/drive-select-dialog.vue index 75537dfe3..6d8451127 100644 --- a/packages/client/src/components/drive-select-dialog.vue +++ b/packages/client/src/components/drive-select-dialog.vue @@ -7,64 +7,51 @@ @click="cancel()" @close="cancel()" @ok="ok()" - @closed="$emit('closed')" + @closed="emit('closed')" > - diff --git a/packages/client/src/components/drive-window.vue b/packages/client/src/components/drive-window.vue index 43f07ebe7..8b60bf779 100644 --- a/packages/client/src/components/drive-window.vue +++ b/packages/client/src/components/drive-window.vue @@ -3,42 +3,27 @@ :initial-width="800" :initial-height="500" :can-resize="true" - @closed="$emit('closed')" + @closed="emit('closed')" > - diff --git a/packages/client/src/components/drive.file.vue b/packages/client/src/components/drive.file.vue index 511647229..fd6a81383 100644 --- a/packages/client/src/components/drive.file.vue +++ b/packages/client/src/components/drive.file.vue @@ -8,17 +8,17 @@ @dragstart="onDragstart" @dragend="onDragend" > -
+
-

{{ $ts.avatar }}

+

{{ i18n.locale.avatar }}

-
+
-

{{ $ts.banner }}

+

{{ i18n.locale.banner }}

-

{{ $ts.nsfw }}

+

{{ i18n.locale.nsfw }}

@@ -30,179 +30,155 @@
- diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index dd7fdea4b..378523e1b 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -541,7 +541,7 @@ export const uploads = ref<{ img: string; }[]>([]); -export function upload(file: File, folder?: any, name?: string) { +export function upload(file: File, folder?: any, name?: string): Promise { if (folder && typeof folder == 'object') folder = folder.id; return new Promise((resolve, reject) => { diff --git a/packages/client/src/scripts/emojilist.ts b/packages/client/src/scripts/emojilist.ts index de7591f5a..bd8689e4f 100644 --- a/packages/client/src/scripts/emojilist.ts +++ b/packages/client/src/scripts/emojilist.ts @@ -1,7 +1,11 @@ -// initial converted from https://github.com/muan/emojilib/commit/242fe68be86ed6536843b83f7e32f376468b38fb -export const emojilist = require('../emojilist.json') as { +export const unicodeEmojiCategories = ['face', 'people', 'animals_and_nature', 'food_and_drink', 'activity', 'travel_and_places', 'objects', 'symbols', 'flags'] as const; + +export type UnicodeEmojiDef = { name: string; keywords: string[]; char: string; - category: 'people' | 'animals_and_nature' | 'food_and_drink' | 'activity' | 'travel_and_places' | 'objects' | 'symbols' | 'flags'; -}[]; + category: typeof unicodeEmojiCategories[number]; +} + +// initial converted from https://github.com/muan/emojilib/commit/242fe68be86ed6536843b83f7e32f376468b38fb +export const emojilist = require('../emojilist.json') as UnicodeEmojiDef[];