@churchapps/apphelper 0.4.50 → 0.5.0
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/dist/components/FormCardPayment.d.ts +1 -1
- package/dist/components/FormCardPayment.d.ts.map +1 -1
- package/dist/components/FormCardPayment.js +27 -10
- package/dist/components/FormCardPayment.js.map +1 -1
- package/dist/components/Loading.js +36 -36
- package/dist/components/notes/Notes.js +27 -27
- package/dist/helpers/index.d.ts +1 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/index.js.map +1 -1
- package/dist/public/css/cropper.css +309 -309
- package/dist/public/css/styles.css +111 -111
- package/package.json +72 -73
- package/public/css/cropper.css +309 -309
- package/public/css/styles.css +111 -111
- package/public/locales/de.json +269 -269
- package/public/locales/en.json +276 -276
- package/public/locales/es.json +272 -272
- package/public/locales/fr.json +269 -269
- package/public/locales/hi.json +269 -269
- package/public/locales/it.json +269 -269
- package/public/locales/ko.json +269 -269
- package/public/locales/no.json +269 -269
- package/public/locales/pt.json +269 -269
- package/public/locales/ru.json +269 -269
- package/public/locales/tl.json +269 -269
- package/public/locales/zh.json +269 -269
- package/src/components/DisplayBox.tsx +83 -83
- package/src/components/ErrorMessages.tsx +28 -28
- package/src/components/ExportLink.tsx +81 -81
- package/src/components/FloatingSupport.tsx +18 -18
- package/src/components/FormCardPayment.tsx +184 -169
- package/src/components/FormSubmissionEdit.tsx +168 -168
- package/src/components/HelpIcon.tsx +12 -12
- package/src/components/ImageEditor.tsx +161 -161
- package/src/components/InputBox.tsx +96 -96
- package/src/components/Loading.tsx +77 -77
- package/src/components/PageHeader.tsx +110 -110
- package/src/components/PersonAvatar.tsx +77 -77
- package/src/components/QuestionEdit.tsx +99 -99
- package/src/components/SmallButton.tsx +42 -42
- package/src/components/SupportModal.tsx +32 -32
- package/src/components/TabPanel.tsx +28 -28
- package/src/components/gallery/GalleryModal.tsx +173 -173
- package/src/components/gallery/StockPhotos.tsx +95 -95
- package/src/components/gallery/index.ts +1 -1
- package/src/components/header/Banner.tsx +11 -11
- package/src/components/header/PrimaryMenu.tsx +100 -100
- package/src/components/header/SecondaryMenu.tsx +23 -23
- package/src/components/header/SecondaryMenuAlt.tsx +40 -40
- package/src/components/header/SiteHeader.tsx +207 -207
- package/src/components/header/SupportDrawer.tsx +111 -111
- package/src/components/header/index.tsx +2 -2
- package/src/components/index.tsx +20 -20
- package/src/components/notes/AddNote.tsx +180 -180
- package/src/components/notes/Note.tsx +68 -68
- package/src/components/notes/Notes.tsx +208 -208
- package/src/components/notes/index.ts +3 -3
- package/src/components/wrapper/AppList.tsx +19 -19
- package/src/components/wrapper/ChurchList.tsx +154 -154
- package/src/components/wrapper/NavItem.tsx +47 -47
- package/src/components/wrapper/NewPrivateMessage.tsx +253 -253
- package/src/components/wrapper/Notifications.tsx +223 -223
- package/src/components/wrapper/PrivateMessageDetails.tsx +112 -112
- package/src/components/wrapper/PrivateMessages.tsx +576 -576
- package/src/components/wrapper/UserMenu.tsx +383 -383
- package/src/components/wrapper/index.tsx +8 -8
- package/src/helpers/AnalyticsHelper.ts +32 -32
- package/src/helpers/AppearanceHelper.ts +73 -73
- package/src/helpers/ArrayHelper.ts +87 -87
- package/src/helpers/CurrencyHelper.ts +10 -10
- package/src/helpers/DateHelper.ts +104 -104
- package/src/helpers/ErrorHelper.ts +43 -43
- package/src/helpers/EventHelper.ts +49 -49
- package/src/helpers/FileHelper.ts +31 -31
- package/src/helpers/Locale.ts +457 -457
- package/src/helpers/NotificationService.ts +296 -296
- package/src/helpers/PersonHelper.ts +62 -62
- package/src/helpers/SlugHelper.ts +37 -37
- package/src/helpers/SocketHelper.ts +296 -296
- package/src/helpers/UniqueIdHelper.ts +36 -36
- package/src/helpers/UserHelper.ts +104 -104
- package/src/helpers/createEmotionCache.ts +17 -17
- package/src/helpers/index.ts +58 -50
- package/src/hooks/index.ts +3 -3
- package/src/hooks/useMountedState.ts +16 -16
- package/src/hooks/useNotifications.ts +93 -93
- package/src/index.ts +2 -2
- package/src/types/interface-extensions.d.ts +12 -0
- package/tsconfig.json +31 -31
- package/dist/public/locales/de.json +0 -270
- package/dist/public/locales/en.json +0 -277
- package/dist/public/locales/es.json +0 -272
- package/dist/public/locales/fr.json +0 -270
- package/dist/public/locales/hi.json +0 -270
- package/dist/public/locales/it.json +0 -270
- package/dist/public/locales/ko.json +0 -270
- package/dist/public/locales/no.json +0 -270
- package/dist/public/locales/pt.json +0 -270
- package/dist/public/locales/ru.json +0 -270
- package/dist/public/locales/tl.json +0 -270
- package/dist/public/locales/zh.json +0 -270
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Paper, Box, Typography, Icon } from "@mui/material";
|
|
5
|
-
import { HelpIcon } from "./HelpIcon";
|
|
6
|
-
import { SmallButton } from "./SmallButton";
|
|
7
|
-
import { styled, useTheme } from '@mui/material/styles';
|
|
8
|
-
|
|
9
|
-
declare module '@mui/material/styles' {
|
|
10
|
-
interface Palette {
|
|
11
|
-
InputBox: { headerText: string; };
|
|
12
|
-
}
|
|
13
|
-
interface PaletteOptions {
|
|
14
|
-
InputBox?: { headerText?: string; };
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
interface Props {
|
|
20
|
-
id?: string,
|
|
21
|
-
children: React.ReactNode,
|
|
22
|
-
headerIcon?: string,
|
|
23
|
-
headerText: string,
|
|
24
|
-
editFunction?: () => void,
|
|
25
|
-
editContent?: React.ReactNode,
|
|
26
|
-
"data-testid"?: string,
|
|
27
|
-
ariaLabel?: string,
|
|
28
|
-
footerContent?: React.ReactNode,
|
|
29
|
-
help?: string
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/* "& p": { color: "#666" }, */
|
|
33
|
-
const CustomContextBox = styled(Box)({
|
|
34
|
-
marginTop: 10,
|
|
35
|
-
overflowX: "hidden",
|
|
36
|
-
"& label": { color: "#999" },
|
|
37
|
-
"& ul": { paddingLeft: 0 },
|
|
38
|
-
"& li": {
|
|
39
|
-
listStyleType: "none",
|
|
40
|
-
marginBottom: 10,
|
|
41
|
-
"& i": { marginRight: 5 }
|
|
42
|
-
},
|
|
43
|
-
"& td": {
|
|
44
|
-
"& i": { marginRight: 5 }
|
|
45
|
-
},
|
|
46
|
-
"& td:first-of-type": { paddingLeft: 0 },
|
|
47
|
-
"& td:last-of-type": { paddingRight: 0 },
|
|
48
|
-
"& th:first-of-type": { paddingLeft: 0 },
|
|
49
|
-
"& th:last-of-type": { paddingRight: 0 }
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
export const DisplayBox = React.forwardRef<HTMLDivElement, Props>((props, ref) => {
|
|
53
|
-
const theme = useTheme();
|
|
54
|
-
const headerText = theme?.palette?.InputBox?.headerText ? theme?.palette?.InputBox?.headerText : "primary";
|
|
55
|
-
|
|
56
|
-
let editContent: React.ReactNode;
|
|
57
|
-
if (props.editFunction !== undefined) {
|
|
58
|
-
editContent = <SmallButton icon="edit" aria-label={props.ariaLabel || "editButton"} onClick={props.editFunction} />
|
|
59
|
-
}
|
|
60
|
-
else if (props.editContent !== undefined) editContent = props.editContent;
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<Paper sx={{ padding: 2, marginBottom: 4 }} id={props.id || "display-box"} data-testid={props["data-testid"] || ""}>
|
|
64
|
-
{props.help && <HelpIcon article={props.help} />}
|
|
65
|
-
<Box id="display-box-header" sx={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
|
|
66
|
-
<Box id="display-box-title-section" sx={{ display: "flex", alignItems: "center" }}>
|
|
67
|
-
{props.headerIcon && <Icon id="display-box-icon" sx={{ color: headerText }}>{props.headerIcon}</Icon>}
|
|
68
|
-
<Typography id="display-box-title" component="h2" sx={{ display: "inline-block", marginLeft: props.headerIcon ? 1 : 0 }} variant="h6" color={headerText}>
|
|
69
|
-
{props.headerText}
|
|
70
|
-
</Typography>
|
|
71
|
-
|
|
72
|
-
</Box>
|
|
73
|
-
<Box id="display-box-actions">
|
|
74
|
-
{editContent}
|
|
75
|
-
</Box>
|
|
76
|
-
</Box>
|
|
77
|
-
<CustomContextBox id="display-box-content" ref={ref} data-testid="display-box-content">{props.children}</CustomContextBox>
|
|
78
|
-
{props.footerContent && (<div id="display-box-footer" style={{ marginLeft: -16, marginRight: -16, marginBottom: -15, marginTop: 15 }}>{props.footerContent}</div>)}
|
|
79
|
-
</Paper>
|
|
80
|
-
);
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
DisplayBox.displayName = "DisplayBox";
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Paper, Box, Typography, Icon } from "@mui/material";
|
|
5
|
+
import { HelpIcon } from "./HelpIcon";
|
|
6
|
+
import { SmallButton } from "./SmallButton";
|
|
7
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
8
|
+
|
|
9
|
+
declare module '@mui/material/styles' {
|
|
10
|
+
interface Palette {
|
|
11
|
+
InputBox: { headerText: string; };
|
|
12
|
+
}
|
|
13
|
+
interface PaletteOptions {
|
|
14
|
+
InputBox?: { headerText?: string; };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
interface Props {
|
|
20
|
+
id?: string,
|
|
21
|
+
children: React.ReactNode,
|
|
22
|
+
headerIcon?: string,
|
|
23
|
+
headerText: string,
|
|
24
|
+
editFunction?: () => void,
|
|
25
|
+
editContent?: React.ReactNode,
|
|
26
|
+
"data-testid"?: string,
|
|
27
|
+
ariaLabel?: string,
|
|
28
|
+
footerContent?: React.ReactNode,
|
|
29
|
+
help?: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* "& p": { color: "#666" }, */
|
|
33
|
+
const CustomContextBox = styled(Box)({
|
|
34
|
+
marginTop: 10,
|
|
35
|
+
overflowX: "hidden",
|
|
36
|
+
"& label": { color: "#999" },
|
|
37
|
+
"& ul": { paddingLeft: 0 },
|
|
38
|
+
"& li": {
|
|
39
|
+
listStyleType: "none",
|
|
40
|
+
marginBottom: 10,
|
|
41
|
+
"& i": { marginRight: 5 }
|
|
42
|
+
},
|
|
43
|
+
"& td": {
|
|
44
|
+
"& i": { marginRight: 5 }
|
|
45
|
+
},
|
|
46
|
+
"& td:first-of-type": { paddingLeft: 0 },
|
|
47
|
+
"& td:last-of-type": { paddingRight: 0 },
|
|
48
|
+
"& th:first-of-type": { paddingLeft: 0 },
|
|
49
|
+
"& th:last-of-type": { paddingRight: 0 }
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const DisplayBox = React.forwardRef<HTMLDivElement, Props>((props, ref) => {
|
|
53
|
+
const theme = useTheme();
|
|
54
|
+
const headerText = theme?.palette?.InputBox?.headerText ? theme?.palette?.InputBox?.headerText : "primary";
|
|
55
|
+
|
|
56
|
+
let editContent: React.ReactNode;
|
|
57
|
+
if (props.editFunction !== undefined) {
|
|
58
|
+
editContent = <SmallButton icon="edit" aria-label={props.ariaLabel || "editButton"} onClick={props.editFunction} />
|
|
59
|
+
}
|
|
60
|
+
else if (props.editContent !== undefined) editContent = props.editContent;
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Paper sx={{ padding: 2, marginBottom: 4 }} id={props.id || "display-box"} data-testid={props["data-testid"] || ""}>
|
|
64
|
+
{props.help && <HelpIcon article={props.help} />}
|
|
65
|
+
<Box id="display-box-header" sx={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
|
|
66
|
+
<Box id="display-box-title-section" sx={{ display: "flex", alignItems: "center" }}>
|
|
67
|
+
{props.headerIcon && <Icon id="display-box-icon" sx={{ color: headerText }}>{props.headerIcon}</Icon>}
|
|
68
|
+
<Typography id="display-box-title" component="h2" sx={{ display: "inline-block", marginLeft: props.headerIcon ? 1 : 0 }} variant="h6" color={headerText}>
|
|
69
|
+
{props.headerText}
|
|
70
|
+
</Typography>
|
|
71
|
+
|
|
72
|
+
</Box>
|
|
73
|
+
<Box id="display-box-actions">
|
|
74
|
+
{editContent}
|
|
75
|
+
</Box>
|
|
76
|
+
</Box>
|
|
77
|
+
<CustomContextBox id="display-box-content" ref={ref} data-testid="display-box-content">{props.children}</CustomContextBox>
|
|
78
|
+
{props.footerContent && (<div id="display-box-footer" style={{ marginLeft: -16, marginRight: -16, marginBottom: -15, marginTop: 15 }}>{props.footerContent}</div>)}
|
|
79
|
+
</Paper>
|
|
80
|
+
);
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
DisplayBox.displayName = "DisplayBox";
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { Alert, Snackbar } from "@mui/material";
|
|
4
|
-
import React, { useEffect } from "react";
|
|
5
|
-
|
|
6
|
-
interface Props { errors: string[] }
|
|
7
|
-
|
|
8
|
-
export const ErrorMessages: React.FC<Props> = props => {
|
|
9
|
-
const [open, setOpen] = React.useState(false);
|
|
10
|
-
const [items, setItems] = React.useState<React.ReactNode[]>([]);
|
|
11
|
-
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
if (props.errors.length > 0) {
|
|
14
|
-
const _items: React.ReactNode[] = [];
|
|
15
|
-
for (let i = 0; i < props.errors.length; i++) {
|
|
16
|
-
_items.push(<div key={i}>{props.errors[i]}</div>);
|
|
17
|
-
}
|
|
18
|
-
setItems(_items);
|
|
19
|
-
setOpen(true);
|
|
20
|
-
}
|
|
21
|
-
}, [props.errors]);
|
|
22
|
-
|
|
23
|
-
let result = (<Snackbar open={open} anchorOrigin={{ horizontal: "center", vertical: "bottom" }} autoHideDuration={6000} onClose={() => setOpen(false)}>
|
|
24
|
-
<Alert variant="filled" severity="error">{items}</Alert>
|
|
25
|
-
</Snackbar>);
|
|
26
|
-
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Alert, Snackbar } from "@mui/material";
|
|
4
|
+
import React, { useEffect } from "react";
|
|
5
|
+
|
|
6
|
+
interface Props { errors: string[] }
|
|
7
|
+
|
|
8
|
+
export const ErrorMessages: React.FC<Props> = props => {
|
|
9
|
+
const [open, setOpen] = React.useState(false);
|
|
10
|
+
const [items, setItems] = React.useState<React.ReactNode[]>([]);
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (props.errors.length > 0) {
|
|
14
|
+
const _items: React.ReactNode[] = [];
|
|
15
|
+
for (let i = 0; i < props.errors.length; i++) {
|
|
16
|
+
_items.push(<div key={i}>{props.errors[i]}</div>);
|
|
17
|
+
}
|
|
18
|
+
setItems(_items);
|
|
19
|
+
setOpen(true);
|
|
20
|
+
}
|
|
21
|
+
}, [props.errors]);
|
|
22
|
+
|
|
23
|
+
let result = (<Snackbar open={open} anchorOrigin={{ horizontal: "center", vertical: "bottom" }} autoHideDuration={6000} onClose={() => setOpen(false)}>
|
|
24
|
+
<Alert variant="filled" severity="error">{items}</Alert>
|
|
25
|
+
</Snackbar>);
|
|
26
|
+
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { Button, Icon } from "@mui/material";
|
|
4
|
-
import React, { Suspense, lazy } from "react";
|
|
5
|
-
import { Loading } from "./Loading";
|
|
6
|
-
|
|
7
|
-
// Lazy load the CSVLink component
|
|
8
|
-
const CSVLink = lazy(() => import("react-csv").then(module => ({ default: module.CSVLink })));
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
data: any[],
|
|
12
|
-
spaceAfter?: boolean,
|
|
13
|
-
spaceBefore?: boolean,
|
|
14
|
-
filename?: string,
|
|
15
|
-
icon?: string,
|
|
16
|
-
text?: string,
|
|
17
|
-
customHeaders?: {label: string, key: string}[]
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const ExportLink: React.FC<Props> = (props) => {
|
|
21
|
-
|
|
22
|
-
const people = props.data ? [...props.data] : [];
|
|
23
|
-
|
|
24
|
-
const getHeaders = () => {
|
|
25
|
-
let result = [];
|
|
26
|
-
if (people?.length > 0) {
|
|
27
|
-
let names = getAllPropertyNames();
|
|
28
|
-
for (let i = 0; i < names.length; i++) { result.push({ label: names[i], key: names[i] }); }
|
|
29
|
-
}
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const getAllPropertyNames = () => {
|
|
34
|
-
let result = [];
|
|
35
|
-
for (let i = 0; i < people.length; i++) {
|
|
36
|
-
let p = {...people[i]}
|
|
37
|
-
p.birthDate = p.birthDate ? new Date(p.birthDate).toISOString() : null;
|
|
38
|
-
p.anniversary = p.anniversary ? new Date(p.anniversary).toISOString() : null;
|
|
39
|
-
people[i] = p;
|
|
40
|
-
let propertyNames = getPropertyNames("", people[i]);
|
|
41
|
-
for (let j = 0; j < propertyNames.length; j++) if (result.indexOf(propertyNames[j]) === -1) result.push(propertyNames[j]);
|
|
42
|
-
}
|
|
43
|
-
return result.sort();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const getPropertyNames = (prefix: string, obj: any) => {
|
|
47
|
-
let result = [];
|
|
48
|
-
let names = Object.getOwnPropertyNames(obj)
|
|
49
|
-
for (let i = 0; i < names.length; i++) {
|
|
50
|
-
let t = typeof obj[names[i]];
|
|
51
|
-
switch (t) {
|
|
52
|
-
case "number":
|
|
53
|
-
case "string":
|
|
54
|
-
case "boolean":
|
|
55
|
-
result.push(prefix + names[i]);
|
|
56
|
-
break;
|
|
57
|
-
case "object":
|
|
58
|
-
if ((obj[names[i]] !== null)) {
|
|
59
|
-
let children: string[] = getPropertyNames(prefix + names[i] + ".", obj[names[i]]);
|
|
60
|
-
for (let j = 0; j < children.length; j++) result.push(children[j]);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return result;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (!people || people?.length === 0) return null;
|
|
68
|
-
else {
|
|
69
|
-
let items = [];
|
|
70
|
-
if (props.spaceBefore) items.push(" ");
|
|
71
|
-
items.push(
|
|
72
|
-
<Suspense key={props.filename} fallback={<Button><Icon sx={{ marginRight: props.text ? 1 : 0 }}>{props.icon || "file_download"}</Icon>{props.text || ""}</Button>}>
|
|
73
|
-
<CSVLink data={people} headers={props.customHeaders || getHeaders()} filename={props.filename || "export.csv"}>
|
|
74
|
-
<Button><Icon sx={{ marginRight: props.text ? 1 : 0 }}>{props.icon || "file_download"}</Icon>{props.text || ""}</Button>
|
|
75
|
-
</CSVLink>
|
|
76
|
-
</Suspense>
|
|
77
|
-
);
|
|
78
|
-
if (props.spaceAfter) items.push(" ");
|
|
79
|
-
return (<>{items}</>);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Button, Icon } from "@mui/material";
|
|
4
|
+
import React, { Suspense, lazy } from "react";
|
|
5
|
+
import { Loading } from "./Loading";
|
|
6
|
+
|
|
7
|
+
// Lazy load the CSVLink component
|
|
8
|
+
const CSVLink = lazy(() => import("react-csv").then(module => ({ default: module.CSVLink })));
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
data: any[],
|
|
12
|
+
spaceAfter?: boolean,
|
|
13
|
+
spaceBefore?: boolean,
|
|
14
|
+
filename?: string,
|
|
15
|
+
icon?: string,
|
|
16
|
+
text?: string,
|
|
17
|
+
customHeaders?: {label: string, key: string}[]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const ExportLink: React.FC<Props> = (props) => {
|
|
21
|
+
|
|
22
|
+
const people = props.data ? [...props.data] : [];
|
|
23
|
+
|
|
24
|
+
const getHeaders = () => {
|
|
25
|
+
let result = [];
|
|
26
|
+
if (people?.length > 0) {
|
|
27
|
+
let names = getAllPropertyNames();
|
|
28
|
+
for (let i = 0; i < names.length; i++) { result.push({ label: names[i], key: names[i] }); }
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const getAllPropertyNames = () => {
|
|
34
|
+
let result = [];
|
|
35
|
+
for (let i = 0; i < people.length; i++) {
|
|
36
|
+
let p = {...people[i]}
|
|
37
|
+
p.birthDate = p.birthDate ? new Date(p.birthDate).toISOString() : null;
|
|
38
|
+
p.anniversary = p.anniversary ? new Date(p.anniversary).toISOString() : null;
|
|
39
|
+
people[i] = p;
|
|
40
|
+
let propertyNames = getPropertyNames("", people[i]);
|
|
41
|
+
for (let j = 0; j < propertyNames.length; j++) if (result.indexOf(propertyNames[j]) === -1) result.push(propertyNames[j]);
|
|
42
|
+
}
|
|
43
|
+
return result.sort();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const getPropertyNames = (prefix: string, obj: any) => {
|
|
47
|
+
let result = [];
|
|
48
|
+
let names = Object.getOwnPropertyNames(obj)
|
|
49
|
+
for (let i = 0; i < names.length; i++) {
|
|
50
|
+
let t = typeof obj[names[i]];
|
|
51
|
+
switch (t) {
|
|
52
|
+
case "number":
|
|
53
|
+
case "string":
|
|
54
|
+
case "boolean":
|
|
55
|
+
result.push(prefix + names[i]);
|
|
56
|
+
break;
|
|
57
|
+
case "object":
|
|
58
|
+
if ((obj[names[i]] !== null)) {
|
|
59
|
+
let children: string[] = getPropertyNames(prefix + names[i] + ".", obj[names[i]]);
|
|
60
|
+
for (let j = 0; j < children.length; j++) result.push(children[j]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!people || people?.length === 0) return null;
|
|
68
|
+
else {
|
|
69
|
+
let items = [];
|
|
70
|
+
if (props.spaceBefore) items.push(" ");
|
|
71
|
+
items.push(
|
|
72
|
+
<Suspense key={props.filename} fallback={<Button><Icon sx={{ marginRight: props.text ? 1 : 0 }}>{props.icon || "file_download"}</Icon>{props.text || ""}</Button>}>
|
|
73
|
+
<CSVLink data={people} headers={props.customHeaders || getHeaders()} filename={props.filename || "export.csv"}>
|
|
74
|
+
<Button><Icon sx={{ marginRight: props.text ? 1 : 0 }}>{props.icon || "file_download"}</Icon>{props.text || ""}</Button>
|
|
75
|
+
</CSVLink>
|
|
76
|
+
</Suspense>
|
|
77
|
+
);
|
|
78
|
+
if (props.spaceAfter) items.push(" ");
|
|
79
|
+
return (<>{items}</>);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { Fab, Icon } from "@mui/material";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { SupportModal } from "./SupportModal";
|
|
6
|
-
|
|
7
|
-
interface Props { appName?: string }
|
|
8
|
-
|
|
9
|
-
export const FloatingSupport: React.FC<Props> = (props) => {
|
|
10
|
-
const [showSupport, setShowSupport] = React.useState(false);
|
|
11
|
-
|
|
12
|
-
return (<>
|
|
13
|
-
<Fab color="primary" style={{ position: "fixed", cursor: "pointer", bottom: "20px", right: (showSupport) ? 47 : 30 }} onClick={() => { setShowSupport(!showSupport) }} aria-label="Support">
|
|
14
|
-
<Icon style={{ fontSize: 40 }}>contact_support</Icon>
|
|
15
|
-
</Fab>
|
|
16
|
-
{showSupport && <SupportModal onClose={() => setShowSupport(false)} appName={props.appName} />}
|
|
17
|
-
</>);
|
|
18
|
-
};
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Fab, Icon } from "@mui/material";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { SupportModal } from "./SupportModal";
|
|
6
|
+
|
|
7
|
+
interface Props { appName?: string }
|
|
8
|
+
|
|
9
|
+
export const FloatingSupport: React.FC<Props> = (props) => {
|
|
10
|
+
const [showSupport, setShowSupport] = React.useState(false);
|
|
11
|
+
|
|
12
|
+
return (<>
|
|
13
|
+
<Fab color="primary" style={{ position: "fixed", cursor: "pointer", bottom: "20px", right: (showSupport) ? 47 : 30 }} onClick={() => { setShowSupport(!showSupport) }} aria-label="Support">
|
|
14
|
+
<Icon style={{ fontSize: 40 }}>contact_support</Icon>
|
|
15
|
+
</Fab>
|
|
16
|
+
{showSupport && <SupportModal onClose={() => setShowSupport(false)} appName={props.appName} />}
|
|
17
|
+
</>);
|
|
18
|
+
};
|