@fluid-app/portal-sdk 0.1.172 → 0.1.173
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/{ContactsScreen-Cx_EJtrO.mjs → ContactsScreen-C1TCBi7p.mjs} +175 -174
- package/dist/ContactsScreen-C1TCBi7p.mjs.map +1 -0
- package/dist/{ContactsScreen-DPabYFtr.cjs → ContactsScreen-DuUHlWxn.cjs} +1 -1
- package/dist/{ContactsScreen-Bufy88vw.cjs → ContactsScreen-RK8gQwUZ.cjs} +174 -173
- package/dist/ContactsScreen-RK8gQwUZ.cjs.map +1 -0
- package/dist/{MySiteScreen-CaBd2GGy.cjs → MySiteScreen-BM3EuPZ4.cjs} +136 -182
- package/dist/MySiteScreen-BM3EuPZ4.cjs.map +1 -0
- package/dist/{MySiteScreen-Cw7fTWT1.cjs → MySiteScreen-CxhmVSdK.cjs} +1 -1
- package/dist/{MySiteScreen-Y4dsjqFj.mjs → MySiteScreen-ZLvvJhoy.mjs} +136 -182
- package/dist/MySiteScreen-ZLvvJhoy.mjs.map +1 -0
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +6 -6
- package/package.json +13 -13
- package/dist/ContactsScreen-Bufy88vw.cjs.map +0 -1
- package/dist/ContactsScreen-Cx_EJtrO.mjs.map +0 -1
- package/dist/MySiteScreen-CaBd2GGy.cjs.map +0 -1
- package/dist/MySiteScreen-Y4dsjqFj.mjs.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-9hOWP6kD.cjs");
|
|
2
2
|
const require_src = require("./src-B0AAcRhB.cjs");
|
|
3
3
|
const require_ScreenHeaderContext = require("./ScreenHeaderContext-DA8cEfP-.cjs");
|
|
4
|
-
const require_AppNavigationContext = require("./AppNavigationContext-N5oUbgNL.cjs");
|
|
5
4
|
const require_dist$3 = require("./dist-Mf7Sx86H.cjs");
|
|
6
5
|
const require_use_mysite_portal = require("./use-mysite-portal-BkEi6LG-.cjs");
|
|
7
6
|
let react = require("react");
|
|
@@ -11,72 +10,28 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
11
10
|
let lucide_react = require("lucide-react");
|
|
12
11
|
let zod = require("zod");
|
|
13
12
|
//#region ../../mysite/ui/src/portal/components/animation-utils.ts
|
|
14
|
-
function
|
|
13
|
+
function getContentClassName(phase) {
|
|
15
14
|
switch (phase) {
|
|
16
|
-
case "idle": return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
case "fade-out": return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
transition: `opacity 300ms ease-in-out`
|
|
25
|
-
};
|
|
26
|
-
case "slide": return {
|
|
27
|
-
transform: "translateX(50%)",
|
|
28
|
-
opacity: 0,
|
|
29
|
-
transition: `transform 500ms ease-in-out`
|
|
30
|
-
};
|
|
31
|
-
case "fade-in": return {
|
|
32
|
-
transform: "translateX(50%)",
|
|
33
|
-
opacity: 1,
|
|
34
|
-
transition: `opacity 300ms ease-in-out`
|
|
35
|
-
};
|
|
36
|
-
case "editing": return {
|
|
37
|
-
transform: "translateX(50%)",
|
|
38
|
-
opacity: 1,
|
|
39
|
-
transition: "none"
|
|
40
|
-
};
|
|
41
|
-
case "exit-fade-out": return {
|
|
42
|
-
transform: "translateX(50%)",
|
|
43
|
-
opacity: 0,
|
|
44
|
-
transition: `opacity 300ms ease-in-out`
|
|
45
|
-
};
|
|
46
|
-
case "exit-slide": return {
|
|
47
|
-
transform: "translateX(0)",
|
|
48
|
-
opacity: 0,
|
|
49
|
-
transition: `transform 500ms ease-in-out`
|
|
50
|
-
};
|
|
51
|
-
case "exit-fade-in": return {
|
|
52
|
-
transform: "translateX(0)",
|
|
53
|
-
opacity: 1,
|
|
54
|
-
transition: `opacity 300ms ease-in-out`
|
|
55
|
-
};
|
|
15
|
+
case "idle": return "opacity-100 transition-none";
|
|
16
|
+
case "fade-out": return "opacity-0 transition-opacity duration-300 ease-in-out";
|
|
17
|
+
case "slide": return "opacity-0 2xl:translate-x-[50%] transition-transform duration-500 ease-in-out";
|
|
18
|
+
case "fade-in": return "opacity-100 2xl:translate-x-[50%] transition-opacity duration-300 ease-in-out";
|
|
19
|
+
case "editing": return "opacity-100 2xl:translate-x-[50%] transition-none";
|
|
20
|
+
case "exit-fade-out": return "opacity-0 2xl:translate-x-[50%] transition-opacity duration-300 ease-in-out";
|
|
21
|
+
case "exit-slide": return "opacity-0 transition-transform duration-500 ease-in-out";
|
|
22
|
+
case "exit-fade-in": return "opacity-100 transition-opacity duration-300 ease-in-out";
|
|
56
23
|
}
|
|
57
24
|
}
|
|
58
|
-
function
|
|
25
|
+
function getPreviewClassName(phase) {
|
|
59
26
|
switch (phase) {
|
|
60
27
|
case "idle":
|
|
61
28
|
case "fade-out":
|
|
62
|
-
case "exit-fade-in": return
|
|
63
|
-
|
|
64
|
-
transition: "none"
|
|
65
|
-
};
|
|
66
|
-
case "slide": return {
|
|
67
|
-
transform: "translateX(-200%)",
|
|
68
|
-
transition: `transform 500ms ease-in-out`
|
|
69
|
-
};
|
|
29
|
+
case "exit-fade-in": return "transition-none";
|
|
30
|
+
case "slide": return "2xl:-translate-x-[200%] transition-transform duration-500 ease-in-out";
|
|
70
31
|
case "fade-in":
|
|
71
32
|
case "editing":
|
|
72
|
-
case "exit-fade-out": return
|
|
73
|
-
|
|
74
|
-
transition: "none"
|
|
75
|
-
};
|
|
76
|
-
case "exit-slide": return {
|
|
77
|
-
transform: "translateX(0)",
|
|
78
|
-
transition: `transform 500ms ease-in-out`
|
|
79
|
-
};
|
|
33
|
+
case "exit-fade-out": return "2xl:-translate-x-[200%] transition-none";
|
|
34
|
+
case "exit-slide": return "transition-transform duration-500 ease-in-out";
|
|
80
35
|
}
|
|
81
36
|
}
|
|
82
37
|
//#endregion
|
|
@@ -264,7 +219,7 @@ function MySitePhonePreview({ mysiteUrl, themeName, previewKey, isUpdating, onPr
|
|
|
264
219
|
className: "text-foreground text-sm font-semibold",
|
|
265
220
|
children: themeName
|
|
266
221
|
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
|
|
267
|
-
className: "col-start-2 row-span-2 row-start-1 self-center justify-self-end",
|
|
222
|
+
className: "col-start-2 row-span-2 row-start-1 cursor-pointer self-center justify-self-end",
|
|
268
223
|
variant: "secondary",
|
|
269
224
|
size: "sm",
|
|
270
225
|
onClick: onPreview,
|
|
@@ -1158,43 +1113,36 @@ function MySiteProfileForm({ onBack, onToast, onUploadPhoto, avatarUrl, userName
|
|
|
1158
1113
|
})]
|
|
1159
1114
|
})]
|
|
1160
1115
|
}),
|
|
1161
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
1162
|
-
className: "
|
|
1163
|
-
children:
|
|
1164
|
-
className: "
|
|
1165
|
-
children: "
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
})
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
children: "About you"
|
|
1190
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Textarea, {
|
|
1191
|
-
id: "profile-bio",
|
|
1192
|
-
rows: 4,
|
|
1193
|
-
value: formState.bio,
|
|
1194
|
-
onChange: (e) => handleFieldChange("bio", e.target.value),
|
|
1195
|
-
placeholder: "Tell people a little about yourself..."
|
|
1116
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Card, {
|
|
1117
|
+
className: "h-auto gap-0 py-0 shadow-none",
|
|
1118
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.CardContent, {
|
|
1119
|
+
className: "space-y-4 p-4 sm:p-6",
|
|
1120
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1121
|
+
className: "space-y-2",
|
|
1122
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Label, {
|
|
1123
|
+
htmlFor: "profile-display-name",
|
|
1124
|
+
children: "Display Name"
|
|
1125
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Input, {
|
|
1126
|
+
id: "profile-display-name",
|
|
1127
|
+
type: "text",
|
|
1128
|
+
value: formState.display_name,
|
|
1129
|
+
onChange: (e) => handleFieldChange("display_name", e.target.value),
|
|
1130
|
+
placeholder: "Your display name"
|
|
1131
|
+
})]
|
|
1132
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1133
|
+
className: "space-y-2",
|
|
1134
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Label, {
|
|
1135
|
+
htmlFor: "profile-bio",
|
|
1136
|
+
children: "Bio"
|
|
1137
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Textarea, {
|
|
1138
|
+
id: "profile-bio",
|
|
1139
|
+
rows: 4,
|
|
1140
|
+
value: formState.bio,
|
|
1141
|
+
onChange: (e) => handleFieldChange("bio", e.target.value),
|
|
1142
|
+
placeholder: "Tell people a little about yourself..."
|
|
1143
|
+
})]
|
|
1196
1144
|
})]
|
|
1197
|
-
})
|
|
1145
|
+
})
|
|
1198
1146
|
}),
|
|
1199
1147
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1200
1148
|
className: "flex justify-end",
|
|
@@ -1213,7 +1161,7 @@ function MySiteProfileForm({ onBack, onToast, onUploadPhoto, avatarUrl, userName
|
|
|
1213
1161
|
const navigationItems = [
|
|
1214
1162
|
{
|
|
1215
1163
|
label: "Profile",
|
|
1216
|
-
|
|
1164
|
+
key: "profile",
|
|
1217
1165
|
icon: lucide_react.User
|
|
1218
1166
|
},
|
|
1219
1167
|
{
|
|
@@ -1232,34 +1180,11 @@ const navigationItems = [
|
|
|
1232
1180
|
icon: lucide_react.Link2
|
|
1233
1181
|
}
|
|
1234
1182
|
];
|
|
1235
|
-
function defaultToast
|
|
1183
|
+
function defaultToast(message, type) {
|
|
1236
1184
|
if (type === "error") console.warn("[MySite]", message);
|
|
1237
1185
|
else console.info("[MySite]", message);
|
|
1238
1186
|
}
|
|
1239
|
-
function MySiteMainView() {
|
|
1240
|
-
const { navigate } = require_AppNavigationContext.useAppNavigation();
|
|
1241
|
-
const [animPhase, setAnimPhase] = (0, react.useState)("idle");
|
|
1242
|
-
const [editingSection, setEditingSection] = (0, react.useState)(null);
|
|
1243
|
-
const timeoutsRef = (0, react.useRef)([]);
|
|
1244
|
-
(0, react.useEffect)(() => {
|
|
1245
|
-
const ref = timeoutsRef;
|
|
1246
|
-
return () => ref.current.forEach(clearTimeout);
|
|
1247
|
-
}, []);
|
|
1248
|
-
const cancelScheduled = (0, react.useCallback)(() => {
|
|
1249
|
-
timeoutsRef.current.forEach(clearTimeout);
|
|
1250
|
-
timeoutsRef.current = [];
|
|
1251
|
-
}, []);
|
|
1252
|
-
const schedule = (0, react.useCallback)((phase, delay) => {
|
|
1253
|
-
const id = setTimeout(() => setAnimPhase(phase), delay);
|
|
1254
|
-
timeoutsRef.current.push(id);
|
|
1255
|
-
}, []);
|
|
1256
|
-
const showEditContent = [
|
|
1257
|
-
"slide",
|
|
1258
|
-
"fade-in",
|
|
1259
|
-
"editing",
|
|
1260
|
-
"exit-fade-out",
|
|
1261
|
-
"exit-slide"
|
|
1262
|
-
].includes(animPhase);
|
|
1187
|
+
function MySiteMainView({ editingSection, animPhase, showEditContent, onEditSection, onBackClick }) {
|
|
1263
1188
|
const { data: profile, isLoading: isProfileLoading } = require_use_mysite_portal.usePortalMySiteProfile();
|
|
1264
1189
|
const { data: themes = [] } = require_use_mysite_portal.usePortalMySiteThemes();
|
|
1265
1190
|
const updateSettingsMutation = require_use_mysite_portal.usePortalUpdateSettings();
|
|
@@ -1278,12 +1203,12 @@ function MySiteMainView() {
|
|
|
1278
1203
|
setSelectedThemeId(theme.id);
|
|
1279
1204
|
updateSettingsMutation.mutate({ theme_id: theme.id }, {
|
|
1280
1205
|
onSuccess: () => {
|
|
1281
|
-
defaultToast
|
|
1206
|
+
defaultToast(`Theme changed to "${theme.name}"`, "success");
|
|
1282
1207
|
refreshPreview();
|
|
1283
1208
|
},
|
|
1284
1209
|
onError: () => {
|
|
1285
1210
|
setSelectedThemeId(previousThemeId);
|
|
1286
|
-
defaultToast
|
|
1211
|
+
defaultToast("Failed to update theme", "error");
|
|
1287
1212
|
}
|
|
1288
1213
|
});
|
|
1289
1214
|
}, [
|
|
@@ -1300,25 +1225,6 @@ function MySiteMainView() {
|
|
|
1300
1225
|
});
|
|
1301
1226
|
});
|
|
1302
1227
|
}, [updateSettingsMutation]);
|
|
1303
|
-
const handleEditSection = (0, react.useCallback)((section) => {
|
|
1304
|
-
cancelScheduled();
|
|
1305
|
-
setEditingSection(section);
|
|
1306
|
-
setAnimPhase("fade-out");
|
|
1307
|
-
schedule("slide", 300);
|
|
1308
|
-
schedule("fade-in", 800);
|
|
1309
|
-
schedule("editing", 1100);
|
|
1310
|
-
}, [cancelScheduled, schedule]);
|
|
1311
|
-
const handleBackClick = (0, react.useCallback)(() => {
|
|
1312
|
-
cancelScheduled();
|
|
1313
|
-
setAnimPhase("exit-fade-out");
|
|
1314
|
-
schedule("exit-slide", 300);
|
|
1315
|
-
schedule("exit-fade-in", 800);
|
|
1316
|
-
const id = setTimeout(() => {
|
|
1317
|
-
setAnimPhase("idle");
|
|
1318
|
-
setEditingSection(null);
|
|
1319
|
-
}, 1100);
|
|
1320
|
-
timeoutsRef.current.push(id);
|
|
1321
|
-
}, [cancelScheduled, schedule]);
|
|
1322
1228
|
const handlePreview = (0, react.useCallback)(() => {
|
|
1323
1229
|
if (mysiteUrl) window.open(`${mysiteUrl}?preview=true`, "_blank");
|
|
1324
1230
|
}, [mysiteUrl]);
|
|
@@ -1326,6 +1232,7 @@ function MySiteMainView() {
|
|
|
1326
1232
|
if (editingSection === "theme") return "Theme";
|
|
1327
1233
|
if (editingSection === "buttons") return "Buttons";
|
|
1328
1234
|
if (editingSection === "content") return "MySite Content";
|
|
1235
|
+
if (editingSection === "profile") return "Profile";
|
|
1329
1236
|
return "";
|
|
1330
1237
|
}, [editingSection]);
|
|
1331
1238
|
if (isProfileLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -1355,13 +1262,12 @@ function MySiteMainView() {
|
|
|
1355
1262
|
})
|
|
1356
1263
|
})]
|
|
1357
1264
|
});
|
|
1358
|
-
const
|
|
1359
|
-
const
|
|
1265
|
+
const contentAnimClassName = getContentClassName(animPhase);
|
|
1266
|
+
const previewAnimClassName = getPreviewClassName(animPhase);
|
|
1360
1267
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1361
1268
|
className: "flex h-full overflow-hidden px-2 py-6",
|
|
1362
1269
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1363
|
-
className:
|
|
1364
|
-
style: contentStyle,
|
|
1270
|
+
className: `w-full px-4 2xl:w-2/3 2xl:shrink-0 ${contentAnimClassName}`,
|
|
1365
1271
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1366
1272
|
className: "flex h-full min-w-0 flex-col gap-5 overflow-y-auto",
|
|
1367
1273
|
children: showEditContent && editingSection === "theme" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MySiteThemeEditor, {
|
|
@@ -1369,15 +1275,18 @@ function MySiteMainView() {
|
|
|
1369
1275
|
selectedThemeId: resolvedThemeId,
|
|
1370
1276
|
onSelectTheme: handleSelectTheme,
|
|
1371
1277
|
isPending: updateSettingsMutation.isPending,
|
|
1372
|
-
onBack:
|
|
1278
|
+
onBack: onBackClick
|
|
1373
1279
|
}) : showEditContent && editingSection === "buttons" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalButtonsEditor, {
|
|
1374
|
-
onBack:
|
|
1280
|
+
onBack: onBackClick,
|
|
1375
1281
|
onRefreshPreview: refreshPreview,
|
|
1376
|
-
onToast: defaultToast
|
|
1282
|
+
onToast: defaultToast
|
|
1377
1283
|
}) : showEditContent && editingSection === "content" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalFavoritesEditor, {
|
|
1378
|
-
onBack:
|
|
1284
|
+
onBack: onBackClick,
|
|
1379
1285
|
onRefreshPreview: refreshPreview,
|
|
1380
|
-
onToast: defaultToast
|
|
1286
|
+
onToast: defaultToast
|
|
1287
|
+
}) : showEditContent && editingSection === "profile" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MySiteProfileForm, {
|
|
1288
|
+
onBack: onBackClick,
|
|
1289
|
+
onToast: defaultToast
|
|
1381
1290
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1382
1291
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1383
1292
|
className: "flex items-center gap-2",
|
|
@@ -1397,7 +1306,7 @@ function MySiteMainView() {
|
|
|
1397
1306
|
mysiteUrl,
|
|
1398
1307
|
displayUrl,
|
|
1399
1308
|
onUpdateSlug: handleUpdateSlug,
|
|
1400
|
-
onToast: defaultToast
|
|
1309
|
+
onToast: defaultToast
|
|
1401
1310
|
}),
|
|
1402
1311
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1403
1312
|
className: "border-border bg-card divide-border divide-y overflow-hidden rounded-lg border",
|
|
@@ -1405,10 +1314,7 @@ function MySiteMainView() {
|
|
|
1405
1314
|
const Icon = item.icon;
|
|
1406
1315
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1407
1316
|
type: "button",
|
|
1408
|
-
onClick: () =>
|
|
1409
|
-
if ("key" in item) handleEditSection(item.key);
|
|
1410
|
-
else navigate(item.slug);
|
|
1411
|
-
},
|
|
1317
|
+
onClick: () => onEditSection(item.key),
|
|
1412
1318
|
className: "group hover:bg-muted flex w-full items-center gap-2.5 px-3 py-2.5 transition-colors text-left cursor-pointer",
|
|
1413
1319
|
children: [
|
|
1414
1320
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -1427,8 +1333,7 @@ function MySiteMainView() {
|
|
|
1427
1333
|
] })
|
|
1428
1334
|
})
|
|
1429
1335
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1430
|
-
className:
|
|
1431
|
-
style: previewStyle,
|
|
1336
|
+
className: `hidden w-1/3 shrink-0 overflow-y-hidden px-4 2xl:block ${previewAnimClassName}`,
|
|
1432
1337
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MySitePhonePreview, {
|
|
1433
1338
|
mysiteUrl,
|
|
1434
1339
|
themeName,
|
|
@@ -1440,44 +1345,93 @@ function MySiteMainView() {
|
|
|
1440
1345
|
});
|
|
1441
1346
|
}
|
|
1442
1347
|
//#endregion
|
|
1443
|
-
//#region src/screens/MySiteScreen/
|
|
1444
|
-
function
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1348
|
+
//#region src/screens/MySiteScreen/use-mysite-editing-section.ts
|
|
1349
|
+
function useMySiteEditingSection() {
|
|
1350
|
+
const [animPhase, setAnimPhase] = (0, react.useState)("idle");
|
|
1351
|
+
const [editingSection, setEditingSection] = (0, react.useState)(null);
|
|
1352
|
+
const timeoutsRef = (0, react.useRef)([]);
|
|
1353
|
+
(0, react.useEffect)(() => {
|
|
1354
|
+
const ref = timeoutsRef;
|
|
1355
|
+
return () => ref.current.forEach(clearTimeout);
|
|
1356
|
+
}, []);
|
|
1357
|
+
const cancelScheduled = (0, react.useCallback)(() => {
|
|
1358
|
+
timeoutsRef.current.forEach(clearTimeout);
|
|
1359
|
+
timeoutsRef.current = [];
|
|
1360
|
+
}, []);
|
|
1361
|
+
const schedule = (0, react.useCallback)((phase, delay) => {
|
|
1362
|
+
const id = setTimeout(() => setAnimPhase(phase), delay);
|
|
1363
|
+
timeoutsRef.current.push(id);
|
|
1364
|
+
}, []);
|
|
1365
|
+
return {
|
|
1366
|
+
editingSection,
|
|
1367
|
+
animPhase,
|
|
1368
|
+
showEditContent: [
|
|
1369
|
+
"slide",
|
|
1370
|
+
"fade-in",
|
|
1371
|
+
"editing",
|
|
1372
|
+
"exit-fade-out",
|
|
1373
|
+
"exit-slide"
|
|
1374
|
+
].includes(animPhase),
|
|
1375
|
+
handleEditSection: (0, react.useCallback)((section) => {
|
|
1376
|
+
cancelScheduled();
|
|
1377
|
+
setEditingSection(section);
|
|
1378
|
+
setAnimPhase("fade-out");
|
|
1379
|
+
schedule("slide", 300);
|
|
1380
|
+
schedule("fade-in", 800);
|
|
1381
|
+
schedule("editing", 1100);
|
|
1382
|
+
}, [cancelScheduled, schedule]),
|
|
1383
|
+
handleBackClick: (0, react.useCallback)(() => {
|
|
1384
|
+
cancelScheduled();
|
|
1385
|
+
setAnimPhase("exit-fade-out");
|
|
1386
|
+
schedule("exit-slide", 300);
|
|
1387
|
+
schedule("exit-fade-in", 800);
|
|
1388
|
+
const id = setTimeout(() => {
|
|
1389
|
+
setAnimPhase("idle");
|
|
1390
|
+
setEditingSection(null);
|
|
1391
|
+
}, 1100);
|
|
1392
|
+
timeoutsRef.current.push(id);
|
|
1393
|
+
}, [cancelScheduled, schedule])
|
|
1394
|
+
};
|
|
1454
1395
|
}
|
|
1455
1396
|
//#endregion
|
|
1456
1397
|
//#region src/screens/MySiteScreen/index.tsx
|
|
1457
1398
|
function MySiteScreen({ background, textColor, accentColor, padding, borderRadius, ...divProps }) {
|
|
1458
|
-
const {
|
|
1459
|
-
const
|
|
1399
|
+
const { editingSection, animPhase, showEditContent, handleEditSection, handleBackClick } = useMySiteEditingSection();
|
|
1400
|
+
const sectionLabel = (0, react.useMemo)(() => {
|
|
1401
|
+
if (editingSection === "theme") return "Theme";
|
|
1402
|
+
if (editingSection === "buttons") return "Buttons";
|
|
1403
|
+
if (editingSection === "content") return "MySite Content";
|
|
1404
|
+
if (editingSection === "profile") return "Profile";
|
|
1405
|
+
return null;
|
|
1406
|
+
}, [editingSection]);
|
|
1407
|
+
const handleRootCrumbClick = (0, react.useCallback)((e) => {
|
|
1408
|
+
e.preventDefault();
|
|
1409
|
+
if (editingSection !== null) handleBackClick();
|
|
1410
|
+
}, [editingSection, handleBackClick]);
|
|
1460
1411
|
require_ScreenHeaderContext.useScreenHeaderBreadcrumbs((0, react.useMemo)(() => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Breadcrumb, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.BreadcrumbList, {
|
|
1461
1412
|
className: "text-lg",
|
|
1462
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.BreadcrumbItem, { children:
|
|
1413
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.BreadcrumbItem, { children: sectionLabel ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.BreadcrumbLink, {
|
|
1463
1414
|
href: "#",
|
|
1464
|
-
onClick:
|
|
1465
|
-
e.preventDefault();
|
|
1466
|
-
navigate("my-site");
|
|
1467
|
-
},
|
|
1415
|
+
onClick: handleRootCrumbClick,
|
|
1468
1416
|
children: "My Site"
|
|
1469
1417
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.BreadcrumbPage, {
|
|
1470
1418
|
className: "font-semibold",
|
|
1471
1419
|
children: "My Site"
|
|
1472
|
-
}) }),
|
|
1420
|
+
}) }), sectionLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.BreadcrumbSeparator, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.BreadcrumbItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.BreadcrumbPage, {
|
|
1473
1421
|
className: "font-semibold",
|
|
1474
|
-
children:
|
|
1422
|
+
children: sectionLabel
|
|
1475
1423
|
}) })] })]
|
|
1476
|
-
}) }), [
|
|
1424
|
+
}) }), [sectionLabel, handleRootCrumbClick]));
|
|
1477
1425
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1478
1426
|
...divProps,
|
|
1479
1427
|
className: `h-full ${divProps.className ?? ""}`,
|
|
1480
|
-
children:
|
|
1428
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MySiteMainView, {
|
|
1429
|
+
editingSection,
|
|
1430
|
+
animPhase,
|
|
1431
|
+
showEditContent,
|
|
1432
|
+
onEditSection: handleEditSection,
|
|
1433
|
+
onBackClick: handleBackClick
|
|
1434
|
+
})
|
|
1481
1435
|
});
|
|
1482
1436
|
}
|
|
1483
1437
|
const mySiteScreenPropertySchema = {
|
|
@@ -1503,4 +1457,4 @@ Object.defineProperty(exports, "mySiteScreenPropertySchema", {
|
|
|
1503
1457
|
}
|
|
1504
1458
|
});
|
|
1505
1459
|
|
|
1506
|
-
//# sourceMappingURL=MySiteScreen-
|
|
1460
|
+
//# sourceMappingURL=MySiteScreen-BM3EuPZ4.cjs.map
|