From 3863d0cfb4d0d2ae6878670e5495b8b913baa51c Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Wed, 25 Dec 2024 19:03:04 +0100 Subject: [PATCH 1/8] feat(accounts): warn when missing scopes Signed-off-by: Adam Setch --- src/renderer/routes/Accounts.tsx | 23 ++++- .../__snapshots__/Accounts.test.tsx.snap | 99 ++++++++++++++++++- src/renderer/types.ts | 1 + src/renderer/utils/auth/utils.ts | 4 + 4 files changed, 123 insertions(+), 4 deletions(-) diff --git a/src/renderer/routes/Accounts.tsx b/src/renderer/routes/Accounts.tsx index e906ce1a9..9bc9a8d17 100644 --- a/src/renderer/routes/Accounts.tsx +++ b/src/renderer/routes/Accounts.tsx @@ -1,4 +1,5 @@ import { + AlertFillIcon, FeedPersonIcon, KeyIcon, MarkGithubIcon, @@ -23,6 +24,7 @@ import { type Account, IconColor, Size } from '../types'; import { getAccountUUID, refreshAccount } from '../utils/auth/utils'; import { cn } from '../utils/cn'; import { updateTrayIcon, updateTrayTitle } from '../utils/comms'; +import { Constants } from '../utils/constants'; import { openAccountProfile, openDeveloperSettings, @@ -78,7 +80,7 @@ export const AccountsRoute: FC = () => { className="mb-4 flex items-center justify-between rounded-md bg-gray-100 p-2 dark:bg-gray-sidebar" >
-
+
+ +
+ + +
+ + +
+ + +
+
+ +
+
+ +
+
+
+ + + + +
+
+ + +
+
+ Add new account +
+
+ + + +
+
+ +`; + +exports[`renderer/routes/Accounts.tsx General should render with PAT scopes warning 1`] = ` +
+
+ +

+ + + Accounts + +

+
+
+
+
+
+
+ + + + +
+
+ +
+
+ +
+
+
+ + + + +
+
+
+
+
+ + + + +
+
+ +
+
+ +
+
+
+ + + + +
+
+
+
+
+ + + - + {account.method === 'Personal Access Token' && + account.hasRequiredScopes === false && ( + + + + )}
-
- - -
- - -
-
- - -
-
+
- {account.method === 'Personal Access Token' && - account.hasRequiredScopes === false && ( - - - - )} + {account.hasRequiredScopes === false && ( + + + + )}