From c1d68cc8ae98cdcd48f7e91055834666b1a0b3e6 Mon Sep 17 00:00:00 2001 From: Dwiferdio Seagal Putra Date: Tue, 12 Oct 2021 13:27:36 +0700 Subject: [PATCH] feat: Show refresh prompt on network disconnect (#3165) Co-authored-by: Pranav Raj S --- app/javascript/dashboard/App.vue | 3 + .../dashboard/assets/scss/_animations.scss | 14 ++ .../components/NetworkNotification.vue | 123 ++++++++++++++++++ .../i18n/locale/en/generalSettings.json | 8 ++ 4 files changed, 148 insertions(+) create mode 100644 app/javascript/dashboard/components/NetworkNotification.vue diff --git a/app/javascript/dashboard/App.vue b/app/javascript/dashboard/App.vue index 147e1d525..502d8bda1 100644 --- a/app/javascript/dashboard/App.vue +++ b/app/javascript/dashboard/App.vue @@ -8,6 +8,7 @@ :has-accounts="hasAccounts" /> + @@ -15,6 +16,7 @@ import { mapGetters } from 'vuex'; import AddAccountModal from '../dashboard/components/layout/sidebarComponents/AddAccountModal'; import WootSnackbarBox from './components/SnackbarContainer'; +import NetworkNotification from './components/NetworkNotification'; import { accountIdFromPathname } from './helper/URLHelper'; export default { @@ -23,6 +25,7 @@ export default { components: { WootSnackbarBox, AddAccountModal, + NetworkNotification, }, data() { diff --git a/app/javascript/dashboard/assets/scss/_animations.scss b/app/javascript/dashboard/assets/scss/_animations.scss index 3a26d5bf2..ebb20a35e 100644 --- a/app/javascript/dashboard/assets/scss/_animations.scss +++ b/app/javascript/dashboard/assets/scss/_animations.scss @@ -93,3 +93,17 @@ /* .slide-fade-leave-active for <2.1.8 */ { opacity: 0; } + +.network-notification-fade-enter-active { + transition: all .1s $ease-in-sine; +} + +.network-notification-fade-leave-active { + transition: all .1s $ease-out-sine; +} + +.network-notification-fade-enter, +.network-notification-fade-leave-to { + transform: translateY(-$space-small); + opacity: 0; +} diff --git a/app/javascript/dashboard/components/NetworkNotification.vue b/app/javascript/dashboard/components/NetworkNotification.vue new file mode 100644 index 000000000..efd6b273e --- /dev/null +++ b/app/javascript/dashboard/components/NetworkNotification.vue @@ -0,0 +1,123 @@ + + + + + diff --git a/app/javascript/dashboard/i18n/locale/en/generalSettings.json b/app/javascript/dashboard/i18n/locale/en/generalSettings.json index d5e8bd50b..223a4688e 100644 --- a/app/javascript/dashboard/i18n/locale/en/generalSettings.json +++ b/app/javascript/dashboard/i18n/locale/en/generalSettings.json @@ -71,5 +71,13 @@ "assigned_conversation_new_message": "New Message", "conversation_mention": "Mention" } + }, + "NETWORK": { + "NOTIFICATION": { + "TEXT": "Disconnected from Chatwoot" + }, + "BUTTON": { + "REFRESH": "Refresh" + } } }