diff --git a/plugins/auth-react/package.json b/plugins/auth-react/package.json index e5eb7db192..9de3aade21 100644 --- a/plugins/auth-react/package.json +++ b/plugins/auth-react/package.json @@ -35,8 +35,6 @@ "@backstage/core-components": "workspace:^", "@backstage/core-plugin-api": "workspace:^", "@backstage/errors": "workspace:^", - "@backstage/frontend-plugin-api": "workspace:^", - "@backstage/version-bridge": "workspace:^", "@material-ui/core": "^4.9.13", "@react-hookz/web": "^24.0.0", "@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0" diff --git a/plugins/auth-react/src/components/CookieAuthRefreshProvider/CompatAppProgress.tsx b/plugins/auth-react/src/components/CookieAuthRefreshProvider/CompatAppProgress.tsx deleted file mode 100644 index e624d46304..0000000000 --- a/plugins/auth-react/src/components/CookieAuthRefreshProvider/CompatAppProgress.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from 'react'; -import { useApp } from '@backstage/core-plugin-api'; -import { useVersionedContext } from '@backstage/version-bridge'; - -import { - coreComponentRefs, - useComponentRef, -} from '@backstage/frontend-plugin-api'; - -function LegacyAppProgress() { - const app = useApp(); - const { Progress } = app.getComponents(); - return ; -} - -function NewAppProgress() { - const Progress = useComponentRef(coreComponentRefs.progress); - return ; -} - -export function CompatAppProgress() { - const isInNewApp = !useVersionedContext<{ 1: unknown }>('app-context'); - return isInNewApp ? : ; -} diff --git a/plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx b/plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx index 2287ab4ad7..4f676aa2d5 100644 --- a/plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx +++ b/plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx @@ -16,9 +16,9 @@ import React, { ReactNode } from 'react'; import { ErrorPanel } from '@backstage/core-components'; -import { Button } from '@material-ui/core'; +import { useApp } from '@backstage/core-plugin-api'; +import Button from '@material-ui/core/Button'; import { useCookieAuthRefresh } from '../../hooks'; -import { CompatAppProgress } from './CompatAppProgress'; /** * @public @@ -41,12 +41,13 @@ export function CookieAuthRefreshProvider( props: CookieAuthRefreshProviderProps, ): JSX.Element { const { children, ...options } = props; + const app = useApp(); + const { Progress } = app.getComponents(); const result = useCookieAuthRefresh(options); if (result.status === 'loading') { - // This component should be compatible with both old and new frontend systems - return ; + return ; } if (result.status === 'error') { diff --git a/yarn.lock b/yarn.lock index 6ce1ec54f3..200ecd0ff3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4193,7 +4193,6 @@ __metadata: "@backstage/core-plugin-api": "workspace:^" "@backstage/errors": "workspace:^" "@backstage/frontend-plugin-api": "workspace:^" - "@backstage/plugin-auth-react": "workspace:^" "@backstage/test-utils": "workspace:^" "@backstage/theme": "workspace:^" "@backstage/types": "workspace:^" @@ -5112,9 +5111,7 @@ __metadata: "@backstage/core-components": "workspace:^" "@backstage/core-plugin-api": "workspace:^" "@backstage/errors": "workspace:^" - "@backstage/frontend-plugin-api": "workspace:^" "@backstage/test-utils": "workspace:^" - "@backstage/version-bridge": "workspace:^" "@material-ui/core": ^4.9.13 "@react-hookz/web": ^24.0.0 "@testing-library/jest-dom": ^6.0.0