diff --git a/package.json b/package.json index ab1ba9f7f..29228184c 100644 --- a/package.json +++ b/package.json @@ -171,7 +171,6 @@ "nprogress": "0.2.0", "postcss": "8.5.1", "postcss-loader": "8.1.1", - "react-final-form": "6.5.9", "rimraf": "6.0.1", "semver": "7.6.3", "styled-components": "6.1.14", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4870b9a01..9b3dd2103 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -138,9 +138,6 @@ importers: postcss-loader: specifier: 8.1.1 version: 8.1.1(postcss@8.5.1)(typescript@5.7.3)(webpack@5.97.1) - react-final-form: - specifier: 6.5.9 - version: 6.5.9(final-form@4.20.10)(react@19.0.0) rimraf: specifier: 6.0.1 version: 6.0.1 @@ -3638,12 +3635,6 @@ packages: peerDependencies: react: ^19.0.0 - react-final-form@6.5.9: - resolution: {integrity: sha512-x3XYvozolECp3nIjly+4QqxdjSSWfcnpGEL5K8OBT6xmGrq5kBqbA6+/tOqoom9NwqIPPbxPNsOViFlbKgowbA==} - peerDependencies: - final-form: ^4.20.4 - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-intersection-observer@9.13.1: resolution: {integrity: sha512-tSzDaTy0qwNPLJHg8XZhlyHTgGW6drFKTtvjdL+p6um12rcnp8Z5XstE+QNBJ7c64n5o0Lj4ilUleA41bmDoMw==} peerDependencies: @@ -8598,12 +8589,6 @@ snapshots: react: 19.0.0 scheduler: 0.25.0 - react-final-form@6.5.9(final-form@4.20.10)(react@19.0.0): - dependencies: - '@babel/runtime': 7.24.1 - final-form: 4.20.10 - react: 19.0.0 - react-intersection-observer@9.13.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0): dependencies: react: 19.0.0 diff --git a/src/renderer/components/fields/FieldInput.test.tsx b/src/renderer/components/fields/FieldInput.test.tsx deleted file mode 100644 index 0e2035a9a..000000000 --- a/src/renderer/components/fields/FieldInput.test.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { render } from '@testing-library/react'; -import { Form } from 'react-final-form'; -import { FieldInput, type IFieldInput } from './FieldInput'; - -describe('renderer/components/fields/FieldInput.tsx', () => { - const props: IFieldInput = { - name: 'appearance', - label: 'Appearance', - placeholder: 'This is some placeholder text', - helpText: 'This is some helper text', - }; - - it('should render', () => { - const tree = render( -
{}} - hand - render={({ handleSubmit }) => ( - - - - )} - />, - ); - expect(tree).toMatchSnapshot(); - }); -}); diff --git a/src/renderer/components/fields/FieldInput.tsx b/src/renderer/components/fields/FieldInput.tsx deleted file mode 100644 index c58207c8f..000000000 --- a/src/renderer/components/fields/FieldInput.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import type { FC, ReactNode } from 'react'; -import { Field } from 'react-final-form'; -import { cn } from '../../utils/cn'; - -export interface IFieldInput { - name: string; - type?: string; - label: string; - placeholder?: string; - helpText?: ReactNode | string; - required?: boolean; -} - -export const FieldInput: FC = ({ - label, - name, - placeholder, - helpText, - type = 'text', - required = false, -}) => { - return ( - - {({ input, meta: { touched, error } }) => ( -
- - - - - {helpText && ( -
{helpText}
- )} - - {touched && error && ( -
{error}
- )} -
- )} -
- ); -}; diff --git a/src/renderer/components/fields/__snapshots__/FieldInput.test.tsx.snap b/src/renderer/components/fields/__snapshots__/FieldInput.test.tsx.snap deleted file mode 100644 index f2d15383f..000000000 --- a/src/renderer/components/fields/__snapshots__/FieldInput.test.tsx.snap +++ /dev/null @@ -1,114 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renderer/components/fields/FieldInput.tsx should render 1`] = ` -{ - "asFragment": [Function], - "baseElement": -
-
-
- - -
- This is some helper text -
-
-
-
- , - "container":
-
-
- - -
- This is some helper text -
-
-
-
, - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; diff --git a/src/renderer/components/layout/Centered.tsx b/src/renderer/components/layout/Centered.tsx index 3e13f17a3..65ab9f793 100644 --- a/src/renderer/components/layout/Centered.tsx +++ b/src/renderer/components/layout/Centered.tsx @@ -3,20 +3,17 @@ import type { FC, ReactNode } from 'react'; interface ICentered { children: ReactNode; - fullHeight?: boolean; + fullHeight: boolean; } -export const Centered: FC = ({ - fullHeight = true, - ...props -}: ICentered) => { +export const Centered: FC = (props: ICentered) => { return ( {props.children} diff --git a/src/renderer/components/layout/Contents.tsx b/src/renderer/components/layout/Contents.tsx index d7d4a1e25..b50b08272 100644 --- a/src/renderer/components/layout/Contents.tsx +++ b/src/renderer/components/layout/Contents.tsx @@ -1,3 +1,4 @@ +import { Box } from '@primer/react'; import type { FC, ReactNode } from 'react'; interface IContents { @@ -5,5 +6,9 @@ interface IContents { } export const Contents: FC = (props: IContents) => { - return
{props.children}
; + return ( + + {props.children} + + ); }; diff --git a/src/renderer/components/layout/Page.test.tsx b/src/renderer/components/layout/Page.test.tsx index 9c1727373..bf51c7ec6 100644 --- a/src/renderer/components/layout/Page.test.tsx +++ b/src/renderer/components/layout/Page.test.tsx @@ -2,22 +2,8 @@ import { render } from '@testing-library/react'; import { Page } from './Page'; describe('renderer/components/layout/Page.tsx', () => { - it('should render itself & its children - full', () => { - const tree = render( - - Test - , - ); - - expect(tree).toMatchSnapshot(); - }); - - it('should render itself & its children - screen', () => { - const tree = render( - - Test - , - ); + it('should render itself & its children', () => { + const tree = render(Test); expect(tree).toMatchSnapshot(); }); diff --git a/src/renderer/components/layout/Page.tsx b/src/renderer/components/layout/Page.tsx index 2d335f6bb..123ccdac0 100644 --- a/src/renderer/components/layout/Page.tsx +++ b/src/renderer/components/layout/Page.tsx @@ -1,16 +1,15 @@ +import { Box } from '@primer/react'; import type { FC, ReactNode } from 'react'; -import { cn } from '../../utils/cn'; interface IPage { children: ReactNode; id: string; - type: 'h-full' | 'h-screen'; } export const Page: FC = (props: IPage) => { return ( -
+ {props.children} -
+ ); }; diff --git a/src/renderer/components/layout/__snapshots__/Contents.test.tsx.snap b/src/renderer/components/layout/__snapshots__/Contents.test.tsx.snap index 94a38f280..ef2f6fb2f 100644 --- a/src/renderer/components/layout/__snapshots__/Contents.test.tsx.snap +++ b/src/renderer/components/layout/__snapshots__/Contents.test.tsx.snap @@ -6,7 +6,7 @@ exports[`renderer/components/layout/Contents.tsx should render itself & its chil "baseElement":
Test
@@ -14,7 +14,7 @@ exports[`renderer/components/layout/Contents.tsx should render itself & its chil , "container":
Test
diff --git a/src/renderer/components/layout/__snapshots__/Page.test.tsx.snap b/src/renderer/components/layout/__snapshots__/Page.test.tsx.snap index 4fbafd1e1..2942df524 100644 --- a/src/renderer/components/layout/__snapshots__/Page.test.tsx.snap +++ b/src/renderer/components/layout/__snapshots__/Page.test.tsx.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renderer/components/layout/Page.tsx should render itself & its children - full 1`] = ` +exports[`renderer/components/layout/Page.tsx should render itself & its children 1`] = ` { "asFragment": [Function], "baseElement":
Test @@ -15,82 +15,7 @@ exports[`renderer/components/layout/Page.tsx should render itself & its children , "container":
- Test -
-
, - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; - -exports[`renderer/components/layout/Page.tsx should render itself & its children - screen 1`] = ` -{ - "asFragment": [Function], - "baseElement": -
-
- Test -
-
- , - "container":
-
Test diff --git a/src/renderer/components/primitives/Footer.tsx b/src/renderer/components/primitives/Footer.tsx index c1d2d637b..861d9f95c 100644 --- a/src/renderer/components/primitives/Footer.tsx +++ b/src/renderer/components/primitives/Footer.tsx @@ -1,4 +1,4 @@ -import { Stack } from '@primer/react'; +import { Box, Stack } from '@primer/react'; import type { FC, ReactNode } from 'react'; interface IFooter { @@ -8,13 +8,10 @@ interface IFooter { export const Footer: FC = (props: IFooter) => { return ( - - {props.children} - + + + {props.children} + + ); }; diff --git a/src/renderer/components/primitives/Header.tsx b/src/renderer/components/primitives/Header.tsx index 189474a11..1d72ffb42 100644 --- a/src/renderer/components/primitives/Header.tsx +++ b/src/renderer/components/primitives/Header.tsx @@ -2,7 +2,7 @@ import { type FC, useContext } from 'react'; import { useNavigate } from 'react-router-dom'; import { ArrowLeftIcon, type Icon } from '@primer/octicons-react'; -import { IconButton, Stack } from '@primer/react'; +import { Box, IconButton, Stack } from '@primer/react'; import { AppContext } from '../../context/App'; import { Title } from './Title'; @@ -19,24 +19,26 @@ export const Header: FC = (props: IHeader) => { const { fetchNotifications } = useContext(AppContext); return ( - - { - navigate(-1); - if (props.fetchOnBack) { - fetchNotifications(); - } - }} - data-testid="header-nav-back" - /> + + + { + navigate(-1); + if (props.fetchOnBack) { + fetchNotifications(); + } + }} + data-testid="header-nav-back" + /> - - {props.children} - - + + {props.children} + + + ); }; diff --git a/src/renderer/components/primitives/__snapshots__/Footer.test.tsx.snap b/src/renderer/components/primitives/__snapshots__/Footer.test.tsx.snap index 10e487af2..d347c3a50 100644 --- a/src/renderer/components/primitives/__snapshots__/Footer.test.tsx.snap +++ b/src/renderer/components/primitives/__snapshots__/Footer.test.tsx.snap @@ -6,7 +6,27 @@ exports[`renderer/components/primitives/Footer.tsx should render itself & its ch "baseElement":
+
+ , + "container":
+ `; exports[`renderer/routes/Accounts.tsx General should render itself & its children 1`] = `
- - -
-

+ +
- Accounts -

-
-
+ +

+ Accounts +

+
+ +
`; diff --git a/src/renderer/routes/__snapshots__/Filters.test.tsx.snap b/src/renderer/routes/__snapshots__/Filters.test.tsx.snap index 1a288aa44..c79e05f1d 100644 --- a/src/renderer/routes/__snapshots__/Filters.test.tsx.snap +++ b/src/renderer/routes/__snapshots__/Filters.test.tsx.snap @@ -2,59 +2,34 @@ exports[`renderer/routes/Filters.tsx General should render itself & its children 1`] = `
- - -
-

+ +
- Filters -

-
-
+ +

+ Filters +

+
+ +
`; diff --git a/src/renderer/routes/__snapshots__/LoginWithOAuthApp.test.tsx.snap b/src/renderer/routes/__snapshots__/LoginWithOAuthApp.test.tsx.snap index bbdccd7db..7551718b3 100644 --- a/src/renderer/routes/__snapshots__/LoginWithOAuthApp.test.tsx.snap +++ b/src/renderer/routes/__snapshots__/LoginWithOAuthApp.test.tsx.snap @@ -5,57 +5,35 @@ exports[`renderer/routes/LoginWithOAuthApp.tsx renders correctly 1`] = ` "asFragment": [Function], "baseElement":
-
+
- - -
-

+ +
- Login with OAuth App -

-
-
+ +

+ Login with OAuth App +

+
+ +
-
-
- +
+ Hostname +
+ + * + + + + -
+ + -
+ +
+
+ - - on GitHub then paste your - -
- - - client id and client secret - - below. - -
-
-
-
+ + + + Create new OAuth App + + + + - + client id & secret + + below. + +
+
+ + -
-
+
+
+ + -
-
+ + +
+
+
+
, "container":
-
+
- - -
-

+ +
- Login with OAuth App -

-
-
+ +

+ Login with OAuth App +

+
+ +
-
-
- +
+ Hostname +
+ + * + + + + -
+ + -
+ +
+
+ - - on GitHub then paste your - -
- - - client id and client secret - - below. - -
-
-
-
+ + + + Create new OAuth App + + + + - + client id & secret + + below. + +
+
+ + -
-
+
+
+ + -
-
+ + +
+
+
+ diff --git a/src/renderer/routes/__snapshots__/LoginWithPersonalAccessToken.test.tsx.snap b/src/renderer/routes/__snapshots__/LoginWithPersonalAccessToken.test.tsx.snap index c62d9a7ec..4f7aa5447 100644 --- a/src/renderer/routes/__snapshots__/LoginWithPersonalAccessToken.test.tsx.snap +++ b/src/renderer/routes/__snapshots__/LoginWithPersonalAccessToken.test.tsx.snap @@ -6,223 +6,181 @@ exports[`renderer/routes/LoginWithPersonalAccessToken.tsx renders correctly 1`] "baseElement":
- -
- -

- Login with Personal Access Token -

+ + + +
+ +

+ Login with Personal Access Token +

+
+
-
-
-
+
-
+
- -
-
- - Change only if you are using GitHub Enterprise Server. -
- - - on GitHub then paste your token below. - + Hostname
- - The required scopes will be automatically selected for you. - -
-
-
-
- - + + + + + + Change only if you are using GitHub Enterprise Server + +
- - - + on GitHub to paste the token below. + +
+ - - + required scopes + + + + will be automatically selected for you. +
-
-
-
- - , - "container":
-
- - -
- -

- Login with Personal Access Token -

-
-
-
-
-
-
-
- -
-
- - Change only if you are using GitHub Enterprise Server. - -
+ Token +
+ + * + + + + + + -
- - The required scopes will be automatically selected for you. - -
+ +
-
- - -
+
+ +
+ + , + "container":
+
+
+
+ + +
+ +

+ Login with Personal Access Token +

+
+
+
+
+
+
+
+ + + + + + Change only if you are using GitHub Enterprise Server + + +
+
+
+ + on GitHub to paste the token below. + +
+ + The + + + + required scopes + + + + will be automatically selected for you. + +
+
+ + + + + + +
- +
+
+
, diff --git a/src/renderer/routes/__snapshots__/Settings.test.tsx.snap b/src/renderer/routes/__snapshots__/Settings.test.tsx.snap index 73503354c..f5345dd2e 100644 --- a/src/renderer/routes/__snapshots__/Settings.test.tsx.snap +++ b/src/renderer/routes/__snapshots__/Settings.test.tsx.snap @@ -2,59 +2,34 @@ exports[`renderer/routes/Settings.tsx should render itself & its children 1`] = `
- - -
-

+ +
- Settings -

-
-
+ +

+ Settings +

+
+ +
diff --git a/src/renderer/utils/auth/utils.ts b/src/renderer/utils/auth/utils.ts index d0a3504ff..878ec920b 100644 --- a/src/renderer/utils/auth/utils.ts +++ b/src/renderer/utils/auth/utils.ts @@ -284,3 +284,7 @@ export function hasAccounts(auth: AuthState) { export function hasMultipleAccounts(auth: AuthState) { return auth.accounts.length > 1; } + +export function formatRequiredScopes() { + return Constants.AUTH_SCOPE.join(', '); +}