1
1
import { useEffect } from 'react' ;
2
2
import { Hotkey } from '../types/Hotkey' ;
3
3
import { Environment } from '../utils/environmentUtils' ;
4
- import { arenaUrl , fpSakUrl , gosysUrl , pesysUrl } from '../utils/urlUtils' ;
4
+ import {
5
+ arenaUrl ,
6
+ fpSakUrl ,
7
+ gosysUrl ,
8
+ pesysUrl ,
9
+ veilarbpersonflateUrl ,
10
+ } from '../utils/urlUtils' ;
5
11
import { useHotkeyState } from '../states/HotkeyState' ;
6
12
7
13
interface Props {
8
14
environment : Environment ;
9
15
fnr ?: string | undefined | null ;
10
16
aktoerId ?: string | undefined | null ;
17
+ enhet ?: string | undefined | null ;
11
18
}
12
19
13
20
const openurl = ( url : string ) => ( ) => window . open ( url , '_blank' ) ;
@@ -22,17 +29,32 @@ const buildHotkey = (
22
29
description,
23
30
} ) ;
24
31
25
- const generateHotkeys = ( { environment, fnr, aktoerId } : Props ) : Hotkey [ ] => [
32
+ const generateHotkeys = ( {
33
+ environment,
34
+ enhet,
35
+ fnr,
36
+ aktoerId,
37
+ } : Props ) : Hotkey [ ] => [
38
+ buildHotkey (
39
+ 'A' ,
40
+ veilarbpersonflateUrl ( { environment, enhet, fnr } ) ,
41
+ 'Gå til Aktivitetsplan' ,
42
+ ) ,
26
43
buildHotkey ( 'G' , gosysUrl ( environment , fnr ) , 'Gå til Gosys' ) ,
27
44
buildHotkey ( 'I' , pesysUrl ( environment , fnr ) , 'Gå til Pesys' ) ,
28
45
buildHotkey ( 'P' , arenaUrl ( { environment, fnr } ) , 'Gå til Arena' ) ,
29
46
buildHotkey ( 'K' , fpSakUrl ( environment , aktoerId ) , 'Gå til fpsak' ) ,
30
47
] ;
31
48
32
- export const useLinkHotkeys = ( { environment, fnr, aktoerId } : Props ) => {
49
+ export const useLinkHotkeys = ( {
50
+ environment,
51
+ fnr,
52
+ enhet,
53
+ aktoerId,
54
+ } : Props ) => {
33
55
const registerHotkeys = useHotkeyState ( ) . register ;
34
56
useEffect ( ( ) => {
35
- const hotkeys = generateHotkeys ( { environment, fnr, aktoerId } ) ;
57
+ const hotkeys = generateHotkeys ( { environment, fnr, enhet , aktoerId } ) ;
36
58
registerHotkeys ( true , ...hotkeys ) ;
37
- } , [ environment , fnr , aktoerId , registerHotkeys ] ) ;
59
+ } , [ environment , fnr , enhet , aktoerId , registerHotkeys ] ) ;
38
60
} ;
0 commit comments