From f9800a087e2c765ce8af732cdbf433496d28a677 Mon Sep 17 00:00:00 2001 From: LouisLam Date: Sun, 11 Jul 2021 15:23:28 +0800 Subject: [PATCH] optimize for mobile --- src/layouts/Layout.vue | 99 +++++++++++++++++++++++++++++++-------- src/mixins/socket.js | 16 +++++++ src/pages/Dashboard.vue | 10 ++-- src/pages/EditMonitor.vue | 3 ++ src/pages/Settings.vue | 3 ++ 5 files changed, 109 insertions(+), 22 deletions(-) diff --git a/src/layouts/Layout.vue b/src/layouts/Layout.vue index f2deae07..0c1acf44 100644 --- a/src/layouts/Layout.vue +++ b/src/layouts/Layout.vue @@ -6,18 +6,25 @@ -
- + +
Uptime Kuma -
+ +
+ + + Uptime Kuma +
@@ -26,6 +33,14 @@
+ +
+ - diff --git a/src/mixins/socket.js b/src/mixins/socket.js index cd96672d..693f2ae0 100644 --- a/src/mixins/socket.js +++ b/src/mixins/socket.js @@ -25,10 +25,14 @@ export default { avgPingList: { }, uptimeList: { }, notificationList: [], + windowWidth: window.innerWidth, + showListMobile: false, } }, created() { + window.addEventListener('resize', this.onResize); + let wsHost; if (localStorage.dev === "dev") { wsHost = ":3001" @@ -136,6 +140,14 @@ export default { methods: { + cancelActiveList() { + this.$root.showListMobile = false; + }, + + onResize() { + this.windowWidth = window.innerWidth; + }, + storage() { return (this.remember) ? localStorage : sessionStorage; }, @@ -209,6 +221,10 @@ export default { computed: { + isMobile() { + return this.windowWidth <= 767.98; + }, + timezone() { if (this.userTimezone === "auto") { diff --git a/src/pages/Dashboard.vue b/src/pages/Dashboard.vue index d96e14b5..c42f2765 100644 --- a/src/pages/Dashboard.vue +++ b/src/pages/Dashboard.vue @@ -3,17 +3,17 @@
-
+
Add New Monitor
-
+
No Monitors, please add one.
- +
@@ -53,6 +53,7 @@ export default { }, data() { return { + } }, computed: { @@ -86,6 +87,9 @@ export default { return result; }, + showList() { + return ! this.$root.isMobile || this.$root.showListMobile; + }, }, methods: { monitorURL(id) { diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index f108b8ff..7054d73a 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -55,6 +55,9 @@
+ +
+

Notifications

Not available, please setup.

diff --git a/src/pages/Settings.vue b/src/pages/Settings.vue index 415baa48..e5670f50 100644 --- a/src/pages/Settings.vue +++ b/src/pages/Settings.vue @@ -51,6 +51,9 @@
+ +
+

Notifications

Not available, please setup.

Please assign the notification to monitor(s) to get it works.