@aarhus-university/au-lib-react-components 9.11.2 → 9.11.6

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.
Files changed (141) hide show
  1. package/.eslintrc +18 -18
  2. package/README.md +20 -20
  3. package/babel.config.js +6 -6
  4. package/build/dev.html +328 -328
  5. package/build/umd/all.css +2 -2
  6. package/build/umd/all.js +1 -1
  7. package/build/umd/alphabox.js +1 -1
  8. package/build/umd/auAuth.js +1 -1
  9. package/build/umd/databox.js +2 -2
  10. package/build/umd/databox.js.LICENSE.txt +5 -5
  11. package/build/umd/diagramme.js +1 -1
  12. package/build/umd/flowbox.js +1 -1
  13. package/build/umd/news.js +1 -1
  14. package/build/umd/universe.js +1 -1
  15. package/package.json +60 -60
  16. package/src/all.js +3 -3
  17. package/src/app.js +263 -263
  18. package/src/components/AUAlertComponent.js +158 -158
  19. package/src/components/AUAmountComponent.js +84 -84
  20. package/src/components/AUBannerComponent.js +99 -99
  21. package/src/components/AUCalendarComponent.js +393 -393
  22. package/src/components/AUCollapsibleComponent.js +173 -173
  23. package/src/components/AUDatepickerComponent.js +105 -105
  24. package/src/components/AUDiagrammeComponent.js +310 -310
  25. package/src/components/AUFilterCheckboxComponent.js +122 -122
  26. package/src/components/AUFocusComponent.js +55 -55
  27. package/src/components/AUModalComponent.js +94 -94
  28. package/src/components/AUPaginationComponent.js +103 -103
  29. package/src/components/AUSpinnerComponent.js +125 -125
  30. package/src/components/AutoSuggestComponent.js +132 -132
  31. package/src/components/alphabox/AlphaBoxComponent.js +140 -140
  32. package/src/components/alphabox/AlphaBoxContentComponent.js +125 -125
  33. package/src/components/context/AUUserContextComponent.js +91 -91
  34. package/src/components/context/ImpersonateComponent.js +54 -54
  35. package/src/components/databox/DataBoxAlphabetComponent.js +144 -144
  36. package/src/components/databox/DataBoxAssociationComponent.js +122 -122
  37. package/src/components/databox/DataBoxButtonComponent.js +153 -153
  38. package/src/components/databox/DataBoxComponent.js +297 -297
  39. package/src/components/databox/DataBoxGroupingComponent.js +62 -62
  40. package/src/components/databox/DataBoxSearchResultComponent.js +40 -40
  41. package/src/components/databox/DataBoxStackedAssociationComponent.js +58 -58
  42. package/src/components/databox/DataBoxSuggestionComponent.js +39 -39
  43. package/src/components/delphinus/AUAlertComponent.js +85 -85
  44. package/src/components/delphinus/AUCalendarComponent.js +487 -487
  45. package/src/components/delphinus/AUContentToggleComponent.js +32 -32
  46. package/src/components/delphinus/AUDatepickerComponent.js +164 -164
  47. package/src/components/delphinus/AULoginComponent.js +65 -65
  48. package/src/components/delphinus/AUModalComponent.js +88 -87
  49. package/src/components/delphinus/AUSpinnerComponent.js +114 -114
  50. package/src/components/delphinus/AUSubNavComponent.js +53 -53
  51. package/src/components/delphinus/AUTabbedContentComponent.js +150 -150
  52. package/src/components/delphinus/AUTableComponent.js +28 -28
  53. package/src/components/delphinus/AUToastComponent.js +91 -91
  54. package/src/components/delphinus/AUToolbarComponent.js +48 -48
  55. package/src/components/delphinus/hooks.js +25 -25
  56. package/src/components/flowbox/FlowBoxComponent.js +126 -126
  57. package/src/components/flowbox/FlowBoxPhoneComponent.js +106 -106
  58. package/src/components/form/AUMobilePrefixComponent.js +18 -18
  59. package/src/components/form/AUReceiptComponent.js +40 -40
  60. package/src/components/form/AUSubmitButtonContainerComponent.js +39 -39
  61. package/src/components/news/EventLayout1Component.js +94 -94
  62. package/src/components/news/EventLayout2Component.js +90 -90
  63. package/src/components/news/EventLayout3Component.js +68 -68
  64. package/src/components/news/NewsCategoriesComponent.js +21 -21
  65. package/src/components/news/NewsCollageBannerComponent.js +71 -71
  66. package/src/components/news/NewsCollageBannerRSSComponent.js +79 -79
  67. package/src/components/news/NewsColumnsComponent.js +125 -125
  68. package/src/components/news/NewsLanguageChangeComponent.js +74 -74
  69. package/src/components/news/NewsLayout1Component.js +80 -80
  70. package/src/components/news/NewsLayout2Component.js +80 -80
  71. package/src/components/news/NewsLayout3Component.js +81 -81
  72. package/src/components/news/NewsLayout4Component.js +80 -80
  73. package/src/components/news/NewsLayout5Component.js +61 -61
  74. package/src/components/news/NewsLayout6Component.js +55 -55
  75. package/src/components/news/NewsLayout7Component.js +58 -58
  76. package/src/components/news/NewsLayout8Component.js +57 -57
  77. package/src/components/news/NewsListComponent.js +291 -291
  78. package/src/components/news/NewsPopUpComponent.js +591 -591
  79. package/src/components/news/NewsRSSComponent.js +74 -74
  80. package/src/components/news/NewsSocialComponent.js +104 -104
  81. package/src/components/news/NewsSubHeaderComponent.js +19 -19
  82. package/src/components/password/AUChangePasswordComponent.js +177 -177
  83. package/src/components/password/AUCurrentPasswordComponent.js +72 -72
  84. package/src/components/password/AUNewPasswordComponent.js +143 -143
  85. package/src/components/password/AUPasswordActions.js +101 -101
  86. package/src/components/password/AUPasswordHooks.js +47 -47
  87. package/src/components/password/AUPasswordReducer.js +78 -78
  88. package/src/components/password/AUPasswordRequirementsComponent.js +29 -29
  89. package/src/components/profile/AUProfileActions.js +128 -128
  90. package/src/components/profile/AUProfileAvatar2016Component.js +99 -99
  91. package/src/components/profile/AUProfileAvatarComponent.js +83 -83
  92. package/src/components/profile/AUProfileAvatarV2Component.js +91 -91
  93. package/src/components/profile/AUProfileAvatarV3Component.js +79 -79
  94. package/src/components/profile/AUProfileContainerComponent.js +283 -283
  95. package/src/components/profile/AUProfileHooks.js +30 -30
  96. package/src/components/profile/AUProfileItemComponent.js +54 -54
  97. package/src/components/profile/AUProfileLanguageComponent.js +131 -131
  98. package/src/components/profile/AUProfileLoginComponent.js +41 -41
  99. package/src/components/profile/AUProfileMailComponent.js +307 -302
  100. package/src/components/profile/AUProfileMobileComponent.js +164 -164
  101. package/src/components/profile/AUProfileNameComponent.js +253 -253
  102. package/src/components/profile/AUProfileNextOfKinComponent.js +216 -216
  103. package/src/components/profile/AUProfileReducer.js +230 -230
  104. package/src/components/profile/AUProfileWidgetComponent.js +95 -95
  105. package/src/components/profile/AUProfileWidgetV2Component.js +116 -116
  106. package/src/components/profile/AUProfileWidgetV3Component.js +120 -116
  107. package/src/components/universe/StaffTopComponent.js +362 -362
  108. package/src/components/universe/StudentTopComponent.js +137 -137
  109. package/src/components/universe/UniverseContainerComponent.js +62 -62
  110. package/src/components/wrapping/AUEmbedComponent.js +47 -47
  111. package/src/config/webpack.dev.config.js +47 -47
  112. package/src/config/webpack.umd.config.js +85 -85
  113. package/src/index.js +6 -6
  114. package/src/lib/au-alphabox.js +102 -102
  115. package/src/lib/au-auth.js +227 -227
  116. package/src/lib/au-databox.js +403 -403
  117. package/src/lib/au-diagramme.js +87 -87
  118. package/src/lib/au-flowbox.js +95 -95
  119. package/src/lib/au-news.js +371 -371
  120. package/src/lib/helpers.js +216 -216
  121. package/src/lib/i18n.js +601 -599
  122. package/src/lib/menu.js +10 -10
  123. package/src/lib/tracking.js +65 -65
  124. package/src/lib/universe.js +9 -9
  125. package/src/lib/urlHandler.js +63 -63
  126. package/src/lib/validation.js +181 -181
  127. package/src/lib/wrapping.js +16 -16
  128. package/src/styles/_settings.scss +10 -10
  129. package/src/styles/alert.scss +39 -39
  130. package/src/styles/alphabox.scss +208 -208
  131. package/src/styles/app.scss +13 -13
  132. package/src/styles/autosuggest.scss +57 -57
  133. package/src/styles/calendar.scss +111 -111
  134. package/src/styles/databox.scss +563 -563
  135. package/src/styles/diagramme.scss +119 -119
  136. package/src/styles/filtercheckbox.scss +4 -4
  137. package/src/styles/flowbox.scss +72 -72
  138. package/src/styles/maps.scss +395 -395
  139. package/src/styles/modal.scss +34 -34
  140. package/src/styles/pagination.scss +10 -10
  141. package/src/styles/spinner.scss +30 -30
