From 7757d3e40063e8fb8bd262efdb3fcafdca581ef8 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Thu, 19 May 2022 13:28:08 +0200 Subject: [PATCH] Refactor pleaseLogin to show a sign-in dialog (#8630) * refactor(client): refactor pleaseLogin to show a sign-in dialog * Apply review suggestions from @Johann150 Co-authored-by: Johann150 Co-authored-by: Johann150 Co-authored-by: syuilo --- locales/ja-JP.yml | 2 +- .../client/src/components/signin-dialog.vue | 16 +- packages/client/src/components/signin.vue | 382 +++++++++--------- packages/client/src/scripts/please-login.ts | 19 +- 4 files changed, 215 insertions(+), 204 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index c52762bf3..f64246d15 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -425,7 +425,7 @@ quoteQuestion: "引用として添付しますか?" noMessagesYet: "まだチャットはありません" newMessageExists: "新しいメッセージがあります" onlyOneFileCanBeAttached: "メッセージに添付できるファイルはひとつです" -signinRequired: "ログインしてください" +signinRequired: "続行する前に、サインアップまたはサインインが必要です" invitations: "招待" invitationCode: "招待コード" checking: "確認しています" diff --git a/packages/client/src/components/signin-dialog.vue b/packages/client/src/components/signin-dialog.vue index 5c2048e7b..848b11fad 100644 --- a/packages/client/src/components/signin-dialog.vue +++ b/packages/client/src/components/signin-dialog.vue @@ -2,12 +2,12 @@ - + @@ -18,17 +18,25 @@ import MkSignin from './signin.vue'; const props = withDefaults(defineProps<{ autoSet?: boolean; + message?: string, }>(), { autoSet: false, + message: '' }); const emit = defineEmits<{ - (e: 'done'): void; - (e: 'closed'): void; + (ev: 'done'): void; + (ev: 'closed'): void; + (ev: 'cancelled'): void; }>(); const dialog = $ref>(); +function onClose() { + emit('cancelled'); + dialog.close(); +} + function onLogin(res) { emit('done', res); dialog.close(); diff --git a/packages/client/src/components/signin.vue b/packages/client/src/components/signin.vue index d140e143d..e3d92dc43 100644 --- a/packages/client/src/components/signin.vue +++ b/packages/client/src/components/signin.vue @@ -1,41 +1,44 @@ -