@aarhus-university/au-lib-react-components 10.1.0 → 10.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/umd/all.css +2 -2
- package/build/umd/all.js +1 -1
- package/build/umd/alphabox.js +1 -1
- package/build/umd/databox.js +1 -1
- package/build/umd/diagramme.js +1 -1
- package/build/umd/flowbox.js +1 -1
- package/build/umd/universe.js +1 -1
- package/package.json +4 -4
- package/src/components/AUAutoSuggestComponent.js +158 -158
- package/src/components/AUTabbedContentComponent.tsx +1 -1
- package/src/components/AUToastComponent.tsx +12 -13
- package/src/components/profile/AUProfileLoginComponent.tsx +26 -26
- package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +143 -143
- package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
- package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
- package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
- package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
- package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
- package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
- package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
- package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
- package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
- package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
- package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
- package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
- package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
- package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
- package/src/layout-2016/components/profile/AUProfileAvatar2016Component.js +103 -103
- package/src/layout-2016/components/universe/StaffTopComponent.js +363 -363
- package/src/layout-2016/components/universe/StudentTopComponent.js +137 -137
- package/src/layout-2016/components/universe/UniverseContainerComponent.js +65 -65
- package/src/layout-2016/lib/all.js +3 -3
- package/src/layout-2016/lib/au-alphabox.js +100 -100
- package/src/layout-2016/lib/au-databox.js +400 -400
- package/src/layout-2016/lib/au-diagramme.js +85 -85
- package/src/layout-2016/lib/au-flowbox.js +93 -93
- package/src/layout-2016/lib/universe.js +9 -9
- package/src/lib/helpers.ts +194 -194
- package/tsconfig.json +46 -46
- package/types/common/interfaces/gui.d.ts +2 -1
- package/types/common/interfaces/model.d.ts +29 -29
- package/types/common/props.d.ts +166 -165
- package/webpack.config.js +89 -89
|
@@ -1,363 +1,363 @@
|
|
|
1
|
-
/* eslint-disable jsx-a11y/interactive-supports-focus */
|
|
2
|
-
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
3
|
-
/* eslint-disable jsx-a11y/control-has-associated-label */
|
|
4
|
-
/* eslint-env browser */
|
|
5
|
-
/* eslint max-len: 0 */
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import ReactDOM from 'react-dom';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
|
-
import AUCollapsibleComponent from '../common/AUCollapsibleComponent';
|
|
10
|
-
import AUProfileLoginComponent from '../../../components/profile/AUProfileLoginComponent';
|
|
11
|
-
import AUProfileAvatar2016Component from '../profile/AUProfileAvatar2016Component';
|
|
12
|
-
import { getCookie, setCookie } from '../../../lib/helpers';
|
|
13
|
-
|
|
14
|
-
const parseBurgerLinks = (elements) => {
|
|
15
|
-
const links = [];
|
|
16
|
-
elements.forEach((e) => {
|
|
17
|
-
const link = e.querySelector('a');
|
|
18
|
-
links.push({
|
|
19
|
-
url: link.getAttribute('href'),
|
|
20
|
-
title: link.innerText,
|
|
21
|
-
className: e.getAttribute('class'),
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
return links;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const parseSystemLinks = (elements) => {
|
|
28
|
-
const systems = [];
|
|
29
|
-
elements.forEach((e) => {
|
|
30
|
-
const div = e.querySelector('div');
|
|
31
|
-
const header = div.querySelector('h3').innerText;
|
|
32
|
-
const text = div.querySelector('p').innerText;
|
|
33
|
-
const actions = div.querySelectorAll('ul > li > a');
|
|
34
|
-
const system = {
|
|
35
|
-
header,
|
|
36
|
-
text,
|
|
37
|
-
actions: [],
|
|
38
|
-
};
|
|
39
|
-
actions.forEach((a) => {
|
|
40
|
-
system.actions.push({
|
|
41
|
-
url: a.getAttribute('href'),
|
|
42
|
-
title: a.innerText,
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
systems.push(system);
|
|
46
|
-
});
|
|
47
|
-
return systems;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
class StaffTopComponent extends React.Component {
|
|
51
|
-
constructor(props) {
|
|
52
|
-
super(props);
|
|
53
|
-
|
|
54
|
-
this.state = {
|
|
55
|
-
active: 0,
|
|
56
|
-
burgerLinks: [],
|
|
57
|
-
systemLinks: [],
|
|
58
|
-
loggedIn: false,
|
|
59
|
-
showHelp: false,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
componentDidMount() {
|
|
64
|
-
const { promiseHandler, user, onLoad } = this.props;
|
|
65
|
-
document.getElementById('fade').addEventListener('click', () => {
|
|
66
|
-
this.setState({
|
|
67
|
-
active: 0,
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
promiseHandler((data) => {
|
|
72
|
-
const container = document.createElement('div');
|
|
73
|
-
container.innerHTML = data;
|
|
74
|
-
const burgerLinks = container.querySelectorAll('ul.burger-links > li');
|
|
75
|
-
const systemLinks = container.querySelectorAll('ul.systems > li');
|
|
76
|
-
this.setState({
|
|
77
|
-
burgerLinks: parseBurgerLinks(burgerLinks),
|
|
78
|
-
systemLinks: parseSystemLinks(systemLinks),
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
const visible = document.querySelector('body').classList.contains('login');
|
|
83
|
-
|
|
84
|
-
if (visible) {
|
|
85
|
-
fetch(`${window.profileApiUri}/v1/person/isauthenticated`, {
|
|
86
|
-
method: 'GET',
|
|
87
|
-
credentials: 'include',
|
|
88
|
-
})
|
|
89
|
-
.then((response) => response.json())
|
|
90
|
-
.then((json) => {
|
|
91
|
-
this.setState({
|
|
92
|
-
loggedIn: json.isAuthenticated,
|
|
93
|
-
}, () => {
|
|
94
|
-
onLoad({ ...user, ...{ auId: json.auId } });
|
|
95
|
-
});
|
|
96
|
-
}).catch((err) => {
|
|
97
|
-
// eslint-disable-next-line no-console
|
|
98
|
-
console.log(err);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
componentDidUpdate() {
|
|
104
|
-
const { active } = this.state;
|
|
105
|
-
const fade = document.getElementById('fade');
|
|
106
|
-
if (active > 0) {
|
|
107
|
-
fade.style.display = 'block';
|
|
108
|
-
} else {
|
|
109
|
-
fade.style.display = 'none';
|
|
110
|
-
}
|
|
111
|
-
fade.style.opacity = 0;
|
|
112
|
-
if (active === 2 && typeof window.findWidgetInit !== 'undefined') {
|
|
113
|
-
window.findWidgetInit('.universe-utility .find-container');
|
|
114
|
-
}
|
|
115
|
-
if (active === 3) {
|
|
116
|
-
AU.alphabox.init();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
render() {
|
|
121
|
-
const {
|
|
122
|
-
lang,
|
|
123
|
-
user,
|
|
124
|
-
onLoad,
|
|
125
|
-
universeLabels,
|
|
126
|
-
profileLabels,
|
|
127
|
-
} = this.props;
|
|
128
|
-
const {
|
|
129
|
-
active,
|
|
130
|
-
burgerLinks,
|
|
131
|
-
systemLinks,
|
|
132
|
-
loggedIn,
|
|
133
|
-
showHelp,
|
|
134
|
-
} = this.state;
|
|
135
|
-
|
|
136
|
-
const helpCookie = getCookie('mystaff-help');
|
|
137
|
-
const visible = document.querySelector('body').classList.contains('login');
|
|
138
|
-
const help = !helpCookie && !loggedIn && document.querySelector('body').classList.contains('help');
|
|
139
|
-
|
|
140
|
-
const renderBurgerLinks = burgerLinks.map(
|
|
141
|
-
(u) => (
|
|
142
|
-
<li key={u.title} className={u.className}>
|
|
143
|
-
<a href={u.url}>
|
|
144
|
-
{u.title}
|
|
145
|
-
</a>
|
|
146
|
-
</li>
|
|
147
|
-
),
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
const renderSystemLinks = systemLinks.map(
|
|
151
|
-
(s) => (
|
|
152
|
-
<li key={s.header}>
|
|
153
|
-
<AUCollapsibleComponent
|
|
154
|
-
collapsed
|
|
155
|
-
header={s.header}
|
|
156
|
-
level={3}
|
|
157
|
-
>
|
|
158
|
-
<div>
|
|
159
|
-
<p>
|
|
160
|
-
{s.text}
|
|
161
|
-
</p>
|
|
162
|
-
<ul className="resetlist">
|
|
163
|
-
{s.actions.map(
|
|
164
|
-
(a) => (
|
|
165
|
-
<li key={a.url}>
|
|
166
|
-
<a href={a.url}>{a.title}</a>
|
|
167
|
-
</li>
|
|
168
|
-
),
|
|
169
|
-
)}
|
|
170
|
-
</ul>
|
|
171
|
-
</div>
|
|
172
|
-
</AUCollapsibleComponent>
|
|
173
|
-
</li>
|
|
174
|
-
),
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
return [
|
|
178
|
-
<div key="header" className="large-12 medium-12 small-12 columns">
|
|
179
|
-
<div>
|
|
180
|
-
<h2 className="universe-home" dangerouslySetInnerHTML={{ __html: universeLabels[lang].staffTitleLink }} />
|
|
181
|
-
<div className={active === 4 ? 'avatar active' : 'avatar'}>
|
|
182
|
-
{
|
|
183
|
-
visible && (
|
|
184
|
-
<>
|
|
185
|
-
<AUProfileLoginComponent
|
|
186
|
-
text={profileLabels[lang].myProfile}
|
|
187
|
-
loggedIn={loggedIn}
|
|
188
|
-
loginUri={`${window.profileApiUri}/auth/login?redirectUri=${window.location.href}`}
|
|
189
|
-
>
|
|
190
|
-
<AUProfileAvatar2016Component
|
|
191
|
-
lang={lang}
|
|
192
|
-
user={user}
|
|
193
|
-
settings={[
|
|
194
|
-
{
|
|
195
|
-
url: `${window.profileApiUri}/${lang}/profile`,
|
|
196
|
-
text: profileLabels[lang].headerContainer,
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
url: `${window.profileApiUri}/${lang}/password`,
|
|
200
|
-
text: profileLabels[lang].headerPassword,
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
url: `${window.profileApiUri}/${lang}/holiday`,
|
|
204
|
-
text: profileLabels[lang].headerVacationAbsence,
|
|
205
|
-
},
|
|
206
|
-
]}
|
|
207
|
-
profileLabels={profileLabels}
|
|
208
|
-
toggled={active === 4}
|
|
209
|
-
onToggle={() => {
|
|
210
|
-
this.setState((prevState) => ({
|
|
211
|
-
active: prevState.active === 4 ? 0 : 4,
|
|
212
|
-
}));
|
|
213
|
-
}}
|
|
214
|
-
onLoad={onLoad}
|
|
215
|
-
logoutUri={`${window.profileApiUri}/auth/logout?redirectUri=${window.location.href}`}
|
|
216
|
-
/>
|
|
217
|
-
</AUProfileLoginComponent>
|
|
218
|
-
{
|
|
219
|
-
help && (
|
|
220
|
-
<>
|
|
221
|
-
<button
|
|
222
|
-
type="button"
|
|
223
|
-
className="btn-help"
|
|
224
|
-
aria-label="Hjælp / help"
|
|
225
|
-
onClick={() => {
|
|
226
|
-
this.setState({
|
|
227
|
-
showHelp: true,
|
|
228
|
-
});
|
|
229
|
-
}}
|
|
230
|
-
>
|
|
231
|
-
|
|
232
|
-
</button>
|
|
233
|
-
{
|
|
234
|
-
showHelp && (
|
|
235
|
-
ReactDOM.createPortal(
|
|
236
|
-
<div className="help-modal">
|
|
237
|
-
<h2>{profileLabels[lang].helpModalHeader}</h2>
|
|
238
|
-
<p>
|
|
239
|
-
{profileLabels[lang].helpModalText}
|
|
240
|
-
</p>
|
|
241
|
-
<button
|
|
242
|
-
type="button"
|
|
243
|
-
className="button bg-staff"
|
|
244
|
-
onClick={() => {
|
|
245
|
-
setCookie('mystaff-help', true, null, 365, ';path=/;domain=medarbejdere.au.dk');
|
|
246
|
-
this.setState({
|
|
247
|
-
showHelp: false,
|
|
248
|
-
});
|
|
249
|
-
}}
|
|
250
|
-
>
|
|
251
|
-
{profileLabels[lang].helpModalBtn}
|
|
252
|
-
</button>
|
|
253
|
-
</div>,
|
|
254
|
-
document.querySelector('.main'),
|
|
255
|
-
'modal',
|
|
256
|
-
)
|
|
257
|
-
)
|
|
258
|
-
}
|
|
259
|
-
</>
|
|
260
|
-
)
|
|
261
|
-
}
|
|
262
|
-
</>
|
|
263
|
-
)
|
|
264
|
-
}
|
|
265
|
-
</div>
|
|
266
|
-
{
|
|
267
|
-
showHelp && (
|
|
268
|
-
<div
|
|
269
|
-
key="overlay"
|
|
270
|
-
className="help-modal-overlay"
|
|
271
|
-
role="button"
|
|
272
|
-
onClick={() => {
|
|
273
|
-
this.setState({
|
|
274
|
-
showHelp: false,
|
|
275
|
-
});
|
|
276
|
-
}}
|
|
277
|
-
/>
|
|
278
|
-
)
|
|
279
|
-
}
|
|
280
|
-
<ul className="resetlist universe-icons">
|
|
281
|
-
<li className="au" dangerouslySetInnerHTML={{ __html: universeLabels[lang].mainPageLink }} />
|
|
282
|
-
<li className={active === 1 ? 'active' : null}>
|
|
283
|
-
<button
|
|
284
|
-
type="button"
|
|
285
|
-
className="btn-system"
|
|
286
|
-
onClick={() => {
|
|
287
|
-
this.setState((prevState) => ({
|
|
288
|
-
active: prevState.active === 1 ? 0 : 1,
|
|
289
|
-
}));
|
|
290
|
-
}}
|
|
291
|
-
>
|
|
292
|
-
System
|
|
293
|
-
</button>
|
|
294
|
-
</li>
|
|
295
|
-
<li className={active === 2 ? 'active' : null}>
|
|
296
|
-
<button
|
|
297
|
-
type="button"
|
|
298
|
-
className="btn-find"
|
|
299
|
-
onClick={() => {
|
|
300
|
-
this.setState((prevState) => ({
|
|
301
|
-
active: prevState.active === 2 ? 0 : 2,
|
|
302
|
-
}));
|
|
303
|
-
}}
|
|
304
|
-
>
|
|
305
|
-
Find
|
|
306
|
-
</button>
|
|
307
|
-
</li>
|
|
308
|
-
<li className={active === 3 ? 'active' : null}>
|
|
309
|
-
<button
|
|
310
|
-
type="button"
|
|
311
|
-
className="btn-menu"
|
|
312
|
-
onClick={() => {
|
|
313
|
-
this.setState((prevState) => ({
|
|
314
|
-
active: prevState.active === 3 ? 0 : 3,
|
|
315
|
-
}));
|
|
316
|
-
}}
|
|
317
|
-
>
|
|
318
|
-
Menu
|
|
319
|
-
</button>
|
|
320
|
-
</li>
|
|
321
|
-
</ul>
|
|
322
|
-
</div>
|
|
323
|
-
</div>,
|
|
324
|
-
<div key={1} className={`universe-utility${active === 1 ? ' active' : ''}`}>
|
|
325
|
-
<div className="universe-utility-links">
|
|
326
|
-
<ul className="resetlist">
|
|
327
|
-
{renderSystemLinks}
|
|
328
|
-
</ul>
|
|
329
|
-
</div>
|
|
330
|
-
</div>,
|
|
331
|
-
<div key={2} className={`universe-utility${active === 2 ? ' active' : ''}`}>
|
|
332
|
-
<div className="find-container au-map" />
|
|
333
|
-
</div>,
|
|
334
|
-
<div key={3} className={`universe-utility${active === 3 ? ' active' : ''}`}>
|
|
335
|
-
<div className="au_alphabox" id="au_alphabox_staff_utility" />
|
|
336
|
-
<div className="universe-utility-links">
|
|
337
|
-
<ul className="resetlist">
|
|
338
|
-
{renderBurgerLinks}
|
|
339
|
-
</ul>
|
|
340
|
-
</div>
|
|
341
|
-
</div>,
|
|
342
|
-
];
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/*
|
|
347
|
-
StaffTopComponent.defaultProps = {
|
|
348
|
-
onLogin: () => { },
|
|
349
|
-
};
|
|
350
|
-
*/
|
|
351
|
-
|
|
352
|
-
StaffTopComponent.propTypes = {
|
|
353
|
-
lang: PropTypes.string.isRequired,
|
|
354
|
-
user: PropTypes.shape({
|
|
355
|
-
}).isRequired,
|
|
356
|
-
promiseHandler: PropTypes.func.isRequired,
|
|
357
|
-
onLoad: PropTypes.func.isRequired,
|
|
358
|
-
universeLabels: PropTypes.shape({}).isRequired,
|
|
359
|
-
profileLabels: PropTypes.shape({}).isRequired,
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
StaffTopComponent.displayName = 'StaffTopComponent';
|
|
363
|
-
export default StaffTopComponent;
|
|
1
|
+
/* eslint-disable jsx-a11y/interactive-supports-focus */
|
|
2
|
+
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
3
|
+
/* eslint-disable jsx-a11y/control-has-associated-label */
|
|
4
|
+
/* eslint-env browser */
|
|
5
|
+
/* eslint max-len: 0 */
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import ReactDOM from 'react-dom';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import AUCollapsibleComponent from '../common/AUCollapsibleComponent';
|
|
10
|
+
import AUProfileLoginComponent from '../../../components/profile/AUProfileLoginComponent';
|
|
11
|
+
import AUProfileAvatar2016Component from '../profile/AUProfileAvatar2016Component';
|
|
12
|
+
import { getCookie, setCookie } from '../../../lib/helpers';
|
|
13
|
+
|
|
14
|
+
const parseBurgerLinks = (elements) => {
|
|
15
|
+
const links = [];
|
|
16
|
+
elements.forEach((e) => {
|
|
17
|
+
const link = e.querySelector('a');
|
|
18
|
+
links.push({
|
|
19
|
+
url: link.getAttribute('href'),
|
|
20
|
+
title: link.innerText,
|
|
21
|
+
className: e.getAttribute('class'),
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
return links;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const parseSystemLinks = (elements) => {
|
|
28
|
+
const systems = [];
|
|
29
|
+
elements.forEach((e) => {
|
|
30
|
+
const div = e.querySelector('div');
|
|
31
|
+
const header = div.querySelector('h3').innerText;
|
|
32
|
+
const text = div.querySelector('p').innerText;
|
|
33
|
+
const actions = div.querySelectorAll('ul > li > a');
|
|
34
|
+
const system = {
|
|
35
|
+
header,
|
|
36
|
+
text,
|
|
37
|
+
actions: [],
|
|
38
|
+
};
|
|
39
|
+
actions.forEach((a) => {
|
|
40
|
+
system.actions.push({
|
|
41
|
+
url: a.getAttribute('href'),
|
|
42
|
+
title: a.innerText,
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
systems.push(system);
|
|
46
|
+
});
|
|
47
|
+
return systems;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
class StaffTopComponent extends React.Component {
|
|
51
|
+
constructor(props) {
|
|
52
|
+
super(props);
|
|
53
|
+
|
|
54
|
+
this.state = {
|
|
55
|
+
active: 0,
|
|
56
|
+
burgerLinks: [],
|
|
57
|
+
systemLinks: [],
|
|
58
|
+
loggedIn: false,
|
|
59
|
+
showHelp: false,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
componentDidMount() {
|
|
64
|
+
const { promiseHandler, user, onLoad } = this.props;
|
|
65
|
+
document.getElementById('fade').addEventListener('click', () => {
|
|
66
|
+
this.setState({
|
|
67
|
+
active: 0,
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
promiseHandler((data) => {
|
|
72
|
+
const container = document.createElement('div');
|
|
73
|
+
container.innerHTML = data;
|
|
74
|
+
const burgerLinks = container.querySelectorAll('ul.burger-links > li');
|
|
75
|
+
const systemLinks = container.querySelectorAll('ul.systems > li');
|
|
76
|
+
this.setState({
|
|
77
|
+
burgerLinks: parseBurgerLinks(burgerLinks),
|
|
78
|
+
systemLinks: parseSystemLinks(systemLinks),
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const visible = document.querySelector('body').classList.contains('login');
|
|
83
|
+
|
|
84
|
+
if (visible) {
|
|
85
|
+
fetch(`${window.profileApiUri}/v1/person/isauthenticated`, {
|
|
86
|
+
method: 'GET',
|
|
87
|
+
credentials: 'include',
|
|
88
|
+
})
|
|
89
|
+
.then((response) => response.json())
|
|
90
|
+
.then((json) => {
|
|
91
|
+
this.setState({
|
|
92
|
+
loggedIn: json.isAuthenticated,
|
|
93
|
+
}, () => {
|
|
94
|
+
onLoad({ ...user, ...{ auId: json.auId } });
|
|
95
|
+
});
|
|
96
|
+
}).catch((err) => {
|
|
97
|
+
// eslint-disable-next-line no-console
|
|
98
|
+
console.log(err);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
componentDidUpdate() {
|
|
104
|
+
const { active } = this.state;
|
|
105
|
+
const fade = document.getElementById('fade');
|
|
106
|
+
if (active > 0) {
|
|
107
|
+
fade.style.display = 'block';
|
|
108
|
+
} else {
|
|
109
|
+
fade.style.display = 'none';
|
|
110
|
+
}
|
|
111
|
+
fade.style.opacity = 0;
|
|
112
|
+
if (active === 2 && typeof window.findWidgetInit !== 'undefined') {
|
|
113
|
+
window.findWidgetInit('.universe-utility .find-container');
|
|
114
|
+
}
|
|
115
|
+
if (active === 3) {
|
|
116
|
+
AU.alphabox.init();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
render() {
|
|
121
|
+
const {
|
|
122
|
+
lang,
|
|
123
|
+
user,
|
|
124
|
+
onLoad,
|
|
125
|
+
universeLabels,
|
|
126
|
+
profileLabels,
|
|
127
|
+
} = this.props;
|
|
128
|
+
const {
|
|
129
|
+
active,
|
|
130
|
+
burgerLinks,
|
|
131
|
+
systemLinks,
|
|
132
|
+
loggedIn,
|
|
133
|
+
showHelp,
|
|
134
|
+
} = this.state;
|
|
135
|
+
|
|
136
|
+
const helpCookie = getCookie('mystaff-help');
|
|
137
|
+
const visible = document.querySelector('body').classList.contains('login');
|
|
138
|
+
const help = !helpCookie && !loggedIn && document.querySelector('body').classList.contains('help');
|
|
139
|
+
|
|
140
|
+
const renderBurgerLinks = burgerLinks.map(
|
|
141
|
+
(u) => (
|
|
142
|
+
<li key={u.title} className={u.className}>
|
|
143
|
+
<a href={u.url}>
|
|
144
|
+
{u.title}
|
|
145
|
+
</a>
|
|
146
|
+
</li>
|
|
147
|
+
),
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
const renderSystemLinks = systemLinks.map(
|
|
151
|
+
(s) => (
|
|
152
|
+
<li key={s.header}>
|
|
153
|
+
<AUCollapsibleComponent
|
|
154
|
+
collapsed
|
|
155
|
+
header={s.header}
|
|
156
|
+
level={3}
|
|
157
|
+
>
|
|
158
|
+
<div>
|
|
159
|
+
<p>
|
|
160
|
+
{s.text}
|
|
161
|
+
</p>
|
|
162
|
+
<ul className="resetlist">
|
|
163
|
+
{s.actions.map(
|
|
164
|
+
(a) => (
|
|
165
|
+
<li key={a.url}>
|
|
166
|
+
<a href={a.url}>{a.title}</a>
|
|
167
|
+
</li>
|
|
168
|
+
),
|
|
169
|
+
)}
|
|
170
|
+
</ul>
|
|
171
|
+
</div>
|
|
172
|
+
</AUCollapsibleComponent>
|
|
173
|
+
</li>
|
|
174
|
+
),
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
return [
|
|
178
|
+
<div key="header" className="large-12 medium-12 small-12 columns">
|
|
179
|
+
<div>
|
|
180
|
+
<h2 className="universe-home" dangerouslySetInnerHTML={{ __html: universeLabels[lang].staffTitleLink }} />
|
|
181
|
+
<div className={active === 4 ? 'avatar active' : 'avatar'}>
|
|
182
|
+
{
|
|
183
|
+
visible && (
|
|
184
|
+
<>
|
|
185
|
+
<AUProfileLoginComponent
|
|
186
|
+
text={profileLabels[lang].myProfile}
|
|
187
|
+
loggedIn={loggedIn}
|
|
188
|
+
loginUri={`${window.profileApiUri}/auth/login?redirectUri=${window.location.href}`}
|
|
189
|
+
>
|
|
190
|
+
<AUProfileAvatar2016Component
|
|
191
|
+
lang={lang}
|
|
192
|
+
user={user}
|
|
193
|
+
settings={[
|
|
194
|
+
{
|
|
195
|
+
url: `${window.profileApiUri}/${lang}/profile`,
|
|
196
|
+
text: profileLabels[lang].headerContainer,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
url: `${window.profileApiUri}/${lang}/password`,
|
|
200
|
+
text: profileLabels[lang].headerPassword,
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
url: `${window.profileApiUri}/${lang}/holiday`,
|
|
204
|
+
text: profileLabels[lang].headerVacationAbsence,
|
|
205
|
+
},
|
|
206
|
+
]}
|
|
207
|
+
profileLabels={profileLabels}
|
|
208
|
+
toggled={active === 4}
|
|
209
|
+
onToggle={() => {
|
|
210
|
+
this.setState((prevState) => ({
|
|
211
|
+
active: prevState.active === 4 ? 0 : 4,
|
|
212
|
+
}));
|
|
213
|
+
}}
|
|
214
|
+
onLoad={onLoad}
|
|
215
|
+
logoutUri={`${window.profileApiUri}/auth/logout?redirectUri=${window.location.href}`}
|
|
216
|
+
/>
|
|
217
|
+
</AUProfileLoginComponent>
|
|
218
|
+
{
|
|
219
|
+
help && (
|
|
220
|
+
<>
|
|
221
|
+
<button
|
|
222
|
+
type="button"
|
|
223
|
+
className="btn-help"
|
|
224
|
+
aria-label="Hjælp / help"
|
|
225
|
+
onClick={() => {
|
|
226
|
+
this.setState({
|
|
227
|
+
showHelp: true,
|
|
228
|
+
});
|
|
229
|
+
}}
|
|
230
|
+
>
|
|
231
|
+
|
|
232
|
+
</button>
|
|
233
|
+
{
|
|
234
|
+
showHelp && (
|
|
235
|
+
ReactDOM.createPortal(
|
|
236
|
+
<div className="help-modal">
|
|
237
|
+
<h2>{profileLabels[lang].helpModalHeader}</h2>
|
|
238
|
+
<p>
|
|
239
|
+
{profileLabels[lang].helpModalText}
|
|
240
|
+
</p>
|
|
241
|
+
<button
|
|
242
|
+
type="button"
|
|
243
|
+
className="button bg-staff"
|
|
244
|
+
onClick={() => {
|
|
245
|
+
setCookie('mystaff-help', true, null, 365, ';path=/;domain=medarbejdere.au.dk');
|
|
246
|
+
this.setState({
|
|
247
|
+
showHelp: false,
|
|
248
|
+
});
|
|
249
|
+
}}
|
|
250
|
+
>
|
|
251
|
+
{profileLabels[lang].helpModalBtn}
|
|
252
|
+
</button>
|
|
253
|
+
</div>,
|
|
254
|
+
document.querySelector('.main'),
|
|
255
|
+
'modal',
|
|
256
|
+
)
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
</>
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
</>
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
</div>
|
|
266
|
+
{
|
|
267
|
+
showHelp && (
|
|
268
|
+
<div
|
|
269
|
+
key="overlay"
|
|
270
|
+
className="help-modal-overlay"
|
|
271
|
+
role="button"
|
|
272
|
+
onClick={() => {
|
|
273
|
+
this.setState({
|
|
274
|
+
showHelp: false,
|
|
275
|
+
});
|
|
276
|
+
}}
|
|
277
|
+
/>
|
|
278
|
+
)
|
|
279
|
+
}
|
|
280
|
+
<ul className="resetlist universe-icons">
|
|
281
|
+
<li className="au" dangerouslySetInnerHTML={{ __html: universeLabels[lang].mainPageLink }} />
|
|
282
|
+
<li className={active === 1 ? 'active' : null}>
|
|
283
|
+
<button
|
|
284
|
+
type="button"
|
|
285
|
+
className="btn-system"
|
|
286
|
+
onClick={() => {
|
|
287
|
+
this.setState((prevState) => ({
|
|
288
|
+
active: prevState.active === 1 ? 0 : 1,
|
|
289
|
+
}));
|
|
290
|
+
}}
|
|
291
|
+
>
|
|
292
|
+
System
|
|
293
|
+
</button>
|
|
294
|
+
</li>
|
|
295
|
+
<li className={active === 2 ? 'active' : null}>
|
|
296
|
+
<button
|
|
297
|
+
type="button"
|
|
298
|
+
className="btn-find"
|
|
299
|
+
onClick={() => {
|
|
300
|
+
this.setState((prevState) => ({
|
|
301
|
+
active: prevState.active === 2 ? 0 : 2,
|
|
302
|
+
}));
|
|
303
|
+
}}
|
|
304
|
+
>
|
|
305
|
+
Find
|
|
306
|
+
</button>
|
|
307
|
+
</li>
|
|
308
|
+
<li className={active === 3 ? 'active' : null}>
|
|
309
|
+
<button
|
|
310
|
+
type="button"
|
|
311
|
+
className="btn-menu"
|
|
312
|
+
onClick={() => {
|
|
313
|
+
this.setState((prevState) => ({
|
|
314
|
+
active: prevState.active === 3 ? 0 : 3,
|
|
315
|
+
}));
|
|
316
|
+
}}
|
|
317
|
+
>
|
|
318
|
+
Menu
|
|
319
|
+
</button>
|
|
320
|
+
</li>
|
|
321
|
+
</ul>
|
|
322
|
+
</div>
|
|
323
|
+
</div>,
|
|
324
|
+
<div key={1} className={`universe-utility${active === 1 ? ' active' : ''}`}>
|
|
325
|
+
<div className="universe-utility-links">
|
|
326
|
+
<ul className="resetlist">
|
|
327
|
+
{renderSystemLinks}
|
|
328
|
+
</ul>
|
|
329
|
+
</div>
|
|
330
|
+
</div>,
|
|
331
|
+
<div key={2} className={`universe-utility${active === 2 ? ' active' : ''}`}>
|
|
332
|
+
<div className="find-container au-map" />
|
|
333
|
+
</div>,
|
|
334
|
+
<div key={3} className={`universe-utility${active === 3 ? ' active' : ''}`}>
|
|
335
|
+
<div className="au_alphabox" id="au_alphabox_staff_utility" />
|
|
336
|
+
<div className="universe-utility-links">
|
|
337
|
+
<ul className="resetlist">
|
|
338
|
+
{renderBurgerLinks}
|
|
339
|
+
</ul>
|
|
340
|
+
</div>
|
|
341
|
+
</div>,
|
|
342
|
+
];
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/*
|
|
347
|
+
StaffTopComponent.defaultProps = {
|
|
348
|
+
onLogin: () => { },
|
|
349
|
+
};
|
|
350
|
+
*/
|
|
351
|
+
|
|
352
|
+
StaffTopComponent.propTypes = {
|
|
353
|
+
lang: PropTypes.string.isRequired,
|
|
354
|
+
user: PropTypes.shape({
|
|
355
|
+
}).isRequired,
|
|
356
|
+
promiseHandler: PropTypes.func.isRequired,
|
|
357
|
+
onLoad: PropTypes.func.isRequired,
|
|
358
|
+
universeLabels: PropTypes.shape({}).isRequired,
|
|
359
|
+
profileLabels: PropTypes.shape({}).isRequired,
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
StaffTopComponent.displayName = 'StaffTopComponent';
|
|
363
|
+
export default StaffTopComponent;
|