@churchapps/apphelper 0.4.50 → 0.5.1
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/UserHelper.d.ts.map +1 -1
- package/dist/helpers/UserHelper.js +4 -1
- package/dist/helpers/UserHelper.js.map +1 -1
- 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 +107 -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,77 +1,77 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Dots } from "react-activity";
|
|
5
|
-
|
|
6
|
-
// Inline CSS for react-activity to avoid external dependencies
|
|
7
|
-
const activityStyles = `
|
|
8
|
-
.activity-loader {
|
|
9
|
-
position: relative;
|
|
10
|
-
display: inline-block;
|
|
11
|
-
}
|
|
12
|
-
.activity-dots {
|
|
13
|
-
position: relative;
|
|
14
|
-
display: inline-block;
|
|
15
|
-
}
|
|
16
|
-
.activity-dots > div {
|
|
17
|
-
position: absolute;
|
|
18
|
-
border-radius: 50%;
|
|
19
|
-
animation: activity-dots 1.2s infinite ease-in-out;
|
|
20
|
-
animation-fill-mode: both;
|
|
21
|
-
}
|
|
22
|
-
.activity-dots > div:nth-child(1) { animation-delay: -1.1s; }
|
|
23
|
-
.activity-dots > div:nth-child(2) { animation-delay: -1.0s; }
|
|
24
|
-
.activity-dots > div:nth-child(3) { animation-delay: -0.9s; }
|
|
25
|
-
.activity-dots > div:nth-child(4) { animation-delay: -0.8s; }
|
|
26
|
-
.activity-dots > div:nth-child(5) { animation-delay: -0.7s; }
|
|
27
|
-
.activity-dots > div:nth-child(6) { animation-delay: -0.6s; }
|
|
28
|
-
.activity-dots > div:nth-child(7) { animation-delay: -0.5s; }
|
|
29
|
-
.activity-dots > div:nth-child(8) { animation-delay: -0.4s; }
|
|
30
|
-
.activity-dots > div:nth-child(9) { animation-delay: -0.3s; }
|
|
31
|
-
.activity-dots > div:nth-child(10) { animation-delay: -0.2s; }
|
|
32
|
-
.activity-dots > div:nth-child(11) { animation-delay: -0.1s; }
|
|
33
|
-
.activity-dots > div:nth-child(12) { animation-delay: 0s; }
|
|
34
|
-
|
|
35
|
-
@keyframes activity-dots {
|
|
36
|
-
0%, 80%, 100% {
|
|
37
|
-
transform: scale(0);
|
|
38
|
-
}
|
|
39
|
-
40% {
|
|
40
|
-
transform: scale(1);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
`;
|
|
44
|
-
|
|
45
|
-
// Add styles to document head if not already present
|
|
46
|
-
if (typeof document !== 'undefined' && !document.getElementById('activity-styles')) {
|
|
47
|
-
const style = document.createElement('style');
|
|
48
|
-
style.id = 'activity-styles';
|
|
49
|
-
style.textContent = activityStyles;
|
|
50
|
-
document.head.appendChild(style);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
interface Props { size?: "sm" | "md" | "lg", loadingText?: string, color?: string }
|
|
54
|
-
|
|
55
|
-
export const Loading: React.FC<Props> = (props) => {
|
|
56
|
-
|
|
57
|
-
const getContents = () => {
|
|
58
|
-
const text = (props.loadingText) ? props.loadingText : "Loading"
|
|
59
|
-
const color = (props.color) ? props.color : "#222"
|
|
60
|
-
let result = <><Dots speed={0.8} animating={true} size={32} color={color} /><p style={{ color: color }}>{text}</p></>
|
|
61
|
-
switch (props.size) {
|
|
62
|
-
case "sm":
|
|
63
|
-
result = <><Dots speed={0.8} animating={true} size={20} color={color} /><p style={{ fontSize: 12, color: color }}>{text}</p></>
|
|
64
|
-
break;
|
|
65
|
-
case "lg":
|
|
66
|
-
result = <><Dots speed={0.8} animating={true} size={48} color={color} /><p style={{ fontSize: 30, color: color }}>{text}</p></>
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
return result;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<div id="loading-component" style={{ textAlign: "center", fontFamily: "Roboto" }}>
|
|
74
|
-
{getContents()}
|
|
75
|
-
</div>
|
|
76
|
-
)
|
|
77
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Dots } from "react-activity";
|
|
5
|
+
|
|
6
|
+
// Inline CSS for react-activity to avoid external dependencies
|
|
7
|
+
const activityStyles = `
|
|
8
|
+
.activity-loader {
|
|
9
|
+
position: relative;
|
|
10
|
+
display: inline-block;
|
|
11
|
+
}
|
|
12
|
+
.activity-dots {
|
|
13
|
+
position: relative;
|
|
14
|
+
display: inline-block;
|
|
15
|
+
}
|
|
16
|
+
.activity-dots > div {
|
|
17
|
+
position: absolute;
|
|
18
|
+
border-radius: 50%;
|
|
19
|
+
animation: activity-dots 1.2s infinite ease-in-out;
|
|
20
|
+
animation-fill-mode: both;
|
|
21
|
+
}
|
|
22
|
+
.activity-dots > div:nth-child(1) { animation-delay: -1.1s; }
|
|
23
|
+
.activity-dots > div:nth-child(2) { animation-delay: -1.0s; }
|
|
24
|
+
.activity-dots > div:nth-child(3) { animation-delay: -0.9s; }
|
|
25
|
+
.activity-dots > div:nth-child(4) { animation-delay: -0.8s; }
|
|
26
|
+
.activity-dots > div:nth-child(5) { animation-delay: -0.7s; }
|
|
27
|
+
.activity-dots > div:nth-child(6) { animation-delay: -0.6s; }
|
|
28
|
+
.activity-dots > div:nth-child(7) { animation-delay: -0.5s; }
|
|
29
|
+
.activity-dots > div:nth-child(8) { animation-delay: -0.4s; }
|
|
30
|
+
.activity-dots > div:nth-child(9) { animation-delay: -0.3s; }
|
|
31
|
+
.activity-dots > div:nth-child(10) { animation-delay: -0.2s; }
|
|
32
|
+
.activity-dots > div:nth-child(11) { animation-delay: -0.1s; }
|
|
33
|
+
.activity-dots > div:nth-child(12) { animation-delay: 0s; }
|
|
34
|
+
|
|
35
|
+
@keyframes activity-dots {
|
|
36
|
+
0%, 80%, 100% {
|
|
37
|
+
transform: scale(0);
|
|
38
|
+
}
|
|
39
|
+
40% {
|
|
40
|
+
transform: scale(1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
// Add styles to document head if not already present
|
|
46
|
+
if (typeof document !== 'undefined' && !document.getElementById('activity-styles')) {
|
|
47
|
+
const style = document.createElement('style');
|
|
48
|
+
style.id = 'activity-styles';
|
|
49
|
+
style.textContent = activityStyles;
|
|
50
|
+
document.head.appendChild(style);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface Props { size?: "sm" | "md" | "lg", loadingText?: string, color?: string }
|
|
54
|
+
|
|
55
|
+
export const Loading: React.FC<Props> = (props) => {
|
|
56
|
+
|
|
57
|
+
const getContents = () => {
|
|
58
|
+
const text = (props.loadingText) ? props.loadingText : "Loading"
|
|
59
|
+
const color = (props.color) ? props.color : "#222"
|
|
60
|
+
let result = <><Dots speed={0.8} animating={true} size={32} color={color} /><p style={{ color: color }}>{text}</p></>
|
|
61
|
+
switch (props.size) {
|
|
62
|
+
case "sm":
|
|
63
|
+
result = <><Dots speed={0.8} animating={true} size={20} color={color} /><p style={{ fontSize: 12, color: color }}>{text}</p></>
|
|
64
|
+
break;
|
|
65
|
+
case "lg":
|
|
66
|
+
result = <><Dots speed={0.8} animating={true} size={48} color={color} /><p style={{ fontSize: 30, color: color }}>{text}</p></>
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div id="loading-component" style={{ textAlign: "center", fontFamily: "Roboto" }}>
|
|
74
|
+
{getContents()}
|
|
75
|
+
</div>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
import React, { ReactNode } from "react";
|
|
2
|
-
import { Box, Typography, Stack } from "@mui/material";
|
|
3
|
-
|
|
4
|
-
interface PageHeaderProps {
|
|
5
|
-
icon: ReactNode;
|
|
6
|
-
title: string;
|
|
7
|
-
subtitle?: string;
|
|
8
|
-
children?: ReactNode; // For action buttons or tabs
|
|
9
|
-
statistics?: Array<{ icon: ReactNode; value: string; label: string }>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const PageHeader: React.FC<PageHeaderProps> = ({ icon, title, subtitle, children, statistics }) => {
|
|
13
|
-
return (
|
|
14
|
-
<Box id="page-header" sx={{
|
|
15
|
-
backgroundColor: "var(--c1l2)",
|
|
16
|
-
color: "#FFF",
|
|
17
|
-
position: 'relative',
|
|
18
|
-
left: '50%',
|
|
19
|
-
right: '50%',
|
|
20
|
-
marginLeft: '-50vw',
|
|
21
|
-
marginRight: '-50vw',
|
|
22
|
-
width: '100vw',
|
|
23
|
-
'--c1': '#1565C0',
|
|
24
|
-
'--c1d1': '#1358AD',
|
|
25
|
-
'--c1d2': '#114A99',
|
|
26
|
-
'--c1l2': '#568BDA'
|
|
27
|
-
}}>
|
|
28
|
-
<Box sx={{
|
|
29
|
-
paddingX: { xs: 2, sm: 3, md: 4 },
|
|
30
|
-
paddingY: 3
|
|
31
|
-
}}>
|
|
32
|
-
<Stack direction={{ xs: "column", md: "row" }} spacing={{ xs: 2, md: 4 }} alignItems={{ xs: "flex-start", md: "center" }} sx={{ width: "100%" }}>
|
|
33
|
-
{/* Left side: Title and Icon */}
|
|
34
|
-
<Stack id="page-header-title-section" direction="row" spacing={2} alignItems="center" sx={{ flex: 1 }}>
|
|
35
|
-
<Box
|
|
36
|
-
id="page-header-icon"
|
|
37
|
-
sx={{
|
|
38
|
-
backgroundColor: "rgba(255,255,255,0.2)",
|
|
39
|
-
borderRadius: "12px",
|
|
40
|
-
p: 1.5,
|
|
41
|
-
display: "flex",
|
|
42
|
-
alignItems: "center",
|
|
43
|
-
justifyContent: "center",
|
|
44
|
-
}}
|
|
45
|
-
>
|
|
46
|
-
{React.cloneElement(icon as React.ReactElement<any>, { sx: { fontSize: 32, color: "#FFF" } })}
|
|
47
|
-
</Box>
|
|
48
|
-
<Box id="page-header-text">
|
|
49
|
-
<Typography
|
|
50
|
-
id="page-header-title"
|
|
51
|
-
variant="h4"
|
|
52
|
-
sx={{
|
|
53
|
-
fontWeight: 600,
|
|
54
|
-
mb: 0.5,
|
|
55
|
-
fontSize: { xs: "1.75rem", md: "2.125rem" },
|
|
56
|
-
}}
|
|
57
|
-
>
|
|
58
|
-
{title}
|
|
59
|
-
</Typography>
|
|
60
|
-
{subtitle && (
|
|
61
|
-
<Typography
|
|
62
|
-
id="page-header-subtitle"
|
|
63
|
-
variant="body1"
|
|
64
|
-
sx={{
|
|
65
|
-
color: "rgba(255,255,255,0.9)",
|
|
66
|
-
fontSize: { xs: "0.875rem", md: "1rem" },
|
|
67
|
-
}}
|
|
68
|
-
>
|
|
69
|
-
{subtitle}
|
|
70
|
-
</Typography>
|
|
71
|
-
)}
|
|
72
|
-
</Box>
|
|
73
|
-
</Stack>
|
|
74
|
-
|
|
75
|
-
{/* Right side: Action Buttons/Tabs */}
|
|
76
|
-
{children && (
|
|
77
|
-
<Stack
|
|
78
|
-
id="page-header-actions"
|
|
79
|
-
direction="row"
|
|
80
|
-
spacing={1}
|
|
81
|
-
sx={{
|
|
82
|
-
flexShrink: 0,
|
|
83
|
-
justifyContent: { xs: "flex-start", md: "flex-end" },
|
|
84
|
-
width: { xs: "100%", md: "auto" },
|
|
85
|
-
}}
|
|
86
|
-
>
|
|
87
|
-
{children}
|
|
88
|
-
</Stack>
|
|
89
|
-
)}
|
|
90
|
-
</Stack>
|
|
91
|
-
|
|
92
|
-
{/* Statistics row */}
|
|
93
|
-
{statistics && statistics.length > 0 && (
|
|
94
|
-
<Stack id="page-header-statistics" direction={{ xs: "column", sm: "row" }} spacing={3} sx={{ mt: 3 }}>
|
|
95
|
-
{statistics.map((stat, index) => (
|
|
96
|
-
<Stack key={index} direction="row" spacing={1} alignItems="center">
|
|
97
|
-
{React.cloneElement(stat.icon as React.ReactElement<any>, { sx: { color: "#FFF", fontSize: 20 } })}
|
|
98
|
-
<Typography variant="h6" sx={{ color: "#FFF", fontWeight: 600, mr: 1 }}>
|
|
99
|
-
{stat.value}
|
|
100
|
-
</Typography>
|
|
101
|
-
<Typography variant="body2" sx={{ color: "rgba(255,255,255,0.9)", fontSize: "0.875rem" }}>
|
|
102
|
-
{stat.label}
|
|
103
|
-
</Typography>
|
|
104
|
-
</Stack>
|
|
105
|
-
))}
|
|
106
|
-
</Stack>
|
|
107
|
-
)}
|
|
108
|
-
</Box>
|
|
109
|
-
</Box>
|
|
110
|
-
);
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { Box, Typography, Stack } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
interface PageHeaderProps {
|
|
5
|
+
icon: ReactNode;
|
|
6
|
+
title: string;
|
|
7
|
+
subtitle?: string;
|
|
8
|
+
children?: ReactNode; // For action buttons or tabs
|
|
9
|
+
statistics?: Array<{ icon: ReactNode; value: string; label: string }>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const PageHeader: React.FC<PageHeaderProps> = ({ icon, title, subtitle, children, statistics }) => {
|
|
13
|
+
return (
|
|
14
|
+
<Box id="page-header" sx={{
|
|
15
|
+
backgroundColor: "var(--c1l2)",
|
|
16
|
+
color: "#FFF",
|
|
17
|
+
position: 'relative',
|
|
18
|
+
left: '50%',
|
|
19
|
+
right: '50%',
|
|
20
|
+
marginLeft: '-50vw',
|
|
21
|
+
marginRight: '-50vw',
|
|
22
|
+
width: '100vw',
|
|
23
|
+
'--c1': '#1565C0',
|
|
24
|
+
'--c1d1': '#1358AD',
|
|
25
|
+
'--c1d2': '#114A99',
|
|
26
|
+
'--c1l2': '#568BDA'
|
|
27
|
+
}}>
|
|
28
|
+
<Box sx={{
|
|
29
|
+
paddingX: { xs: 2, sm: 3, md: 4 },
|
|
30
|
+
paddingY: 3
|
|
31
|
+
}}>
|
|
32
|
+
<Stack direction={{ xs: "column", md: "row" }} spacing={{ xs: 2, md: 4 }} alignItems={{ xs: "flex-start", md: "center" }} sx={{ width: "100%" }}>
|
|
33
|
+
{/* Left side: Title and Icon */}
|
|
34
|
+
<Stack id="page-header-title-section" direction="row" spacing={2} alignItems="center" sx={{ flex: 1 }}>
|
|
35
|
+
<Box
|
|
36
|
+
id="page-header-icon"
|
|
37
|
+
sx={{
|
|
38
|
+
backgroundColor: "rgba(255,255,255,0.2)",
|
|
39
|
+
borderRadius: "12px",
|
|
40
|
+
p: 1.5,
|
|
41
|
+
display: "flex",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
justifyContent: "center",
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
{React.cloneElement(icon as React.ReactElement<any>, { sx: { fontSize: 32, color: "#FFF" } })}
|
|
47
|
+
</Box>
|
|
48
|
+
<Box id="page-header-text">
|
|
49
|
+
<Typography
|
|
50
|
+
id="page-header-title"
|
|
51
|
+
variant="h4"
|
|
52
|
+
sx={{
|
|
53
|
+
fontWeight: 600,
|
|
54
|
+
mb: 0.5,
|
|
55
|
+
fontSize: { xs: "1.75rem", md: "2.125rem" },
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
{title}
|
|
59
|
+
</Typography>
|
|
60
|
+
{subtitle && (
|
|
61
|
+
<Typography
|
|
62
|
+
id="page-header-subtitle"
|
|
63
|
+
variant="body1"
|
|
64
|
+
sx={{
|
|
65
|
+
color: "rgba(255,255,255,0.9)",
|
|
66
|
+
fontSize: { xs: "0.875rem", md: "1rem" },
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
{subtitle}
|
|
70
|
+
</Typography>
|
|
71
|
+
)}
|
|
72
|
+
</Box>
|
|
73
|
+
</Stack>
|
|
74
|
+
|
|
75
|
+
{/* Right side: Action Buttons/Tabs */}
|
|
76
|
+
{children && (
|
|
77
|
+
<Stack
|
|
78
|
+
id="page-header-actions"
|
|
79
|
+
direction="row"
|
|
80
|
+
spacing={1}
|
|
81
|
+
sx={{
|
|
82
|
+
flexShrink: 0,
|
|
83
|
+
justifyContent: { xs: "flex-start", md: "flex-end" },
|
|
84
|
+
width: { xs: "100%", md: "auto" },
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
{children}
|
|
88
|
+
</Stack>
|
|
89
|
+
)}
|
|
90
|
+
</Stack>
|
|
91
|
+
|
|
92
|
+
{/* Statistics row */}
|
|
93
|
+
{statistics && statistics.length > 0 && (
|
|
94
|
+
<Stack id="page-header-statistics" direction={{ xs: "column", sm: "row" }} spacing={3} sx={{ mt: 3 }}>
|
|
95
|
+
{statistics.map((stat, index) => (
|
|
96
|
+
<Stack key={index} direction="row" spacing={1} alignItems="center">
|
|
97
|
+
{React.cloneElement(stat.icon as React.ReactElement<any>, { sx: { color: "#FFF", fontSize: 20 } })}
|
|
98
|
+
<Typography variant="h6" sx={{ color: "#FFF", fontWeight: 600, mr: 1 }}>
|
|
99
|
+
{stat.value}
|
|
100
|
+
</Typography>
|
|
101
|
+
<Typography variant="body2" sx={{ color: "rgba(255,255,255,0.9)", fontSize: "0.875rem" }}>
|
|
102
|
+
{stat.label}
|
|
103
|
+
</Typography>
|
|
104
|
+
</Stack>
|
|
105
|
+
))}
|
|
106
|
+
</Stack>
|
|
107
|
+
)}
|
|
108
|
+
</Box>
|
|
109
|
+
</Box>
|
|
110
|
+
);
|
|
111
111
|
};
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Avatar, SxProps } from "@mui/material";
|
|
5
|
-
import { PersonInterface } from "@churchapps/helpers";
|
|
6
|
-
import { PersonHelper } from "../helpers";
|
|
7
|
-
|
|
8
|
-
interface Props {
|
|
9
|
-
person: PersonInterface;
|
|
10
|
-
size?: "small" | "medium" | "large" | "xlarge" | "xxlarge" | "responsive";
|
|
11
|
-
sx?: SxProps;
|
|
12
|
-
onClick?: () => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const PersonAvatar: React.FC<Props> = ({ person, size = "medium", sx, onClick }) => {
|
|
16
|
-
const [imageError, setImageError] = React.useState(false);
|
|
17
|
-
|
|
18
|
-
const getSizeProps = () => {
|
|
19
|
-
switch (size) {
|
|
20
|
-
case "small":
|
|
21
|
-
return { width: 48, height: 48 };
|
|
22
|
-
case "medium":
|
|
23
|
-
return { width: 56, height: 56 };
|
|
24
|
-
case "large":
|
|
25
|
-
return { width: 80, height: 80 };
|
|
26
|
-
case "xlarge":
|
|
27
|
-
return { width: 100, height: 100 };
|
|
28
|
-
case "xxlarge":
|
|
29
|
-
return { width: 120, height: 120 };
|
|
30
|
-
case "responsive":
|
|
31
|
-
return { width: { xs: 70, sm: 80, md: 100 }, height: { xs: 70, sm: 80, md: 100 } };
|
|
32
|
-
default:
|
|
33
|
-
return { width: 56, height: 56 };
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const getInitials = () => {
|
|
38
|
-
if (!person?.name?.display) return "?";
|
|
39
|
-
|
|
40
|
-
const names = person.name.display.trim().split(" ");
|
|
41
|
-
if (names.length >= 2) {
|
|
42
|
-
return (names[0][0] + names[names.length - 1][0]).toUpperCase();
|
|
43
|
-
} else if (names.length === 1) {
|
|
44
|
-
return names[0][0]?.toUpperCase() || "?";
|
|
45
|
-
}
|
|
46
|
-
return "?";
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const photoUrl = PersonHelper.getPhotoUrl(person);
|
|
50
|
-
const sizeProps = getSizeProps();
|
|
51
|
-
|
|
52
|
-
// Combine default styles with custom sx
|
|
53
|
-
const combinedSx = {
|
|
54
|
-
...sizeProps,
|
|
55
|
-
cursor: onClick ? "pointer" : "default",
|
|
56
|
-
"&:hover": onClick ? {
|
|
57
|
-
opacity: 0.8,
|
|
58
|
-
transition: "opacity 0.2s ease-in-out",
|
|
59
|
-
} : {},
|
|
60
|
-
...sx,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const handleImageError = () => {
|
|
64
|
-
setImageError(true);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<Avatar
|
|
69
|
-
src={!imageError ? photoUrl : undefined}
|
|
70
|
-
alt={person?.name?.display || "User avatar"}
|
|
71
|
-
sx={combinedSx}
|
|
72
|
-
onClick={onClick}
|
|
73
|
-
onError={handleImageError}
|
|
74
|
-
>
|
|
75
|
-
{(imageError || !photoUrl) && getInitials()}
|
|
76
|
-
</Avatar>
|
|
77
|
-
);
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Avatar, SxProps } from "@mui/material";
|
|
5
|
+
import { PersonInterface } from "@churchapps/helpers";
|
|
6
|
+
import { PersonHelper } from "../helpers";
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
person: PersonInterface;
|
|
10
|
+
size?: "small" | "medium" | "large" | "xlarge" | "xxlarge" | "responsive";
|
|
11
|
+
sx?: SxProps;
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const PersonAvatar: React.FC<Props> = ({ person, size = "medium", sx, onClick }) => {
|
|
16
|
+
const [imageError, setImageError] = React.useState(false);
|
|
17
|
+
|
|
18
|
+
const getSizeProps = () => {
|
|
19
|
+
switch (size) {
|
|
20
|
+
case "small":
|
|
21
|
+
return { width: 48, height: 48 };
|
|
22
|
+
case "medium":
|
|
23
|
+
return { width: 56, height: 56 };
|
|
24
|
+
case "large":
|
|
25
|
+
return { width: 80, height: 80 };
|
|
26
|
+
case "xlarge":
|
|
27
|
+
return { width: 100, height: 100 };
|
|
28
|
+
case "xxlarge":
|
|
29
|
+
return { width: 120, height: 120 };
|
|
30
|
+
case "responsive":
|
|
31
|
+
return { width: { xs: 70, sm: 80, md: 100 }, height: { xs: 70, sm: 80, md: 100 } };
|
|
32
|
+
default:
|
|
33
|
+
return { width: 56, height: 56 };
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const getInitials = () => {
|
|
38
|
+
if (!person?.name?.display) return "?";
|
|
39
|
+
|
|
40
|
+
const names = person.name.display.trim().split(" ");
|
|
41
|
+
if (names.length >= 2) {
|
|
42
|
+
return (names[0][0] + names[names.length - 1][0]).toUpperCase();
|
|
43
|
+
} else if (names.length === 1) {
|
|
44
|
+
return names[0][0]?.toUpperCase() || "?";
|
|
45
|
+
}
|
|
46
|
+
return "?";
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const photoUrl = PersonHelper.getPhotoUrl(person);
|
|
50
|
+
const sizeProps = getSizeProps();
|
|
51
|
+
|
|
52
|
+
// Combine default styles with custom sx
|
|
53
|
+
const combinedSx = {
|
|
54
|
+
...sizeProps,
|
|
55
|
+
cursor: onClick ? "pointer" : "default",
|
|
56
|
+
"&:hover": onClick ? {
|
|
57
|
+
opacity: 0.8,
|
|
58
|
+
transition: "opacity 0.2s ease-in-out",
|
|
59
|
+
} : {},
|
|
60
|
+
...sx,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const handleImageError = () => {
|
|
64
|
+
setImageError(true);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Avatar
|
|
69
|
+
src={!imageError ? photoUrl : undefined}
|
|
70
|
+
alt={person?.name?.display || "User avatar"}
|
|
71
|
+
sx={combinedSx}
|
|
72
|
+
onClick={onClick}
|
|
73
|
+
onError={handleImageError}
|
|
74
|
+
>
|
|
75
|
+
{(imageError || !photoUrl) && getInitials()}
|
|
76
|
+
</Avatar>
|
|
77
|
+
);
|
|
78
78
|
};
|