From 8f79f862b90b4f8bbdfed8115ceb2c2764b6eb16 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 29 May 2018 01:44:15 +0900 Subject: [PATCH] :pizza: --- locales/ja.yml | 12 +++-- .../desktop/views/components/post-form.vue | 12 ++++- .../app/desktop/views/widgets/post-form.vue | 13 +++++- .../app/mobile/views/components/post-form.vue | 46 ++++++++++++++++--- 4 files changed, 70 insertions(+), 13 deletions(-) diff --git a/locales/ja.yml b/locales/ja.yml index 44fa0ef538..c02422e81a 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -39,6 +39,13 @@ common: confused: "こまこまのこまり" pudding: "Pudding" + note-placeholders: + a: "今どうしてる?" + b: "何かありましたか?" + c: "言いたいことは?" + d: "ここに書いてください" + e: "あなたが書くのを待っています..." + delete: "削除" loading: "読み込み中" ok: "わかった" @@ -393,10 +400,9 @@ desktop/views/components/notifications.vue: empty: "ありません!" desktop/views/components/post-form.vue: - note-placeholder: "いまどうしてる?" reply-placeholder: "この投稿への返信..." quote-placeholder: "この投稿を引用..." - note: "投稿" + submit: "投稿" reply: "返信" renote: "Renote" posted: "投稿しました!" @@ -718,7 +724,6 @@ desktop/views/widgets/polls.vue: desktop/views/widgets/post-form.vue: title: "投稿" note: "投稿" - placeholder: "いまどうしてる?" desktop/views/widgets/profile.vue: update-banner: "クリックでバナー編集" @@ -819,7 +824,6 @@ mobile/views/components/post-form.vue: renote: "Renote" renote-placeholder: "この投稿を引用... (オプション)" reply-placeholder: "この投稿への返信..." - note-placeholder: "いまどうしてる?" cw-placeholder: "内容への注釈 (オプション)" location-alert: "お使いの端末は位置情報に対応していません" error: "エラー" diff --git a/src/client/app/desktop/views/components/post-form.vue b/src/client/app/desktop/views/components/post-form.vue index 8eec677b06..ad829065b0 100644 --- a/src/client/app/desktop/views/components/post-form.vue +++ b/src/client/app/desktop/views/components/post-form.vue @@ -86,11 +86,19 @@ export default Vue.extend({ }, placeholder(): string { + const x = [ + '%i18n:common.note-placeholders.a%', + '%i18n:common.note-placeholders.b%', + '%i18n:common.note-placeholders.c%', + '%i18n:common.note-placeholders.d%', + '%i18n:common.note-placeholders.e%' + ][Math.floor(Math.random() * 5)]; + return this.renote ? '%i18n:@quote-placeholder%' : this.reply ? '%i18n:@reply-placeholder%' - : '%i18n:@note-placeholder%'; + : x; }, submitText(): string { @@ -98,7 +106,7 @@ export default Vue.extend({ ? '%i18n:@renote%' : this.reply ? '%i18n:@reply%' - : '%i18n:@note%'; + : '%i18n:@submit%'; }, canPost(): boolean { diff --git a/src/client/app/desktop/views/widgets/post-form.vue b/src/client/app/desktop/views/widgets/post-form.vue index 69b21ad37a..fb4adf70b8 100644 --- a/src/client/app/desktop/views/widgets/post-form.vue +++ b/src/client/app/desktop/views/widgets/post-form.vue @@ -3,7 +3,7 @@ - + @@ -22,6 +22,17 @@ export default define({ text: '' }; }, + computed: { + placeholder(): string { + return [ + '%i18n:common.note-placeholders.a%', + '%i18n:common.note-placeholders.b%', + '%i18n:common.note-placeholders.c%', + '%i18n:common.note-placeholders.d%', + '%i18n:common.note-placeholders.e%' + ][Math.floor(Math.random() * 5)]; + } + }, methods: { func() { if (this.props.design == 1) { diff --git a/src/client/app/mobile/views/components/post-form.vue b/src/client/app/mobile/views/components/post-form.vue index f5badb48cc..61f0462659 100644 --- a/src/client/app/mobile/views/components/post-form.vue +++ b/src/client/app/mobile/views/components/post-form.vue @@ -5,11 +5,7 @@
{{ 1000 - text.length }} %fa:map-marker-alt% - +
@@ -20,7 +16,7 @@ +%i18n:@add-visible-user%
- +
@@ -74,6 +70,44 @@ export default Vue.extend({ }; }, + computed: { + draftId(): string { + return this.renote + ? 'renote:' + this.renote.id + : this.reply + ? 'reply:' + this.reply.id + : 'note'; + }, + + placeholder(): string { + const x = [ + '%i18n:common.note-placeholders.a%', + '%i18n:common.note-placeholders.b%', + '%i18n:common.note-placeholders.c%', + '%i18n:common.note-placeholders.d%', + '%i18n:common.note-placeholders.e%' + ][Math.floor(Math.random() * 5)]; + + return this.renote + ? '%i18n:@quote-placeholder%' + : this.reply + ? '%i18n:@reply-placeholder%' + : x; + }, + + submitText(): string { + return this.renote + ? '%i18n:@renote%' + : this.reply + ? '%i18n:@reply%' + : '%i18n:@submit%'; + }, + + canPost(): boolean { + return !this.posting && (this.text.length != 0 || this.files.length != 0 || this.poll || this.renote); + } + }, + mounted() { if (this.reply && this.reply.user.host != null) { this.text = `@${this.reply.user.username}@${this.reply.user.host} `;