@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
|
import { r as __exportAll } from "./es-CtZEZp97.mjs";
|
|
2
2
|
import { Ct as CardContent, E as Separator, Et as CardTitle, Jt as BreadcrumbLink, Kt as Breadcrumb, P as Input, St as CardAction, Tt as CardHeader, U as Label, Xt as BreadcrumbPage, Yt as BreadcrumbList, Zt as BreadcrumbSeparator, _n as useZodForm, at as DialogFooter, b as Skeleton, lt as DialogTitle, ot as DialogHeader, qt as BreadcrumbItem, rt as DialogContent, s as Textarea, tt as Dialog, un as Button, vn as cn, xt as Card } from "./src-BYkS71q3.mjs";
|
|
3
3
|
import { r as useScreenHeaderBreadcrumbs } from "./ScreenHeaderContext-DhC-5Y4x.mjs";
|
|
4
|
-
import { n as useAppNavigation } from "./AppNavigationContext-qFKCN8FO.mjs";
|
|
5
4
|
import { a as verticalListSortingStrategy, c as PointerSensor, d as useSensors, f as CSS, i as useSortable, l as closestCenter, n as arrayMove, o as DndContext, r as sortableKeyboardCoordinates, s as KeyboardSensor, t as SortableContext, u as useSensor } from "./sortable.esm-CzzU6kIR.mjs";
|
|
6
5
|
import { a as usePortalFavorites, c as usePortalMySiteThemes, d as usePortalUpdateLink, f as usePortalUpdateProfile, i as usePortalDeleteLink, l as usePortalReorderFavorites, n as usePortalCreateLink, o as usePortalLinks, p as usePortalUpdateSettings, r as usePortalDeleteFavorite, s as usePortalMySiteProfile, u as usePortalReorderLinks } from "./use-mysite-portal-CtU6iAbx.mjs";
|
|
7
6
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -10,72 +9,28 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
10
9
|
import { ArrowLeft, Camera, Check, ChevronRight, Copy, Eye, GripVertical, LayoutGrid, Link2, LoaderCircle, Palette, Pencil, Plus, Trash2, User, Users } from "lucide-react";
|
|
11
10
|
import { z } from "zod";
|
|
12
11
|
//#region ../../mysite/ui/src/portal/components/animation-utils.ts
|
|
13
|
-
function
|
|
12
|
+
function getContentClassName(phase) {
|
|
14
13
|
switch (phase) {
|
|
15
|
-
case "idle": return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
case "fade-out": return
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
transition: `opacity 300ms ease-in-out`
|
|
24
|
-
};
|
|
25
|
-
case "slide": return {
|
|
26
|
-
transform: "translateX(50%)",
|
|
27
|
-
opacity: 0,
|
|
28
|
-
transition: `transform 500ms ease-in-out`
|
|
29
|
-
};
|
|
30
|
-
case "fade-in": return {
|
|
31
|
-
transform: "translateX(50%)",
|
|
32
|
-
opacity: 1,
|
|
33
|
-
transition: `opacity 300ms ease-in-out`
|
|
34
|
-
};
|
|
35
|
-
case "editing": return {
|
|
36
|
-
transform: "translateX(50%)",
|
|
37
|
-
opacity: 1,
|
|
38
|
-
transition: "none"
|
|
39
|
-
};
|
|
40
|
-
case "exit-fade-out": return {
|
|
41
|
-
transform: "translateX(50%)",
|
|
42
|
-
opacity: 0,
|
|
43
|
-
transition: `opacity 300ms ease-in-out`
|
|
44
|
-
};
|
|
45
|
-
case "exit-slide": return {
|
|
46
|
-
transform: "translateX(0)",
|
|
47
|
-
opacity: 0,
|
|
48
|
-
transition: `transform 500ms ease-in-out`
|
|
49
|
-
};
|
|
50
|
-
case "exit-fade-in": return {
|
|
51
|
-
transform: "translateX(0)",
|
|
52
|
-
opacity: 1,
|
|
53
|
-
transition: `opacity 300ms ease-in-out`
|
|
54
|
-
};
|
|
14
|
+
case "idle": return "opacity-100 transition-none";
|
|
15
|
+
case "fade-out": return "opacity-0 transition-opacity duration-300 ease-in-out";
|
|
16
|
+
case "slide": return "opacity-0 2xl:translate-x-[50%] transition-transform duration-500 ease-in-out";
|
|
17
|
+
case "fade-in": return "opacity-100 2xl:translate-x-[50%] transition-opacity duration-300 ease-in-out";
|
|
18
|
+
case "editing": return "opacity-100 2xl:translate-x-[50%] transition-none";
|
|
19
|
+
case "exit-fade-out": return "opacity-0 2xl:translate-x-[50%] transition-opacity duration-300 ease-in-out";
|
|
20
|
+
case "exit-slide": return "opacity-0 transition-transform duration-500 ease-in-out";
|
|
21
|
+
case "exit-fade-in": return "opacity-100 transition-opacity duration-300 ease-in-out";
|
|
55
22
|
}
|
|
56
23
|
}
|
|
57
|
-
function
|
|
24
|
+
function getPreviewClassName(phase) {
|
|
58
25
|
switch (phase) {
|
|
59
26
|
case "idle":
|
|
60
27
|
case "fade-out":
|
|
61
|
-
case "exit-fade-in": return
|
|
62
|
-
|
|
63
|
-
transition: "none"
|
|
64
|
-
};
|
|
65
|
-
case "slide": return {
|
|
66
|
-
transform: "translateX(-200%)",
|
|
67
|
-
transition: `transform 500ms ease-in-out`
|
|
68
|
-
};
|
|
28
|
+
case "exit-fade-in": return "transition-none";
|
|
29
|
+
case "slide": return "2xl:-translate-x-[200%] transition-transform duration-500 ease-in-out";
|
|
69
30
|
case "fade-in":
|
|
70
31
|
case "editing":
|
|
71
|
-
case "exit-fade-out": return
|
|
72
|
-
|
|
73
|
-
transition: "none"
|
|
74
|
-
};
|
|
75
|
-
case "exit-slide": return {
|
|
76
|
-
transform: "translateX(0)",
|
|
77
|
-
transition: `transform 500ms ease-in-out`
|
|
78
|
-
};
|
|
32
|
+
case "exit-fade-out": return "2xl:-translate-x-[200%] transition-none";
|
|
33
|
+
case "exit-slide": return "transition-transform duration-500 ease-in-out";
|
|
79
34
|
}
|
|
80
35
|
}
|
|
81
36
|
//#endregion
|
|
@@ -263,7 +218,7 @@ function MySitePhonePreview({ mysiteUrl, themeName, previewKey, isUpdating, onPr
|
|
|
263
218
|
className: "text-foreground text-sm font-semibold",
|
|
264
219
|
children: themeName
|
|
265
220
|
})] }), /* @__PURE__ */ jsx(Button, {
|
|
266
|
-
className: "col-start-2 row-span-2 row-start-1 self-center justify-self-end",
|
|
221
|
+
className: "col-start-2 row-span-2 row-start-1 cursor-pointer self-center justify-self-end",
|
|
267
222
|
variant: "secondary",
|
|
268
223
|
size: "sm",
|
|
269
224
|
onClick: onPreview,
|
|
@@ -1152,43 +1107,36 @@ function MySiteProfileForm({ onBack, onToast, onUploadPhoto, avatarUrl, userName
|
|
|
1152
1107
|
})]
|
|
1153
1108
|
})]
|
|
1154
1109
|
}),
|
|
1155
|
-
/* @__PURE__ */
|
|
1156
|
-
className: "
|
|
1157
|
-
children:
|
|
1158
|
-
className: "
|
|
1159
|
-
children: "
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
})
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
children: "About you"
|
|
1184
|
-
}), /* @__PURE__ */ jsx(Textarea, {
|
|
1185
|
-
id: "profile-bio",
|
|
1186
|
-
rows: 4,
|
|
1187
|
-
value: formState.bio,
|
|
1188
|
-
onChange: (e) => handleFieldChange("bio", e.target.value),
|
|
1189
|
-
placeholder: "Tell people a little about yourself..."
|
|
1110
|
+
/* @__PURE__ */ jsx(Card, {
|
|
1111
|
+
className: "h-auto gap-0 py-0 shadow-none",
|
|
1112
|
+
children: /* @__PURE__ */ jsxs(CardContent, {
|
|
1113
|
+
className: "space-y-4 p-4 sm:p-6",
|
|
1114
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1115
|
+
className: "space-y-2",
|
|
1116
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
1117
|
+
htmlFor: "profile-display-name",
|
|
1118
|
+
children: "Display Name"
|
|
1119
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
1120
|
+
id: "profile-display-name",
|
|
1121
|
+
type: "text",
|
|
1122
|
+
value: formState.display_name,
|
|
1123
|
+
onChange: (e) => handleFieldChange("display_name", e.target.value),
|
|
1124
|
+
placeholder: "Your display name"
|
|
1125
|
+
})]
|
|
1126
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1127
|
+
className: "space-y-2",
|
|
1128
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
1129
|
+
htmlFor: "profile-bio",
|
|
1130
|
+
children: "Bio"
|
|
1131
|
+
}), /* @__PURE__ */ jsx(Textarea, {
|
|
1132
|
+
id: "profile-bio",
|
|
1133
|
+
rows: 4,
|
|
1134
|
+
value: formState.bio,
|
|
1135
|
+
onChange: (e) => handleFieldChange("bio", e.target.value),
|
|
1136
|
+
placeholder: "Tell people a little about yourself..."
|
|
1137
|
+
})]
|
|
1190
1138
|
})]
|
|
1191
|
-
})
|
|
1139
|
+
})
|
|
1192
1140
|
}),
|
|
1193
1141
|
/* @__PURE__ */ jsx("div", {
|
|
1194
1142
|
className: "flex justify-end",
|
|
@@ -1207,7 +1155,7 @@ function MySiteProfileForm({ onBack, onToast, onUploadPhoto, avatarUrl, userName
|
|
|
1207
1155
|
const navigationItems = [
|
|
1208
1156
|
{
|
|
1209
1157
|
label: "Profile",
|
|
1210
|
-
|
|
1158
|
+
key: "profile",
|
|
1211
1159
|
icon: User
|
|
1212
1160
|
},
|
|
1213
1161
|
{
|
|
@@ -1226,34 +1174,11 @@ const navigationItems = [
|
|
|
1226
1174
|
icon: Link2
|
|
1227
1175
|
}
|
|
1228
1176
|
];
|
|
1229
|
-
function defaultToast
|
|
1177
|
+
function defaultToast(message, type) {
|
|
1230
1178
|
if (type === "error") console.warn("[MySite]", message);
|
|
1231
1179
|
else console.info("[MySite]", message);
|
|
1232
1180
|
}
|
|
1233
|
-
function MySiteMainView() {
|
|
1234
|
-
const { navigate } = useAppNavigation();
|
|
1235
|
-
const [animPhase, setAnimPhase] = useState("idle");
|
|
1236
|
-
const [editingSection, setEditingSection] = useState(null);
|
|
1237
|
-
const timeoutsRef = useRef([]);
|
|
1238
|
-
useEffect(() => {
|
|
1239
|
-
const ref = timeoutsRef;
|
|
1240
|
-
return () => ref.current.forEach(clearTimeout);
|
|
1241
|
-
}, []);
|
|
1242
|
-
const cancelScheduled = useCallback(() => {
|
|
1243
|
-
timeoutsRef.current.forEach(clearTimeout);
|
|
1244
|
-
timeoutsRef.current = [];
|
|
1245
|
-
}, []);
|
|
1246
|
-
const schedule = useCallback((phase, delay) => {
|
|
1247
|
-
const id = setTimeout(() => setAnimPhase(phase), delay);
|
|
1248
|
-
timeoutsRef.current.push(id);
|
|
1249
|
-
}, []);
|
|
1250
|
-
const showEditContent = [
|
|
1251
|
-
"slide",
|
|
1252
|
-
"fade-in",
|
|
1253
|
-
"editing",
|
|
1254
|
-
"exit-fade-out",
|
|
1255
|
-
"exit-slide"
|
|
1256
|
-
].includes(animPhase);
|
|
1181
|
+
function MySiteMainView({ editingSection, animPhase, showEditContent, onEditSection, onBackClick }) {
|
|
1257
1182
|
const { data: profile, isLoading: isProfileLoading } = usePortalMySiteProfile();
|
|
1258
1183
|
const { data: themes = [] } = usePortalMySiteThemes();
|
|
1259
1184
|
const updateSettingsMutation = usePortalUpdateSettings();
|
|
@@ -1272,12 +1197,12 @@ function MySiteMainView() {
|
|
|
1272
1197
|
setSelectedThemeId(theme.id);
|
|
1273
1198
|
updateSettingsMutation.mutate({ theme_id: theme.id }, {
|
|
1274
1199
|
onSuccess: () => {
|
|
1275
|
-
defaultToast
|
|
1200
|
+
defaultToast(`Theme changed to "${theme.name}"`, "success");
|
|
1276
1201
|
refreshPreview();
|
|
1277
1202
|
},
|
|
1278
1203
|
onError: () => {
|
|
1279
1204
|
setSelectedThemeId(previousThemeId);
|
|
1280
|
-
defaultToast
|
|
1205
|
+
defaultToast("Failed to update theme", "error");
|
|
1281
1206
|
}
|
|
1282
1207
|
});
|
|
1283
1208
|
}, [
|
|
@@ -1294,25 +1219,6 @@ function MySiteMainView() {
|
|
|
1294
1219
|
});
|
|
1295
1220
|
});
|
|
1296
1221
|
}, [updateSettingsMutation]);
|
|
1297
|
-
const handleEditSection = useCallback((section) => {
|
|
1298
|
-
cancelScheduled();
|
|
1299
|
-
setEditingSection(section);
|
|
1300
|
-
setAnimPhase("fade-out");
|
|
1301
|
-
schedule("slide", 300);
|
|
1302
|
-
schedule("fade-in", 800);
|
|
1303
|
-
schedule("editing", 1100);
|
|
1304
|
-
}, [cancelScheduled, schedule]);
|
|
1305
|
-
const handleBackClick = useCallback(() => {
|
|
1306
|
-
cancelScheduled();
|
|
1307
|
-
setAnimPhase("exit-fade-out");
|
|
1308
|
-
schedule("exit-slide", 300);
|
|
1309
|
-
schedule("exit-fade-in", 800);
|
|
1310
|
-
const id = setTimeout(() => {
|
|
1311
|
-
setAnimPhase("idle");
|
|
1312
|
-
setEditingSection(null);
|
|
1313
|
-
}, 1100);
|
|
1314
|
-
timeoutsRef.current.push(id);
|
|
1315
|
-
}, [cancelScheduled, schedule]);
|
|
1316
1222
|
const handlePreview = useCallback(() => {
|
|
1317
1223
|
if (mysiteUrl) window.open(`${mysiteUrl}?preview=true`, "_blank");
|
|
1318
1224
|
}, [mysiteUrl]);
|
|
@@ -1320,6 +1226,7 @@ function MySiteMainView() {
|
|
|
1320
1226
|
if (editingSection === "theme") return "Theme";
|
|
1321
1227
|
if (editingSection === "buttons") return "Buttons";
|
|
1322
1228
|
if (editingSection === "content") return "MySite Content";
|
|
1229
|
+
if (editingSection === "profile") return "Profile";
|
|
1323
1230
|
return "";
|
|
1324
1231
|
}, [editingSection]);
|
|
1325
1232
|
if (isProfileLoading) return /* @__PURE__ */ jsxs("div", {
|
|
@@ -1349,13 +1256,12 @@ function MySiteMainView() {
|
|
|
1349
1256
|
})
|
|
1350
1257
|
})]
|
|
1351
1258
|
});
|
|
1352
|
-
const
|
|
1353
|
-
const
|
|
1259
|
+
const contentAnimClassName = getContentClassName(animPhase);
|
|
1260
|
+
const previewAnimClassName = getPreviewClassName(animPhase);
|
|
1354
1261
|
return /* @__PURE__ */ jsxs("div", {
|
|
1355
1262
|
className: "flex h-full overflow-hidden px-2 py-6",
|
|
1356
1263
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1357
|
-
className:
|
|
1358
|
-
style: contentStyle,
|
|
1264
|
+
className: `w-full px-4 2xl:w-2/3 2xl:shrink-0 ${contentAnimClassName}`,
|
|
1359
1265
|
children: /* @__PURE__ */ jsx("div", {
|
|
1360
1266
|
className: "flex h-full min-w-0 flex-col gap-5 overflow-y-auto",
|
|
1361
1267
|
children: showEditContent && editingSection === "theme" ? /* @__PURE__ */ jsx(MySiteThemeEditor, {
|
|
@@ -1363,15 +1269,18 @@ function MySiteMainView() {
|
|
|
1363
1269
|
selectedThemeId: resolvedThemeId,
|
|
1364
1270
|
onSelectTheme: handleSelectTheme,
|
|
1365
1271
|
isPending: updateSettingsMutation.isPending,
|
|
1366
|
-
onBack:
|
|
1272
|
+
onBack: onBackClick
|
|
1367
1273
|
}) : showEditContent && editingSection === "buttons" ? /* @__PURE__ */ jsx(PortalButtonsEditor, {
|
|
1368
|
-
onBack:
|
|
1274
|
+
onBack: onBackClick,
|
|
1369
1275
|
onRefreshPreview: refreshPreview,
|
|
1370
|
-
onToast: defaultToast
|
|
1276
|
+
onToast: defaultToast
|
|
1371
1277
|
}) : showEditContent && editingSection === "content" ? /* @__PURE__ */ jsx(PortalFavoritesEditor, {
|
|
1372
|
-
onBack:
|
|
1278
|
+
onBack: onBackClick,
|
|
1373
1279
|
onRefreshPreview: refreshPreview,
|
|
1374
|
-
onToast: defaultToast
|
|
1280
|
+
onToast: defaultToast
|
|
1281
|
+
}) : showEditContent && editingSection === "profile" ? /* @__PURE__ */ jsx(MySiteProfileForm, {
|
|
1282
|
+
onBack: onBackClick,
|
|
1283
|
+
onToast: defaultToast
|
|
1375
1284
|
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1376
1285
|
/* @__PURE__ */ jsxs("div", {
|
|
1377
1286
|
className: "flex items-center gap-2",
|
|
@@ -1391,7 +1300,7 @@ function MySiteMainView() {
|
|
|
1391
1300
|
mysiteUrl,
|
|
1392
1301
|
displayUrl,
|
|
1393
1302
|
onUpdateSlug: handleUpdateSlug,
|
|
1394
|
-
onToast: defaultToast
|
|
1303
|
+
onToast: defaultToast
|
|
1395
1304
|
}),
|
|
1396
1305
|
/* @__PURE__ */ jsx("div", {
|
|
1397
1306
|
className: "border-border bg-card divide-border divide-y overflow-hidden rounded-lg border",
|
|
@@ -1399,10 +1308,7 @@ function MySiteMainView() {
|
|
|
1399
1308
|
const Icon = item.icon;
|
|
1400
1309
|
return /* @__PURE__ */ jsxs("button", {
|
|
1401
1310
|
type: "button",
|
|
1402
|
-
onClick: () =>
|
|
1403
|
-
if ("key" in item) handleEditSection(item.key);
|
|
1404
|
-
else navigate(item.slug);
|
|
1405
|
-
},
|
|
1311
|
+
onClick: () => onEditSection(item.key),
|
|
1406
1312
|
className: "group hover:bg-muted flex w-full items-center gap-2.5 px-3 py-2.5 transition-colors text-left cursor-pointer",
|
|
1407
1313
|
children: [
|
|
1408
1314
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -1421,8 +1327,7 @@ function MySiteMainView() {
|
|
|
1421
1327
|
] })
|
|
1422
1328
|
})
|
|
1423
1329
|
}), /* @__PURE__ */ jsx("div", {
|
|
1424
|
-
className:
|
|
1425
|
-
style: previewStyle,
|
|
1330
|
+
className: `hidden w-1/3 shrink-0 overflow-y-hidden px-4 2xl:block ${previewAnimClassName}`,
|
|
1426
1331
|
children: /* @__PURE__ */ jsx(MySitePhonePreview, {
|
|
1427
1332
|
mysiteUrl,
|
|
1428
1333
|
themeName,
|
|
@@ -1434,17 +1339,53 @@ function MySiteMainView() {
|
|
|
1434
1339
|
});
|
|
1435
1340
|
}
|
|
1436
1341
|
//#endregion
|
|
1437
|
-
//#region src/screens/MySiteScreen/
|
|
1438
|
-
function
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1342
|
+
//#region src/screens/MySiteScreen/use-mysite-editing-section.ts
|
|
1343
|
+
function useMySiteEditingSection() {
|
|
1344
|
+
const [animPhase, setAnimPhase] = useState("idle");
|
|
1345
|
+
const [editingSection, setEditingSection] = useState(null);
|
|
1346
|
+
const timeoutsRef = useRef([]);
|
|
1347
|
+
useEffect(() => {
|
|
1348
|
+
const ref = timeoutsRef;
|
|
1349
|
+
return () => ref.current.forEach(clearTimeout);
|
|
1350
|
+
}, []);
|
|
1351
|
+
const cancelScheduled = useCallback(() => {
|
|
1352
|
+
timeoutsRef.current.forEach(clearTimeout);
|
|
1353
|
+
timeoutsRef.current = [];
|
|
1354
|
+
}, []);
|
|
1355
|
+
const schedule = useCallback((phase, delay) => {
|
|
1356
|
+
const id = setTimeout(() => setAnimPhase(phase), delay);
|
|
1357
|
+
timeoutsRef.current.push(id);
|
|
1358
|
+
}, []);
|
|
1359
|
+
return {
|
|
1360
|
+
editingSection,
|
|
1361
|
+
animPhase,
|
|
1362
|
+
showEditContent: [
|
|
1363
|
+
"slide",
|
|
1364
|
+
"fade-in",
|
|
1365
|
+
"editing",
|
|
1366
|
+
"exit-fade-out",
|
|
1367
|
+
"exit-slide"
|
|
1368
|
+
].includes(animPhase),
|
|
1369
|
+
handleEditSection: useCallback((section) => {
|
|
1370
|
+
cancelScheduled();
|
|
1371
|
+
setEditingSection(section);
|
|
1372
|
+
setAnimPhase("fade-out");
|
|
1373
|
+
schedule("slide", 300);
|
|
1374
|
+
schedule("fade-in", 800);
|
|
1375
|
+
schedule("editing", 1100);
|
|
1376
|
+
}, [cancelScheduled, schedule]),
|
|
1377
|
+
handleBackClick: useCallback(() => {
|
|
1378
|
+
cancelScheduled();
|
|
1379
|
+
setAnimPhase("exit-fade-out");
|
|
1380
|
+
schedule("exit-slide", 300);
|
|
1381
|
+
schedule("exit-fade-in", 800);
|
|
1382
|
+
const id = setTimeout(() => {
|
|
1383
|
+
setAnimPhase("idle");
|
|
1384
|
+
setEditingSection(null);
|
|
1385
|
+
}, 1100);
|
|
1386
|
+
timeoutsRef.current.push(id);
|
|
1387
|
+
}, [cancelScheduled, schedule])
|
|
1388
|
+
};
|
|
1448
1389
|
}
|
|
1449
1390
|
//#endregion
|
|
1450
1391
|
//#region src/screens/MySiteScreen/index.tsx
|
|
@@ -1453,29 +1394,42 @@ var MySiteScreen_exports = /* @__PURE__ */ __exportAll({
|
|
|
1453
1394
|
mySiteScreenPropertySchema: () => mySiteScreenPropertySchema
|
|
1454
1395
|
});
|
|
1455
1396
|
function MySiteScreen({ background, textColor, accentColor, padding, borderRadius, ...divProps }) {
|
|
1456
|
-
const {
|
|
1457
|
-
const
|
|
1397
|
+
const { editingSection, animPhase, showEditContent, handleEditSection, handleBackClick } = useMySiteEditingSection();
|
|
1398
|
+
const sectionLabel = useMemo(() => {
|
|
1399
|
+
if (editingSection === "theme") return "Theme";
|
|
1400
|
+
if (editingSection === "buttons") return "Buttons";
|
|
1401
|
+
if (editingSection === "content") return "MySite Content";
|
|
1402
|
+
if (editingSection === "profile") return "Profile";
|
|
1403
|
+
return null;
|
|
1404
|
+
}, [editingSection]);
|
|
1405
|
+
const handleRootCrumbClick = useCallback((e) => {
|
|
1406
|
+
e.preventDefault();
|
|
1407
|
+
if (editingSection !== null) handleBackClick();
|
|
1408
|
+
}, [editingSection, handleBackClick]);
|
|
1458
1409
|
useScreenHeaderBreadcrumbs(useMemo(() => /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsxs(BreadcrumbList, {
|
|
1459
1410
|
className: "text-lg",
|
|
1460
|
-
children: [/* @__PURE__ */ jsx(BreadcrumbItem, { children:
|
|
1411
|
+
children: [/* @__PURE__ */ jsx(BreadcrumbItem, { children: sectionLabel ? /* @__PURE__ */ jsx(BreadcrumbLink, {
|
|
1461
1412
|
href: "#",
|
|
1462
|
-
onClick:
|
|
1463
|
-
e.preventDefault();
|
|
1464
|
-
navigate("my-site");
|
|
1465
|
-
},
|
|
1413
|
+
onClick: handleRootCrumbClick,
|
|
1466
1414
|
children: "My Site"
|
|
1467
1415
|
}) : /* @__PURE__ */ jsx(BreadcrumbPage, {
|
|
1468
1416
|
className: "font-semibold",
|
|
1469
1417
|
children: "My Site"
|
|
1470
|
-
}) }),
|
|
1418
|
+
}) }), sectionLabel && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(BreadcrumbSeparator, {}), /* @__PURE__ */ jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsx(BreadcrumbPage, {
|
|
1471
1419
|
className: "font-semibold",
|
|
1472
|
-
children:
|
|
1420
|
+
children: sectionLabel
|
|
1473
1421
|
}) })] })]
|
|
1474
|
-
}) }), [
|
|
1422
|
+
}) }), [sectionLabel, handleRootCrumbClick]));
|
|
1475
1423
|
return /* @__PURE__ */ jsx("div", {
|
|
1476
1424
|
...divProps,
|
|
1477
1425
|
className: `h-full ${divProps.className ?? ""}`,
|
|
1478
|
-
children:
|
|
1426
|
+
children: /* @__PURE__ */ jsx(MySiteMainView, {
|
|
1427
|
+
editingSection,
|
|
1428
|
+
animPhase,
|
|
1429
|
+
showEditContent,
|
|
1430
|
+
onEditSection: handleEditSection,
|
|
1431
|
+
onBackClick: handleBackClick
|
|
1432
|
+
})
|
|
1479
1433
|
});
|
|
1480
1434
|
}
|
|
1481
1435
|
const mySiteScreenPropertySchema = {
|
|
@@ -1490,4 +1444,4 @@ const mySiteScreenPropertySchema = {
|
|
|
1490
1444
|
//#endregion
|
|
1491
1445
|
export { MySiteScreen_exports as n, mySiteScreenPropertySchema as r, MySiteScreen as t };
|
|
1492
1446
|
|
|
1493
|
-
//# sourceMappingURL=MySiteScreen-
|
|
1447
|
+
//# sourceMappingURL=MySiteScreen-ZLvvJhoy.mjs.map
|