ehr-alerts-ui 0.0.25 → 0.0.27
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/.husky/pre-commit +4 -0
- package/.prettierrc +13 -0
- package/lib/index.cjs.js +1 -1
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +22 -11
- package/src/App.tsx +19 -23
- package/src/index.tsx +1 -2
- package/src/library/actions/AlertActions.ts +91 -66
- package/src/library/actions/TableActions.ts +55 -54
- package/src/library/components/AlertModal/AlertModal.tsx +251 -152
- package/src/library/components/AlertModal/AlertModalContainer.tsx +16 -14
- package/src/library/components/AlertModal/index.ts +1 -1
- package/src/library/components/AlertsTable/AlertsTable.tsx +144 -66
- package/src/library/components/AlertsTable/AlertsTableContainer.tsx +37 -24
- package/src/library/components/AlertsTable/SortableRow/SortableRow.tsx +53 -33
- package/src/library/components/AlertsTable/SortableRow/index.ts +1 -1
- package/src/library/components/AlertsTable/index.ts +1 -1
- package/src/library/components/Header/Header.tsx +11 -12
- package/src/library/components/Header/HeaderContainer.tsx +13 -11
- package/src/library/components/Header/index.ts +1 -1
- package/src/library/components/MainPage/MainPage.tsx +17 -18
- package/src/library/components/MainPage/index.ts +2 -2
- package/src/library/configureStore.ts +10 -14
- package/src/library/helpers/appendZero.ts +1 -1
- package/src/library/helpers/printDate.ts +1 -1
- package/src/library/index.ts +1 -1
- package/src/library/reducers/alertReducer.ts +19 -20
- package/src/library/reducers/index.ts +6 -6
- package/src/library/reducers/tableReducer.ts +32 -33
- package/src/react-app-env.d.ts +1 -1
- package/src/setupProxy.js +9 -7
- package/src/translations/elements_et.json +231 -244
- package/tsconfig.json +1 -1
|
@@ -1,21 +1,30 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
DatePicker,
|
|
5
|
+
FieldWrapper,
|
|
6
|
+
Input,
|
|
7
|
+
Section,
|
|
8
|
+
Select,
|
|
9
|
+
TextArea,
|
|
10
|
+
AlertIcon,
|
|
11
|
+
} from 'ehr-components';
|
|
12
|
+
import { Alert, Audience, MessageLevel } from '../../reducers/tableReducer';
|
|
13
|
+
import appendZero from '../../helpers/appendZero';
|
|
14
|
+
import { AlertModalError } from '../../reducers/alertReducer';
|
|
6
15
|
|
|
7
16
|
export interface AlertModalState {
|
|
8
|
-
alert: Alert | undefined
|
|
9
|
-
errors: AlertModalError[]
|
|
17
|
+
alert: Alert | undefined;
|
|
18
|
+
errors: AlertModalError[];
|
|
10
19
|
}
|
|
11
20
|
|
|
12
21
|
export interface AlertModalDispatch {
|
|
13
|
-
editAlert: (alert: Alert) => void
|
|
14
|
-
clearAlert: () => void
|
|
15
|
-
postAlert: () => void
|
|
16
|
-
updateAlert: () => void
|
|
17
|
-
addAlertModalError: (error: AlertModalError) => void
|
|
18
|
-
clearAlertModalErrors: () => void
|
|
22
|
+
editAlert: (alert: Alert) => void;
|
|
23
|
+
clearAlert: () => void;
|
|
24
|
+
postAlert: () => void;
|
|
25
|
+
updateAlert: () => void;
|
|
26
|
+
addAlertModalError: (error: AlertModalError) => void;
|
|
27
|
+
clearAlertModalErrors: () => void;
|
|
19
28
|
}
|
|
20
29
|
|
|
21
30
|
enum ContentLanguage {
|
|
@@ -25,20 +34,26 @@ enum ContentLanguage {
|
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
const audiences = [
|
|
28
|
-
{code: Audience.AUTHENTICATED, texts: 'Autenditud kasutaja'},
|
|
29
|
-
{code: Audience.NOT_AUTHENTICATED, texts: 'Autentimata kasutaja'},
|
|
30
|
-
]
|
|
37
|
+
{ code: Audience.AUTHENTICATED, texts: 'Autenditud kasutaja' },
|
|
38
|
+
{ code: Audience.NOT_AUTHENTICATED, texts: 'Autentimata kasutaja' },
|
|
39
|
+
];
|
|
31
40
|
|
|
32
41
|
const messageLevels = [
|
|
33
|
-
{code: MessageLevel.TEADE, texts: 'Teade (roheline)'},
|
|
34
|
-
{code: MessageLevel.HOIATUS, texts: 'Hoiatus (kollane)'},
|
|
35
|
-
{code: MessageLevel.VEATEADE, texts: 'Veateade (punane)'},
|
|
36
|
-
]
|
|
37
|
-
|
|
38
|
-
const AlertModal: React.FC<AlertModalState & AlertModalDispatch> = ({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
{ code: MessageLevel.TEADE, texts: 'Teade (roheline)' },
|
|
43
|
+
{ code: MessageLevel.HOIATUS, texts: 'Hoiatus (kollane)' },
|
|
44
|
+
{ code: MessageLevel.VEATEADE, texts: 'Veateade (punane)' },
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const AlertModal: React.FC<AlertModalState & AlertModalDispatch> = ({
|
|
48
|
+
alert,
|
|
49
|
+
clearAlert,
|
|
50
|
+
editAlert,
|
|
51
|
+
postAlert,
|
|
52
|
+
updateAlert,
|
|
53
|
+
addAlertModalError,
|
|
54
|
+
errors,
|
|
55
|
+
clearAlertModalErrors,
|
|
56
|
+
}) => {
|
|
42
57
|
function onAudienceChange(code: Audience) {
|
|
43
58
|
if (!alert) {
|
|
44
59
|
return;
|
|
@@ -91,7 +106,7 @@ const AlertModal: React.FC<AlertModalState & AlertModalDispatch> = ({alert, clea
|
|
|
91
106
|
editAlert({
|
|
92
107
|
...alert,
|
|
93
108
|
beginMinute: parseInt(value) || 0,
|
|
94
|
-
})
|
|
109
|
+
});
|
|
95
110
|
}
|
|
96
111
|
|
|
97
112
|
function onDateEndChange(date: string) {
|
|
@@ -124,7 +139,7 @@ const AlertModal: React.FC<AlertModalState & AlertModalDispatch> = ({alert, clea
|
|
|
124
139
|
editAlert({
|
|
125
140
|
...alert,
|
|
126
141
|
endMinute: parseInt(value) || 0,
|
|
127
|
-
})
|
|
142
|
+
});
|
|
128
143
|
}
|
|
129
144
|
|
|
130
145
|
function onTitleChange(lang: ContentLanguage, title: string) {
|
|
@@ -253,7 +268,7 @@ const AlertModal: React.FC<AlertModalState & AlertModalDispatch> = ({alert, clea
|
|
|
253
268
|
if (!checkMinute(alert.endMinute)) {
|
|
254
269
|
addAlertModalError({
|
|
255
270
|
title: 'end_minute',
|
|
256
|
-
content:
|
|
271
|
+
content: 'Please add a valid minute.',
|
|
257
272
|
});
|
|
258
273
|
errors = true;
|
|
259
274
|
}
|
|
@@ -278,16 +293,15 @@ const AlertModal: React.FC<AlertModalState & AlertModalDispatch> = ({alert, clea
|
|
|
278
293
|
}
|
|
279
294
|
|
|
280
295
|
function checkHour(hour: number | undefined) {
|
|
281
|
-
return
|
|
296
|
+
return hour !== undefined && hour >= 0 && hour <= 23;
|
|
282
297
|
}
|
|
283
298
|
|
|
284
299
|
function checkMinute(minute: number | undefined) {
|
|
285
|
-
return
|
|
300
|
+
return minute !== undefined && minute >= 0 && minute <= 59;
|
|
286
301
|
}
|
|
287
302
|
|
|
288
|
-
|
|
289
303
|
function checkSelfError(title: string): string {
|
|
290
|
-
if (errors.filter((error) =>
|
|
304
|
+
if (errors.filter((error) => error.title === title).length > 0) {
|
|
291
305
|
return 'has-danger';
|
|
292
306
|
}
|
|
293
307
|
|
|
@@ -296,11 +310,10 @@ const AlertModal: React.FC<AlertModalState & AlertModalDispatch> = ({alert, clea
|
|
|
296
310
|
|
|
297
311
|
return (
|
|
298
312
|
<>
|
|
299
|
-
{
|
|
300
|
-
alert
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
<h4 className='text-primary'>Teate lisamine</h4>
|
|
313
|
+
{alert && (
|
|
314
|
+
<div id="alerts-ui--alert-creation-modal">
|
|
315
|
+
<div className="alerts-ui--alert-creation-modal--modal">
|
|
316
|
+
<h4 className="text-primary">Teate lisamine</h4>
|
|
304
317
|
|
|
305
318
|
{/*<ul className="alerts-ui--alert-creation-modal--errors">*/}
|
|
306
319
|
{/* {*/}
|
|
@@ -313,101 +326,163 @@ const AlertModal: React.FC<AlertModalState & AlertModalDispatch> = ({alert, clea
|
|
|
313
326
|
{/* ))*/}
|
|
314
327
|
{/* }*/}
|
|
315
328
|
{/*</ul>*/}
|
|
316
|
-
<div className=
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
329
|
+
<div className="alerts-ui--alert-creation-modal--content">
|
|
330
|
+
<FieldWrapper
|
|
331
|
+
label="Teate publik"
|
|
332
|
+
info={{
|
|
333
|
+
content:
|
|
334
|
+
'Autentimata kasutaja on iga kasutaja, kes avab e-ehituse veebilehe. Autenditud kasutaja on kasutaja, kes logib end e-ehituse veebi sisse. Teate loomisel tuleb arvestada, kas teade on vajalik neile, kes on juba lehel sisse loginud või kõikidele, kes lehele satuvad.',
|
|
335
|
+
}}
|
|
336
|
+
className={checkSelfError('publik')}
|
|
337
|
+
component={
|
|
338
|
+
<Select
|
|
339
|
+
name="audience"
|
|
340
|
+
value={alert.audience}
|
|
341
|
+
onChange={onAudienceChange}
|
|
342
|
+
options={audiences}
|
|
343
|
+
/>
|
|
344
|
+
}
|
|
345
|
+
required
|
|
325
346
|
/>
|
|
326
347
|
|
|
327
|
-
<FieldWrapper
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
348
|
+
<FieldWrapper
|
|
349
|
+
label="Teate tase"
|
|
350
|
+
info={{
|
|
351
|
+
content:
|
|
352
|
+
'Teade (roheline) on neutraalse või positiivse sisuga. Näiteks info uue teenuse või muutuse kohta keskkonnas. Hoiatus (kollane) on hoiatav info millegi kohta, mis võib häirida kasutaja tööd lehel, kuid ei takista. Näiteks suhtlus mõne teise registriga võib olla häiritud. Veateade (punane) on teade selle kohta, et midagi ei tööta ja see takistab tööd lehel. Näiteks teenus on mingi aeg maas, allkirjastamine ei tööta, sisse logida ei saa.',
|
|
353
|
+
}}
|
|
354
|
+
className={checkSelfError('tease')}
|
|
355
|
+
component={
|
|
356
|
+
<Select
|
|
357
|
+
name="level"
|
|
358
|
+
value={alert.level}
|
|
359
|
+
onChange={onLevelChange}
|
|
360
|
+
options={messageLevels}
|
|
361
|
+
/>
|
|
362
|
+
}
|
|
363
|
+
required
|
|
334
364
|
/>
|
|
335
365
|
|
|
336
|
-
<FieldWrapper
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
366
|
+
<FieldWrapper
|
|
367
|
+
label="Teate kuvamise algus"
|
|
368
|
+
info={{
|
|
369
|
+
content:
|
|
370
|
+
'Teade kuvatakse kasutajale siin märgitud kellaajast alates',
|
|
371
|
+
}}
|
|
372
|
+
component={
|
|
373
|
+
<div className="alerts-ui--alert-creation-modal--content--date">
|
|
374
|
+
<InternalDatePicker
|
|
375
|
+
date={alert.begin}
|
|
376
|
+
onChange={onDateStartChange}
|
|
377
|
+
title="start_date"
|
|
378
|
+
checkSelfError={checkSelfError}
|
|
379
|
+
/>
|
|
380
|
+
|
|
381
|
+
<div className="alerts-ui--alert-creation-modal--content--time">
|
|
382
|
+
<p>kell</p>
|
|
383
|
+
|
|
384
|
+
<TimeInput
|
|
385
|
+
date={alert.beginHour}
|
|
386
|
+
checkSelfError={checkSelfError}
|
|
387
|
+
onChange={onHourStartChange}
|
|
388
|
+
min="0"
|
|
389
|
+
max="23"
|
|
390
|
+
title="start_hour"
|
|
391
|
+
/>
|
|
392
|
+
|
|
393
|
+
<p>:</p>
|
|
394
|
+
|
|
395
|
+
<TimeInput
|
|
396
|
+
date={alert.beginMinute}
|
|
397
|
+
onChange={onMinuteStartChange}
|
|
398
|
+
min="0"
|
|
399
|
+
max="59"
|
|
400
|
+
title="start_minute"
|
|
401
|
+
checkSelfError={checkSelfError}
|
|
402
|
+
/>
|
|
403
|
+
</div>
|
|
404
|
+
</div>
|
|
405
|
+
}
|
|
406
|
+
required
|
|
359
407
|
/>
|
|
360
408
|
|
|
361
|
-
<FieldWrapper
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
409
|
+
<FieldWrapper
|
|
410
|
+
label="Teate kuvamise lõpp"
|
|
411
|
+
info={{
|
|
412
|
+
content:
|
|
413
|
+
'Teate kuvamine kasutajale lõpeb siin märgitud kellaajast',
|
|
414
|
+
}}
|
|
415
|
+
component={
|
|
416
|
+
<div className="alerts-ui--alert-creation-modal--content--date">
|
|
417
|
+
<InternalDatePicker
|
|
418
|
+
date={alert.end}
|
|
419
|
+
onChange={onDateEndChange}
|
|
420
|
+
title="end_date"
|
|
421
|
+
checkSelfError={checkSelfError}
|
|
422
|
+
/>
|
|
423
|
+
|
|
424
|
+
<div className="alerts-ui--alert-creation-modal--content--time">
|
|
425
|
+
<p>kell</p>
|
|
426
|
+
|
|
427
|
+
<TimeInput
|
|
428
|
+
date={alert.endHour}
|
|
429
|
+
onChange={onHourEndChange}
|
|
430
|
+
min="0"
|
|
431
|
+
max="23"
|
|
432
|
+
checkSelfError={checkSelfError}
|
|
433
|
+
title="end_hour"
|
|
434
|
+
/>
|
|
435
|
+
|
|
436
|
+
<p>:</p>
|
|
437
|
+
|
|
438
|
+
<TimeInput
|
|
439
|
+
date={alert.endMinute}
|
|
440
|
+
onChange={onMinuteEndChange}
|
|
441
|
+
min="0"
|
|
442
|
+
max="59"
|
|
443
|
+
title="end_minute"
|
|
444
|
+
checkSelfError={checkSelfError}
|
|
445
|
+
/>
|
|
446
|
+
</div>
|
|
447
|
+
</div>
|
|
448
|
+
}
|
|
449
|
+
required
|
|
385
450
|
/>
|
|
386
451
|
|
|
387
452
|
{/*<Section form={true} title='EE' >*/}
|
|
388
453
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
454
|
+
<FieldWrapper
|
|
455
|
+
label="Teate pealkiri"
|
|
456
|
+
className={checkSelfError('title')}
|
|
457
|
+
component={
|
|
458
|
+
<Input
|
|
459
|
+
name="Title EE"
|
|
460
|
+
value={alert.title}
|
|
461
|
+
onChange={(c: string) =>
|
|
462
|
+
onTitleChange(ContentLanguage.EE, c)
|
|
463
|
+
}
|
|
464
|
+
maxLength="100"
|
|
465
|
+
/>
|
|
466
|
+
}
|
|
467
|
+
required
|
|
468
|
+
/>
|
|
469
|
+
|
|
470
|
+
<FieldWrapper
|
|
471
|
+
label="Teate sisu"
|
|
472
|
+
className={checkSelfError('content')}
|
|
473
|
+
component={
|
|
474
|
+
<TextArea
|
|
475
|
+
name="Content EE"
|
|
476
|
+
value={alert.content}
|
|
477
|
+
onChange={(c: string) =>
|
|
478
|
+
onContentChange(ContentLanguage.EE, c)
|
|
479
|
+
}
|
|
480
|
+
isLimitingLength={true}
|
|
481
|
+
maxLength={500}
|
|
482
|
+
/>
|
|
483
|
+
}
|
|
484
|
+
required
|
|
485
|
+
/>
|
|
411
486
|
|
|
412
487
|
{/*</Section>*/}
|
|
413
488
|
|
|
@@ -466,49 +541,73 @@ const AlertModal: React.FC<AlertModalState & AlertModalDispatch> = ({alert, clea
|
|
|
466
541
|
{/*</Section>*/}
|
|
467
542
|
</div>
|
|
468
543
|
|
|
469
|
-
<div className=
|
|
470
|
-
<Button colourScheme=
|
|
471
|
-
|
|
544
|
+
<div className="alerts-ui--alert-creation-modal--footer mt-2">
|
|
545
|
+
<Button colourScheme="light" onClick={onCancel}>
|
|
546
|
+
Loobun
|
|
547
|
+
</Button>
|
|
548
|
+
<Button colourScheme="success" onClick={onSubmit}>
|
|
549
|
+
Salvestan
|
|
550
|
+
</Button>
|
|
472
551
|
</div>
|
|
473
552
|
</div>
|
|
474
553
|
</div>
|
|
475
|
-
}
|
|
554
|
+
)}
|
|
476
555
|
</>
|
|
477
556
|
);
|
|
478
|
-
}
|
|
479
|
-
|
|
557
|
+
};
|
|
480
558
|
|
|
481
559
|
interface TimeInputProps {
|
|
482
|
-
date: number | undefined
|
|
483
|
-
onChange: (value: string) => void
|
|
484
|
-
min: string
|
|
485
|
-
max: string
|
|
486
|
-
title: string
|
|
487
|
-
checkSelfError: (title: string) => string
|
|
560
|
+
date: number | undefined;
|
|
561
|
+
onChange: (value: string) => void;
|
|
562
|
+
min: string;
|
|
563
|
+
max: string;
|
|
564
|
+
title: string;
|
|
565
|
+
checkSelfError: (title: string) => string;
|
|
488
566
|
}
|
|
489
567
|
|
|
490
|
-
const TimeInput: React.FC<TimeInputProps> = ({
|
|
568
|
+
const TimeInput: React.FC<TimeInputProps> = ({
|
|
569
|
+
date,
|
|
570
|
+
onChange,
|
|
571
|
+
max,
|
|
572
|
+
min,
|
|
573
|
+
title,
|
|
574
|
+
checkSelfError,
|
|
575
|
+
}) => {
|
|
491
576
|
return (
|
|
492
|
-
<input
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
}
|
|
577
|
+
<input
|
|
578
|
+
className={`safari-input-rendering-bug-fix form-control ${checkSelfError(
|
|
579
|
+
title,
|
|
580
|
+
)}`}
|
|
581
|
+
placeholder="00"
|
|
582
|
+
defaultValue={date !== undefined ? appendZero(date.toString()) : ''}
|
|
583
|
+
onChange={(event) => onChange(event.target.value)}
|
|
584
|
+
type="number"
|
|
585
|
+
min={min}
|
|
586
|
+
max={max}
|
|
587
|
+
/>
|
|
588
|
+
);
|
|
589
|
+
};
|
|
498
590
|
|
|
499
591
|
interface InternalDatePickerProps {
|
|
500
|
-
date: string | undefined
|
|
501
|
-
onChange: (value: string) => void
|
|
502
|
-
title: string
|
|
503
|
-
checkSelfError: (title: string) => string
|
|
592
|
+
date: string | undefined;
|
|
593
|
+
onChange: (value: string) => void;
|
|
594
|
+
title: string;
|
|
595
|
+
checkSelfError: (title: string) => string;
|
|
504
596
|
}
|
|
505
597
|
|
|
506
|
-
const InternalDatePicker: React.FC<InternalDatePickerProps> = ({
|
|
598
|
+
const InternalDatePicker: React.FC<InternalDatePickerProps> = ({
|
|
599
|
+
date,
|
|
600
|
+
onChange,
|
|
601
|
+
title,
|
|
602
|
+
checkSelfError,
|
|
603
|
+
}) => {
|
|
507
604
|
return (
|
|
508
|
-
<DatePicker
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
605
|
+
<DatePicker
|
|
606
|
+
value={date}
|
|
607
|
+
className={checkSelfError(title)}
|
|
608
|
+
onChange={onChange}
|
|
609
|
+
/>
|
|
610
|
+
);
|
|
611
|
+
};
|
|
513
612
|
|
|
514
|
-
export default AlertModal;
|
|
613
|
+
export default AlertModal;
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {connect} from
|
|
3
|
-
import {AlertsUiState} from
|
|
4
|
-
import AlertModal, {AlertModalDispatch, AlertModalState} from
|
|
5
|
-
import {ThunkDispatch} from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { connect } from 'react-redux';
|
|
3
|
+
import { AlertsUiState } from '../../reducers';
|
|
4
|
+
import AlertModal, { AlertModalDispatch, AlertModalState } from './AlertModal';
|
|
5
|
+
import { ThunkDispatch } from 'redux-thunk';
|
|
6
6
|
import {
|
|
7
7
|
addAlertModalError,
|
|
8
8
|
clearAlert,
|
|
9
9
|
clearAlertModalErrors,
|
|
10
10
|
editAlert,
|
|
11
11
|
postAlert,
|
|
12
|
-
updateAlert
|
|
13
|
-
} from
|
|
14
|
-
import {Simulate} from
|
|
12
|
+
updateAlert,
|
|
13
|
+
} from '../../actions/AlertActions';
|
|
14
|
+
import { Simulate } from 'react-dom/test-utils';
|
|
15
15
|
|
|
16
16
|
function mapStateToProps(state: AlertsUiState): AlertModalState {
|
|
17
17
|
return {
|
|
18
18
|
alert: state.alert.alert,
|
|
19
19
|
errors: state.alert.errors,
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function mapDispatchToProps(
|
|
23
|
+
function mapDispatchToProps(
|
|
24
|
+
dispatch: ThunkDispatch<any, any, any>,
|
|
25
|
+
): AlertModalDispatch {
|
|
24
26
|
return {
|
|
25
27
|
clearAlert: () => {
|
|
26
28
|
dispatch(clearAlert());
|
|
@@ -35,12 +37,12 @@ function mapDispatchToProps(dispatch: ThunkDispatch<any, any, any>): AlertModalD
|
|
|
35
37
|
dispatch(updateAlert());
|
|
36
38
|
},
|
|
37
39
|
addAlertModalError: (error) => {
|
|
38
|
-
dispatch(addAlertModalError(error))
|
|
40
|
+
dispatch(addAlertModalError(error));
|
|
39
41
|
},
|
|
40
42
|
clearAlertModalErrors: () => {
|
|
41
43
|
dispatch(clearAlertModalErrors());
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
+
},
|
|
45
|
+
};
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
export default connect(mapStateToProps, mapDispatchToProps)(AlertModal);
|
|
48
|
+
export default connect(mapStateToProps, mapDispatchToProps)(AlertModal);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {default} from './AlertModalContainer';
|
|
1
|
+
export { default } from './AlertModalContainer';
|