Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New navigation #2831

Draft
wants to merge 68 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
632885b
add basic navigation groups in side bar
bjosttveit Nov 26, 2024
6b6a07b
added states
bjosttveit Nov 26, 2024
aa3604c
only group as completed if any of its pages contain required components
bjosttveit Nov 26, 2024
161de52
conditionally render icon and make selectors lax
bjosttveit Nov 27, 2024
bd70467
add explanation
bjosttveit Nov 27, 2024
c116fd1
dont show state on group if open
bjosttveit Nov 27, 2024
b9393d1
currently, at least 1450 is required
bjosttveit Nov 27, 2024
edc176a
css tweaks
bjosttveit Nov 27, 2024
a4a449e
dont render sidebar when loading
bjosttveit Nov 27, 2024
c62346d
remove back button and move close button
bjosttveit Nov 27, 2024
5f36a4a
make inbox button less annoying in localtest
bjosttveit Nov 27, 2024
4c58ca1
clean up
bjosttveit Nov 27, 2024
932001d
dont show as completed if the page has any validation errors (even wh…
bjosttveit Nov 27, 2024
e66beb0
small tweaks
bjosttveit Nov 27, 2024
81a76ae
improve logic in states and hopefully make code more understandable
bjosttveit Nov 27, 2024
92f74bb
expand the definition of 'required'
bjosttveit Nov 27, 2024
3d8862e
started implementing navigation for smaller screen sizes
bjosttveit Nov 27, 2024
f2f0386
improve responsiveness
bjosttveit Nov 28, 2024
7a18efa
even more responsiveness
bjosttveit Nov 28, 2024
da93243
clean up
bjosttveit Nov 28, 2024
eb3d812
split into multiple files
bjosttveit Nov 28, 2024
1ce20cf
Merge branch 'main' into feat/navigation
bjosttveit Dec 5, 2024
176aab1
reorganize layout-settings hooks and use groups instead of order when…
bjosttveit Dec 5, 2024
cde35f4
make config require either groups or order
bjosttveit Dec 6, 2024
c26abba
add focus styling
bjosttveit Dec 6, 2024
37cfbe4
respect hidden pages
bjosttveit Dec 6, 2024
65fca33
add task config
bjosttveit Dec 17, 2024
cc7d633
Merge branch 'main' into feat/navigation
bjosttveit Dec 17, 2024
843bec0
more active state stuff
bjosttveit Dec 17, 2024
06b9e62
dont show navigation on receipt page
bjosttveit Dec 18, 2024
f6f4582
automatically determine task type
bjosttveit Dec 18, 2024
890a89e
Merge branch 'main' into feat/navigation
bjosttveit Dec 20, 2024
e27492d
isDev fixes [no-ci]
bjosttveit Dec 20, 2024
0bcd1ae
remove deleted class [no ci]
bjosttveit Dec 20, 2024
4fcabad
add some aria-things [no ci]
bjosttveit Dec 20, 2024
be651d9
Merge branch 'main' into feat/navigation [no ci]
bjosttveit Jan 2, 2025
c84f65b
Merge branch 'main' into feat/navigation [no ci]
bjosttveit Jan 3, 2025
89a5326
navigation scales better with more text
bjosttveit Jan 6, 2025
0f107df
improve mobile experience [no ci]
bjosttveit Jan 9, 2025
62d8536
popover navigation button active when open
bjosttveit Jan 9, 2025
1e5a13f
Merge branch 'main' into feat/navigation
bjosttveit Jan 9, 2025
252436e
flip chevron on navigation button when opening [no ci]
bjosttveit Jan 9, 2025
65e4eb4
required if not read only [no ci]
bjosttveit Jan 10, 2025
22a6ce1
Merge branch 'main' into feat/navigation [no ci]
bjosttveit Jan 13, 2025
646d3cb
remove material-ui from both AltinnAppHeaders and clean css [no ci]
bjosttveit Jan 13, 2025
bcdc68d
improve accessibility of language selector [no ci]
bjosttveit Jan 13, 2025
8af20cb
Merge branch 'main' into feat/navigation [no ci]
bjosttveit Jan 15, 2025
d25ebc8
refactor returnUrl, urlHelper, add back to main form, update tests [n…
bjosttveit Jan 16, 2025
b339f1b
remove unecessary nullish coalecence [no ci]
bjosttveit Jan 16, 2025
d40b03d
Merge branch 'main' into feat/navigation [no ci]
bjosttveit Jan 16, 2025
ce3a503
page more stable during loading [no ci]
bjosttveit Jan 16, 2025
526e437
add support for info icon and single page groups [no ci]
bjosttveit Jan 17, 2025
6fdd966
started changing done state logic
bjosttveit Jan 21, 2025
cde9019
test new method of using localstorage
bjosttveit Jan 21, 2025
98214eb
avoid setting a language as current when the app does not support it
bjosttveit Jan 22, 2025
c4dbf34
fixes
bjosttveit Jan 22, 2025
b5c8081
new localstorage store implementation using useSyncExternalStore
bjosttveit Jan 22, 2025
f802e9f
rename
bjosttveit Jan 22, 2025
3909065
comment
bjosttveit Jan 22, 2025
1b734fa
make scope keys more ergonomic
bjosttveit Jan 22, 2025
89c659e
implement visited pages into nav buttons and navigation state logic […
bjosttveit Jan 22, 2025
b2f4d08
make the last page also visited
bjosttveit Jan 23, 2025
ed47a05
Merge branch 'main' into feat/navigation
bjosttveit Jan 23, 2025
55f2c31
fix mocks [no ci]
bjosttveit Jan 23, 2025
9dfd6a4
update cypress tests
bjosttveit Jan 23, 2025
28a65d6
use exact match for back button
bjosttveit Jan 23, 2025
23154ea
hopefully fix cypress tests but cannot test until frontend-test gets …
bjosttveit Jan 24, 2025
64e1838
trigger tests ;)
bjosttveit Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 75 additions & 7 deletions src/codegen/Common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,15 +692,31 @@ const common = {
'An attribute specifying when the application will save form data. onChangeFormData saves on every interaction with form elements. onChangePage saves on every page change.',
),
),
new CG.prop(
'taskNavigation',
new CG.arr(
new CG.union(
new CG.obj(
// TODO: Add tests checking that this gets added
new CG.prop('id', new CG.str()).omitInSchema(),
new CG.prop('name', new CG.str().optional()),
new CG.prop('taskId', new CG.str()),
).exportAs('NavigationTask'),
new CG.obj(
// TODO: Add tests checking that this gets added
new CG.prop('id', new CG.str()).omitInSchema(),
new CG.prop('name', new CG.str().optional()),
new CG.prop('type', new CG.const('receipt')),
).exportAs('NavigationReceipt'),
).setUnionType('discriminated'),
)
.optional()
.setTitle('Task navigation settings')
.setDescription('Shows the listed tasks in the sidebar navigation menu'),
),
),
IPagesBaseSettings: () =>
new CG.obj(
new CG.prop(
'order',
new CG.arr(new CG.str())
.setTitle('Page order')
.setDescription('List of pages in the order they should appear in the application'),
),
new CG.prop(
'excludeFromPdf',
new CG.arr(new CG.str())
Expand All @@ -718,7 +734,59 @@ const common = {
),
),
),
IPagesSettings: () => new CG.obj().extends(CG.common('GlobalPageSettings')).extends(CG.common('IPagesBaseSettings')),
INavigationBasePageGroup: () =>
new CG.obj(
// TODO: Add tests checking that this gets added
new CG.prop('id', new CG.str()).omitInSchema(),
new CG.prop('type', new CG.enum('default', 'info').optional({ default: 'default' })),
new CG.prop(
'markAsCompleted',
new CG.bool()
.optional({ default: false })
.setDescription('Whether this group should mark pages as completed when the user finishes'),
),
),
IPagesSettingsWithGroups: () =>
new CG.obj(
new CG.prop(
'groups',
new CG.arr(
new CG.union(
new CG.obj(
new CG.prop('name', new CG.str()),
new CG.prop('single', new CG.const(false).optional({ default: false })),
new CG.prop('order', new CG.arr(new CG.str()).setMinItems(1)),
)
.extends(CG.common('INavigationBasePageGroup'))
.exportAs('NavigationPageGroupMultiple'),
new CG.obj(
new CG.prop('single', new CG.const(true)),
new CG.prop('order', new CG.arr(new CG.str()).setMinItems(1).setMaxItems(1)),
)
.extends(CG.common('INavigationBasePageGroup'))
.exportAs('NavigationPageGroupSingle'),
)
.setUnionType('discriminated')
.exportAs('NavigationPageGroup'),
)
.setTitle('Page groups')
.setDescription('List of page groups in the order they should appear in the application'),
),
).extends(CG.common('GlobalPageSettings'), CG.common('IPagesBaseSettings')),

