utopia-ui 3.0.63 → 3.0.64
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 +214 -221
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +24 -50
- package/dist/index.esm.js +215 -220
- package/dist/index.esm.js.map +1 -1
- package/dist/types/src/Components/AppShell/AppShell.d.ts +1 -2
- package/dist/types/src/Components/AppShell/NavBar.d.ts +1 -2
- package/dist/types/src/Components/AppShell/SetAppState.d.ts +1 -2
- package/dist/types/src/Components/Auth/index.d.ts +1 -1
- package/dist/types/src/Components/Map/Layer.d.ts +2 -1
- package/dist/types/src/Components/Profile/index.d.ts +0 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -1170,183 +1170,6 @@ function FilterControl() {
|
|
1170
1170
|
}, children: jsxRuntime.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', fill: 'none', viewBox: '0 0 24 24', strokeWidth: 2.3, stroke: 'currentColor', className: 'size-6', children: jsxRuntime.jsx("path", { strokeLinecap: 'round', strokeLinejoin: 'round', d: 'M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z' }) }) })] })) }));
|
1171
1171
|
}
|
1172
1172
|
|
1173
|
-
/**
|
1174
|
-
* @category Templates
|
1175
|
-
*/
|
1176
|
-
function MapOverlayPage({ children, className, backdrop, card = true, }) {
|
1177
|
-
const closeScreen = () => {
|
1178
|
-
navigate(`/${window.location.search ? window.location.search : ''}`);
|
1179
|
-
};
|
1180
|
-
const navigate = reactRouterDom.useNavigate();
|
1181
|
-
const overlayRef = react.createRef();
|
1182
|
-
const backdropRef = react.createRef();
|
1183
|
-
react.useEffect(() => {
|
1184
|
-
if (overlayRef.current !== null) {
|
1185
|
-
leaflet.DomEvent.disableClickPropagation(overlayRef.current);
|
1186
|
-
leaflet.DomEvent.disableScrollPropagation(overlayRef.current);
|
1187
|
-
}
|
1188
|
-
if (backdropRef.current !== null && backdrop) {
|
1189
|
-
leaflet.DomEvent.disableClickPropagation(backdropRef.current);
|
1190
|
-
leaflet.DomEvent.disableScrollPropagation(backdropRef.current);
|
1191
|
-
}
|
1192
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
1193
|
-
}, [overlayRef, backdropRef]);
|
1194
|
-
return (jsxRuntime.jsx("div", { className: `tw-absolute tw-h-full tw-w-full tw-m-auto ${backdrop && 'tw-z-[2000]'}`, children: jsxRuntime.jsx("div", { ref: backdropRef, className: `${backdrop && 'tw-backdrop-brightness-75'} tw-h-full tw-w-full tw-grid tw-place-items-center tw-m-auto`, children: jsxRuntime.jsxs("div", { ref: overlayRef, className: `${card && 'tw-card tw-card-body'} tw-shadow-xl tw-bg-base-100 tw-p-6 ${className && className} ${!backdrop && 'tw-z-[2000]'} tw-absolute tw-top-0 tw-bottom-0 tw-right-0 tw-left-0 tw-m-auto`, children: [children, jsxRuntime.jsx("button", { className: 'tw-btn tw-btn-sm tw-btn-circle tw-btn-ghost tw-absolute tw-right-2 tw-top-2', onClick: () => closeScreen(), children: "\u2715" })] }) }) }));
|
1195
|
-
}
|
1196
|
-
|
1197
|
-
/**
|
1198
|
-
* @category Auth
|
1199
|
-
*/
|
1200
|
-
function LoginPage() {
|
1201
|
-
const [email, setEmail] = react.useState('');
|
1202
|
-
const [password, setPassword] = react.useState('');
|
1203
|
-
const { login, loading } = useAuth();
|
1204
|
-
const navigate = reactRouterDom.useNavigate();
|
1205
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
1206
|
-
const onLogin = async () => {
|
1207
|
-
await reactToastify.toast.promise(login({ email, password }), {
|
1208
|
-
success: {
|
1209
|
-
render({ data }) {
|
1210
|
-
navigate('/');
|
1211
|
-
return `Hi ${data?.first_name}`;
|
1212
|
-
},
|
1213
|
-
// other options
|
1214
|
-
icon: '✌️',
|
1215
|
-
},
|
1216
|
-
error: {
|
1217
|
-
render({ data }) {
|
1218
|
-
return `${data}`;
|
1219
|
-
},
|
1220
|
-
autoClose: 10000,
|
1221
|
-
},
|
1222
|
-
pending: 'logging in ...',
|
1223
|
-
});
|
1224
|
-
};
|
1225
|
-
react.useEffect(() => {
|
1226
|
-
const keyDownHandler = (event) => {
|
1227
|
-
if (event.key === 'Enter') {
|
1228
|
-
event.preventDefault();
|
1229
|
-
onLogin();
|
1230
|
-
}
|
1231
|
-
};
|
1232
|
-
document.addEventListener('keydown', keyDownHandler);
|
1233
|
-
return () => {
|
1234
|
-
document.removeEventListener('keydown', keyDownHandler);
|
1235
|
-
};
|
1236
|
-
}, [onLogin]);
|
1237
|
-
return (jsxRuntime.jsxs(MapOverlayPage, { backdrop: true, className: 'tw-max-w-xs tw-h-fit', children: [jsxRuntime.jsx("h2", { className: 'tw-text-2xl tw-font-semibold tw-mb-2 tw-text-center', children: "Login" }), jsxRuntime.jsx("input", { type: 'email', placeholder: 'E-Mail', value: email, onChange: (e) => setEmail(e.target.value), className: 'tw-input tw-input-bordered tw-w-full tw-max-w-xs' }), jsxRuntime.jsx("input", { type: 'password', placeholder: 'Password', onChange: (e) => setPassword(e.target.value), className: 'tw-input tw-input-bordered tw-w-full tw-max-w-xs' }), jsxRuntime.jsx("div", { className: 'tw-text-right tw-text-primary', children: jsxRuntime.jsx(reactRouterDom.Link, { to: '/reset-password', children: jsxRuntime.jsx("span", { className: 'tw-text-sm tw-inline-block hover:tw-text-primary hover:tw-underline hover:tw-cursor-pointer tw-transition tw-duration-200', children: "Forgot Password?" }) }) }), jsxRuntime.jsx("div", { className: 'tw-card-actions', children: jsxRuntime.jsx("button", { className: loading
|
1238
|
-
? 'tw-btn tw-btn-disabled tw-btn-block tw-btn-primary'
|
1239
|
-
: 'tw-btn tw-btn-primary tw-btn-block', onClick: () => onLogin(), children: loading ? jsxRuntime.jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Login' }) })] }));
|
1240
|
-
}
|
1241
|
-
|
1242
|
-
/**
|
1243
|
-
* @category Auth
|
1244
|
-
*/
|
1245
|
-
function SignupPage() {
|
1246
|
-
const [email, setEmail] = react.useState('');
|
1247
|
-
const [userName, setUserName] = react.useState('');
|
1248
|
-
const [password, setPassword] = react.useState('');
|
1249
|
-
const { register, loading } = useAuth();
|
1250
|
-
const navigate = reactRouterDom.useNavigate();
|
1251
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
1252
|
-
const onRegister = async () => {
|
1253
|
-
await reactToastify.toast.promise(register({ email, password }, userName), {
|
1254
|
-
success: {
|
1255
|
-
render({ data }) {
|
1256
|
-
navigate('/');
|
1257
|
-
return `Hi ${data?.first_name}`;
|
1258
|
-
},
|
1259
|
-
// other options
|
1260
|
-
icon: '✌️',
|
1261
|
-
},
|
1262
|
-
error: {
|
1263
|
-
render({ data }) {
|
1264
|
-
return `${data}`;
|
1265
|
-
},
|
1266
|
-
autoClose: 10000,
|
1267
|
-
},
|
1268
|
-
pending: 'creating new user ...',
|
1269
|
-
});
|
1270
|
-
};
|
1271
|
-
react.useEffect(() => {
|
1272
|
-
const keyDownHandler = (event) => {
|
1273
|
-
if (event.key === 'Enter') {
|
1274
|
-
event.preventDefault();
|
1275
|
-
onRegister();
|
1276
|
-
}
|
1277
|
-
};
|
1278
|
-
document.addEventListener('keydown', keyDownHandler);
|
1279
|
-
return () => {
|
1280
|
-
document.removeEventListener('keydown', keyDownHandler);
|
1281
|
-
};
|
1282
|
-
}, [onRegister]);
|
1283
|
-
return (jsxRuntime.jsxs(MapOverlayPage, { backdrop: true, className: 'tw-max-w-xs tw-h-fit', children: [jsxRuntime.jsx("h2", { className: 'tw-text-2xl tw-font-semibold tw-mb-2 tw-text-center', children: "Sign Up" }), jsxRuntime.jsx("input", { type: 'text', placeholder: 'Name', value: userName, onChange: (e) => setUserName(e.target.value), className: 'tw-input tw-input-bordered tw-w-full tw-max-w-xs' }), jsxRuntime.jsx("input", { type: 'email', placeholder: 'E-Mail', value: email, onChange: (e) => setEmail(e.target.value), className: 'tw-input tw-input-bordered tw-w-full tw-max-w-xs' }), jsxRuntime.jsx("input", { type: 'password', placeholder: 'Password', onChange: (e) => setPassword(e.target.value), className: 'tw-input tw-input-bordered tw-w-full tw-max-w-xs' }), jsxRuntime.jsx("div", { className: 'tw-card-actions tw-mt-4', children: jsxRuntime.jsx("button", { className: loading
|
1284
|
-
? 'tw-btn tw-btn-disabled tw-btn-block tw-btn-primary'
|
1285
|
-
: 'tw-btn tw-btn-primary tw-btn-block', onClick: () => onRegister(), children: loading ? jsxRuntime.jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Sign Up' }) })] }));
|
1286
|
-
}
|
1287
|
-
|
1288
|
-
/**
|
1289
|
-
* @category Auth
|
1290
|
-
*/
|
1291
|
-
// eslint-disable-next-line react/prop-types
|
1292
|
-
function RequestPasswordPage({ resetUrl }) {
|
1293
|
-
const [email, setEmail] = react.useState('');
|
1294
|
-
const { requestPasswordReset, loading } = useAuth();
|
1295
|
-
const navigate = reactRouterDom.useNavigate();
|
1296
|
-
const onReset = async () => {
|
1297
|
-
await reactToastify.toast.promise(requestPasswordReset(email, resetUrl), {
|
1298
|
-
success: {
|
1299
|
-
render() {
|
1300
|
-
navigate('/');
|
1301
|
-
return 'Check your mailbox';
|
1302
|
-
},
|
1303
|
-
// other options
|
1304
|
-
icon: '📬',
|
1305
|
-
},
|
1306
|
-
error: {
|
1307
|
-
render({ data }) {
|
1308
|
-
return `${data}`;
|
1309
|
-
},
|
1310
|
-
},
|
1311
|
-
pending: 'sending email ...',
|
1312
|
-
});
|
1313
|
-
};
|
1314
|
-
return (jsxRuntime.jsxs(MapOverlayPage, { backdrop: true, className: 'tw-max-w-xs tw-h-fit', children: [jsxRuntime.jsx("h2", { className: 'tw-text-2xl tw-font-semibold tw-mb-2 tw-text-center', children: "Reset Password" }), jsxRuntime.jsx("input", { type: 'email', placeholder: 'E-Mail', value: email, onChange: (e) => setEmail(e.target.value), className: 'tw-input tw-input-bordered tw-w-full tw-max-w-xs' }), jsxRuntime.jsx("div", { className: 'tw-card-actions tw-mt-4', children: jsxRuntime.jsx("button", { className: loading
|
1315
|
-
? 'tw-btn tw-btn-disabled tw-btn-block tw-btn-primary'
|
1316
|
-
: 'tw-btn tw-btn-primary tw-btn-block', onClick: () => onReset(), children: loading ? jsxRuntime.jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Send' }) })] }));
|
1317
|
-
}
|
1318
|
-
|
1319
|
-
/**
|
1320
|
-
* @category Auth
|
1321
|
-
*/
|
1322
|
-
function SetNewPasswordPage() {
|
1323
|
-
const [password, setPassword] = react.useState('');
|
1324
|
-
const { passwordReset, loading } = useAuth();
|
1325
|
-
const navigate = reactRouterDom.useNavigate();
|
1326
|
-
const onReset = async () => {
|
1327
|
-
const token = window.location.search.split('token=')[1];
|
1328
|
-
// eslint-disable-next-line no-console
|
1329
|
-
console.log(token);
|
1330
|
-
await reactToastify.toast.promise(passwordReset(token, password), {
|
1331
|
-
success: {
|
1332
|
-
render() {
|
1333
|
-
navigate('/');
|
1334
|
-
return 'New password set';
|
1335
|
-
},
|
1336
|
-
},
|
1337
|
-
error: {
|
1338
|
-
render({ data }) {
|
1339
|
-
return `${data}`;
|
1340
|
-
},
|
1341
|
-
},
|
1342
|
-
pending: 'setting password ...',
|
1343
|
-
});
|
1344
|
-
};
|
1345
|
-
return (jsxRuntime.jsxs(MapOverlayPage, { backdrop: true, className: 'tw-max-w-xs tw-h-fit', children: [jsxRuntime.jsx("h2", { className: 'tw-text-2xl tw-font-semibold tw-mb-2 tw-text-center', children: "Set new Password" }), jsxRuntime.jsx("input", { type: 'password', placeholder: 'Password', onChange: (e) => setPassword(e.target.value), className: 'tw-input tw-input-bordered tw-w-full tw-max-w-xs' }), jsxRuntime.jsx("div", { className: 'tw-card-actions tw-mt-4', children: jsxRuntime.jsx("button", { className: loading
|
1346
|
-
? 'tw-btn tw-btn-disabled tw-btn-block tw-btn-primary'
|
1347
|
-
: 'tw-btn tw-btn-primary tw-btn-block', onClick: () => onReset(), children: loading ? jsxRuntime.jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Set' }) })] }));
|
1348
|
-
}
|
1349
|
-
|
1350
1173
|
const GratitudeControl = () => {
|
1351
1174
|
const navigate = reactRouterDom.useNavigate();
|
1352
1175
|
const { isAuthenticated } = useAuth();
|
@@ -3072,14 +2895,14 @@ function ItemFormPopup(props) {
|
|
3072
2895
|
map.closePopup();
|
3073
2896
|
}
|
3074
2897
|
else {
|
3075
|
-
const item = items.find((i) => i.user_created?.id === user?.id && i.layer?.
|
2898
|
+
const item = items.find((i) => i.user_created?.id === user?.id && i.layer?.id === props.layer.id);
|
3076
2899
|
const uuid = crypto.randomUUID();
|
3077
2900
|
let success = false;
|
3078
2901
|
try {
|
3079
|
-
props.layer.
|
2902
|
+
props.layer.userProfileLayer &&
|
3080
2903
|
item &&
|
3081
2904
|
(await props.layer.api?.updateItem({ ...formItem, id: item.id }));
|
3082
|
-
(!props.layer.
|
2905
|
+
(!props.layer.userProfileLayer || !item) &&
|
3083
2906
|
(await props.layer.api?.createItem({
|
3084
2907
|
...formItem,
|
3085
2908
|
id: uuid,
|
@@ -3092,14 +2915,13 @@ function ItemFormPopup(props) {
|
|
3092
2915
|
reactToastify.toast.error(error.toString());
|
3093
2916
|
}
|
3094
2917
|
if (success) {
|
3095
|
-
if (props.layer.
|
2918
|
+
if (props.layer.userProfileLayer && item)
|
3096
2919
|
updateItem({ ...item, ...formItem });
|
3097
|
-
if (!props.layer.
|
2920
|
+
if (!props.layer.userProfileLayer || !item) {
|
3098
2921
|
addItem({
|
3099
2922
|
...formItem,
|
3100
2923
|
name: (formItem.name ? formItem.name : user?.first_name) ?? '',
|
3101
2924
|
user_created: user ?? undefined,
|
3102
|
-
type: props.layer.itemType,
|
3103
2925
|
id: uuid,
|
3104
2926
|
layer: props.layer,
|
3105
2927
|
public_edit: !user,
|
@@ -3256,9 +3078,9 @@ const ItemViewPopup = react.forwardRef((props, ref) => {
|
|
3256
3078
|
setLoading(true);
|
3257
3079
|
let success = false;
|
3258
3080
|
try {
|
3259
|
-
!props.item.layer?.
|
3081
|
+
!props.item.layer?.userProfileLayer &&
|
3260
3082
|
(await props.item.layer?.api?.deleteItem(props.item.id));
|
3261
|
-
props.item.layer?.
|
3083
|
+
props.item.layer?.userProfileLayer &&
|
3262
3084
|
(await props.item.layer.api?.updateItem({ id: props.item.id, position: null }));
|
3263
3085
|
success = true;
|
3264
3086
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
@@ -3268,8 +3090,8 @@ const ItemViewPopup = react.forwardRef((props, ref) => {
|
|
3268
3090
|
reactToastify.toast.error(error.toString());
|
3269
3091
|
}
|
3270
3092
|
if (success) {
|
3271
|
-
!props.item.layer?.
|
3272
|
-
props.item.layer?.
|
3093
|
+
!props.item.layer?.userProfileLayer && removeItem(props.item);
|
3094
|
+
props.item.layer?.userProfileLayer && updadateItem({ ...props.item, position: undefined });
|
3273
3095
|
reactToastify.toast.success('Item deleted');
|
3274
3096
|
}
|
3275
3097
|
setLoading(false);
|
@@ -3290,7 +3112,7 @@ const ItemViewPopup = react.forwardRef((props, ref) => {
|
|
3290
3112
|
/**
|
3291
3113
|
* @category Map
|
3292
3114
|
*/
|
3293
|
-
const Layer = ({ data, children, name = 'places', menuIcon = 'MapPinIcon', menuText = 'add new place', menuColor = '#2E7D32', markerIcon = 'point', markerShape = 'circle', markerDefaultColor = '#777', markerDefaultColor2 = 'RGBA(35, 31, 32, 0.2)', api, itemType,
|
3115
|
+
const Layer = ({ data, children, name = 'places', menuIcon = 'MapPinIcon', menuText = 'add new place', menuColor = '#2E7D32', markerIcon = 'point', markerShape = 'circle', markerDefaultColor = '#777', markerDefaultColor2 = 'RGBA(35, 31, 32, 0.2)', api, itemType, userProfileLayer = false, customEditLink, customEditParameter,
|
3294
3116
|
// eslint-disable-next-line camelcase
|
3295
3117
|
public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }) => {
|
3296
3118
|
const filterTags = useFilterTags();
|
@@ -3327,7 +3149,7 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3327
3149
|
markerDefaultColor2,
|
3328
3150
|
api,
|
3329
3151
|
itemType,
|
3330
|
-
|
3152
|
+
userProfileLayer,
|
3331
3153
|
// Can we just use editCallback for all cases?
|
3332
3154
|
customEditLink,
|
3333
3155
|
customEditParameter,
|
@@ -3353,7 +3175,7 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3353
3175
|
markerDefaultColor2,
|
3354
3176
|
api,
|
3355
3177
|
itemType,
|
3356
|
-
|
3178
|
+
userProfileLayer,
|
3357
3179
|
customEditLink,
|
3358
3180
|
customEditParameter,
|
3359
3181
|
// eslint-disable-next-line camelcase
|
@@ -3589,17 +3411,15 @@ const StartEndView = ({ item }) => {
|
|
3589
3411
|
return (jsxRuntime.jsxs("div", { className: 'tw-flex tw-flex-row tw-mb-4 tw-mt-1', children: [jsxRuntime.jsxs("div", { className: 'tw-basis-2/5 tw-flex tw-flex-row', children: [jsxRuntime.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', className: 'tw-h-4 tw-w-4 tw-mr-2', fill: 'none', viewBox: '0 0 24 24', stroke: 'currentColor', strokeWidth: 2, children: jsxRuntime.jsx("path", { strokeLinecap: 'round', strokeLinejoin: 'round', d: 'M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z' }) }), jsxRuntime.jsx("time", { className: 'tw-align-middle', dateTime: item && item.start ? item.start.substring(0, 10) : '', children: item && item.start ? new Date(item.start).toLocaleDateString() : '' })] }), jsxRuntime.jsx("div", { className: 'tw-basis-1/5 tw-place-content-center', children: jsxRuntime.jsx("span", { children: "-" }) }), jsxRuntime.jsxs("div", { className: 'tw-basis-2/5 tw-flex tw-flex-row', children: [jsxRuntime.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', className: 'tw-h-4 tw-w-4 tw-mr-2', fill: 'none', viewBox: '0 0 24 24', stroke: 'currentColor', strokeWidth: 2, children: jsxRuntime.jsx("path", { strokeLinecap: 'round', strokeLinejoin: 'round', d: 'M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z' }) }), jsxRuntime.jsx("time", { className: 'tw-align-middle', dateTime: item && item.end ? item.end.substring(0, 10) : '', children: item && item.end ? new Date(item.end).toLocaleDateString() : '' })] })] }));
|
3590
3412
|
};
|
3591
3413
|
|
3592
|
-
function NavBar({ appName
|
3414
|
+
function NavBar({ appName }) {
|
3593
3415
|
const { isAuthenticated, user, logout } = useAuth();
|
3594
3416
|
const [userProfile, setUserProfile] = react.useState({});
|
3595
3417
|
const items = useItems();
|
3596
3418
|
react.useEffect(() => {
|
3597
|
-
const profile = user &&
|
3598
|
-
items.find((i) => i.user_created?.id === user.id && i.layer?.itemType.name === userType);
|
3419
|
+
const profile = user && items.find((i) => i.user_created?.id === user.id && i.layer?.userProfileLayer);
|
3599
3420
|
profile
|
3600
3421
|
? setUserProfile(profile)
|
3601
3422
|
: setUserProfile({ id: crypto.randomUUID(), name: user?.first_name ?? '', text: '' });
|
3602
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
3603
3423
|
}, [user, items]);
|
3604
3424
|
// useEffect(() => {}, [userProfile])
|
3605
3425
|
const nameRef = react.useRef(null);
|
@@ -3640,23 +3460,20 @@ function NavBar({ appName, userType }) {
|
|
3640
3460
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
3641
3461
|
}
|
3642
3462
|
|
3643
|
-
const SetAppState = ({ assetsApi
|
3463
|
+
const SetAppState = ({ assetsApi }) => {
|
3644
3464
|
const setAppState = useSetAppState();
|
3645
3465
|
react.useEffect(() => {
|
3646
3466
|
setAppState({ assetsApi });
|
3647
3467
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
3648
3468
|
}, [assetsApi]);
|
3649
|
-
react.useEffect(() => {
|
3650
|
-
setAppState({ userType });
|
3651
|
-
}, [setAppState, userType]);
|
3652
3469
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
3653
3470
|
};
|
3654
3471
|
|
3655
3472
|
/**
|
3656
3473
|
* @category AppShell
|
3657
3474
|
*/
|
3658
|
-
function AppShell({ appName, children, assetsApi,
|
3659
|
-
return (jsxRuntime.jsx(ContextWrapper, { children: jsxRuntime.jsxs("div", { className: 'tw-flex tw-flex-col tw-h-full', children: [jsxRuntime.jsx(SetAppState, { assetsApi: assetsApi
|
3475
|
+
function AppShell({ appName, children, assetsApi, }) {
|
3476
|
+
return (jsxRuntime.jsx(ContextWrapper, { children: jsxRuntime.jsxs("div", { className: 'tw-flex tw-flex-col tw-h-full', children: [jsxRuntime.jsx(SetAppState, { assetsApi: assetsApi }), jsxRuntime.jsx(NavBar, { appName: appName }), jsxRuntime.jsx("div", { id: 'app-content', className: 'tw-flex-grow', children: children })] }) }));
|
3660
3477
|
}
|
3661
3478
|
|
3662
3479
|
function SidebarSubmenu({ submenu, name, icon, }) {
|
@@ -3754,6 +3571,183 @@ const Sitemap = ({ url }) => {
|
|
3754
3571
|
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h1", { children: "Sitemap" }), jsxRuntime.jsx("textarea", { value: sitemap, readOnly: true, rows: items.length + 4, cols: 80 })] }));
|
3755
3572
|
};
|
3756
3573
|
|
3574
|
+
/**
|
3575
|
+
* @category Templates
|
3576
|
+
*/
|
3577
|
+
function MapOverlayPage({ children, className, backdrop, card = true, }) {
|
3578
|
+
const closeScreen = () => {
|
3579
|
+
navigate(`/${window.location.search ? window.location.search : ''}`);
|
3580
|
+
};
|
3581
|
+
const navigate = reactRouterDom.useNavigate();
|
3582
|
+
const overlayRef = react.createRef();
|
3583
|
+
const backdropRef = react.createRef();
|
3584
|
+
react.useEffect(() => {
|
3585
|
+
if (overlayRef.current !== null) {
|
3586
|
+
leaflet.DomEvent.disableClickPropagation(overlayRef.current);
|
3587
|
+
leaflet.DomEvent.disableScrollPropagation(overlayRef.current);
|
3588
|
+
}
|
3589
|
+
if (backdropRef.current !== null && backdrop) {
|
3590
|
+
leaflet.DomEvent.disableClickPropagation(backdropRef.current);
|
3591
|
+
leaflet.DomEvent.disableScrollPropagation(backdropRef.current);
|
3592
|
+
}
|
3593
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
3594
|
+
}, [overlayRef, backdropRef]);
|
3595
|
+
return (jsxRuntime.jsx("div", { className: `tw-absolute tw-h-full tw-w-full tw-m-auto ${backdrop && 'tw-z-[2000]'}`, children: jsxRuntime.jsx("div", { ref: backdropRef, className: `${backdrop && 'tw-backdrop-brightness-75'} tw-h-full tw-w-full tw-grid tw-place-items-center tw-m-auto`, children: jsxRuntime.jsxs("div", { ref: overlayRef, className: `${card && 'tw-card tw-card-body'} tw-shadow-xl tw-bg-base-100 tw-p-6 ${className && className} ${!backdrop && 'tw-z-[2000]'} tw-absolute tw-top-0 tw-bottom-0 tw-right-0 tw-left-0 tw-m-auto`, children: [children, jsxRuntime.jsx("button", { className: 'tw-btn tw-btn-sm tw-btn-circle tw-btn-ghost tw-absolute tw-right-2 tw-top-2', onClick: () => closeScreen(), children: "\u2715" })] }) }) }));
|
3596
|
+
}
|
3597
|
+
|
3598
|
+
/**
|
3599
|
+
* @category Auth
|
3600
|
+
*/
|
3601
|
+
function LoginPage() {
|
3602
|
+
const [email, setEmail] = react.useState('');
|
3603
|
+
const [password, setPassword] = react.useState('');
|
3604
|
+
const { login, loading } = useAuth();
|
3605
|
+
const navigate = reactRouterDom.useNavigate();
|
3606
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
3607
|
+
const onLogin = async () => {
|
3608
|
+
await reactToastify.toast.promise(login({ email, password }), {
|
3609
|
+
success: {
|
3610
|
+
render({ data }) {
|
3611
|
+
navigate('/');
|
3612
|
+
return `Hi ${data?.first_name}`;
|
3613
|
+
},
|
3614
|
+
// other options
|
3615
|
+
icon: '✌️',
|
3616
|
+
},
|
3617
|
+
error: {
|
3618
|
+
render({ data }) {
|
3619
|
+
return `${data}`;
|
3620
|
+
},
|
3621
|
+
autoClose: 10000,
|
3622
|
+
},
|
3623
|
+
pending: 'logging in ...',
|
3624
|
+
});
|
3625
|
+
};
|
3626
|
+
react.useEffect(() => {
|
3627
|
+
const keyDownHandler = (event) => {
|
3628
|
+
if (event.key === 'Enter') {
|
3629
|
+
event.preventDefault();
|
3630
|
+
onLogin();
|
3631
|
+
}
|
3632
|
+
};
|
3633
|
+
document.addEventListener('keydown', keyDownHandler);
|
3634
|
+
return () => {
|
3635
|
+
document.removeEventListener('keydown', keyDownHandler);
|
3636
|
+
};
|
3637
|
+
}, [onLogin]);
|
3638
|
+
return (jsxRuntime.jsxs(MapOverlayPage, { backdrop: true, className: 'tw-max-w-xs tw-h-fit', children: [jsxRuntime.jsx("h2", { className: 'tw-text-2xl tw-font-semibold tw-mb-2 tw-text-center', children: "Login" }), jsxRuntime.jsx("input", { type: 'email', placeholder: 'E-Mail', value: email, onChange: (e) => setEmail(e.target.value), className: 'tw-input tw-input-bordered tw-w-full tw-max-w-xs' }), jsxRuntime.jsx("input", { type: 'password', placeholder: 'Password', onChange: (e) => setPassword(e.target.value), className: 'tw-input tw-input-bordered tw-w-full tw-max-w-xs' }), jsxRuntime.jsx("div", { className: 'tw-text-right tw-text-primary', children: jsxRuntime.jsx(reactRouterDom.Link, { to: '/reset-password', children: jsxRuntime.jsx("span", { className: 'tw-text-sm tw-inline-block hover:tw-text-primary hover:tw-underline hover:tw-cursor-pointer tw-transition tw-duration-200', children: "Forgot Password?" }) }) }), jsxRuntime.jsx("div", { className: 'tw-card-actions', children: jsxRuntime.jsx("button", { className: loading
|
3639
|
+
? 'tw-btn tw-btn-disabled tw-btn-block tw-btn-primary'
|
3640
|
+
: 'tw-btn tw-btn-primary tw-btn-block', onClick: () => onLogin(), children: loading ? jsxRuntime.jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Login' }) })] }));
|
3641
|
+
}
|
3642
|
+
|
3643
|
+
/**
|
3644
|
+
* @category Auth
|
3645
|
+
*/
|
3646
|
+
function SignupPage() {
|
3647
|
+
const [email, setEmail] = react.useState('');
|
3648
|
+
const [userName, setUserName] = react.useState('');
|
3649
|
+
const [password, setPassword] = react.useState('');
|
3650
|
+
const { register, loading } = useAuth();
|
3651
|
+
const navigate = reactRouterDom.useNavigate();
|
3652
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
3653
|
+
const onRegister = async () => {
|
3654
|
+
await reactToastify.toast.promise(register({ email, password }, userName), {
|
3655
|
+
success: {
|
3656
|
+
render({ data }) {
|
3657
|
+
navigate('/');
|
3658
|
+
return `Hi ${data?.first_name}`;
|
3659
|
+
},
|
3660
|
+
// other options
|
3661
|
+
icon: '✌️',
|
3662
|
+
},
|
3663
|
+
error: {
|
3664
|
+
render({ data }) {
|
3665
|
+
return `${data}`;
|
3666
|
+
},
|
3667
|
+
autoClose: 10000,
|
3668
|
+
},
|
3669
|
+
pending: 'creating new user ...',
|
3670
|
+
});
|
3671
|
+
};
|
3672
|
+
react.useEffect(() => {
|
3673
|
+
const keyDownHandler = (event) => {
|
3674
|
+
if (event.key === 'Enter') {
|
3675
|
+
event.preventDefault();
|
3676
|
+
onRegister();
|
3677
|
+
}
|
3678
|
+
};
|
3679
|
+
document.addEventListener('keydown', keyDownHandler);
|
3680
|
+
return () => {
|
3681
|
+
document.removeEventListener('keydown', keyDownHandler);
|
3682
|
+
};
|
3683
|
+
}, [onRegister]);
|
3684
|
+
return (jsxRuntime.jsxs(MapOverlayPage, { backdrop: true, className: 'tw-max-w-xs tw-h-fit', children: [jsxRuntime.jsx("h2", { className: 'tw-text-2xl tw-font-semibold tw-mb-2 tw-text-center', children: "Sign Up" }), jsxRuntime.jsx("input", { type: 'text', placeholder: 'Name', value: userName, onChange: (e) => setUserName(e.target.value), className: 'tw-input tw-input-bordered tw-w-full tw-max-w-xs' }), jsxRuntime.jsx("input", { type: 'email', placeholder: 'E-Mail', value: email, onChange: (e) => setEmail(e.target.value), className: 'tw-input tw-input-bordered tw-w-full tw-max-w-xs' }), jsxRuntime.jsx("input", { type: 'password', placeholder: 'Password', onChange: (e) => setPassword(e.target.value), className: 'tw-input tw-input-bordered tw-w-full tw-max-w-xs' }), jsxRuntime.jsx("div", { className: 'tw-card-actions tw-mt-4', children: jsxRuntime.jsx("button", { className: loading
|
3685
|
+
? 'tw-btn tw-btn-disabled tw-btn-block tw-btn-primary'
|
3686
|
+
: 'tw-btn tw-btn-primary tw-btn-block', onClick: () => onRegister(), children: loading ? jsxRuntime.jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Sign Up' }) })] }));
|
3687
|
+
}
|
3688
|
+
|
3689
|
+
/**
|
3690
|
+
* @category Auth
|
3691
|
+
*/
|
3692
|
+
// eslint-disable-next-line react/prop-types
|
3693
|
+
function RequestPasswordPage({ resetUrl }) {
|
3694
|
+
const [email, setEmail] = react.useState('');
|
3695
|
+
const { requestPasswordReset, loading } = useAuth();
|
3696
|
+
const navigate = reactRouterDom.useNavigate();
|
3697
|
+
const onReset = async () => {
|
3698
|
+
await reactToastify.toast.promise(requestPasswordReset(email, resetUrl), {
|
3699
|
+
success: {
|
3700
|
+
render() {
|
3701
|
+
navigate('/');
|
3702
|
+
return 'Check your mailbox';
|
3703
|
+
},
|
3704
|
+
// other options
|
3705
|
+
icon: '📬',
|
3706
|
+
},
|
3707
|
+
error: {
|
3708
|
+
render({ data }) {
|
3709
|
+
return `${data}`;
|
3710
|
+
},
|
3711
|
+
},
|
3712
|
+
pending: 'sending email ...',
|
3713
|
+
});
|
3714
|
+
};
|
3715
|
+
return (jsxRuntime.jsxs(MapOverlayPage, { backdrop: true, className: 'tw-max-w-xs tw-h-fit', children: [jsxRuntime.jsx("h2", { className: 'tw-text-2xl tw-font-semibold tw-mb-2 tw-text-center', children: "Reset Password" }), jsxRuntime.jsx("input", { type: 'email', placeholder: 'E-Mail', value: email, onChange: (e) => setEmail(e.target.value), className: 'tw-input tw-input-bordered tw-w-full tw-max-w-xs' }), jsxRuntime.jsx("div", { className: 'tw-card-actions tw-mt-4', children: jsxRuntime.jsx("button", { className: loading
|
3716
|
+
? 'tw-btn tw-btn-disabled tw-btn-block tw-btn-primary'
|
3717
|
+
: 'tw-btn tw-btn-primary tw-btn-block', onClick: () => onReset(), children: loading ? jsxRuntime.jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Send' }) })] }));
|
3718
|
+
}
|
3719
|
+
|
3720
|
+
/**
|
3721
|
+
* @category Auth
|
3722
|
+
*/
|
3723
|
+
function SetNewPasswordPage() {
|
3724
|
+
const [password, setPassword] = react.useState('');
|
3725
|
+
const { passwordReset, loading } = useAuth();
|
3726
|
+
const navigate = reactRouterDom.useNavigate();
|
3727
|
+
const onReset = async () => {
|
3728
|
+
const token = window.location.search.split('token=')[1];
|
3729
|
+
// eslint-disable-next-line no-console
|
3730
|
+
console.log(token);
|
3731
|
+
await reactToastify.toast.promise(passwordReset(token, password), {
|
3732
|
+
success: {
|
3733
|
+
render() {
|
3734
|
+
navigate('/');
|
3735
|
+
return 'New password set';
|
3736
|
+
},
|
3737
|
+
},
|
3738
|
+
error: {
|
3739
|
+
render({ data }) {
|
3740
|
+
return `${data}`;
|
3741
|
+
},
|
3742
|
+
},
|
3743
|
+
pending: 'setting password ...',
|
3744
|
+
});
|
3745
|
+
};
|
3746
|
+
return (jsxRuntime.jsxs(MapOverlayPage, { backdrop: true, className: 'tw-max-w-xs tw-h-fit', children: [jsxRuntime.jsx("h2", { className: 'tw-text-2xl tw-font-semibold tw-mb-2 tw-text-center', children: "Set new Password" }), jsxRuntime.jsx("input", { type: 'password', placeholder: 'Password', onChange: (e) => setPassword(e.target.value), className: 'tw-input tw-input-bordered tw-w-full tw-max-w-xs' }), jsxRuntime.jsx("div", { className: 'tw-card-actions tw-mt-4', children: jsxRuntime.jsx("button", { className: loading
|
3747
|
+
? 'tw-btn tw-btn-disabled tw-btn-block tw-btn-primary'
|
3748
|
+
: 'tw-btn tw-btn-primary tw-btn-block', onClick: () => onReset(), children: loading ? jsxRuntime.jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Set' }) })] }));
|
3749
|
+
}
|
3750
|
+
|
3757
3751
|
function Subtitle({ styleClass, children }) {
|
3758
3752
|
return jsxRuntime.jsx("div", { className: `tw-text-xl tw-font-semibold ${styleClass}`, children: children });
|
3759
3753
|
}
|
@@ -3854,7 +3848,7 @@ const MoonCalendar = () => {
|
|
3854
3848
|
const SelectUser = () => {
|
3855
3849
|
const appState = useAppState();
|
3856
3850
|
const items = useItems();
|
3857
|
-
const users = items.filter((i) => i.layer?.
|
3851
|
+
const users = items.filter((i) => i.layer?.userProfileLayer);
|
3858
3852
|
const [selectedUsers, setSelectedUsers] = react.useState([]);
|
3859
3853
|
return (jsxRuntime.jsxs(MapOverlayPage, { backdrop: true, className: 'tw-h-3/4 tw-w-80', children: [jsxRuntime.jsx("div", { className: 'tw-text-center tw-text-xl tw-font-bold tw-mb-4', children: "Gratitude to ..." }), jsxRuntime.jsx("div", { className: 'tw-overflow-x-auto tw-w-full fade', children: jsxRuntime.jsx("table", { className: 'tw-table tw-w-full', children: jsxRuntime.jsx("tbody", { children: users.map((u, k) => {
|
3860
3854
|
return (jsxRuntime.jsxs("tr", { children: [jsxRuntime.jsx("td", { children: jsxRuntime.jsx("input", { type: 'checkbox', onChange: () => setSelectedUsers((prev) => [...prev, u.id]), className: 'tw-checkbox tw-checkbox-sm' }) }), jsxRuntime.jsx("td", { children: jsxRuntime.jsxs("div", { className: 'tw-flex tw-items-center tw-space-x-3', children: [u.image ? (jsxRuntime.jsx("div", { className: 'tw-avatar', children: jsxRuntime.jsx("div", { className: 'tw-mask tw-mask-circle tw-w-8 tw-h-8', children: jsxRuntime.jsx("img", { src: appState.assetsApi.url + u.image + '?width=40&heigth=40', alt: 'Avatar' }) }) })) : (jsxRuntime.jsx("div", { className: 'tw-mask tw-mask-circle tw-text-xl md:tw-text-2xl tw-bg-slate-200 tw-rounded-full tw-w-8 tw-h-8' })), jsxRuntime.jsx("div", { children: jsxRuntime.jsx("div", { className: 'tw-font-bold', children: u.name }) })] }) })] }, k));
|
@@ -4118,7 +4112,7 @@ const AttestationForm = ({ api }) => {
|
|
4118
4112
|
items.find((i) =>
|
4119
4113
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
4120
4114
|
i.user_created?.id === to[0].directus_users_id &&
|
4121
|
-
i.layer?.
|
4115
|
+
i.layer?.userProfileLayer === true)?.id +
|
4122
4116
|
'?tab=2'));
|
4123
4117
|
};
|
4124
4118
|
const [selectedEmoji, setSelectedEmoji] = react.useState('select badge');
|
@@ -4393,7 +4387,6 @@ const onUpdateItem = async (state, item, tags, addTag, setLoading, navigate, upd
|
|
4393
4387
|
...changedItem,
|
4394
4388
|
layer: item.layer,
|
4395
4389
|
user_created: user,
|
4396
|
-
type: item.layer?.itemType,
|
4397
4390
|
}))
|
4398
4391
|
.then(() => {
|
4399
4392
|
setLoading(false);
|
@@ -4408,12 +4401,7 @@ const ContactInfoView = ({ item, heading }) => {
|
|
4408
4401
|
const [profileOwner, setProfileOwner] = react.useState();
|
4409
4402
|
const items = useItems();
|
4410
4403
|
react.useEffect(() => {
|
4411
|
-
|
4412
|
-
console.log('user:', items.find((i) => i.user_created?.id === item.user_created?.id &&
|
4413
|
-
i.layer?.itemType.name === appState.userType));
|
4414
|
-
setProfileOwner(items.find((i) => i.user_created?.id === item.user_created?.id &&
|
4415
|
-
i.layer?.itemType.name === appState.userType));
|
4416
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
4404
|
+
setProfileOwner(items.find((i) => i.user_created?.id === item.user_created?.id && i.layer?.userProfileLayer));
|
4417
4405
|
}, [item, items]);
|
4418
4406
|
return (jsxRuntime.jsxs("div", { className: 'tw-bg-base-200 tw-mb-6 tw-mt-6 tw-p-6', children: [jsxRuntime.jsx("h2", { className: 'tw-text-lg tw-font-semibold', children: heading }), jsxRuntime.jsxs("div", { className: 'tw-mt-4 tw-flex tw-items-center', children: [profileOwner?.image && (jsxRuntime.jsx(ConditionalLink, { url: '/item/' + profileOwner?.id, children: jsxRuntime.jsx("div", { className: 'tw-mr-5 tw-flex tw-items-center tw-justify-center', children: jsxRuntime.jsx("div", { className: 'tw-avatar', children: jsxRuntime.jsx("div", { className: 'tw-w-20 tw-h-20 tw-bg-gray-200 rounded-full tw-flex tw-items-center tw-justify-center overflow-hidden', children: jsxRuntime.jsx("img", { src: appState.assetsApi.url + profileOwner?.image, alt: profileOwner?.name, className: 'tw-w-full tw-h-full tw-object-cover' }) }) }) }) })), jsxRuntime.jsxs("div", { className: 'tw-text-sm tw-flex-grow', children: [jsxRuntime.jsx("p", { className: 'tw-font-semibold', children: profileOwner?.name }), item.contact && (jsxRuntime.jsx("p", { children: jsxRuntime.jsxs("a", { href: `mailto:${item.contact}`, className: 'tw-mt-2 tw-text-green-500 tw-inline-flex tw-items-center', children: [jsxRuntime.jsxs("svg", { xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round', className: 'tw-w-4 tw-h-4 tw-mr-1', children: [jsxRuntime.jsx("path", { d: 'M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z' }), jsxRuntime.jsx("polyline", { points: '22,6 12,13 2,6' })] }), item.contact] }) })), item.telephone && (jsxRuntime.jsx("p", { children: jsxRuntime.jsxs("a", { href: `tel:${item.telephone}`, className: 'tw-mt-2 tw-text-green-500 tw-inline-flex tw-items-center tw-whitespace-nowrap', children: [jsxRuntime.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round', className: 'tw-w-4 tw-h-4 tw-mr-1', children: jsxRuntime.jsx("path", { d: 'M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.5 19.5 0 01-6-6 19.79 19.79 0 01-3.07-8.67A2 2 0 014.11 2h3a2 2 0 012 1.72 12.84 12.84 0 00.7 2.81 2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45 12.84 12.84 0 002.81.7A2 2 0 0122 16.92z' }) }), item.telephone] }) }))] })] })] }));
|
4419
4407
|
};
|
@@ -4547,7 +4535,8 @@ const get = (value, path, defaultValue) => {
|
|
4547
4535
|
const ProfileTextView = ({ item, dataField = 'text', heading, hideWhenEmpty, }) => {
|
4548
4536
|
const text = get(item, dataField);
|
4549
4537
|
if (typeof text !== 'string') {
|
4550
|
-
|
4538
|
+
// eslint-disable-next-line no-console
|
4539
|
+
console.log('123');
|
4551
4540
|
}
|
4552
4541
|
return (jsxRuntime.jsxs("div", { className: 'tw-my-10 tw-mt-2 tw-px-6', children: [!(text === '' && hideWhenEmpty) && (jsxRuntime.jsx("h2", { className: 'tw-text-lg tw-font-semibold', children: heading })), jsxRuntime.jsx("div", { className: 'tw-mt-2 tw-text-sm', children: jsxRuntime.jsx(TextView, { itemId: item.id, rawText: text }) })] }));
|
4553
4542
|
};
|
@@ -5301,14 +5290,20 @@ function ProfileForm() {
|
|
5301
5290
|
const item = items.find((i) => i.id === itemId);
|
5302
5291
|
item && setItem(item);
|
5303
5292
|
if (!item) {
|
5304
|
-
|
5305
|
-
|
5306
|
-
|
5307
|
-
|
5308
|
-
|
5309
|
-
layer
|
5310
|
-
|
5311
|
-
|
5293
|
+
if (items.some((i) => i.user_created?.id === user?.id && i.layer?.userProfileLayer)) {
|
5294
|
+
navigate('/');
|
5295
|
+
reactToastify.toast.error('Item does not exist');
|
5296
|
+
}
|
5297
|
+
else {
|
5298
|
+
const layer = layers.find((l) => l.userProfileLayer);
|
5299
|
+
setItem({
|
5300
|
+
id: crypto.randomUUID(),
|
5301
|
+
name: user?.first_name ?? '',
|
5302
|
+
text: '',
|
5303
|
+
layer,
|
5304
|
+
new: true,
|
5305
|
+
});
|
5306
|
+
}
|
5312
5307
|
}
|
5313
5308
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
5314
5309
|
}, [items]);
|
@@ -5399,7 +5394,7 @@ function Quests() {
|
|
5399
5394
|
const items = useItems();
|
5400
5395
|
react.useEffect(() => {
|
5401
5396
|
setProfie(items.find((i) => i.user_created?.id === user?.id &&
|
5402
|
-
i.layer?.
|
5397
|
+
i.layer?.userProfileLayer &&
|
5403
5398
|
i.user_created?.id != null));
|
5404
5399
|
}, [items, user]);
|
5405
5400
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: questsOpen ? (jsxRuntime.jsx("div", { className: 'tw-card tw-w-48 tw-bg-base-100 tw-shadow-xl tw-absolute tw-bottom-4 tw-left-4 tw-z-[2000]', children: jsxRuntime.jsxs("div", { className: 'tw-card-body tw-p-4 tw-pt-0', children: [jsxRuntime.jsx("div", { className: 'tw-card-actions tw-justify-end', children: jsxRuntime.jsx("label", { className: 'tw-btn tw-btn-sm tw-btn-circle tw-btn-ghost tw-absolute tw-right-1 tw-top-1', onClick: () => setQuestsOpen(false), children: "\u2715" }) }), jsxRuntime.jsxs("h2", { className: 'tw-card-title tw-m-auto ', children: ["Level 1", jsxRuntime.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', fill: 'none', viewBox: '0 0 24 24', strokeWidth: 1.5, stroke: '#aaa', className: 'tw-w-5 tw-h-5 tw-cursor-pointer', children: jsxRuntime.jsx("path", { strokeLinecap: 'round', strokeLinejoin: 'round', d: 'M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z' }) })] }), jsxRuntime.jsxs("ul", { className: 'tw-flex-row', children: [jsxRuntime.jsx("li", { children: jsxRuntime.jsxs("label", { className: 'tw-label tw-justify-normal tw-pt-1 tw-pb-0', children: [jsxRuntime.jsx("input", { type: 'checkbox', readOnly: true, className: 'tw-checkbox tw-checkbox-xs tw-checkbox-success', checked: isAuthenticated || false }), jsxRuntime.jsx("span", { className: 'tw-text-sm tw-label-text tw-mx-2', children: "Sign Up" })] }) }), jsxRuntime.jsx("li", { children: jsxRuntime.jsxs("label", { className: 'tw-label tw-justify-normal tw-pt-1 tw-pb-0', children: [jsxRuntime.jsx("input", { type: 'checkbox', readOnly: true, className: 'tw-checkbox tw-checkbox-xs tw-checkbox-success', checked: !!profile?.text }), jsxRuntime.jsx("span", { className: 'tw-text-sm tw-label-text tw-mx-2', children: "Fill Profile" })] }) }), jsxRuntime.jsx("li", { children: jsxRuntime.jsxs("label", { className: 'tw-label tw-justify-normal tw-pt-1 tw-pb-0', children: [jsxRuntime.jsx("input", { type: 'checkbox', readOnly: true, className: 'tw-checkbox tw-checkbox-xs tw-checkbox-success', checked: !!profile?.image }), jsxRuntime.jsx("span", { className: 'tw-text-sm tw-label-text tw-mx-2', children: "Upload Avatar" })] }) })] }), ' '] }) })) : ('') }));
|
@@ -5420,7 +5415,6 @@ exports.Modal = Modal;
|
|
5420
5415
|
exports.MoonCalendar = MoonCalendar;
|
5421
5416
|
exports.OverlayItemsIndexPage = OverlayItemsIndexPage;
|
5422
5417
|
exports.Permissions = Permissions;
|
5423
|
-
exports.PlusButton = PlusButton;
|
5424
5418
|
exports.PopupButton = PopupButton;
|
5425
5419
|
exports.PopupCheckboxInput = PopupCheckboxInput;
|
5426
5420
|
exports.PopupStartEndInput = PopupStartEndInput;
|
@@ -5444,5 +5438,4 @@ exports.TextView = TextView;
|
|
5444
5438
|
exports.TitleCard = TitleCard;
|
5445
5439
|
exports.UserSettings = UserSettings;
|
5446
5440
|
exports.UtopiaMap = UtopiaMap;
|
5447
|
-
exports.useAuth = useAuth;
|
5448
5441
|
//# sourceMappingURL=index.cjs.map
|