@@ -1,362 +1,362 @@
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 '../AUCollapsibleComponent';
10
- import AUProfileLoginComponent from '../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
- console.log(err);
98
- });
99
- }
100
- }
101
-
102
- componentDidUpdate() {
103
- const { active } = this.state;
104
- const fade = document.getElementById('fade');
105
- if (active > 0) {
106
- fade.style.display = 'block';
107
- } else {
108
- fade.style.display = 'none';
109
- }
110
- fade.style.opacity = 0;
111
- if (active === 2 && typeof window.findWidgetInit !== 'undefined') {
112
- window.findWidgetInit('.universe-utility .find-container');
113
- }
114
- if (active === 3) {
115
- AU.alphabox.init();
116
- }
117
- }
118
-
119
- render() {
120
- const {
121
- lang,
122
- user,
123
- onLoad,
124
- universeLabels,
125
- profileLabels,
126
- } = this.props;
127
- const {
128
- active,
129
- burgerLinks,
130
- systemLinks,
131
- loggedIn,
132
- showHelp,
133
- } = this.state;
134
-
135
- const helpCookie = getCookie('mystaff-help');
136
- const visible = document.querySelector('body').classList.contains('login');
137
- const help = !helpCookie && !loggedIn && document.querySelector('body').classList.contains('help');
138
-
139
- const renderBurgerLinks = burgerLinks.map(
140
- (u) => (
141
- <li key={u.title} className={u.className}>
142
- <a href={u.url}>
143
- {u.title}
144
- </a>
145
- </li>
146
- ),
147
- );
148
-
149
- const renderSystemLinks = systemLinks.map(
150
- (s) => (
151
- <li key={s.header}>
152
- <AUCollapsibleComponent
153
- collapsed
154
- header={s.header}
155
- level={3}
156
- >
157
- <div>
158
- <p>
159
- {s.text}
160
- </p>
161
- <ul className="resetlist">
162
- {s.actions.map(
163
- (a) => (
164
- <li key={a.url}>
165
- <a href={a.url}>{a.title}</a>
166
- </li>
167
- ),
168
- )}
169
- </ul>
170
- </div>
171
- </AUCollapsibleComponent>
172
- </li>
173
- ),
174
- );
175
-
176
- return [
177
- <div key="header" className="large-12 medium-12 small-12 columns">
178
- <div>
179
- <h2 className="universe-home" dangerouslySetInnerHTML={{ __html: universeLabels[lang].staffTitleLink }} />
180
- <div className={active === 4 ? 'avatar active' : 'avatar'}>
181
- {
182
- visible && (
183
- <>
184
- <AUProfileLoginComponent
185
- text={profileLabels[lang].myProfile}
186
- loggedIn={loggedIn}
187
- loginUri={`${window.profileApiUri}/auth/login?redirectUri=${window.location.href}`}
188
- >
189
- <AUProfileAvatar2016Component
190
- lang={lang}
191
- user={user}
192
- settings={[
193
- {
194
- url: `${window.profileApiUri}/${lang}/profile`,
195
- text: profileLabels[lang].headerContainer,
196
- },
197
- {
198
- url: `${window.profileApiUri}/${lang}/password`,
199
- text: profileLabels[lang].headerPassword,
200
- },
201
- {
202
- url: `${window.profileApiUri}/${lang}/holiday`,
203
- text: profileLabels[lang].headerVacationAbsence,
204
- },
205
- ]}
206
- profileLabels={profileLabels}
207
- toggled={active === 4}
208
- onToggle={() => {
209
- this.setState((prevState) => ({
210
- active: prevState.active === 4 ? 0 : 4,
211
- }));
212
- }}
213
- onLoad={onLoad}
214
- logoutUri={`${window.profileApiUri}/auth/logout?redirectUri=${window.location.href}`}
215
- />
216
- </AUProfileLoginComponent>
217
- {
218
- help && (
219
- <>
220
- <button
221
- type="button"
222
- className="btn-help"
223
- aria-label="Hjælp / help"
224
- onClick={() => {
225
- this.setState({
226
- showHelp: true,
227
- });
228
- }}
229
- >
230
-
231
- </button>
232
- {
233
- showHelp && (
234
- ReactDOM.createPortal(
235
- <div className="help-modal">
236
- <h2>{profileLabels[lang].helpModalHeader}</h2>
237
- <p>
238
- {profileLabels[lang].helpModalText}
239
- </p>
240
- <button
241
- type="button"
242
- className="button bg-staff"
243
- onClick={() => {
244
- setCookie('mystaff-help', true, null, 365, ';path=/;domain=medarbejdere.au.dk');
245
- this.setState({
246
- showHelp: false,
247
- });
248
- }}
249
- >
250
- {profileLabels[lang].helpModalBtn}
251
- </button>
252
- </div>,
253
- document.querySelector('.main'),
254
- 'modal',
255
- )
256
- )
257
- }
258
- </>
259
- )
260
- }
261
- </>
262
- )
263
- }
264
- </div>
265
- {
266
- showHelp && (
267
- <div
268
- key="overlay"
269
- className="help-modal-overlay"
270
- role="button"
271
- onClick={() => {
272
- this.setState({
273
- showHelp: false,
274
- });
275
- }}
276
- />
277
- )
278
- }
279
- <ul className="resetlist universe-icons">
280
- <li className="au" dangerouslySetInnerHTML={{ __html: universeLabels[lang].mainPageLink }} />
281
- <li className={active === 1 ? 'active' : null}>
282
- <button
283
- type="button"
284
- className="btn-system"
285
- onClick={() => {
286
- this.setState((prevState) => ({
287
- active: prevState.active === 1 ? 0 : 1,
288
- }));
289
- }}
290
- >
291
- System
292
- </button>
293
- </li>
294
- <li className={active === 2 ? 'active' : null}>
295
- <button
296
- type="button"
297
- className="btn-find"
298
- onClick={() => {
299
- this.setState((prevState) => ({
300
- active: prevState.active === 2 ? 0 : 2,
301
- }));
302
- }}
303
- >
304
- Find
305
- </button>
306
- </li>
307
- <li className={active === 3 ? 'active' : null}>
308
- <button
309
- type="button"
310
- className="btn-menu"
311
- onClick={() => {
312
- this.setState((prevState) => ({
313
- active: prevState.active === 3 ? 0 : 3,
314
- }));
315
- }}
316
- >
317
- Menu
318
- </button>
319
- </li>
320
- </ul>
321
- </div>
322
- </div>,
323
- <div key={1} className={`universe-utility${active === 1 ? ' active' : ''}`}>
324
- <div className="universe-utility-links">
325
- <ul className="resetlist">
326
- {renderSystemLinks}
327
- </ul>
328
- </div>
329
- </div>,
330
- <div key={2} className={`universe-utility${active === 2 ? ' active' : ''}`}>
331
- <div className="find-container au-map" />
332
- </div>,
333
- <div key={3} className={`universe-utility${active === 3 ? ' active' : ''}`}>
334
- <div className="au_alphabox" id="au_alphabox_staff_utility" />
335
- <div className="universe-utility-links">
336
- <ul className="resetlist">
337
- {renderBurgerLinks}
338
- </ul>
339
- </div>
340
- </div>,
341
- ];
342
- }
343
- }
344
-
345
- /*
346
- StaffTopComponent.defaultProps = {
347
- onLogin: () => { },
348
- };
349
- */
350
-
351
- StaffTopComponent.propTypes = {
352
- lang: PropTypes.string.isRequired,
353
- user: PropTypes.shape({
354
- }).isRequired,
355
- promiseHandler: PropTypes.func.isRequired,
356
- onLoad: PropTypes.func.isRequired,
357
- universeLabels: PropTypes.shape({}).isRequired,
358
- profileLabels: PropTypes.shape({}).isRequired,
359
- };
360
-
361
- StaffTopComponent.displayName = 'StaffTopComponent';
362
- 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 '../AUCollapsibleComponent';
10
+ import AUProfileLoginComponent from '../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
+ console.log(err);
98
+ });
99
+ }
100
+ }
101
+
102
+ componentDidUpdate() {
103
+ const { active } = this.state;
104
+ const fade = document.getElementById('fade');
105
+ if (active > 0) {
106
+ fade.style.display = 'block';
107
+ } else {
108
+ fade.style.display = 'none';
109
+ }
110
+ fade.style.opacity = 0;
111
+ if (active === 2 && typeof window.findWidgetInit !== 'undefined') {
112
+ window.findWidgetInit('.universe-utility .find-container');
113
+ }
114
+ if (active === 3) {
115
+ AU.alphabox.init();
116
+ }
117
+ }
118
+
119
+ render() {
120
+ const {
121
+ lang,
122
+ user,
123
+ onLoad,
124
+ universeLabels,
125
+ profileLabels,
126
+ } = this.props;
127
+ const {
128
+ active,
129
+ burgerLinks,
130
+ systemLinks,
131
+ loggedIn,
132
+ showHelp,
133
+ } = this.state;
134
+
135
+ const helpCookie = getCookie('mystaff-help');
136
+ const visible = document.querySelector('body').classList.contains('login');
137
+ const help = !helpCookie && !loggedIn && document.querySelector('body').classList.contains('help');
138
+
139
+ const renderBurgerLinks = burgerLinks.map(
140
+ (u) => (
141
+ <li key={u.title} className={u.className}>
142
+ <a href={u.url}>
143
+ {u.title}
144
+ </a>
145
+ </li>
146
+ ),
147
+ );
148
+
149
+ const renderSystemLinks = systemLinks.map(
150
+ (s) => (
151
+ <li key={s.header}>
152
+ <AUCollapsibleComponent
153
+ collapsed
154
+ header={s.header}
155
+ level={3}
156
+ >
157
+ <div>
158
+ <p>
159
+ {s.text}
160
+ </p>
161
+ <ul className="resetlist">
162
+ {s.actions.map(
163
+ (a) => (
164
+ <li key={a.url}>
165
+ <a href={a.url}>{a.title}</a>
166
+ </li>
167
+ ),
168
+ )}
169
+ </ul>
170
+ </div>
171
+ </AUCollapsibleComponent>
172
+ </li>
173
+ ),
174
+ );
175
+
176
+ return [
177
+ <div key="header" className="large-12 medium-12 small-12 columns">
178
+ <div>
179
+ <h2 className="universe-home" dangerouslySetInnerHTML={{ __html: universeLabels[lang].staffTitleLink }} />
180
+ <div className={active === 4 ? 'avatar active' : 'avatar'}>
181
+ {
182
+ visible && (
183
+ <>
184
+ <AUProfileLoginComponent
185
+ text={profileLabels[lang].myProfile}
186
+ loggedIn={loggedIn}
187
+ loginUri={`${window.profileApiUri}/auth/login?redirectUri=${window.location.href}`}
188
+ >
189
+ <AUProfileAvatar2016Component
190
+ lang={lang}
191
+ user={user}
192
+ settings={[
193
+ {
194
+ url: `${window.profileApiUri}/${lang}/profile`,
195
+ text: profileLabels[lang].headerContainer,
196
+ },
197
+ {
198
+ url: `${window.profileApiUri}/${lang}/password`,
199
+ text: profileLabels[lang].headerPassword,
200
+ },
201
+ {
202
+ url: `${window.profileApiUri}/${lang}/holiday`,
203
+ text: profileLabels[lang].headerVacationAbsence,
204
+ },
205
+ ]}
206
+ profileLabels={profileLabels}
207
+ toggled={active === 4}
208
+ onToggle={() => {
209
+ this.setState((prevState) => ({
210
+ active: prevState.active === 4 ? 0 : 4,
211
+ }));
212
+ }}
213
+ onLoad={onLoad}
214
+ logoutUri={`${window.profileApiUri}/auth/logout?redirectUri=${window.location.href}`}
215
+ />
216
+ </AUProfileLoginComponent>
217
+ {
218
+ help && (
219
+ <>
220
+ <button
221
+ type="button"
222
+ className="btn-help"
223
+ aria-label="Hjælp / help"
224
+ onClick={() => {
225
+ this.setState({
226
+ showHelp: true,
227
+ });
228
+ }}
229
+ >
230
+
231
+ </button>
232
+ {
233
+ showHelp && (
234
+ ReactDOM.createPortal(
235
+ <div className="help-modal">
236
+ <h2>{profileLabels[lang].helpModalHeader}</h2>
237
+ <p>
238
+ {profileLabels[lang].helpModalText}
239
+ </p>
240
+ <button
241
+ type="button"
242
+ className="button bg-staff"
243
+ onClick={() => {
244
+ setCookie('mystaff-help', true, null, 365, ';path=/;domain=medarbejdere.au.dk');
245
+ this.setState({
246
+ showHelp: false,
247
+ });
248
+ }}
249
+ >
250
+ {profileLabels[lang].helpModalBtn}
251
+ </button>
252
+ </div>,
253
+ document.querySelector('.main'),
254
+ 'modal',
255
+ )
256
+ )
257
+ }
258
+ </>
259
+ )
260
+ }
261
+ </>
262
+ )
263
+ }
264
+ </div>
265
+ {
266
+ showHelp && (
267
+ <div
268
+ key="overlay"
269
+ className="help-modal-overlay"
270
+ role="button"
271
+ onClick={() => {
272
+ this.setState({
273
+ showHelp: false,
274
+ });
275
+ }}
276
+ />
277
+ )
278
+ }
279
+ <ul className="resetlist universe-icons">
280
+ <li className="au" dangerouslySetInnerHTML={{ __html: universeLabels[lang].mainPageLink }} />
281
+ <li className={active === 1 ? 'active' : null}>
282
+ <button
283
+ type="button"
284
+ className="btn-system"
285
+ onClick={() => {
286
+ this.setState((prevState) => ({
287
+ active: prevState.active === 1 ? 0 : 1,
288
+ }));
289
+ }}
290
+ >
291
+ System
292
+ </button>
293
+ </li>
294
+ <li className={active === 2 ? 'active' : null}>
295
+ <button
296
+ type="button"
297
+ className="btn-find"
298
+ onClick={() => {
299
+ this.setState((prevState) => ({
300
+ active: prevState.active === 2 ? 0 : 2,
301
+ }));
302
+ }}
303
+ >
304
+ Find
305
+ </button>
306
+ </li>
307
+ <li className={active === 3 ? 'active' : null}>
308
+ <button
309
+ type="button"
310
+ className="btn-menu"
311
+ onClick={() => {
312
+ this.setState((prevState) => ({
313
+ active: prevState.active === 3 ? 0 : 3,
314
+ }));
315
+ }}
316
+ >
317
+ Menu
318
+ </button>
319
+ </li>
320
+ </ul>
321
+ </div>
322
+ </div>,
323
+ <div key={1} className={`universe-utility${active === 1 ? ' active' : ''}`}>
324
+ <div className="universe-utility-links">
325
+ <ul className="resetlist">
326
+ {renderSystemLinks}
327
+ </ul>
328
+ </div>
329
+ </div>,
330
+ <div key={2} className={`universe-utility${active === 2 ? ' active' : ''}`}>
331
+ <div className="find-container au-map" />
332
+ </div>,
333
+ <div key={3} className={`universe-utility${active === 3 ? ' active' : ''}`}>
334
+ <div className="au_alphabox" id="au_alphabox_staff_utility" />
335
+ <div className="universe-utility-links">
336
+ <ul className="resetlist">
337
+ {renderBurgerLinks}
338
+ </ul>
339
+ </div>
340
+ </div>,
341
+ ];
342
+ }
343
+ }
344
+
345
+ /*
346
+ StaffTopComponent.defaultProps = {
347
+ onLogin: () => { },
348
+ };
349
+ */
350
+
351
+ StaffTopComponent.propTypes = {
352
+ lang: PropTypes.string.isRequired,
353
+ user: PropTypes.shape({
354
+ }).isRequired,
355
+ promiseHandler: PropTypes.func.isRequired,
356
+ onLoad: PropTypes.func.isRequired,
357
+ universeLabels: PropTypes.shape({}).isRequired,
358
+ profileLabels: PropTypes.shape({}).isRequired,
359
+ };
360
+
361
+ StaffTopComponent.displayName = 'StaffTopComponent';
362
+ export default StaffTopComponent;