Skip to content

Commit

Permalink
Fix & Refactor UI/UX Page [Settings]
Browse files Browse the repository at this point in the history
- [+] fix(settings.tsx): fix conditional rendering of ListItem based on clientConfig.isApp
- [+] refactor(settings.tsx): improve readability of conditional rendering code
  • Loading branch information
H0llyW00dzZ committed Nov 27, 2023
1 parent 7df868e commit dda40e2
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions app/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -914,21 +914,26 @@ export function Settings() {

{!accessStore.hideUserApiKey && (
<>
<ListItem
title={Locale.Settings.Access.CustomEndpoint.Title}
subTitle={Locale.Settings.Access.CustomEndpoint.SubTitle}
>
<input
type="checkbox"
checked={accessStore.useCustomConfig}
onChange={(e) =>
accessStore.update(
(access) =>
(access.useCustomConfig = e.currentTarget.checked),
)
}
></input>
</ListItem>
{
// Conditionally render the following ListItem based on clientConfig.isApp
!clientConfig?.isApp && ( // only show if isApp is false
<ListItem
title={Locale.Settings.Access.CustomEndpoint.Title}
subTitle={Locale.Settings.Access.CustomEndpoint.SubTitle}
>
<input
type="checkbox"
checked={accessStore.useCustomConfig}
onChange={(e) =>
accessStore.update(
(access) =>
(access.useCustomConfig = e.currentTarget.checked),
)
}
></input>
</ListItem>
)
}
{accessStore.useCustomConfig && (
<>
<ListItem
Expand Down

0 comments on commit dda40e2

Please sign in to comment.