From 56fcc12a50d7139363931974618663f7e869449e Mon Sep 17 00:00:00 2001 From: tjtanjin Date: Sun, 20 Oct 2024 23:17:53 +0800 Subject: [PATCH 1/3] refactor: Improve desktop and mobile devices check --- src/hooks/internal/useIsDesktopInternal.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hooks/internal/useIsDesktopInternal.ts b/src/hooks/internal/useIsDesktopInternal.ts index 9d1279df..d0ef4603 100644 --- a/src/hooks/internal/useIsDesktopInternal.ts +++ b/src/hooks/internal/useIsDesktopInternal.ts @@ -5,7 +5,12 @@ export const useIsDesktopInternal = () => { if (typeof window === 'undefined' || !window.navigator) { return false; // Default to false if running on server-side } - return !(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)); + const userAgent = navigator.userAgent; + const isNotMobileUA = !(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent)); + const isWideEnough = window.innerWidth >= 768; + + // device is desktop if it is not a mobile agent and if the width is wide enough + return isNotMobileUA && isWideEnough; }, []); // boolean indicating if user is on desktop (otherwise treated as on mobile) From 79380478cd1ae0bb8c09829d5d2fc30c069063a3 Mon Sep 17 00:00:00 2001 From: tjtanjin Date: Sun, 20 Oct 2024 23:19:05 +0800 Subject: [PATCH 2/3] lint: Fix lint issues --- src/hooks/internal/useIsDesktopInternal.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hooks/internal/useIsDesktopInternal.ts b/src/hooks/internal/useIsDesktopInternal.ts index d0ef4603..cd1fe2ac 100644 --- a/src/hooks/internal/useIsDesktopInternal.ts +++ b/src/hooks/internal/useIsDesktopInternal.ts @@ -6,11 +6,11 @@ export const useIsDesktopInternal = () => { return false; // Default to false if running on server-side } const userAgent = navigator.userAgent; - const isNotMobileUA = !(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent)); - const isWideEnough = window.innerWidth >= 768; + const isNotMobileUA = !(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent)); + const isWideEnough = window.innerWidth >= 768; - // device is desktop if it is not a mobile agent and if the width is wide enough - return isNotMobileUA && isWideEnough; + // device is desktop if it is not a mobile agent and if the width is wide enough + return isNotMobileUA && isWideEnough; }, []); // boolean indicating if user is on desktop (otherwise treated as on mobile) From 37a433e15e1ed28d1b2478f621d086d47ec50656 Mon Sep 17 00:00:00 2001 From: tjtanjin Date: Sun, 20 Oct 2024 23:19:27 +0800 Subject: [PATCH 3/3] fix: Fix icon color in chatbot footer --- src/constants/internal/DefaultSettings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/internal/DefaultSettings.tsx b/src/constants/internal/DefaultSettings.tsx index 22f963e1..fd790597 100644 --- a/src/constants/internal/DefaultSettings.tsx +++ b/src/constants/internal/DefaultSettings.tsx @@ -154,7 +154,7 @@ export const DefaultSettings: Settings = { background: "linear-gradient(to right, #42b0c5, #491d8d)", }} > - + React ChatBotify