@churchapps/apphelper 0.0.11 → 0.0.12
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SiteWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/material/SiteWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAA8C,mBAAmB,EAAa,MAAM,eAAe,CAAC;AAE3G,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAKxD,UAAU,KAAK;IACb,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC;IACxB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,UAAU,CAAC,EAAE,mBAAmB,CAAA;CACjC;AA4DD,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"SiteWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/material/SiteWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAA8C,mBAAmB,EAAa,MAAM,eAAe,CAAC;AAE3G,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAKxD,UAAU,KAAK;IACb,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC;IACxB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,UAAU,CAAC,EAAE,mBAAmB,CAAA;CACjC;AA4DD,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAkEvC,CAAC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -16,9 +7,7 @@ exports.SiteWrapper = void 0;
|
|
|
16
7
|
const react_1 = __importDefault(require("react"));
|
|
17
8
|
const material_1 = require("@mui/material");
|
|
18
9
|
const helpers_1 = require("../../helpers");
|
|
19
|
-
const UserMenu_1 = require("./UserMenu");
|
|
20
10
|
const useMountedState_1 = require("../../hooks/useMountedState");
|
|
21
|
-
const SocketHelper_1 = require("../../helpers/SocketHelper");
|
|
22
11
|
const OpenDrawer = (0, material_1.styled)(material_1.Drawer)(({ theme }) => ({
|
|
23
12
|
"& .MuiDrawer-paper": {
|
|
24
13
|
position: "relative",
|
|
@@ -66,7 +55,7 @@ const OpenDrawerAppBar = (0, material_1.styled)(ClosedDrawerAppBar)(({ theme })
|
|
|
66
55
|
})
|
|
67
56
|
}));
|
|
68
57
|
const SiteWrapper = props => {
|
|
69
|
-
var _a, _b
|
|
58
|
+
var _a, _b;
|
|
70
59
|
const [churchLogo, setChurchLogo] = react_1.default.useState();
|
|
71
60
|
const [open, setOpen] = react_1.default.useState(false);
|
|
72
61
|
const toggleDrawer = () => { setOpen(!open); };
|
|
@@ -76,27 +65,31 @@ const SiteWrapper = props => {
|
|
|
76
65
|
const handleNotification = () => {
|
|
77
66
|
alert("Notification received. Make GET to fetch bell count and toast message.");
|
|
78
67
|
};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (!isMounted()) {
|
|
86
|
-
getChurchLogo();
|
|
68
|
+
/*
|
|
69
|
+
|
|
70
|
+
React.useEffect(() => {
|
|
71
|
+
const getChurchLogo = async () => {
|
|
72
|
+
if (UserHelper.currentUserChurch) {
|
|
73
|
+
setChurchLogo(AppearanceHelper.getLogoDark(props.appearance, "/images/logo-wrapper.png"));
|
|
87
74
|
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!isMounted()) {
|
|
78
|
+
getChurchLogo();
|
|
79
|
+
}
|
|
88
80
|
}, [isMounted, props.appearance]);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
else
|
|
94
|
-
SocketHelper_1.SocketHelper.setPersonChurch({ personId: props.context.person.id, churchId: (_a = props.context.userChurch) === null || _a === void 0 ? void 0 : _a.church.id });
|
|
81
|
+
|
|
82
|
+
React.useEffect(() => {
|
|
83
|
+
if (!props.context.userChurch) SocketHelper.setPersonChurch({personId:null, churchId:null});
|
|
84
|
+
else SocketHelper.setPersonChurch({personId:props.context.userChurch?.person?.id, churchId:props.context.userChurch?.church.id});
|
|
95
85
|
}, [props.context.userChurch]);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
86
|
+
|
|
87
|
+
React.useEffect(() => {
|
|
88
|
+
SocketHelper.addHandler("notification", "notificationBell", handleNotification);
|
|
89
|
+
SocketHelper.init();
|
|
99
90
|
}, []);
|
|
91
|
+
|
|
92
|
+
*/
|
|
100
93
|
return react_1.default.createElement(react_1.default.Fragment, null,
|
|
101
94
|
react_1.default.createElement(CustomAppBar, { position: "absolute" },
|
|
102
95
|
react_1.default.createElement(material_1.Toolbar, { sx: { pr: "24px" } },
|
|
@@ -104,7 +97,6 @@ const SiteWrapper = props => {
|
|
|
104
97
|
react_1.default.createElement(material_1.Icon, null, "menu")),
|
|
105
98
|
react_1.default.createElement(material_1.Typography, { variant: "h6", noWrap: true }, ((_b = (_a = helpers_1.UserHelper.currentUserChurch) === null || _a === void 0 ? void 0 : _a.church) === null || _b === void 0 ? void 0 : _b.name) || ""),
|
|
106
99
|
react_1.default.createElement("div", { style: { flex: 1 } }),
|
|
107
|
-
helpers_1.UserHelper.user && react_1.default.createElement(UserMenu_1.UserMenu, { profilePicture: helpers_1.PersonHelper.getPhotoUrl((_c = props.context) === null || _c === void 0 ? void 0 : _c.person), userName: `${(_d = helpers_1.UserHelper.user) === null || _d === void 0 ? void 0 : _d.firstName} ${(_e = helpers_1.UserHelper.user) === null || _e === void 0 ? void 0 : _e.lastName}`, userChurches: helpers_1.UserHelper.userChurches, currentUserChurch: helpers_1.UserHelper.currentUserChurch, context: props.context, appName: props.appName, router: props.router }),
|
|
108
100
|
!helpers_1.UserHelper.user && react_1.default.createElement(material_1.Link, { href: "/login", color: "inherit", style: { textDecoration: "none" } }, "Login"))),
|
|
109
101
|
react_1.default.createElement(CustomDrawer, { variant: "permanent", open: open },
|
|
110
102
|
react_1.default.createElement(material_1.Toolbar, { sx: { display: "flex", alignItems: "center", width: "100%", px: [1] } },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SiteWrapper.js","sourceRoot":"","sources":["../../../src/components/material/SiteWrapper.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SiteWrapper.js","sourceRoot":"","sources":["../../../src/components/material/SiteWrapper.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,4CAAoH;AACpH,2CAA2G;AAG3G,iEAA8D;AAa9D,MAAM,UAAU,GAAG,IAAA,iBAAM,EAAC,iBAAM,CAAC,CAC/B,CAAC,EAAE,KAAK,EAAE,EAAE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O,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE;gBAC5E,uCAAK,GAAG,EAAE,UAAU,IAAI,0BAA0B,EAAE,GAAG,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAI;gBAC3F,uCAAK,KAAK,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE;oBAClE,8BAAC,qBAAU,IAAC,OAAO,EAAE,YAAY;wBAAE,8BAAC,eAAI,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,mBAAqB,CAAa,CAClG,CACE;YACT,KAAK,CAAC,UAAU,CACJ;QACf,8BAAC,cAAG,IAAC,SAAS,EAAC,MAAM,EAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE;YAC1F,8BAAC,oBAAS,IAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAC7C,KAAK,CAAC,QAAQ,CACL,CACR,CACL,CAAA;AACL,CAAC,CAAC;AAlEW,QAAA,WAAW,eAkEtB"}
|
package/package.json
CHANGED
|
@@ -87,6 +87,8 @@ export const SiteWrapper: React.FC<Props> = props => {
|
|
|
87
87
|
alert("Notification received. Make GET to fetch bell count and toast message.")
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
/*
|
|
91
|
+
|
|
90
92
|
React.useEffect(() => {
|
|
91
93
|
const getChurchLogo = async () => {
|
|
92
94
|
if (UserHelper.currentUserChurch) {
|
|
@@ -101,7 +103,7 @@ export const SiteWrapper: React.FC<Props> = props => {
|
|
|
101
103
|
|
|
102
104
|
React.useEffect(() => {
|
|
103
105
|
if (!props.context.userChurch) SocketHelper.setPersonChurch({personId:null, churchId:null});
|
|
104
|
-
else SocketHelper.setPersonChurch({personId:props.context.person
|
|
106
|
+
else SocketHelper.setPersonChurch({personId:props.context.userChurch?.person?.id, churchId:props.context.userChurch?.church.id});
|
|
105
107
|
}, [props.context.userChurch]);
|
|
106
108
|
|
|
107
109
|
React.useEffect(() => {
|
|
@@ -109,6 +111,8 @@ export const SiteWrapper: React.FC<Props> = props => {
|
|
|
109
111
|
SocketHelper.init();
|
|
110
112
|
}, []);
|
|
111
113
|
|
|
114
|
+
*/
|
|
115
|
+
|
|
112
116
|
return <>
|
|
113
117
|
<CustomAppBar position="absolute">
|
|
114
118
|
<Toolbar sx={{ pr: "24px" }}>
|
|
@@ -117,7 +121,6 @@ export const SiteWrapper: React.FC<Props> = props => {
|
|
|
117
121
|
</IconButton>
|
|
118
122
|
<Typography variant="h6" noWrap>{UserHelper.currentUserChurch?.church?.name || ""}</Typography>
|
|
119
123
|
<div style={{ flex: 1 }}></div>
|
|
120
|
-
{UserHelper.user && <UserMenu profilePicture={PersonHelper.getPhotoUrl(props.context?.person)} userName={`${UserHelper.user?.firstName} ${UserHelper.user?.lastName}`} userChurches={UserHelper.userChurches} currentUserChurch={UserHelper.currentUserChurch} context={props.context} appName={props.appName} router={props.router} />}
|
|
121
124
|
{!UserHelper.user && <Link href="/login" color="inherit" style={{ textDecoration: "none" }}>Login</Link>}
|
|
122
125
|
</Toolbar>
|
|
123
126
|
</CustomAppBar>
|