IPagesSettingsWithOrder: () =>
new CG.obj(
new CG.prop(
'order',
new CG.arr(new CG.str())
.setTitle('Page order')
.setDescription('List of pages in the order they should appear in the application'),
),
).extends(CG.common('GlobalPageSettings'), CG.common('IPagesBaseSettings')),
IPagesSettings: () =>
new CG.union(CG.common('IPagesSettingsWithOrder'), CG.common('IPagesSettingsWithGroups')).setUnionType(
'discriminated',
),
ILayoutSettings: () =>
new CG.obj(
new CG.prop('$schema', new CG.str().optional()),
Expand Down
57 changes: 15 additions & 42 deletions src/components/AltinnAppHeader.module.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
.appBarWrapper {
.app-bar-wrapper {
flex-grow: 1;
}

.appBarWrapper header {
box-shadow: none;
}

.default {
.app-bar {
background-color: transparent;
padding-top: 1.875rem;
margin-bottom: 2.25rem;
padding-left: 0;
padding-right: 0;
box-sizing: border-box;
min-height: 64px;
display: flex;
position: relative;
align-items: center;
}

.headerLink {
.header-link {
display: inline;
color: var(--fds-semantic-surface-action-default);
font-size: 1.25rem;
line-height: 1.5;
Expand All @@ -36,51 +42,18 @@
}
}

.headerLinkList {
.header-link-list {
flex-grow: 1;
list-style: none;
margin: 0;
padding: 0;
float: left;
}

.headerLinkList li {
display: inline;
}

.headerProfile {
float: right;
}

.languageDropdown {
font-size: 0.875rem;
}

.logo {
margin-right: 0.75rem;
}

.partyIcon {
.party-icon {
margin-left: 5px;
}

.toolbarContainer {
padding-top: 1.875rem;
margin-bottom: 2.25rem;
padding-left: 0;
padding-right: 0;
box-sizing: border-box;
}

.toolbarContainer .a-personSwitcher {
margin-top: 0;
margin-left: 1.5rem;
}

.gridStyle {
flex-grow: 1;
}

.spanStyle {
margin-bottom: 10px;
}
116 changes: 55 additions & 61 deletions src/components/altinnAppHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';

import { AppBar, Toolbar } from '@material-ui/core';
import { Buildings3Icon, PersonIcon } from '@navikt/aksel-icons';

import { Flex } from 'src/app-components/Flex/Flex';
Expand All @@ -10,7 +9,7 @@ import { LandmarkShortcuts } from 'src/components/LandmarkShortcuts';
import { AltinnLogo, LogoColor } from 'src/components/logo/AltinnLogo';
import { Lang } from 'src/features/language/Lang';
import { renderParty } from 'src/utils/party';
import { returnUrlToAllSchemas, returnUrlToMessagebox, returnUrlToProfile } from 'src/utils/urls/urlHelper';
import { returnUrlToAllForms, returnUrlToMessagebox, returnUrlToProfile } from 'src/utils/urls/urlHelper';
import type { IProfile } from 'src/types/shared';

export interface IHeaderProps {
Expand All @@ -33,66 +32,61 @@ export const AltinnAppHeader = ({ profile }: IHeaderProps) => {
},
]}
/>
<AppBar
position='static'
className={classes.default}
>
<Toolbar className={classes.toolbarContainer}>
<Flex
item
className={classes.logo}
<header className={classes.appBar}>
<Flex
item
className={classes.logo}
>
<AltinnLogo color={LogoColor.blueDark} />
</Flex>
{party && (
<ul className={classes.headerLinkList}>
<li className={classes.headerLink}>
<a
className='altinnLink'
href={returnUrlToMessagebox(window.location.host, party?.partyId)}
>
<Lang id='instantiate.inbox' />
</a>
</li>
<li className={classes.headerLink}>
<a
className='altinnLink'
href={returnUrlToAllForms(window.location.host)}
>
<Lang id='instantiate.all_forms' />
</a>
</li>
<li className={classes.headerLink}>
<a
className='altinnLink'
href={returnUrlToProfile(window.location.host, party?.partyId)}
>
<Lang id='instantiate.profile' />
</a>
</li>
</ul>
)}
{party && (
<CircleIcon
size='1.5rem'
className={classes.partyIcon}
title={renderParty(profile) || ''}
>
<AltinnLogo color={LogoColor.blueDark} />
</Flex>
{party && (
<ul className={classes.headerLinkList}>
<li className={classes.headerLink}>
<a
className='altinnLink'
href={returnUrlToMessagebox(window.location.origin, party?.partyId) || '#'}
>
<Lang id='instantiate.inbox' />
</a>
</li>
<li className={classes.headerLink}>
<a
className='altinnLink'
href={returnUrlToAllSchemas(window.location.origin) || '#'}
>
<Lang id='instantiate.all_forms' />
</a>
</li>
<li className={classes.headerLink}>
<a
className='altinnLink'
href={returnUrlToProfile(window.location.origin, party?.partyId) || '#'}
>
<Lang id='instantiate.profile' />
</a>
</li>
</ul>
)}
{party && (
<CircleIcon
size='1.5rem'
className={classes.partyIcon}
title={renderParty(profile) || ''}
>
{party.orgNumber ? (
<Buildings3Icon
color='white'
aria-hidden='true'
/>
) : (
<PersonIcon
color='white'
aria-hidden='true'
/>
)}
</CircleIcon>
)}
</Toolbar>
</AppBar>
{party.orgNumber ? (
<Buildings3Icon
color='white'
aria-hidden='true'
/>
) : (
<PersonIcon
color='white'
aria-hidden='true'
/>
)}
</CircleIcon>
)}
</header>
</div>
);
};
21 changes: 11 additions & 10 deletions src/components/organisms/AltinnAppHeader.module.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
.appBar {
box-shadow: none;
z-index: 800;
}

.appBarText {
font-size: 0.875rem;
font-weight: 500;
}

.container {
width: 100%;
display: flex;
Expand All @@ -34,3 +24,14 @@
align-items: center;
gap: 0.5rem;
}

.partyName {
font-size: 0.875rem;
font-weight: 500;
}

@media (max-width: 768px) {
.partyName {
display: none;
}
}
Loading
Loading