Skip to content

Commit a73784c

Browse files
authored
chore(admin): cleanup (#18241)
1 parent df15575 commit a73784c

File tree

8 files changed

+29
-40
lines changed

8 files changed

+29
-40
lines changed

.github/workflows/deploy-designer.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010
- '.github/workflows/template-short-sha.yaml'
1111
- 'src/Designer/backend/**'
1212
- 'src/Designer/frontend/**'
13-
- '!src/Designer/frontend/admin/**'
1413
- 'src/Designer/Dockerfile'
1514
- 'package.json'
1615
- 'charts/altinn-designer/**'

.github/workflows/designer-frontend-run-playwright-on-pr.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
types: [opened, reopened, synchronize, ready_for_review]
66
paths:
77
- 'src/Designer/frontend/**'
8-
- '!src/Designer/frontend/admin/**'
98
- '!src/Designer/frontend/stats/**'
109
- 'src/Designer/backend/**'
1110
- '.github/workflows/designer-frontend-run-playwright-on-pr.yaml'

src/Designer/development/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ These are created by the script and are found at the root in the `.env`-file.
1919
CYPRESS_TEST_APP=<cypress-test-app>
2020
DEVELOP_APP_DEVELOPMENT=0
2121
DEVELOP_RESOURCE_ADMIN=0
22-
DEVELOP_ADMIN_FRONTEND=0
22+
DEVELOP_ADMIN=0
2323
DEVELOP_BACKEND=1
2424
DEVELOP_DASHBOARD=0
2525
DEVELOP_PREVIEW=0

src/Designer/frontend/admin/layout/NotFoundPage.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { StudioNotFoundPage } from '@studio/components';
2-
import { Paragraph, Link } from '@digdir/designsystemet-react';
1+
import { StudioNotFoundPage, StudioParagraph, StudioLink } from '@studio/components';
32
import { useTranslation, Trans } from 'react-i18next';
43

54
export const NotFoundPage = () => {
@@ -9,14 +8,14 @@ export const NotFoundPage = () => {
98
<StudioNotFoundPage
109
title={t('not_found_page.heading')}
1110
body={
12-
<Paragraph size='small'>
11+
<StudioParagraph>
1312
<Trans
1413
i18nKey='not_found_page.text'
1514
components={{
16-
a: <Link href='/info/contact'> </Link>,
15+
a: <StudioLink href='/info/contact'> </StudioLink>,
1716
}}
1817
></Trans>
19-
</Paragraph>
18+
</StudioParagraph>
2019
}
2120
redirectHref='/'
2221
redirectLinkText={t('not_found_page.redirect_to_dashboard')}

src/Designer/frontend/admin/layout/PageHeader.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import userEvent from '@testing-library/user-event';
33
import { MemoryRouter } from 'react-router-dom';
44
import { textMock } from '@studio/testing/mocks/i18nMock';
55
import { PageHeader } from './PageHeader';
6-
import { useMediaQuery } from '@studio/components-legacy';
6+
import { useMediaQuery } from '@studio/hooks';
77
import type { AltinnStudioEnvironment } from 'app-shared/utils/altinnStudioEnv';
88

99
const mockEnvironment: {
@@ -13,8 +13,8 @@ const mockEnvironment: {
1313
} = { environment: null, isLoading: false, error: null };
1414
const mockLogout = jest.fn();
1515

16-
jest.mock('@studio/components-legacy', () => ({
17-
...jest.requireActual('@studio/components-legacy'),
16+
jest.mock('@studio/hooks', () => ({
17+
...jest.requireActual('@studio/hooks'),
1818
useMediaQuery: jest.fn(),
1919
}));
2020

src/Designer/frontend/admin/layout/PageHeader.tsx

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { MEDIA_QUERY_MAX_WIDTH, USER_SETTINGS_BASENAME } from 'app-shared/constants';
22
import type { Org } from 'app-shared/types/OrgList';
3-
import type { StudioProfileMenuGroup } from '@studio/components-legacy';
4-
import { StudioPageHeader, useMediaQuery } from '@studio/components-legacy';
5-
import { StudioAvatar } from '@studio/components';
3+
import type { StudioProfileMenuGroup } from '@studio/components';
4+
import { StudioPageHeader, StudioAvatar } from '@studio/components';
5+
import { useMediaQuery } from '@studio/hooks';
66
import type { ReactElement } from 'react';
77
import { useTranslation } from 'react-i18next';
88
import type { User } from 'app-shared/types/Repository';
@@ -20,18 +20,20 @@ export const PageHeader = (): ReactElement => {
2020
const { i18n } = useTranslation();
2121

2222
return (
23-
<StudioPageHeader>
24-
<StudioPageHeader.Main>
25-
<StudioPageHeader.Left
26-
showTitle={shouldDisplayDesktopMenu}
27-
title={org.name[i18n.language]}
28-
/>
29-
{shouldDisplayDesktopMenu && <CenterContent />}
30-
<StudioPageHeader.Right>
31-
<ProfileMenu org={org} user={user} />
32-
</StudioPageHeader.Right>
33-
</StudioPageHeader.Main>
34-
</StudioPageHeader>
23+
<div data-color-scheme='dark'>
24+
<StudioPageHeader>
25+
<StudioPageHeader.Main>
26+
<StudioPageHeader.Left
27+
showTitle={shouldDisplayDesktopMenu}
28+
title={org.name[i18n.language]}
29+
/>
30+
{shouldDisplayDesktopMenu && <CenterContent />}
31+
<StudioPageHeader.Right>
32+
<ProfileMenu org={org} user={user} />
33+
</StudioPageHeader.Right>
34+
</StudioPageHeader.Main>
35+
</StudioPageHeader>
36+
</div>
3537
);
3638
};
3739

@@ -42,26 +44,20 @@ const CenterContent = (): ReactElement => {
4244
return (
4345
<StudioPageHeader.Center>
4446
<StudioPageHeader.HeaderLink
45-
color='dark'
46-
variant='regular'
4747
renderLink={(props) => (
4848
<a href={`/dashboard/app-dashboard/${org}`} {...props}>
4949
<span>{t('dashboard.header_item_dashboard')}</span>
5050
</a>
5151
)}
5252
/>
5353
<StudioPageHeader.HeaderLink
54-
color='dark'
55-
variant='regular'
5654
renderLink={(props) => (
57-
<NavLink to={`/${org}/apps`} {...props}>
55+
<NavLink data-color='dark' to={`/${org}/apps`} {...props}>
5856
<span className={classes.active}>{t('admin.apps.title')}</span>
5957
</NavLink>
6058
)}
6159
/>
6260
<StudioPageHeader.HeaderLink
63-
color='dark'
64-
variant='regular'
6561
isBeta={true}
6662
renderLink={(props) => (
6763
<a href={`/dashboard/org-library/${org}`} {...props}>
@@ -118,16 +114,13 @@ const ProfileMenu = ({ user, org }: ProfileMenuProps): ReactElement => {
118114
<StudioPageHeader.ProfileMenu
119115
profileMenuGroups={profileMenuGroups}
120116
triggerButtonText={userNameAndOrg}
121-
ariaLabelTriggerButton={userNameAndOrg}
122117
profileImage={
123118
<StudioAvatar
124119
src={user?.avatar_url}
125120
alt={t('general.profile_icon')}
126121
title={t('shared.header_profile_icon_text')}
127122
/>
128123
}
129-
color='dark'
130-
variant={'regular'}
131124
/>
132125
);
133126
};

src/Designer/frontend/admin/router/PageRouterErrorBoundary.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { ReactElement } from 'react';
2-
import { StudioParagraph, StudioPageError } from '@studio/components';
2+
import { StudioParagraph, StudioPageError, StudioLink } from '@studio/components';
33
import { Trans, useTranslation } from 'react-i18next';
4-
import { Link } from '@digdir/designsystemet-react';
54

65
export const ErrorBoundary = (): ReactElement => {
76
const { t } = useTranslation();
@@ -13,7 +12,7 @@ export const ErrorBoundary = (): ReactElement => {
1312
<Trans
1413
i18nKey={'general.page_error_message'}
1514
components={{
16-
a: <Link href='/info/contact'> </Link>,
15+
a: <StudioLink href='/info/contact'> </StudioLink>,
1716
}}
1817
/>
1918
</StudioParagraph>

src/Designer/frontend/admin/router/PageRoutes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const BASE_PATH = '/:org';
2020

2121
const router = createBrowserRouter(
2222
createRoutesFromElements(
23-
<Route path='/' element={<App />} errorElement={<AppRouteErrorBoundary />}>
23+
<Route element={<App />} errorElement={<AppRouteErrorBoundary />}>
2424
<Route path={BASE_PATH} element={<PageLayout />} errorElement={<RouteErrorBoundary />}>
2525
{routerRoutes.map((route) => (
2626
<Route

0 commit comments

Comments
 (0)