From 26cd12f7bf5e212db6b6599d37c809d64189acd9 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Sun, 15 Oct 2023 18:00:09 +0200 Subject: [PATCH] upd: add locale for quoted, add toasts and effects --- locales/en-US.yml | 1 + locales/index.d.ts | 1 + locales/ja-JP.yml | 3 ++- packages/frontend/src/components/MkNote.vue | 20 +++++++++++++++++++ .../src/components/MkNoteDetailed.vue | 20 +++++++++++++++++++ .../frontend/src/components/MkNoteSub.vue | 20 +++++++++++++++++++ 6 files changed, 64 insertions(+), 1 deletion(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 59a634c7fe..1699f2c085 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -108,6 +108,7 @@ enterEmoji: "Enter an emoji" renote: "Boost" unrenote: "Remove boost" renoted: "Boosted." +quoted: "Quoted." rmquote: "Removed quote." rmboost: "Unboosted." cantRenote: "This post can't be boosted." diff --git a/locales/index.d.ts b/locales/index.d.ts index 3712d6b81e..bdd32566f0 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -111,6 +111,7 @@ export interface Locale { "renote": string; "unrenote": string; "renoted": string; + "quoted": string; "rmboost": string; "rmquote": string; "cantRenote": string; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 97ce1af625..3bbab69821 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -107,7 +107,8 @@ followRequestPending: "フォロー許可待ち" enterEmoji: "絵文字を入力" renote: "リノート" unrenote: "リノート解除" -renoted: "ブースト" +renoted: "ブースト。" +quoted: "引用。" rmboost: "アンブースト。" rmquote: "引用を削除しました。" cantRenote: "この投稿はリノートできません。" diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 2f5966be6d..eb6f95248e 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -406,6 +406,7 @@ function quote() { } quoted.value = res.length > 0; + os.toast(i18n.ts.quoted); }); }); } else { @@ -427,6 +428,7 @@ function quote() { } quoted.value = res.length > 0; + os.toast(i18n.ts.quoted); }); }); } @@ -502,7 +504,16 @@ function undoRenote(note) : void { os.api("notes/unrenote", { noteId: note.id }); + os.toast(i18n.ts.rmboost); renoted.value = false; + + const el = renoteButton.value as HTMLElement | null | undefined; + if (el) { + const rect = el.getBoundingClientRect(); + const x = rect.left + (el.offsetWidth / 2); + const y = rect.top + (el.offsetHeight / 2); + os.popup(MkRippleEffect, { x, y }, {}, 'end'); + } } function undoQuote(note) : void { @@ -510,7 +521,16 @@ function undoQuote(note) : void { noteId: note.id, quote: true }); + os.toast(i18n.ts.rmquote); quoted.value = false; + + const el = quoteButton.value as HTMLElement | null | undefined; + if (el) { + const rect = el.getBoundingClientRect(); + const x = rect.left + (el.offsetWidth / 2); + const y = rect.top + (el.offsetHeight / 2); + os.popup(MkRippleEffect, { x, y }, {}, 'end'); + } } function onContextmenu(ev: MouseEvent): void { diff --git a/packages/frontend/src/components/MkNoteDetailed.vue b/packages/frontend/src/components/MkNoteDetailed.vue index 32ea1f3e47..61d4016d69 100644 --- a/packages/frontend/src/components/MkNoteDetailed.vue +++ b/packages/frontend/src/components/MkNoteDetailed.vue @@ -450,6 +450,7 @@ function quote() { } quoted.value = res.length > 0; + os.toast(i18n.ts.quoted); }); }); } else { @@ -471,6 +472,7 @@ function quote() { } quoted.value = res.length > 0; + os.toast(i18n.ts.quoted); }); }); } @@ -548,7 +550,16 @@ function undoRenote() : void { os.api("notes/unrenote", { noteId: appearNote.id, }); + os.toast(i18n.ts.rmboost); renoted.value = false; + + const el = renoteButton.value as HTMLElement | null | undefined; + if (el) { + const rect = el.getBoundingClientRect(); + const x = rect.left + (el.offsetWidth / 2); + const y = rect.top + (el.offsetHeight / 2); + os.popup(MkRippleEffect, { x, y }, {}, 'end'); + } } function undoQuote() : void { @@ -556,7 +567,16 @@ function undoQuote() : void { noteId: appearNote.id, quote: true }); + os.toast(i18n.ts.rmquote); quoted.value = false; + + const el = quoteButton.value as HTMLElement | null | undefined; + if (el) { + const rect = el.getBoundingClientRect(); + const x = rect.left + (el.offsetWidth / 2); + const y = rect.top + (el.offsetHeight / 2); + os.popup(MkRippleEffect, { x, y }, {}, 'end'); + } } function onContextmenu(ev: MouseEvent): void { diff --git a/packages/frontend/src/components/MkNoteSub.vue b/packages/frontend/src/components/MkNoteSub.vue index 4a8d6c0d32..a701766c25 100644 --- a/packages/frontend/src/components/MkNoteSub.vue +++ b/packages/frontend/src/components/MkNoteSub.vue @@ -241,7 +241,16 @@ function undoRenote() : void { os.api("notes/unrenote", { noteId: appearNote.id, }); + os.toast(i18n.ts.rmboost); renoted.value = false; + + const el = renoteButton.value as HTMLElement | null | undefined; + if (el) { + const rect = el.getBoundingClientRect(); + const x = rect.left + (el.offsetWidth / 2); + const y = rect.top + (el.offsetHeight / 2); + os.popup(MkRippleEffect, { x, y }, {}, 'end'); + } } function undoQuote() : void { @@ -249,7 +258,16 @@ function undoQuote() : void { noteId: appearNote.id, quote: true }); + os.toast(i18n.ts.rmquote); quoted.value = false; + + const el = quoteButton.value as HTMLElement | null | undefined; + if (el) { + const rect = el.getBoundingClientRect(); + const x = rect.left + (el.offsetWidth / 2); + const y = rect.top + (el.offsetHeight / 2); + os.popup(MkRippleEffect, { x, y }, {}, 'end'); + } } let showContent = $ref(false); @@ -317,6 +335,7 @@ function quote() { } quoted.value = res.length > 0; + os.toast(i18n.ts.quoted); }); }); } else { @@ -338,6 +357,7 @@ function quote() { } quoted.value = res.length > 0; + os.toast(i18n.ts.quoted); }); }); }