@planningcenter/organization-avatars 1.6.1 → 1.6.3
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/index.cjs +1 -1
- package/dist/index.js +132 -137
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),M=require("react-dom"),B=require("@planningcenter/url"),A=require("@planningcenter/tapestry"),x=require("@planningcenter/icons/paths/general"),O=require("@planningcenter/icons/paths/services"),P=require("react-dropzone");function z(a){var o,t,r="";if(typeof a=="string"||typeof a=="number")r+=a;else if(typeof a=="object")if(Array.isArray(a)){var l=a.length;for(o=0;o<l;o++)a[o]&&(t=z(a[o]))&&(r&&(r+=" "),r+=t)}else for(t in a)a[t]&&(r&&(r+=" "),r+=t);return r}function T(){for(var a,o,t=0,r="",l=arguments.length;t<l;t++)(a=arguments[t])&&(o=z(a))&&(r&&(r+=" "),r+=o);return r}function $(){const a=document.querySelector('meta[name="csrf-token"]');if(!a||!a.content)throw new Error('CSRF token not found. Ensure your Rails application includes <meta name="csrf-token" content="..."> in the document head.');return a.content}function L(a){const o=a.split("");return[o.shift()?.toUpperCase(),o.join("")].join("")}const I=a=>a==="dark_mode_avatar"?"dark":"light";function S({avatarUrl:a,organization:o,mode:t,pcoEnv:r,readOnly:l,onAvatarUpdate:j}){const[s,g]=i.useState(null),[c,_]=i.useState(!1),[d,f]=i.useState(!1),[b,u]=i.useState(""),p=i.useId(),v=i.useRef(null),y=I(t),F=h=>{const[n]=h;n&&g(Object.assign(n,{preview:URL.createObjectURL(n)}))};i.useEffect(()=>()=>{s?.preview&&(URL.revokeObjectURL(s.preview),u(""))},[s]);const N=async h=>{const n=await fetch(B.pcoApiUrl("accounts",{env:r}),{method:"PATCH",headers:{"Content-Type":"application/json","X-CSRF-Token":$(),Accept:"application/json"},body:JSON.stringify({data:{attributes:h}})}),m=await n.json();if(!n.ok)throw m;return m},R=async h=>{if(h.preventDefault(),!(!s||c||d)){_(!0);try{const n=new FileReader,m=await new Promise((w,k)=>{n.onloadend=()=>w(n.result),n.onerror=k,n.readAsDataURL(s)}),C=await N({[t]:m,[`${t}_cache`]:""});g(null),j(t,C.data.attributes[t].url),v.current?.close()}catch{u("We were unable to save your avatar.")}finally{_(!1)}}},U=async()=>{if(!(c||d)){f(!0);try{await N({[`remove_${t}`]:"1"}),j(t,""),v.current?.close()}catch{u("We were unable to delete your avatar.")}finally{f(!1)}}},q=()=>{g(null),u("")};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pco-org-avatar",children:[e.jsx("button",{type:"button",onClick:()=>v.current?.showModal(),disabled:l,className:`pco-org-avatar__button pco-org-avatar__button--${y}`,children:a?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:a,alt:`Church logo for ${o}`}),e.jsx("div",{className:"tds-btn tds-btn--interaction tds-btn--icononly",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:x.pencil})})})]}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{width:"48",height:"48",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:O.image})}),e.jsx("div",{className:"tds-btn tds-btn--interaction tds-btn--icononly",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:x.pencil})})})]})}),e.jsxs("div",{className:"pco-org-avatar__label",children:[L(y)," mode"]})]}),M.createPortal(e.jsx("dialog",{id:p,ref:v,className:"pco-org-avatar__dialog",onClose:q,children:e.jsxs("form",{onSubmit:R,children:[e.jsxs("div",{className:"pco-org-avatar__dialog-header",children:[e.jsxs("h1",{className:"pco-org-avatar__dialog-title",children:["Church logo — ",y," mode"]}),e.jsx("button",{type:"button",onClick:()=>v.current?.close(),className:"pco-org-avatar__dialog-close","aria-label":"Close modal",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:x.smallX})})})]}),e.jsxs("div",{className:"pco-org-avatar__dialog-body",children:[b&&e.jsxs("div",{role:"alert",className:"pco-org-avatar__dialog-alert",children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",className:"symbol","aria-hidden":"true",children:e.jsx("path",{d:x.exclamationTriangle})}),e.jsx("p",{children:b})]}),e.jsx(P,{accept:{"image/*":[".jpg",".jpeg",".png"]},multiple:!1,onDropAccepted:F,children:({getRootProps:h,getInputProps:n,isFocused:m,isDragAccept:C,isDragReject:w,isDragActive:k})=>{const D=T("pco-org-avatar__dialog-dropzone",`pco-org-avatar__dialog-dropzone--${y}`,{"pco-org-avatar__dialog-dropzone--image":s||a,"pco-org-avatar__dialog-dropzone--focused":m,"pco-org-avatar__dialog-dropzone--accepted":C,"pco-org-avatar__dialog-dropzone--rejected":k&&w});return e.jsxs("div",{...h({className:D}),children:[e.jsx("input",{...n()}),s?e.jsx("img",{src:s.preview,alt:`Church logo for ${o}`}):a?e.jsx("img",{src:a,alt:`Church logo for ${o}`}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{width:"64",height:"64",viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:x.toCloudArrow})}),k&&w?e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:"Wrong file type"}),e.jsx("p",{children:"Please upload a PNG or JPG file."})]}):e.jsxs(e.Fragment,{children:[e.jsx("h2",{children:"Add church logo"}),e.jsx("p",{children:"Use a high-quality image (up to 20mb) with a transparent background."})]})]})]})}})]}),e.jsxs("div",{className:"pco-org-avatar__dialog-actions",children:[a&&e.jsx(A.Button,{label:"Delete logo",kind:"delete",onClick:U,loading:d,disabled:d||c,className:"pco-org-avatar__dialog-delete"}),e.jsx(A.Button,{type:"button",label:"Cancel",onClick:()=>v.current?.close(),disabled:c||d}),e.jsx(A.Button,{type:"submit",label:"Update logo",kind:"primary",loading:c,disabled:!s||c||d})]})]})}),document.body)]})}function E({avatarUrl:a,darkModeAvatarUrl:o,orgName:t,onAvatarUpdate:r,pcoEnv:l,readOnly:j,showDarkModeAvatar:s=!1}){const[g,c]=i.useState(a),[_,d]=i.useState(o),f=(u,p)=>{u==="avatar"?(c(p),r?.("avatar",p)):u==="dark_mode_avatar"&&(d(p),r?.("dark_mode_avatar",p))},b=_||g;return e.jsxs("div",{className:"pco-org-avatars",children:[e.jsx(S,{avatarUrl:g,organization:t,mode:"avatar",pcoEnv:l,readOnly:j,onAvatarUpdate:f}),s&&e.jsx(S,{avatarUrl:b,organization:t,mode:"dark_mode_avatar",pcoEnv:l,readOnly:j,onAvatarUpdate:f})]})}exports.OrganizationAvatars=E;
|
package/dist/index.js
CHANGED
|
@@ -1,120 +1,117 @@
|
|
|
1
|
-
import { jsxs as n, Fragment as f, jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { pcoApiUrl as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { pencil as
|
|
7
|
-
import { image as
|
|
8
|
-
import
|
|
9
|
-
function
|
|
1
|
+
import { jsxs as n, Fragment as f, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as _, useId as O, useRef as P, useEffect as T } from "react";
|
|
3
|
+
import { createPortal as L } from "react-dom";
|
|
4
|
+
import { pcoApiUrl as I } from "@planningcenter/url";
|
|
5
|
+
import { Button as z } from "@planningcenter/tapestry";
|
|
6
|
+
import { pencil as x, smallX as E, exclamationTriangle as W, toCloudArrow as q } from "@planningcenter/icons/paths/general";
|
|
7
|
+
import { image as G } from "@planningcenter/icons/paths/services";
|
|
8
|
+
import J from "react-dropzone";
|
|
9
|
+
function M(a) {
|
|
10
10
|
var o, r, t = "";
|
|
11
|
-
if (typeof
|
|
12
|
-
else if (typeof
|
|
13
|
-
var c =
|
|
14
|
-
for (o = 0; o < c; o++)
|
|
15
|
-
} else for (r in
|
|
11
|
+
if (typeof a == "string" || typeof a == "number") t += a;
|
|
12
|
+
else if (typeof a == "object") if (Array.isArray(a)) {
|
|
13
|
+
var c = a.length;
|
|
14
|
+
for (o = 0; o < c; o++) a[o] && (r = M(a[o])) && (t && (t += " "), t += r);
|
|
15
|
+
} else for (r in a) a[r] && (t && (t += " "), t += r);
|
|
16
16
|
return t;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
for (var
|
|
18
|
+
function X() {
|
|
19
|
+
for (var a, o, r = 0, t = "", c = arguments.length; r < c; r++) (a = arguments[r]) && (o = M(a)) && (t && (t += " "), t += o);
|
|
20
20
|
return t;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
22
|
+
function H() {
|
|
23
|
+
const a = document.querySelector('meta[name="csrf-token"]');
|
|
24
|
+
if (!a || !a.content)
|
|
25
25
|
throw new Error(
|
|
26
26
|
'CSRF token not found. Ensure your Rails application includes <meta name="csrf-token" content="..."> in the document head.'
|
|
27
27
|
);
|
|
28
|
-
return
|
|
28
|
+
return a.content;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
const o =
|
|
30
|
+
function K(a) {
|
|
31
|
+
const o = a.split("");
|
|
32
32
|
return [o.shift()?.toUpperCase(), o.join("")].join("");
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
function
|
|
36
|
-
avatarUrl:
|
|
34
|
+
const Q = (a) => a === "dark_mode_avatar" ? "dark" : "light";
|
|
35
|
+
function D({
|
|
36
|
+
avatarUrl: a,
|
|
37
37
|
organization: o,
|
|
38
38
|
mode: r,
|
|
39
39
|
pcoEnv: t,
|
|
40
40
|
readOnly: c,
|
|
41
|
-
onAvatarUpdate:
|
|
41
|
+
onAvatarUpdate: b
|
|
42
42
|
}) {
|
|
43
|
-
const [l,
|
|
44
|
-
const [i] =
|
|
45
|
-
i &&
|
|
43
|
+
const [l, p] = _(null), [d, w] = _(!1), [s, y] = _(!1), [N, h] = _(""), g = O(), m = P(null), k = Q(r), R = (u) => {
|
|
44
|
+
const [i] = u;
|
|
45
|
+
i && p(
|
|
46
46
|
Object.assign(i, {
|
|
47
47
|
preview: URL.createObjectURL(i)
|
|
48
48
|
})
|
|
49
49
|
);
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, [e]), R(() => () => {
|
|
54
|
-
l?.preview && (URL.revokeObjectURL(l.preview), k(""));
|
|
51
|
+
T(() => () => {
|
|
52
|
+
l?.preview && (URL.revokeObjectURL(l.preview), h(""));
|
|
55
53
|
}, [l]);
|
|
56
|
-
const
|
|
57
|
-
const i = await fetch(
|
|
54
|
+
const U = async (u) => {
|
|
55
|
+
const i = await fetch(I("accounts", { env: t }), {
|
|
58
56
|
method: "PATCH",
|
|
59
57
|
headers: {
|
|
60
58
|
"Content-Type": "application/json",
|
|
61
|
-
"X-CSRF-Token":
|
|
59
|
+
"X-CSRF-Token": H(),
|
|
62
60
|
Accept: "application/json"
|
|
63
61
|
},
|
|
64
62
|
body: JSON.stringify({
|
|
65
63
|
data: {
|
|
66
|
-
attributes:
|
|
64
|
+
attributes: u
|
|
67
65
|
}
|
|
68
66
|
})
|
|
69
67
|
}), v = await i.json();
|
|
70
68
|
if (!i.ok) throw v;
|
|
71
69
|
return v;
|
|
72
|
-
},
|
|
73
|
-
if (
|
|
74
|
-
|
|
70
|
+
}, S = async (u) => {
|
|
71
|
+
if (u.preventDefault(), !(!l || d || s)) {
|
|
72
|
+
w(!0);
|
|
75
73
|
try {
|
|
76
|
-
const i = new FileReader(), v = await new Promise((
|
|
77
|
-
i.onloadend = () =>
|
|
78
|
-
}),
|
|
74
|
+
const i = new FileReader(), v = await new Promise((C, A) => {
|
|
75
|
+
i.onloadend = () => C(i.result), i.onerror = A, i.readAsDataURL(l);
|
|
76
|
+
}), j = await U({
|
|
79
77
|
[r]: v,
|
|
80
78
|
[`${r}_cache`]: ""
|
|
81
79
|
});
|
|
82
|
-
|
|
80
|
+
p(null), b(r, j.data.attributes[r].url), m.current?.close();
|
|
83
81
|
} catch {
|
|
84
|
-
|
|
82
|
+
h("We were unable to save your avatar.");
|
|
85
83
|
} finally {
|
|
86
|
-
|
|
84
|
+
w(!1);
|
|
87
85
|
}
|
|
88
86
|
}
|
|
89
|
-
},
|
|
90
|
-
if (!(
|
|
91
|
-
|
|
87
|
+
}, F = async () => {
|
|
88
|
+
if (!(d || s)) {
|
|
89
|
+
y(!0);
|
|
92
90
|
try {
|
|
93
|
-
await
|
|
91
|
+
await U({
|
|
94
92
|
[`remove_${r}`]: "1"
|
|
95
|
-
}), b(
|
|
93
|
+
}), b(r, ""), m.current?.close();
|
|
96
94
|
} catch {
|
|
97
|
-
|
|
95
|
+
h("We were unable to delete your avatar.");
|
|
98
96
|
} finally {
|
|
99
|
-
|
|
97
|
+
y(!1);
|
|
100
98
|
}
|
|
101
99
|
}
|
|
102
|
-
},
|
|
103
|
-
|
|
100
|
+
}, B = () => {
|
|
101
|
+
p(null), h("");
|
|
104
102
|
};
|
|
105
103
|
return /* @__PURE__ */ n(f, { children: [
|
|
106
104
|
/* @__PURE__ */ n("div", { className: "pco-org-avatar", children: [
|
|
107
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ e(
|
|
108
106
|
"button",
|
|
109
107
|
{
|
|
110
108
|
type: "button",
|
|
111
|
-
|
|
112
|
-
command: "show-modal",
|
|
109
|
+
onClick: () => m.current?.showModal(),
|
|
113
110
|
disabled: c,
|
|
114
|
-
className: `pco-org-avatar__button pco-org-avatar__button--${
|
|
115
|
-
children:
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */
|
|
111
|
+
className: `pco-org-avatar__button pco-org-avatar__button--${k}`,
|
|
112
|
+
children: a ? /* @__PURE__ */ n(f, { children: [
|
|
113
|
+
/* @__PURE__ */ e("img", { src: a, alt: `Church logo for ${o}` }),
|
|
114
|
+
/* @__PURE__ */ e("div", { className: "tds-btn tds-btn--interaction tds-btn--icononly", children: /* @__PURE__ */ e(
|
|
118
115
|
"svg",
|
|
119
116
|
{
|
|
120
117
|
width: "14",
|
|
@@ -122,11 +119,11 @@ function S({
|
|
|
122
119
|
viewBox: "0 0 16 16",
|
|
123
120
|
fill: "currentColor",
|
|
124
121
|
"aria-hidden": "true",
|
|
125
|
-
children: /* @__PURE__ */
|
|
122
|
+
children: /* @__PURE__ */ e("path", { d: x })
|
|
126
123
|
}
|
|
127
124
|
) })
|
|
128
125
|
] }) : /* @__PURE__ */ n(f, { children: [
|
|
129
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ e(
|
|
130
127
|
"svg",
|
|
131
128
|
{
|
|
132
129
|
width: "48",
|
|
@@ -134,10 +131,10 @@ function S({
|
|
|
134
131
|
viewBox: "0 0 16 16",
|
|
135
132
|
fill: "currentColor",
|
|
136
133
|
"aria-hidden": "true",
|
|
137
|
-
children: /* @__PURE__ */
|
|
134
|
+
children: /* @__PURE__ */ e("path", { d: G })
|
|
138
135
|
}
|
|
139
136
|
),
|
|
140
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ e("div", { className: "tds-btn tds-btn--interaction tds-btn--icononly", children: /* @__PURE__ */ e(
|
|
141
138
|
"svg",
|
|
142
139
|
{
|
|
143
140
|
width: "14",
|
|
@@ -145,41 +142,40 @@ function S({
|
|
|
145
142
|
viewBox: "0 0 16 16",
|
|
146
143
|
fill: "currentColor",
|
|
147
144
|
"aria-hidden": "true",
|
|
148
|
-
children: /* @__PURE__ */
|
|
145
|
+
children: /* @__PURE__ */ e("path", { d: x })
|
|
149
146
|
}
|
|
150
147
|
) })
|
|
151
148
|
] })
|
|
152
149
|
}
|
|
153
150
|
),
|
|
154
151
|
/* @__PURE__ */ n("div", { className: "pco-org-avatar__label", children: [
|
|
155
|
-
|
|
152
|
+
K(k),
|
|
156
153
|
" mode"
|
|
157
154
|
] })
|
|
158
155
|
] }),
|
|
159
|
-
|
|
160
|
-
/* @__PURE__ */
|
|
156
|
+
L(
|
|
157
|
+
/* @__PURE__ */ e(
|
|
161
158
|
"dialog",
|
|
162
159
|
{
|
|
163
|
-
id:
|
|
164
|
-
ref:
|
|
160
|
+
id: g,
|
|
161
|
+
ref: m,
|
|
165
162
|
className: "pco-org-avatar__dialog",
|
|
166
|
-
onClose:
|
|
167
|
-
children: /* @__PURE__ */ n("form", { onSubmit:
|
|
163
|
+
onClose: B,
|
|
164
|
+
children: /* @__PURE__ */ n("form", { onSubmit: S, children: [
|
|
168
165
|
/* @__PURE__ */ n("div", { className: "pco-org-avatar__dialog-header", children: [
|
|
169
166
|
/* @__PURE__ */ n("h1", { className: "pco-org-avatar__dialog-title", children: [
|
|
170
167
|
"Church logo — ",
|
|
171
|
-
|
|
168
|
+
k,
|
|
172
169
|
" mode"
|
|
173
170
|
] }),
|
|
174
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ e(
|
|
175
172
|
"button",
|
|
176
173
|
{
|
|
177
174
|
type: "button",
|
|
178
|
-
|
|
179
|
-
command: "close",
|
|
175
|
+
onClick: () => m.current?.close(),
|
|
180
176
|
className: "pco-org-avatar__dialog-close",
|
|
181
177
|
"aria-label": "Close modal",
|
|
182
|
-
children: /* @__PURE__ */
|
|
178
|
+
children: /* @__PURE__ */ e(
|
|
183
179
|
"svg",
|
|
184
180
|
{
|
|
185
181
|
width: "16",
|
|
@@ -187,15 +183,15 @@ function S({
|
|
|
187
183
|
viewBox: "0 0 16 16",
|
|
188
184
|
fill: "currentColor",
|
|
189
185
|
"aria-hidden": "true",
|
|
190
|
-
children: /* @__PURE__ */
|
|
186
|
+
children: /* @__PURE__ */ e("path", { d: E })
|
|
191
187
|
}
|
|
192
188
|
)
|
|
193
189
|
}
|
|
194
190
|
)
|
|
195
191
|
] }),
|
|
196
192
|
/* @__PURE__ */ n("div", { className: "pco-org-avatar__dialog-body", children: [
|
|
197
|
-
|
|
198
|
-
/* @__PURE__ */
|
|
193
|
+
N && /* @__PURE__ */ n("div", { role: "alert", className: "pco-org-avatar__dialog-alert", children: [
|
|
194
|
+
/* @__PURE__ */ e(
|
|
199
195
|
"svg",
|
|
200
196
|
{
|
|
201
197
|
width: "16",
|
|
@@ -203,66 +199,66 @@ function S({
|
|
|
203
199
|
viewBox: "0 0 16 16",
|
|
204
200
|
className: "symbol",
|
|
205
201
|
"aria-hidden": "true",
|
|
206
|
-
children: /* @__PURE__ */
|
|
202
|
+
children: /* @__PURE__ */ e("path", { d: W })
|
|
207
203
|
}
|
|
208
204
|
),
|
|
209
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ e("p", { children: N })
|
|
210
206
|
] }),
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
|
|
207
|
+
/* @__PURE__ */ e(
|
|
208
|
+
J,
|
|
213
209
|
{
|
|
214
210
|
accept: { "image/*": [".jpg", ".jpeg", ".png"] },
|
|
215
211
|
multiple: !1,
|
|
216
|
-
onDropAccepted:
|
|
212
|
+
onDropAccepted: R,
|
|
217
213
|
children: ({
|
|
218
|
-
getRootProps:
|
|
214
|
+
getRootProps: u,
|
|
219
215
|
getInputProps: i,
|
|
220
216
|
isFocused: v,
|
|
221
|
-
isDragAccept:
|
|
222
|
-
isDragReject:
|
|
223
|
-
isDragActive:
|
|
217
|
+
isDragAccept: j,
|
|
218
|
+
isDragReject: C,
|
|
219
|
+
isDragActive: A
|
|
224
220
|
}) => {
|
|
225
|
-
const
|
|
221
|
+
const $ = X(
|
|
226
222
|
"pco-org-avatar__dialog-dropzone",
|
|
227
|
-
`pco-org-avatar__dialog-dropzone--${
|
|
223
|
+
`pco-org-avatar__dialog-dropzone--${k}`,
|
|
228
224
|
{
|
|
229
|
-
"pco-org-avatar__dialog-dropzone--image": l ||
|
|
225
|
+
"pco-org-avatar__dialog-dropzone--image": l || a,
|
|
230
226
|
"pco-org-avatar__dialog-dropzone--focused": v,
|
|
231
|
-
"pco-org-avatar__dialog-dropzone--accepted":
|
|
232
|
-
"pco-org-avatar__dialog-dropzone--rejected":
|
|
227
|
+
"pco-org-avatar__dialog-dropzone--accepted": j,
|
|
228
|
+
"pco-org-avatar__dialog-dropzone--rejected": A && C
|
|
233
229
|
}
|
|
234
230
|
);
|
|
235
|
-
return /* @__PURE__ */ n("div", { ...
|
|
236
|
-
/* @__PURE__ */
|
|
237
|
-
l ? /* @__PURE__ */
|
|
231
|
+
return /* @__PURE__ */ n("div", { ...u({ className: $ }), children: [
|
|
232
|
+
/* @__PURE__ */ e("input", { ...i() }),
|
|
233
|
+
l ? /* @__PURE__ */ e(
|
|
238
234
|
"img",
|
|
239
235
|
{
|
|
240
236
|
src: l.preview,
|
|
241
237
|
alt: `Church logo for ${o}`
|
|
242
238
|
}
|
|
243
|
-
) :
|
|
239
|
+
) : a ? /* @__PURE__ */ e(
|
|
244
240
|
"img",
|
|
245
241
|
{
|
|
246
|
-
src:
|
|
242
|
+
src: a,
|
|
247
243
|
alt: `Church logo for ${o}`
|
|
248
244
|
}
|
|
249
245
|
) : /* @__PURE__ */ n(f, { children: [
|
|
250
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ e(
|
|
251
247
|
"svg",
|
|
252
248
|
{
|
|
253
249
|
width: "64",
|
|
254
250
|
height: "64",
|
|
255
251
|
viewBox: "0 0 16 16",
|
|
256
252
|
"aria-hidden": "true",
|
|
257
|
-
children: /* @__PURE__ */
|
|
253
|
+
children: /* @__PURE__ */ e("path", { d: q })
|
|
258
254
|
}
|
|
259
255
|
),
|
|
260
|
-
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
/* @__PURE__ */
|
|
256
|
+
A && C ? /* @__PURE__ */ n(f, { children: [
|
|
257
|
+
/* @__PURE__ */ e("h2", { children: "Wrong file type" }),
|
|
258
|
+
/* @__PURE__ */ e("p", { children: "Please upload a PNG or JPG file." })
|
|
263
259
|
] }) : /* @__PURE__ */ n(f, { children: [
|
|
264
|
-
/* @__PURE__ */
|
|
265
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ e("h2", { children: "Add church logo" }),
|
|
261
|
+
/* @__PURE__ */ e("p", { children: "Use a high-quality image (up to 20mb) with a transparent background." })
|
|
266
262
|
] })
|
|
267
263
|
] })
|
|
268
264
|
] });
|
|
@@ -271,35 +267,34 @@ function S({
|
|
|
271
267
|
)
|
|
272
268
|
] }),
|
|
273
269
|
/* @__PURE__ */ n("div", { className: "pco-org-avatar__dialog-actions", children: [
|
|
274
|
-
|
|
275
|
-
|
|
270
|
+
a && /* @__PURE__ */ e(
|
|
271
|
+
z,
|
|
276
272
|
{
|
|
277
273
|
label: "Delete logo",
|
|
278
274
|
kind: "delete",
|
|
279
|
-
onClick:
|
|
280
|
-
loading:
|
|
281
|
-
disabled:
|
|
275
|
+
onClick: F,
|
|
276
|
+
loading: s,
|
|
277
|
+
disabled: s || d,
|
|
282
278
|
className: "pco-org-avatar__dialog-delete"
|
|
283
279
|
}
|
|
284
280
|
),
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
|
|
281
|
+
/* @__PURE__ */ e(
|
|
282
|
+
z,
|
|
287
283
|
{
|
|
288
284
|
type: "button",
|
|
289
285
|
label: "Cancel",
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
disabled: s || h
|
|
286
|
+
onClick: () => m.current?.close(),
|
|
287
|
+
disabled: d || s
|
|
293
288
|
}
|
|
294
289
|
),
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
-
|
|
290
|
+
/* @__PURE__ */ e(
|
|
291
|
+
z,
|
|
297
292
|
{
|
|
298
293
|
type: "submit",
|
|
299
294
|
label: "Update logo",
|
|
300
295
|
kind: "primary",
|
|
301
|
-
loading:
|
|
302
|
-
disabled: !l ||
|
|
296
|
+
loading: d,
|
|
297
|
+
disabled: !l || d || s
|
|
303
298
|
}
|
|
304
299
|
)
|
|
305
300
|
] })
|
|
@@ -310,45 +305,45 @@ function S({
|
|
|
310
305
|
)
|
|
311
306
|
] });
|
|
312
307
|
}
|
|
313
|
-
function
|
|
314
|
-
avatarUrl:
|
|
308
|
+
function ne({
|
|
309
|
+
avatarUrl: a,
|
|
315
310
|
darkModeAvatarUrl: o,
|
|
316
311
|
orgName: r,
|
|
317
312
|
onAvatarUpdate: t,
|
|
318
313
|
pcoEnv: c,
|
|
319
|
-
readOnly:
|
|
314
|
+
readOnly: b,
|
|
320
315
|
showDarkModeAvatar: l = !1
|
|
321
316
|
}) {
|
|
322
|
-
const [
|
|
317
|
+
const [p, d] = _(a), [w, s] = _(
|
|
323
318
|
o
|
|
324
|
-
), y = (
|
|
325
|
-
|
|
319
|
+
), y = (h, g) => {
|
|
320
|
+
h === "avatar" ? (d(g), t?.("avatar", g)) : h === "dark_mode_avatar" && (s(g), t?.("dark_mode_avatar", g));
|
|
326
321
|
};
|
|
327
322
|
return /* @__PURE__ */ n("div", { className: "pco-org-avatars", children: [
|
|
328
|
-
/* @__PURE__ */
|
|
329
|
-
|
|
323
|
+
/* @__PURE__ */ e(
|
|
324
|
+
D,
|
|
330
325
|
{
|
|
331
|
-
avatarUrl:
|
|
326
|
+
avatarUrl: p,
|
|
332
327
|
organization: r,
|
|
333
328
|
mode: "avatar",
|
|
334
329
|
pcoEnv: c,
|
|
335
|
-
readOnly:
|
|
330
|
+
readOnly: b,
|
|
336
331
|
onAvatarUpdate: y
|
|
337
332
|
}
|
|
338
333
|
),
|
|
339
|
-
l && /* @__PURE__ */
|
|
340
|
-
|
|
334
|
+
l && /* @__PURE__ */ e(
|
|
335
|
+
D,
|
|
341
336
|
{
|
|
342
|
-
avatarUrl:
|
|
337
|
+
avatarUrl: w || p,
|
|
343
338
|
organization: r,
|
|
344
339
|
mode: "dark_mode_avatar",
|
|
345
340
|
pcoEnv: c,
|
|
346
|
-
readOnly:
|
|
341
|
+
readOnly: b,
|
|
347
342
|
onAvatarUpdate: y
|
|
348
343
|
}
|
|
349
344
|
)
|
|
350
345
|
] });
|
|
351
346
|
}
|
|
352
347
|
export {
|
|
353
|
-
|
|
348
|
+
ne as OrganizationAvatars
|
|
354
349
|
};
|