From d62f3dae673ded9caf20afc3306a74a7d18d682d Mon Sep 17 00:00:00 2001 From: dakkar Date: Thu, 17 Oct 2024 15:56:05 +0000 Subject: [PATCH] merge: Feat: Implement clickable notifications (!685) View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/685 Approved-by: Hazelnoot Approved-by: dakkar --- locales/en-US.yml | 1 + locales/index.d.ts | 4 ++++ locales/ja-JP.yml | 1 + locales/zh-CN.yml | 1 + locales/zh-TW.yml | 1 + packages/frontend/src/pages/settings/general.vue | 3 +++ packages/frontend/src/store.ts | 4 ++++ packages/frontend/src/ui/_common_/common.vue | 11 +++++++++-- 8 files changed, 24 insertions(+), 2 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 52413116c..d1fd8b013 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1229,6 +1229,7 @@ refreshing: "Refreshing..." pullDownToRefresh: "Pull down to refresh" disableStreamingTimeline: "Disable real-time timeline updates" useGroupedNotifications: "Display grouped notifications" +allowClickingNotifications: "Allow clicking on pop-up notifications" signupPendingError: "There was a problem verifying the email address. The link may have expired." cwNotationRequired: "If \"Hide content\" is enabled, a description must be provided." doReaction: "Add reaction" diff --git a/locales/index.d.ts b/locales/index.d.ts index c47728313..eeefdc796 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -4938,6 +4938,10 @@ export interface Locale extends ILocale { * 通知をグルーピングして表示する */ "useGroupedNotifications": string; + /** + * ポップアップ通知のクリックを許可する + */ + "allowClickingNotifications": string; /** * メールアドレスの確認中に問題が発生しました。リンクの有効期限が切れている可能性があります。 */ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 86f43abdc..c62eb6418 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1230,6 +1230,7 @@ refreshing: "リロード中" pullDownToRefresh: "引っ張ってリロード" disableStreamingTimeline: "タイムラインのリアルタイム更新を無効にする" useGroupedNotifications: "通知をグルーピングして表示する" +allowClickingNotifications: "ポップアップ通知のクリックを許可する" signupPendingError: "メールアドレスの確認中に問題が発生しました。リンクの有効期限が切れている可能性があります。" cwNotationRequired: "「内容を隠す」がオンの場合は注釈の記述が必要です。" doReaction: "リアクションする" diff --git a/locales/zh-CN.yml b/locales/zh-CN.yml index e5a59aa1b..fe4995ec7 100644 --- a/locales/zh-CN.yml +++ b/locales/zh-CN.yml @@ -1230,6 +1230,7 @@ refreshing: "刷新中" pullDownToRefresh: "下拉以刷新" disableStreamingTimeline: "禁止实时更新时间线" useGroupedNotifications: "分组显示通知" +allowClickingNotifications: "可以点击弹出的通知" signupPendingError: "确认电子邮件时出现错误。链接可能已过期。" cwNotationRequired: "在启用「隐藏内容」时必须输入注释" doReaction: "回应" diff --git a/locales/zh-TW.yml b/locales/zh-TW.yml index d195f53b0..8ba3aef0a 100644 --- a/locales/zh-TW.yml +++ b/locales/zh-TW.yml @@ -1230,6 +1230,7 @@ refreshing: "載入更新中" pullDownToRefresh: "往下拉來更新內容" disableStreamingTimeline: "停用時間軸的即時更新" useGroupedNotifications: "分組顯示通知訊息" +allowClickingNotifications: "可以點擊彈出的通知" signupPendingError: "驗證您的電子郵件地址時出現問題。連結可能已過期。" cwNotationRequired: "如果開啟「隱藏內容」,則需要註解說明。" doReaction: "做出反應" diff --git a/packages/frontend/src/pages/settings/general.vue b/packages/frontend/src/pages/settings/general.vue index 1c95681c4..d87350158 100644 --- a/packages/frontend/src/pages/settings/general.vue +++ b/packages/frontend/src/pages/settings/general.vue @@ -108,6 +108,8 @@ SPDX-License-Identifier: AGPL-3.0-only + {{ i18n.ts.allowClickingNotifications }} + {{ i18n.ts._notification.checkNotificationBehavior }} @@ -338,6 +340,7 @@ const showAvatarDecorations = computed(defaultStore.makeGetterSetter('showAvatar const mediaListWithOneImageAppearance = computed(defaultStore.makeGetterSetter('mediaListWithOneImageAppearance')); const notificationPosition = computed(defaultStore.makeGetterSetter('notificationPosition')); const notificationStackAxis = computed(defaultStore.makeGetterSetter('notificationStackAxis')); +const notificationClickable = computed(defaultStore.makeGetterSetter('notificationClickable')); const keepScreenOn = computed(defaultStore.makeGetterSetter('keepScreenOn')); const disableStreamingTimeline = computed(defaultStore.makeGetterSetter('disableStreamingTimeline')); const useGroupedNotifications = computed(defaultStore.makeGetterSetter('useGroupedNotifications')); diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts index 8b3e27d85..989d986fc 100644 --- a/packages/frontend/src/store.ts +++ b/packages/frontend/src/store.ts @@ -398,6 +398,10 @@ export const defaultStore = markRaw(new Storage('base', { where: 'device', default: 'horizontal' as 'vertical' | 'horizontal', }, + notificationClickable: { + where: 'device', + default: false, + }, enableCondensedLine: { where: 'device', default: false, diff --git a/packages/frontend/src/ui/_common_/common.vue b/packages/frontend/src/ui/_common_/common.vue index f18266564..dad855dd5 100644 --- a/packages/frontend/src/ui/_common_/common.vue +++ b/packages/frontend/src/ui/_common_/common.vue @@ -30,7 +30,11 @@ SPDX-License-Identifier: AGPL-3.0-only :enterFromClass="defaultStore.state.animation ? $style.transition_notification_enterFrom : ''" :leaveToClass="defaultStore.state.animation ? $style.transition_notification_leaveTo : ''" > -
+
@@ -96,6 +100,10 @@ if ($i) { swInject(); } } + +function getPointerEvents() { + return defaultStore.state.notificationClickable ? undefined : 'none'; +}