Skip to content

Commit cce9d3f

Browse files
authored
Merge pull request #193 from CSCfi/CSCFC4EMSCR-518_Rearrange-content-page-top-layout
CSCFC4EMSCR-518 Rearrange content page top layout and add styles
2 parents 7363a8b + 7af0a05 commit cce9d3f

File tree

36 files changed

+1542
-1569
lines changed

36 files changed

+1542
-1569
lines changed

mscr-ui/public/locales/en/common.json

+12-7
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
"access-request-error": "",
66
"access-request-sent": "",
77
"action": {
8-
"actions": "Actions",
98
"cancel": "Cancel",
9+
"crosswalk-actions": "Crosswalk actions",
1010
"deprecate": "Deprecate",
1111
"invalidate": "Invalidate",
1212
"publish": "Publish",
13-
"save": "Save"
13+
"save": "Save",
14+
"schema-actions": "Schema actions"
1415
},
1516
"actionmenu": {
1617
"delete-crosswalk": "Delete crosswalk",
@@ -340,7 +341,6 @@
340341
"site-logout": "Log out",
341342
"site-open-link-new-window": "",
342343
"site-open-new-email": "",
343-
"site-page-not-found": "Content not available, check url",
344344
"site-register": "",
345345
"site-services": "",
346346
"site-title": "Metadata Schema and Crosswalk Regisrtry",
@@ -361,11 +361,16 @@
361361
"subscription-description": "",
362362
"synonym": "",
363363
"tabs": {
364+
"crosswalk": {
365+
"content-and-editor-tab": "Crosswalk"
366+
},
367+
"history-tab": "Version history",
364368
"label": "Content tabs",
365-
"metadata-and-files": "Metadata and files",
366-
"metadata-stub": "Metadata",
367-
"schema": "Schema",
368-
"version-history": "Version history"
369+
"metadata-and-files": "Metadata & files",
370+
"schema": {
371+
"content-and-editor-tab": "Schema"
372+
},
373+
"stub-metadata": "Metadata"
369374
},
370375
"term-conjugation": {
371376
"plural": "",

mscr-ui/public/locales/fi/common.json

+11-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
"access-request-error": "",
66
"access-request-sent": "",
77
"action": {
8-
"actions": "",
98
"cancel": "",
9+
"crosswalk-actions": "",
1010
"deprecate": "",
1111
"invalidate": "",
1212
"publish": "",
13-
"save": ""
13+
"save": "",
14+
"schema-actions": ""
1415
},
1516
"actionmenu": {
1617
"delete-crosswalk": "",
@@ -340,7 +341,6 @@
340341
"site-logout": "",
341342
"site-open-link-new-window": "",
342343
"site-open-new-email": "",
343-
"site-page-not-found": "",
344344
"site-register": "",
345345
"site-services": "",
346346
"site-title": "",
@@ -361,11 +361,16 @@
361361
"subscription-description": "",
362362
"synonym": "",
363363
"tabs": {
364+
"crosswalk": {
365+
"content-and-editor-tab": ""
366+
},
367+
"history-tab": "",
364368
"label": "",
365369
"metadata-and-files": "",
366-
"metadata-stub": "",
367-
"schema": "",
368-
"version-history": ""
370+
"schema": {
371+
"content-and-editor-tab": ""
372+
},
373+
"stub-metadata": ""
369374
},
370375
"term-conjugation": {
371376
"plural": "",

mscr-ui/public/locales/sv/common.json

+11-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
"access-request-error": "",
66
"access-request-sent": "",
77
"action": {
8-
"actions": "",
98
"cancel": "",
9+
"crosswalk-actions": "",
1010
"deprecate": "",
1111
"invalidate": "",
1212
"publish": "",
13-
"save": ""
13+
"save": "",
14+
"schema-actions": ""
1415
},
1516
"actionmenu": {
1617
"delete-crosswalk": "",
@@ -340,7 +341,6 @@
340341
"site-logout": "logout",
341342
"site-open-link-new-window": "",
342343
"site-open-new-email": "",
343-
"site-page-not-found": "",
344344
"site-register": "",
345345
"site-services": "",
346346
"site-title": "",
@@ -361,11 +361,16 @@
361361
"subscription-description": "",
362362
"synonym": "",
363363
"tabs": {
364+
"crosswalk": {
365+
"content-and-editor-tab": ""
366+
},
367+
"history-tab": "",
364368
"label": "",
365369
"metadata-and-files": "",
366-
"metadata-stub": "",
367-
"schema": "",
368-
"version-history": ""
370+
"schema": {
371+
"content-and-editor-tab": ""
372+
},
373+
"stub-metadata": ""
369374
},
370375
"term-conjugation": {
371376
"plural": "",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import styled from 'styled-components';
2+
3+
export const StyledPanel = styled.div`
4+
width: 100%;
5+
display: flex;
6+
justify-content: space-between;
7+
// Until Breadcrumbs are in place:
8+
flex-direction: row-reverse;
9+
padding-top: 1em;
10+
`;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { StyledPanel } from '@app/common/components/action-panel/action-panel.styles';
2+
import SchemaAndCrosswalkActionMenu from '@app/common/components/schema-and-crosswalk-actionmenu';
3+
4+
export default function ActionPanel({ isActionMenu }: { isActionMenu?: boolean }) {
5+
return (
6+
<StyledPanel>
7+
{isActionMenu && <SchemaAndCrosswalkActionMenu />}
8+
</StyledPanel>
9+
);
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
import { createSlice } from '@reduxjs/toolkit';
2+
import { AppState, AppThunk } from '@app/store';
3+
4+
export interface MenuList {
5+
editMetadata: boolean;
6+
editContent: boolean;
7+
// testCrosswalk: boolean;
8+
publish: boolean;
9+
invalidate: boolean;
10+
deprecate: boolean;
11+
remove: boolean;
12+
version: boolean;
13+
mscrCopy: boolean;
14+
deleteDraft: boolean;
15+
}
16+
17+
const initialMenuList: MenuList = {
18+
deleteDraft: false,
19+
deprecate: false,
20+
editContent: false,
21+
editMetadata: false,
22+
invalidate: false,
23+
mscrCopy: false,
24+
publish: false,
25+
remove: false,
26+
version: false,
27+
};
28+
29+
export interface ModalList {
30+
form: FormState;
31+
confirm: ConfirmState;
32+
}
33+
34+
export interface FormState {
35+
mscrCopy: boolean;
36+
version: boolean;
37+
}
38+
39+
const initialFormState: FormState = {
40+
mscrCopy: false,
41+
version: false
42+
};
43+
44+
export interface ConfirmState {
45+
deleteDraft: boolean;
46+
deprecate: boolean;
47+
invalidate: boolean;
48+
publish: boolean;
49+
remove: boolean;
50+
saveMetadata: boolean;
51+
}
52+
53+
const initialConfirmState: ConfirmState = {
54+
deleteDraft: false,
55+
deprecate: false,
56+
invalidate: false,
57+
publish: false,
58+
remove: false,
59+
saveMetadata: false,
60+
};
61+
62+
const initialModalList: ModalList = {
63+
confirm: initialConfirmState,
64+
form: initialFormState,
65+
};
66+
67+
const initialState = {
68+
isLatest: false,
69+
isPublished: false,
70+
isCrosswalk: false,
71+
menuList: initialMenuList,
72+
modal: initialModalList,
73+
};
74+
75+
export const actionmenuSlice = createSlice({
76+
name: 'actionmenu',
77+
initialState: initialState,
78+
reducers: {
79+
setIsLatest(state, action) {
80+
return {
81+
...state,
82+
isLatest: action.payload
83+
};
84+
},
85+
setIsPublished(state, action) {
86+
return {
87+
...state,
88+
isPublished: action.payload
89+
};
90+
},
91+
setIsCrosswalk(state, action) {
92+
return {
93+
...state,
94+
isCrosswalk: action.payload
95+
};
96+
},
97+
setMenuList(state, action) {
98+
const menuListAddition: Partial<MenuList> = {};
99+
action.payload.forEach((key: keyof MenuList) => menuListAddition[key] = true);
100+
return {
101+
...state,
102+
menuList: {
103+
...state.menuList,
104+
...menuListAddition
105+
}
106+
};
107+
},
108+
setMenuListFull(state, action) {
109+
return {
110+
...state,
111+
menuList: action.payload
112+
};
113+
},
114+
setFormState(state, action) {
115+
return {
116+
...state,
117+
modal: {
118+
...initialModalList,
119+
form: {
120+
...initialFormState,
121+
[action.payload.key]: action.payload.value
122+
}
123+
}
124+
};
125+
},
126+
setConfirmState(state, action) {
127+
return {
128+
...state,
129+
modal: {
130+
...initialModalList,
131+
confirm: {
132+
...initialConfirmState,
133+
[action.payload.key]: action.payload.value
134+
}
135+
}
136+
};
137+
},
138+
},
139+
});
140+
141+
export function selectIsLatest() {
142+
return (state: AppState) => state.actionmenu.isLatest;
143+
}
144+
145+
export function setIsLatest(isLatest?: boolean): AppThunk {
146+
return (dispatch) =>
147+
dispatch(actionmenuSlice.actions.setIsLatest(isLatest ?? false));
148+
}
149+
150+
export function selectIsPublished() {
151+
return (state: AppState) => state.actionmenu.isPublished;
152+
}
153+
154+
export function setIsPublished(isPublished?: boolean): AppThunk {
155+
return (dispatch) =>
156+
dispatch(actionmenuSlice.actions.setIsPublished(isPublished ?? false));
157+
}
158+
159+
export function selectIsCrosswalk() {
160+
return (state: AppState) => state.actionmenu.isCrosswalk;
161+
}
162+
163+
export function setIsCrosswalk(isCrosswalk?: boolean): AppThunk {
164+
return (dispatch) =>
165+
dispatch(actionmenuSlice.actions.setIsCrosswalk(isCrosswalk ?? false));
166+
}
167+
168+
export function selectMenuList() {
169+
return (state: AppState) => state.actionmenu.menuList;
170+
}
171+
172+
export function setMenuList(menuList: Array<keyof MenuList>): AppThunk {
173+
return (dispatch) => dispatch(actionmenuSlice.actions.setMenuList(menuList));
174+
}
175+
176+
export function resetMenuList(): AppThunk {
177+
return (dispatch) => dispatch(actionmenuSlice.actions.setMenuListFull(initialMenuList));
178+
}
179+
180+
export function selectModal() {
181+
return (state: AppState) => state.actionmenu.modal;
182+
}
183+
184+
export function selectFormModalState() {
185+
return (state: AppState) => state.actionmenu.modal.form;
186+
}
187+
188+
export function setFormModalState(formType: {key: keyof FormState; value: boolean}): AppThunk {
189+
return (dispatch) => dispatch(actionmenuSlice.actions.setFormState(formType));
190+
}
191+
192+
export function selectConfirmModalState() {
193+
return (state: AppState) => state.actionmenu.modal.confirm;
194+
}
195+
196+
export function setConfirmModalState(confirmType: {key: keyof ConfirmState; value: boolean}): AppThunk {
197+
return (dispatch) => dispatch(actionmenuSlice.actions.setConfirmState(confirmType));
198+
}

0 commit comments

Comments
 (0)