From d76e744eabe181bf9ce04effb48547427f63c7bb Mon Sep 17 00:00:00 2001 From: H0llyW00dzZ Date: Mon, 27 Nov 2023 05:44:26 +0700 Subject: [PATCH 1/4] Fix & Refactor UI/UX Page [Auth] - [+] fix(auth.tsx): fix condition to set custom endpoint to true if it's app - [+] refactor(auth.tsx): update accessStore to set useCustomConfig to true --- app/components/auth.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/components/auth.tsx b/app/components/auth.tsx index 7962d46bee4..c1e5c52afdb 100644 --- a/app/components/auth.tsx +++ b/app/components/auth.tsx @@ -24,8 +24,12 @@ export function AuthPage() { }; // Reset access code to empty string useEffect(() => { - if (getClientConfig()?.isApp) { + const clientConfig = getClientConfig(); + if (clientConfig?.isApp) { // Force to set custom endpoint to true if it's app navigate(Path.Settings); + accessStore.update((state) => { + state.useCustomConfig = true; + }); } // eslint-disable-next-line react-hooks/exhaustive-deps }, []); From bf5e7aaa484c42201178830d82d126f76ee55ed2 Mon Sep 17 00:00:00 2001 From: H0llyW00dzZ Date: Mon, 27 Nov 2023 07:03:41 +0700 Subject: [PATCH 2/4] Feat UI/UX Page [Settings] - [+] feat(settings.tsx): set useCustomConfig to true if clientConfig.isApp is truthy --- app/components/settings.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 1edb3c6bae4..53ca13f2f42 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -635,6 +635,11 @@ export function Settings() { navigate(Path.Home); } }; + if (clientConfig?.isApp) { // Force to set custom endpoint to true if it's app + accessStore.update((state) => { + state.useCustomConfig = true; + }); + } document.addEventListener("keydown", keydownEvent); return () => { document.removeEventListener("keydown", keydownEvent); From 7df868e22a66db618688878bbe4753c4dd3c495c Mon Sep 17 00:00:00 2001 From: H0llyW00dzZ Date: Mon, 27 Nov 2023 07:12:57 +0700 Subject: [PATCH 3/4] Revert "Fix & Refactor UI/UX Page [Auth]" This reverts commit d76e744eabe181bf9ce04effb48547427f63c7bb. Reason: Move to commits bf5e7aaa484c42201178830d82d126f76ee55ed2 --- app/components/auth.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/components/auth.tsx b/app/components/auth.tsx index c1e5c52afdb..7962d46bee4 100644 --- a/app/components/auth.tsx +++ b/app/components/auth.tsx @@ -24,12 +24,8 @@ export function AuthPage() { }; // Reset access code to empty string useEffect(() => { - const clientConfig = getClientConfig(); - if (clientConfig?.isApp) { // Force to set custom endpoint to true if it's app + if (getClientConfig()?.isApp) { navigate(Path.Settings); - accessStore.update((state) => { - state.useCustomConfig = true; - }); } // eslint-disable-next-line react-hooks/exhaustive-deps }, []); From dda40e29f440fdbdb0e17bada3f7a09f658f63cd Mon Sep 17 00:00:00 2001 From: H0llyW00dzZ Date: Mon, 27 Nov 2023 08:07:53 +0700 Subject: [PATCH 4/4] Fix & Refactor UI/UX Page [Settings] - [+] fix(settings.tsx): fix conditional rendering of ListItem based on clientConfig.isApp - [+] refactor(settings.tsx): improve readability of conditional rendering code --- app/components/settings.tsx | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 53ca13f2f42..f53024d6cbb 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -914,21 +914,26 @@ export function Settings() { {!accessStore.hideUserApiKey && ( <> - - - accessStore.update( - (access) => - (access.useCustomConfig = e.currentTarget.checked), - ) - } - > - + { + // Conditionally render the following ListItem based on clientConfig.isApp + !clientConfig?.isApp && ( // only show if isApp is false + + + accessStore.update( + (access) => + (access.useCustomConfig = e.currentTarget.checked), + ) + } + > + + ) + } {accessStore.useCustomConfig && ( <>