dce-reactkit 3.2.1 → 3.2.2-beta.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/.vscode/settings.json +3 -0
- package/dist/cjs/index.js +2106 -416
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/CSVDownloadButton.d.ts +19 -0
- package/dist/cjs/types/components/IntelliTable.d.ts +17 -0
- package/dist/cjs/types/components/LogReviewer.d.ts +13 -0
- package/dist/cjs/types/components/SimpleDateChooser.d.ts +1 -0
- package/dist/cjs/types/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +6 -0
- package/dist/cjs/types/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +7 -0
- package/dist/cjs/types/helpers/canReviewLogs.d.ts +7 -0
- package/dist/cjs/types/helpers/genCSV.d.ts +14 -0
- package/dist/cjs/types/helpers/getMonthName.d.ts +14 -0
- package/dist/cjs/types/index.d.ts +8 -1
- package/dist/cjs/types/server/initServer.d.ts +8 -0
- package/dist/cjs/types/types/IntelliTableColumn.d.ts +12 -0
- package/dist/cjs/types/types/LogBuiltInMetadata.d.ts +1 -0
- package/dist/cjs/types/types/LogMetadataType.d.ts +19 -0
- package/dist/cjs/types/types/ReactKitErrorCode.d.ts +2 -1
- package/dist/esm/index.js +2103 -418
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/CSVDownloadButton.d.ts +19 -0
- package/dist/esm/types/components/IntelliTable.d.ts +17 -0
- package/dist/esm/types/components/LogReviewer.d.ts +13 -0
- package/dist/esm/types/components/SimpleDateChooser.d.ts +1 -0
- package/dist/esm/types/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +6 -0
- package/dist/esm/types/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +7 -0
- package/dist/esm/types/helpers/canReviewLogs.d.ts +7 -0
- package/dist/esm/types/helpers/genCSV.d.ts +14 -0
- package/dist/esm/types/helpers/getMonthName.d.ts +14 -0
- package/dist/esm/types/index.d.ts +8 -1
- package/dist/esm/types/server/initServer.d.ts +8 -0
- package/dist/esm/types/types/IntelliTableColumn.d.ts +12 -0
- package/dist/esm/types/types/LogBuiltInMetadata.d.ts +1 -0
- package/dist/esm/types/types/LogMetadataType.d.ts +19 -0
- package/dist/esm/types/types/ReactKitErrorCode.d.ts +2 -1
- package/dist/index.d.ts +163 -47
- package/package.json +1 -1
- package/sandbox.js +78 -17
- package/src/components/AppWrapper.tsx +15 -0
- package/src/components/CSVDownloadButton.tsx +102 -0
- package/src/components/IntelliTable.tsx +610 -0
- package/src/components/LogReviewer.tsx +2038 -0
- package/src/components/SimpleDateChooser.tsx +26 -27
- package/src/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.ts +9 -0
- package/src/constants/LOG_REVIEW_STATUS_ROUTE.ts +10 -0
- package/src/helpers/canReviewLogs.ts +33 -0
- package/src/helpers/genCSV.ts +59 -0
- package/src/helpers/getHumanReadableDate.ts +6 -17
- package/src/helpers/getMonthName.ts +29 -0
- package/src/index.ts +14 -0
- package/src/server/initServer.ts +105 -3
- package/src/types/IntelliTableColumn.ts +24 -0
- package/src/types/LogBuiltInMetadata.ts +1 -0
- package/src/types/LogMetadataType.ts +23 -0
- package/src/types/ReactKitErrorCode.tsx +2 -1
|
@@ -21,6 +21,8 @@ import Modal from './Modal';
|
|
|
21
21
|
|
|
22
22
|
// Import custom errors
|
|
23
23
|
import ErrorWithCode from '../errors/ErrorWithCode';
|
|
24
|
+
import logClientEvent from '../helpers/logClientEvent';
|
|
25
|
+
import LogBuiltInMetadata from '../types/LogBuiltInMetadata';
|
|
24
26
|
|
|
25
27
|
/*------------------------------------------------------------------------*/
|
|
26
28
|
/* Props */
|
|
@@ -222,6 +224,19 @@ export const showFatalError = (
|
|
|
222
224
|
: String(error.code ?? ReactKitErrorCode.NoCode)
|
|
223
225
|
);
|
|
224
226
|
|
|
227
|
+
// Add log
|
|
228
|
+
logClientEvent({
|
|
229
|
+
context: LogBuiltInMetadata.Context.ClientFatalError,
|
|
230
|
+
error: {
|
|
231
|
+
message,
|
|
232
|
+
code,
|
|
233
|
+
stack: (error ?? {}).stack,
|
|
234
|
+
},
|
|
235
|
+
metadata: {
|
|
236
|
+
errorTitle,
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
|
|
225
240
|
// Handle case where app hasn't loaded
|
|
226
241
|
if (!setFatalErrorMessage || !setFatalErrorCode) {
|
|
227
242
|
alert(
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button for downloading a csv file
|
|
3
|
+
* @author Gabe Abrams
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Import React
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
// Import FontAwesome
|
|
10
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
11
|
+
import { faCloudDownloadAlt } from '@fortawesome/free-solid-svg-icons';
|
|
12
|
+
|
|
13
|
+
/*------------------------------------------------------------------------*/
|
|
14
|
+
/* Types */
|
|
15
|
+
/*------------------------------------------------------------------------*/
|
|
16
|
+
|
|
17
|
+
// Props definition
|
|
18
|
+
type Props = {
|
|
19
|
+
// The filename
|
|
20
|
+
filename: string,
|
|
21
|
+
// The contents of the CSV file to download
|
|
22
|
+
csv: string,
|
|
23
|
+
// Id of the button
|
|
24
|
+
id?: string,
|
|
25
|
+
// Class name of the button
|
|
26
|
+
className?: string,
|
|
27
|
+
// Aria label for the button
|
|
28
|
+
ariaLabel?: string,
|
|
29
|
+
// Style for the button
|
|
30
|
+
style?: { [k: string]: any },
|
|
31
|
+
// Handler for when the button is clicked (in addition to download)
|
|
32
|
+
onClick?: () => void,
|
|
33
|
+
// Contents of button
|
|
34
|
+
children?: React.ReactNode,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/*------------------------------------------------------------------------*/
|
|
38
|
+
/* Component */
|
|
39
|
+
/*------------------------------------------------------------------------*/
|
|
40
|
+
|
|
41
|
+
const CSVDownloadButton: React.FC<Props> = (props) => {
|
|
42
|
+
/*------------------------------------------------------------------------*/
|
|
43
|
+
/* Setup */
|
|
44
|
+
/*------------------------------------------------------------------------*/
|
|
45
|
+
|
|
46
|
+
/* -------------- Props ------------- */
|
|
47
|
+
|
|
48
|
+
// Destructure all props
|
|
49
|
+
const {
|
|
50
|
+
filename,
|
|
51
|
+
csv,
|
|
52
|
+
id,
|
|
53
|
+
className,
|
|
54
|
+
ariaLabel,
|
|
55
|
+
style,
|
|
56
|
+
onClick,
|
|
57
|
+
children,
|
|
58
|
+
} = props;
|
|
59
|
+
|
|
60
|
+
/*------------------------------------------------------------------------*/
|
|
61
|
+
/* Render */
|
|
62
|
+
/*------------------------------------------------------------------------*/
|
|
63
|
+
|
|
64
|
+
/*----------------------------------------*/
|
|
65
|
+
/* Main UI */
|
|
66
|
+
/*----------------------------------------*/
|
|
67
|
+
|
|
68
|
+
// Render the button
|
|
69
|
+
return (
|
|
70
|
+
<a
|
|
71
|
+
id={id}
|
|
72
|
+
download={filename}
|
|
73
|
+
href={`data:application/octet-stream,${csv}`}
|
|
74
|
+
className={`CSVDownloadButton-button ${className ?? 'btn btn-secondary'}`}
|
|
75
|
+
aria-label={(
|
|
76
|
+
ariaLabel
|
|
77
|
+
? `Click to download ${filename}`
|
|
78
|
+
: ariaLabel
|
|
79
|
+
)}
|
|
80
|
+
style={style}
|
|
81
|
+
onClick={onClick}
|
|
82
|
+
>
|
|
83
|
+
{!children && (
|
|
84
|
+
<>
|
|
85
|
+
<FontAwesomeIcon
|
|
86
|
+
icon={faCloudDownloadAlt}
|
|
87
|
+
className="mr-2"
|
|
88
|
+
/>
|
|
89
|
+
Download CSV
|
|
90
|
+
</>
|
|
91
|
+
)}
|
|
92
|
+
{children}
|
|
93
|
+
</a>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/*------------------------------------------------------------------------*/
|
|
98
|
+
/* Wrap Up */
|
|
99
|
+
/*------------------------------------------------------------------------*/
|
|
100
|
+
|
|
101
|
+
// Export component
|
|
102
|
+
export default CSVDownloadButton;
|