Skip to content

Commit a0ab8c6

Browse files
pkp/pkp-lib#7495 OPS navigaton config clean up
1 parent bcafd3b commit a0ab8c6

File tree

1 file changed

+4
-77
lines changed

1 file changed

+4
-77
lines changed

src/pages/workflow/composables/useWorkflowNavigationConfig/useWorkflowNavigationConfigOPS.js

Lines changed: 4 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,13 @@
11
import {useSubmission} from '@/composables/useSubmission';
22
import {useLocalize} from '@/composables/useLocalize';
33
import {DashboardPageTypes} from '@/pages/dashboard/dashboardPageStore';
4+
import {
5+
getPublicationItem,
6+
getWorkflowItem,
7+
} from './useWorkflowNavigationConfigOJS';
48

59
const {t} = useLocalize();
610

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-
4211
export function getWorkflowTitle(stageLabel) {
4312
return `${t('semicolon', {label: t('manager.workflow')})} ${stageLabel} `;
4413
}
@@ -49,48 +18,6 @@ export function getPublicationTitle(publicationMenuTitle) {
4918
})} ${publicationMenuTitle}`;
5019
}
5120

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-
9421
export function useWorkflowNavigationConfigOPS(pageInitConfig) {
9522
const {publicationSettings} = pageInitConfig;
9623
const {t} = useLocalize();

0 commit comments

Comments
 (0)