Skip to content

Commit c9f3033

Browse files
committed
Better PAT name suggestion for each device
1 parent fbedabe commit c9f3033

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

packages/components/src/components/context/LoginHelpersContext.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
clearOAuthQueryParams,
3030
clearQueryStringFromURL,
3131
} from '../../utils/helpers/auth'
32+
import { Platform } from '../../libs/platform'
3233

3334
export interface LoginHelpersProviderProps {
3435
children?: React.ReactNode
@@ -145,8 +146,22 @@ export function LoginHelpersProvider(props: LoginHelpersProviderProps) {
145146
{
146147
text: 'Create new token',
147148
onPress: () => {
149+
const description = Platform.isMacOS
150+
? 'DevHub (macOS native)'
151+
: Platform.isElectron
152+
? `DevHub (${Platform.realOS})`
153+
: Platform.isDesktop
154+
? `DevHub (${Platform.realOS})`
155+
: Platform.isPad
156+
? 'DevHub (iPad)'
157+
: Platform.OS === 'ios'
158+
? 'DevHub (iOS)'
159+
: `DevHub (${Platform.OS})`
160+
148161
Browser.openURLOnNewTab(
149-
`https://github.com/settings/tokens/new?description=DevHub&scopes=${(
162+
`https://github.com/settings/tokens/new?description=${encodeURIComponent(
163+
description,
164+
)}&scopes=${(
150165
constants.FULL_ACCESS_GITHUB_OAUTH_SCOPES ||
151166
_.uniq([...constants.DEFAULT_GITHUB_OAUTH_SCOPES, 'repo'])
152167
).join(',')}`,

0 commit comments

Comments
 (0)