From 1a2f1a5bfb12c69215ed58cc4f80ad5d49e21753 Mon Sep 17 00:00:00 2001
From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com>
Date: Sun, 20 Oct 2024 16:26:39 +0900
Subject: [PATCH] =?UTF-8?q?enhance(frontend):=20=E6=8A=95=E7=A8=BF?=
=?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=BC=E3=83=A0=E3=81=AE=E8=A8=AD=E5=AE=9A?=
=?UTF-8?q?=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC=E3=82=92=E6=94=B9=E8=89=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
locales/index.d.ts | 8 +
locales/ja-JP.yml | 2 +
.../frontend/src/components/MkPostForm.vue | 49 +--
.../src/components/MkPostFormOtherMenu.vue | 321 ++++++++++++++++++
packages/frontend/src/filters/number.ts | 2 +-
5 files changed, 361 insertions(+), 21 deletions(-)
create mode 100644 packages/frontend/src/components/MkPostFormOtherMenu.vue
diff --git a/locales/index.d.ts b/locales/index.d.ts
index b5af5909a3..5af999b16b 100644
--- a/locales/index.d.ts
+++ b/locales/index.d.ts
@@ -5190,6 +5190,14 @@ export interface Locale extends ILocale {
* 名前に禁止されている文字列が含まれています。この名前を使用したい場合は、サーバー管理者にお問い合わせください。
*/
"yourNameContainsProhibitedWordsDescription": string;
+ /**
+ * 文字数
+ */
+ "textCount": string;
+ /**
+ * リセット
+ */
+ "reset": string;
"_abuseUserReport": {
/**
* 転送
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index c448d4d50a..d4b2d8dcc8 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -1293,6 +1293,8 @@ prohibitedWordsForNameOfUser: "禁止ワード(ユーザーの名前)"
prohibitedWordsForNameOfUserDescription: "このリストに含まれる文字列がユーザーの名前に含まれる場合、ユーザーの名前の変更を拒否します。モデレーター権限を持つユーザーはこの制限の影響を受けません。"
yourNameContainsProhibitedWords: "変更しようとした名前に禁止された文字列が含まれています"
yourNameContainsProhibitedWordsDescription: "名前に禁止されている文字列が含まれています。この名前を使用したい場合は、サーバー管理者にお問い合わせください。"
+textCount: "文字数"
+reset: "リセット"
_abuseUserReport:
forward: "転送"
diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue
index 76a6e4212a..29c306ea35 100644
--- a/packages/frontend/src/components/MkPostForm.vue
+++ b/packages/frontend/src/components/MkPostForm.vue
@@ -20,7 +20,7 @@ SPDX-License-Identifier: AGPL-3.0-only
-
-
+
-
-
-
-
-
+
@@ -174,6 +170,7 @@ const textareaEl = shallowRef
(null);
const cwInputEl = shallowRef(null);
const hashtagsInputEl = shallowRef(null);
const visibilityButton = shallowRef();
+const otherSettingsButton = shallowRef();
const posting = ref(false);
const posted = ref(false);
@@ -527,20 +524,32 @@ async function toggleLocalOnly() {
}
}
-async function toggleReactionAcceptance() {
- const select = await os.select({
- title: i18n.ts.reactionAcceptance,
- items: [
- { value: null, text: i18n.ts.all },
- { value: 'likeOnlyForRemote' as const, text: i18n.ts.likeOnlyForRemote },
- { value: 'nonSensitiveOnly' as const, text: i18n.ts.nonSensitiveOnly },
- { value: 'nonSensitiveOnlyForLocalLikeOnlyForRemote' as const, text: i18n.ts.nonSensitiveOnlyForLocalLikeOnlyForRemote },
- { value: 'likeOnly' as const, text: i18n.ts.likeOnly },
- ],
- default: reactionAcceptance.value,
+function showOtherSettings() {
+ const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkPostFormOtherMenu.vue')), {
+ currentReactionAcceptance: reactionAcceptance.value,
+ textLength: textLength.value,
+ src: otherSettingsButton.value,
+ }, {
+ changeReactionAcceptance: (value: Misskey.entities.Note['reactionAcceptance']) => {
+ reactionAcceptance.value = value;
+ },
+ reset: () => {
+ reset();
+ },
+ closed: () => dispose(),
});
- if (select.canceled) return;
- reactionAcceptance.value = select.result;
+}
+
+function reset() {
+ text.value = '';
+ cw.value = null;
+ useCw.value = false;
+ visibility.value = defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility;
+ localOnly.value = defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly;
+ files.value = [];
+ poll.value = null;
+ quoteId.value = null;
+ reactionAcceptance.value = defaultStore.state.reactionAcceptance;
}
function pushVisibleUser(user: Misskey.entities.UserDetailed) {
diff --git a/packages/frontend/src/components/MkPostFormOtherMenu.vue b/packages/frontend/src/components/MkPostFormOtherMenu.vue
new file mode 100644
index 0000000000..7d0406d562
--- /dev/null
+++ b/packages/frontend/src/components/MkPostFormOtherMenu.vue
@@ -0,0 +1,321 @@
+
+
+
+
+
+
+
{{ i18n.ts.textCount }}
+
+
+
{{ number(textLength) }} / {{ number(maxTextLength) }}
+
+
+
+
+
+
+ {{ i18n.ts.reactionAcceptance }}
+
+
+
+
+
+
+ {{ i18n.ts.reset }}
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/frontend/src/filters/number.ts b/packages/frontend/src/filters/number.ts
index 10fb64deb4..479afd58d4 100644
--- a/packages/frontend/src/filters/number.ts
+++ b/packages/frontend/src/filters/number.ts
@@ -5,4 +5,4 @@
import { numberFormat } from '@@/js/intl-const.js';
-export default n => n == null ? 'N/A' : numberFormat.format(n);
+export default (n?: number) => n == null ? 'N/A' : numberFormat.format(n);