Skip to content

Commit

Permalink
Merge pull request #393 from navikt/andnorda-patch-1
Browse files Browse the repository at this point in the history
add hotkey alt+a for aktivitetsplan
  • Loading branch information
LudvigHz authored Apr 10, 2024
2 parents 55f43c2 + cf05c9b commit 6895248
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/lenker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const pesysUrl = (fnr: string, path: string) => (fnr ? pesysDomain(path) : pesys
export const gosysUrl = (fnr: string, path: string) => fnr ? gosysDomain(path) : gosysDomain('/gosys/');
const fpsakUrl = `https://fpsak${finnNaisInternNavMiljoStreng()}`
const foreldrePengerUrl = (aktoerId: string) => aktoerId ? `${fpsakUrl}/aktoer/${aktoerId}` : `${fpsakUrl}/`;
const aktivitetsplanUrl = (fnr: string, enhet: string) => `https://veilarbpersonflate${finnNaisInternNavMiljoStreng()}/${fnr ? fnr : ''}?enhet=${enhet}`;

const inst2 = () => `https://inst2-web${finnNaisMiljoStreng(true)}/`;
function k9Url(aktorId: string): string {
Expand All @@ -71,7 +72,7 @@ function openUrl(url: string): () => void {
return () => { window.open(url, '_blank'); };
}

function lagHotkeys(fnr: string, aktorId: string): Array<Hotkey> {
function lagHotkeys(fnr: string, aktorId: string, enhet: string): Array<Hotkey> {
return [
{
key: { char: 'G', altKey: true },
Expand All @@ -92,6 +93,11 @@ function lagHotkeys(fnr: string, aktorId: string): Array<Hotkey> {
key: { char: 'K', altKey: true },
action: openUrl(foreldrePengerUrl(aktorId)),
description: 'Gå til fpsak'
},
{
key: { char: 'A', altKey: true },
action: openUrl(aktivitetsplanUrl(fnr, enhet)),
description: 'Gå til aktivitetsplan'
}
];
}
Expand All @@ -110,8 +116,8 @@ function Lenker(props: Props) {

const { register } = useDecoratorHotkeys();
useEffect(() => {
lagHotkeys(fnr, aktorId).forEach(register);
}, [register, fnr, aktorId])
lagHotkeys(fnr, aktorId, enhet).forEach(register);
}, [register, fnr, aktorId, enhet])

if (!props.apen.value) {
return null;
Expand Down Expand Up @@ -160,7 +166,7 @@ function Lenker(props: Props) {
<Lenke href={`https://beslutteroversikt${finnNaisInternNavMiljoStreng()}`}>
Kvalitetssikring 14a
</Lenke>
<Lenke href={`https://veilarbpersonflate${finnNaisInternNavMiljoStreng()}/${fnr ? fnr : ''}?enhet=${enhet}`}>
<Lenke href={aktivitetsplanUrl(fnr, enhet)}>
Aktivitetsplan
</Lenke>
<Lenke href={`https://arbeidssokerregistrering-for-veileder${finnNaisInternNavMiljoStreng()}/`}>
Expand Down

0 comments on commit 6895248

Please sign in to comment.