1
1
import { useSubmission } from '@/composables/useSubmission' ;
2
2
import { useLocalize } from '@/composables/useLocalize' ;
3
3
import { DashboardPageTypes } from '@/pages/dashboard/dashboardPageStore' ;
4
+ import {
5
+ getPublicationItem ,
6
+ getWorkflowItem ,
7
+ } from './useWorkflowNavigationConfigOJS' ;
4
8
5
9
const { t} = useLocalize ( ) ;
6
10
7
- const StageColors = {
8
- [ pkp . const . WORKFLOW_STAGE_ID_SUBMISSION ] : 'border-stage-desk-review' ,
9
- [ pkp . const . WORKFLOW_STAGE_ID_EXTERNAL_REVIEW ] : 'border-stage-in-review' ,
10
- [ pkp . const . WORKFLOW_STAGE_ID_EDITING ] : 'border-stage-copyediting' ,
11
- [ pkp . const . WORKFLOW_STAGE_ID_PRODUCTION ] : 'border-stage-production' ,
12
- } ;
13
-
14
- export function getPublicationItem ( { label, name} ) {
15
- return {
16
- key : `publication_${ name } ` ,
17
- label : label ,
18
- action : 'selectMenu' ,
19
- actionArgs : {
20
- primaryMenuItem : 'publication' ,
21
- secondaryMenuItem : name ,
22
- title : getPublicationTitle ( label ) ,
23
- } ,
24
- } ;
25
- }
26
-
27
- export function getWorkflowItem ( { stageId, label, isActive, isDisabled, items} ) {
28
- return {
29
- key : `workflow_${ stageId } ` ,
30
- label : label ,
31
- colorStripe : isActive ? StageColors [ stageId ] : null ,
32
- action : isDisabled ? undefined : 'selectMenu' ,
33
- actionArgs : {
34
- primaryMenuItem : 'workflow' ,
35
- stageId : stageId ,
36
- title : getWorkflowTitle ( label ) ,
37
- } ,
38
- items,
39
- } ;
40
- }
41
-
42
11
export function getWorkflowTitle ( stageLabel ) {
43
12
return `${ t ( 'semicolon' , { label : t ( 'manager.workflow' ) } ) } ${ stageLabel } ` ;
44
13
}
@@ -49,48 +18,6 @@ export function getPublicationTitle(publicationMenuTitle) {
49
18
} ) } ${ publicationMenuTitle } `;
50
19
}
51
20
52
- export function getReviewItems ( { submission, stageId, title} ) {
53
- const { getActiveStage, getCurrentReviewRound} = useSubmission ( ) ;
54
-
55
- const activeStage = getActiveStage ( submission ) ;
56
-
57
- const activeReviewRound = getCurrentReviewRound ( submission , stageId ) ;
58
-
59
- const reviewMenuItems = [ ] ;
60
-
61
- const { getReviewRoundsForStage} = useSubmission ( ) ;
62
- const reviewRounds = getReviewRoundsForStage ( submission , stageId ) ;
63
-
64
- reviewRounds . forEach ( ( reviewRound ) => {
65
- reviewMenuItems . push (
66
- getReviewItem ( {
67
- stageId,
68
- reviewRound,
69
- isActive :
70
- activeStage . id === stageId && activeReviewRound . id === reviewRound . id ,
71
- title : title ,
72
- } ) ,
73
- ) ;
74
- } ) ;
75
-
76
- return reviewMenuItems ;
77
- }
78
-
79
- export function getReviewItem ( { stageId, reviewRound, isActive, title} ) {
80
- return {
81
- key : `workflow_${ stageId } _${ reviewRound . id } ` ,
82
- label : t ( 'dashboard.workflow.reviewRoundN' , { number : reviewRound . round } ) ,
83
- colorStripe : isActive ? StageColors [ stageId ] : null ,
84
- action : 'selectMenu' ,
85
- actionArgs : {
86
- primaryMenuItem : 'workflow' ,
87
- stageId : stageId ,
88
- reviewRoundId : reviewRound . id ,
89
- title : title ,
90
- } ,
91
- } ;
92
- }
93
-
94
21
export function useWorkflowNavigationConfigOPS ( pageInitConfig ) {
95
22
const { publicationSettings} = pageInitConfig ;
96
23
const { t} = useLocalize ( ) ;
0 commit comments