Skip to content

Commit b7422c1

Browse files
committed
Only show Personal Token section on settings if user has one
1 parent 5d2cae7 commit b7422c1

1 file changed

Lines changed: 53 additions & 57 deletions

File tree

packages/components/src/components/modals/AdvancedSettingsModal.tsx

Lines changed: 53 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -174,66 +174,62 @@ export const AdvancedSettingsModal = React.memo(
174174
)}
175175

176176
<View>
177-
<View>
178-
<SubHeader title="Personal Access Token">
179-
<Spacer flex={1} />
180-
181-
{!!(
182-
githubPersonalTokenDetails &&
183-
githubPersonalTokenDetails.token
184-
) && (
185-
<Button
186-
analyticsLabel="remove_personal_access_token"
187-
contentContainerStyle={{
188-
width: 52,
189-
paddingHorizontal: contentPadding,
190-
}}
191-
disabled={isRemovingPersonalToken}
192-
loading={isRemovingPersonalToken}
193-
onPress={() => {
194-
removePersonalAccessToken()
195-
}}
196-
size={32}
197-
type="danger"
198-
>
199-
<ThemedIcon
200-
color={foregroundThemeColor}
201-
name="trashcan"
202-
size={16}
203-
/>
204-
</Button>
205-
)}
206-
</SubHeader>
177+
{!!(
178+
githubPersonalTokenDetails && githubPersonalTokenDetails.token
179+
) && (
180+
<>
181+
<View>
182+
<SubHeader title="Personal Access Token">
183+
<Spacer flex={1} />
184+
185+
{!!(
186+
githubPersonalTokenDetails &&
187+
githubPersonalTokenDetails.token
188+
) && (
189+
<Button
190+
analyticsLabel="remove_personal_access_token"
191+
contentContainerStyle={{
192+
width: 52,
193+
paddingHorizontal: contentPadding,
194+
}}
195+
disabled={isRemovingPersonalToken}
196+
loading={isRemovingPersonalToken}
197+
onPress={() => {
198+
removePersonalAccessToken()
199+
}}
200+
size={32}
201+
type="danger"
202+
>
203+
<ThemedIcon
204+
color={foregroundThemeColor}
205+
name="trashcan"
206+
size={16}
207+
/>
208+
</Button>
209+
)}
210+
</SubHeader>
207211

208-
<View
209-
style={[
210-
sharedStyles.horizontal,
211-
sharedStyles.alignItemsCenter,
212-
sharedStyles.paddingHorizontal,
213-
]}
214-
>
215-
{githubPersonalTokenDetails &&
216-
githubPersonalTokenDetails.token ? (
217-
<ThemedText
218-
color="foregroundColorMuted65"
219-
style={sharedStyles.flex}
212+
<View
213+
style={[
214+
sharedStyles.horizontal,
215+
sharedStyles.alignItemsCenter,
216+
sharedStyles.paddingHorizontal,
217+
]}
220218
>
221-
{new Array(githubPersonalTokenDetails.token.length)
222-
.fill('*')
223-
.join('')}
224-
</ThemedText>
225-
) : (
226-
<ThemedText
227-
color="foregroundColorMuted65"
228-
style={[sharedStyles.flex, { fontStyle: 'italic' }]}
229-
>
230-
No personal token
231-
</ThemedText>
232-
)}
233-
</View>
234-
</View>
219+
<ThemedText
220+
color="foregroundColorMuted65"
221+
style={sharedStyles.flex}
222+
>
223+
{new Array(githubPersonalTokenDetails.token.length)
224+
.fill('*')
225+
.join('')}
226+
</ThemedText>
227+
</View>
228+
</View>
235229

236-
<Spacer height={contentPadding} />
230+
<Spacer height={contentPadding} />
231+
</>
232+
)}
237233

238234
<View>
239235
<SubHeader title="Manage OAuth access" />

0 commit comments

Comments
 (0)