From 9086650fe22ec7a0b096ef99b66495d43105ee3c Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 25 Apr 2024 10:23:15 +0530 Subject: [PATCH 1/2] fix: heatmap colors for dark mode [CW-3241] (#9278) * feat: add new heatmap colors * fix: loader * fix: move new styles to tailwind * feat: update tw classes * refactor: update styles * feat: add useI18n composable * feat: use composition api * fix: empty div * chore: don't import defineProps Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> --------- Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> --- .../dashboard/composables/useI18n.js | 32 ++ .../settings/reports/components/Heatmap.vue | 413 ++++++------------ 2 files changed, 171 insertions(+), 274 deletions(-) create mode 100644 app/javascript/dashboard/composables/useI18n.js diff --git a/app/javascript/dashboard/composables/useI18n.js b/app/javascript/dashboard/composables/useI18n.js new file mode 100644 index 000000000..9bcdfe020 --- /dev/null +++ b/app/javascript/dashboard/composables/useI18n.js @@ -0,0 +1,32 @@ +import { computed, getCurrentInstance } from 'vue'; +import Vue from 'vue'; +import VueI18n from 'vue-i18n'; + +let i18nInstance = VueI18n; + +export function useI18n() { + if (!i18nInstance) throw new Error('vue-i18n not initialized'); + + const i18n = i18nInstance; + + const instance = getCurrentInstance(); + const vm = instance?.proxy || instance || new Vue({}); + + const locale = computed({ + get() { + return i18n.locale; + }, + set(v) { + i18n.locale = v; + }, + }); + + return { + locale, + t: vm.$t.bind(vm), + tc: vm.$tc.bind(vm), + d: vm.$d.bind(vm), + te: vm.$te.bind(vm), + n: vm.$n.bind(vm), + }; +} diff --git a/app/javascript/dashboard/routes/dashboard/settings/reports/components/Heatmap.vue b/app/javascript/dashboard/routes/dashboard/settings/reports/components/Heatmap.vue index fb7e7b5eb..6f28dabb5 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/reports/components/Heatmap.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/reports/components/Heatmap.vue @@ -1,308 +1,173 @@ + + - - - From 1bf3ad9a088995469edab4031700c3a2cab0aa3e Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Thu, 25 Apr 2024 11:25:19 +0530 Subject: [PATCH 2/2] fix: Remove unnecessary attributes from notification deleted action cable event payload (#9295) fix: simplify notification deleted payload event --- app/listeners/action_cable_listener.rb | 2 +- spec/listeners/action_cable_listener_spec.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/listeners/action_cable_listener.rb b/app/listeners/action_cable_listener.rb index 5aac56db3..99a8fe2af 100644 --- a/app/listeners/action_cable_listener.rb +++ b/app/listeners/action_cable_listener.rb @@ -18,7 +18,7 @@ class ActionCableListener < BaseListener notification, account, unread_count, count = extract_notification_and_account(event) tokens = [event.data[:notification].user.pubsub_token] - broadcast(account, tokens, NOTIFICATION_DELETED, { notification: notification.push_event_data, unread_count: unread_count, count: count }) + broadcast(account, tokens, NOTIFICATION_DELETED, { notification: { id: notification.id }, unread_count: unread_count, count: count }) end def account_cache_invalidated(event) diff --git a/spec/listeners/action_cable_listener_spec.rb b/spec/listeners/action_cable_listener_spec.rb index 5802ce00a..b353f330d 100644 --- a/spec/listeners/action_cable_listener_spec.rb +++ b/spec/listeners/action_cable_listener_spec.rb @@ -142,7 +142,9 @@ describe ActionCableListener do 'notification.deleted', { account_id: notification.account_id, - notification: notification.push_event_data, + notification: { + id: notification.id + }, unread_count: 1, count: 1 }