From dda40e29f440fdbdb0e17bada3f7a09f658f63cd Mon Sep 17 00:00:00 2001 From: H0llyW00dzZ Date: Mon, 27 Nov 2023 08:07:53 +0700 Subject: [PATCH] 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 53ca13f2..f53024d6 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 && ( <>