utopia-ui 3.0.32 → 3.0.34

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.
Files changed (57) hide show
  1. package/dist/Components/AppShell/AppShell.d.ts +1 -1
  2. package/dist/Components/AppShell/SetAppState.d.ts +1 -1
  3. package/dist/Components/AppShell/hooks/useAppState.d.ts +1 -1
  4. package/dist/Components/AppShell/hooks/useAssets.d.ts +1 -1
  5. package/dist/Components/Auth/useAuth.d.ts +2 -1
  6. package/dist/Components/Input/TextAreaInput.d.ts +2 -1
  7. package/dist/Components/Map/ItemForm.d.ts +1 -1
  8. package/dist/Components/Map/ItemView.d.ts +1 -1
  9. package/dist/Components/Map/Layer.d.ts +1 -1
  10. package/dist/Components/Map/Permissions.d.ts +2 -1
  11. package/dist/Components/Map/Subcomponents/ItemFormPopup.d.ts +1 -1
  12. package/dist/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.d.ts +2 -1
  13. package/dist/Components/Map/Subcomponents/ItemPopupComponents/PopupButton.d.ts +1 -1
  14. package/dist/Components/Map/Subcomponents/ItemPopupComponents/PopupCheckboxInput.d.ts +1 -1
  15. package/dist/Components/Map/Subcomponents/ItemPopupComponents/PopupStartEndInput.d.ts +1 -1
  16. package/dist/Components/Map/Subcomponents/ItemPopupComponents/PopupTextAreaInput.d.ts +1 -1
  17. package/dist/Components/Map/Subcomponents/ItemPopupComponents/PopupTextInput.d.ts +1 -1
  18. package/dist/Components/Map/Subcomponents/ItemPopupComponents/StartEndView.d.ts +1 -1
  19. package/dist/Components/Map/Subcomponents/ItemPopupComponents/TextView.d.ts +1 -1
  20. package/dist/Components/Map/Subcomponents/ItemViewPopup.d.ts +2 -1
  21. package/dist/Components/Map/Tags.d.ts +2 -1
  22. package/dist/Components/Map/UtopiaMap.d.ts +1 -1
  23. package/dist/Components/Map/UtopiaMapInner.d.ts +1 -1
  24. package/dist/Components/Map/hooks/useFilter.d.ts +2 -1
  25. package/dist/Components/Map/hooks/useItems.d.ts +2 -1
  26. package/dist/Components/Map/hooks/useLayers.d.ts +1 -1
  27. package/dist/Components/Map/hooks/useLeafletRefs.d.ts +2 -2
  28. package/dist/Components/Map/hooks/usePermissions.d.ts +5 -1
  29. package/dist/Components/Map/hooks/useSelectPosition.d.ts +4 -2
  30. package/dist/Components/Map/hooks/useTags.d.ts +3 -1
  31. package/dist/Components/Profile/ProfileView.d.ts +1 -1
  32. package/dist/Components/Profile/Subcomponents/ActionsButton.d.ts +1 -1
  33. package/dist/Components/Profile/Subcomponents/ContactInfoForm.d.ts +1 -1
  34. package/dist/Components/Profile/Subcomponents/ContactInfoView.d.ts +1 -1
  35. package/dist/Components/Profile/Subcomponents/GalleryView.d.ts +4 -0
  36. package/dist/Components/Profile/Subcomponents/GroupSubHeaderView.d.ts +1 -1
  37. package/dist/Components/Profile/Subcomponents/GroupSubheaderForm.d.ts +2 -1
  38. package/dist/Components/Profile/Subcomponents/LinkedItemsHeaderView.d.ts +1 -1
  39. package/dist/Components/Profile/Subcomponents/PlusButton.d.ts +1 -1
  40. package/dist/Components/Profile/Subcomponents/ProfileStartEndForm.d.ts +1 -1
  41. package/dist/Components/Profile/Subcomponents/ProfileStartEndView.d.ts +1 -1
  42. package/dist/Components/Profile/Subcomponents/ProfileTextForm.d.ts +3 -2
  43. package/dist/Components/Profile/Subcomponents/ProfileTextView.d.ts +1 -1
  44. package/dist/Components/Profile/Templates/FlexForm.d.ts +2 -1
  45. package/dist/Components/Profile/Templates/FlexView.d.ts +1 -1
  46. package/dist/Components/Profile/Templates/OnepagerForm.d.ts +2 -1
  47. package/dist/Components/Profile/Templates/OnepagerView.d.ts +1 -1
  48. package/dist/Components/Profile/Templates/SimpleView.d.ts +1 -1
  49. package/dist/Components/Profile/Templates/TabsView.d.ts +2 -1
  50. package/dist/Components/Templates/AttestationForm.d.ts +1 -1
  51. package/dist/Components/Templates/DateUserInfo.d.ts +1 -1
  52. package/dist/Components/Templates/ItemCard.d.ts +1 -1
  53. package/dist/Components/Templates/TagView.d.ts +1 -1
  54. package/dist/index.d.ts +3 -1
  55. package/dist/index.js +78 -75
  56. package/dist/index.js.map +1 -1
  57. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -548,13 +548,11 @@ function useItemsManager(initialItems) {
548
548
  })];
549
549
  case 1:
550
550
  result = _a.sent();
551
- if (result) {
552
- result.map(function (item) {
553
- dispatch({ type: 'ADD', item: __assign(__assign({}, item), { layer: layer }) });
554
- return null;
555
- });
556
- setallItemsLoaded(true);
557
- }
551
+ result.map(function (item) {
552
+ dispatch({ type: 'ADD', item: __assign(__assign({}, item), { layer: layer }) });
553
+ return null;
554
+ });
555
+ setallItemsLoaded(true);
558
556
  return [2 /*return*/];
559
557
  }
560
558
  });
@@ -760,7 +758,7 @@ var AuthProvider = function (_a) {
760
758
  return [4 /*yield*/, userApi.login(credentials.email, credentials.password)];
761
759
  case 2:
762
760
  res = _a.sent();
763
- setToken(res.access_token);
761
+ setToken(res === null || res === void 0 ? void 0 : res.access_token);
764
762
  return [4 /*yield*/, loadUser()];
765
763
  case 3: return [2 /*return*/, _a.sent()];
766
764
  case 4:
@@ -931,12 +929,10 @@ function usePermissionsManager(initialPermissions) {
931
929
  case 0: return [4 /*yield*/, api.getItems()];
932
930
  case 1:
933
931
  result = _a.sent();
934
- if (result) {
935
- result.map(function (permission) {
936
- dispatch({ type: 'ADD', permission: permission });
937
- return null;
938
- });
939
- }
932
+ result.map(function (permission) {
933
+ dispatch({ type: 'ADD', permission: permission });
934
+ return null;
935
+ });
940
936
  return [2 /*return*/];
941
937
  }
942
938
  });
@@ -1011,14 +1007,6 @@ var useSetAdminRole = function () {
1011
1007
  return setAdminRole;
1012
1008
  };
1013
1009
 
1014
- var Geometry = /** @class */ (function () {
1015
- function Geometry(lng, lat) {
1016
- this.coordinates = [lng, lat];
1017
- this.type = 'Point';
1018
- }
1019
- return Geometry;
1020
- }());
1021
-
1022
1010
  var SelectPositionContext = createContext({
1023
1011
  selectPosition: null,
1024
1012
  setSelectPosition: function () { },
@@ -1052,7 +1040,11 @@ function useSelectPositionManager() {
1052
1040
  setSelectPosition(null);
1053
1041
  }
1054
1042
  if ('text' in selectPosition) {
1055
- var position = (mapClicked === null || mapClicked === void 0 ? void 0 : mapClicked.position.lng) && new Geometry(mapClicked.position.lng, mapClicked.position.lat);
1043
+ var position = (mapClicked === null || mapClicked === void 0 ? void 0 : mapClicked.position.lng) &&
1044
+ {
1045
+ type: 'Point',
1046
+ coordinates: [mapClicked.position.lng, mapClicked.position.lat],
1047
+ };
1056
1048
  position && itemUpdatePosition(__assign(__assign({}, selectPosition), { position: position }));
1057
1049
  setSelectPosition(null);
1058
1050
  }
@@ -3293,9 +3285,9 @@ var rgbToHex = function (r, g, b) {
3293
3285
  };
3294
3286
 
3295
3287
  function TextAreaInput(_a) {
3296
- var labelTitle = _a.labelTitle, dataField = _a.dataField, labelStyle = _a.labelStyle, containerStyle = _a.containerStyle, inputStyle = _a.inputStyle, defaultValue = _a.defaultValue, placeholder = _a.placeholder, updateFormValue = _a.updateFormValue;
3288
+ var labelTitle = _a.labelTitle, dataField = _a.dataField, labelStyle = _a.labelStyle, containerStyle = _a.containerStyle, inputStyle = _a.inputStyle, defaultValue = _a.defaultValue, placeholder = _a.placeholder, _b = _a.required, required = _b === void 0 ? true : _b, updateFormValue = _a.updateFormValue;
3297
3289
  var ref = useRef(null);
3298
- var _b = useState(defaultValue), inputValue = _b[0], setInputValue = _b[1];
3290
+ var _c = useState(defaultValue), inputValue = _c[0], setInputValue = _c[1];
3299
3291
  // prevent react18 from calling useEffect twice
3300
3292
  var init = useRef(false);
3301
3293
  var tags = useTags();
@@ -3335,7 +3327,7 @@ function TextAreaInput(_a) {
3335
3327
  updateFormValue(newValue);
3336
3328
  }
3337
3329
  };
3338
- return (jsxs("div", __assign({ className: "tw-form-control tw-w-full ".concat(containerStyle || '') }, { children: [labelTitle ? (jsx("label", __assign({ className: 'tw-label' }, { children: jsx("span", __assign({ className: "tw-label-text tw-text-base-content ".concat(labelStyle) }, { children: labelTitle })) }))) : null, jsx("textarea", { required: true, ref: ref, value: inputValue, name: dataField, className: "tw-textarea tw-textarea-bordered tw-w-full tw-leading-5 ".concat(inputStyle || ''), placeholder: placeholder || '', onChange: handleChange })] })));
3330
+ return (jsxs("div", __assign({ className: "tw-form-control tw-w-full ".concat(containerStyle || '') }, { children: [labelTitle ? (jsx("label", __assign({ className: 'tw-label' }, { children: jsx("span", __assign({ className: "tw-label-text tw-text-base-content ".concat(labelStyle) }, { children: labelTitle })) }))) : null, jsx("textarea", { required: required, ref: ref, value: inputValue, name: dataField, className: "tw-textarea tw-textarea-bordered tw-w-full tw-leading-5 ".concat(inputStyle || ''), placeholder: placeholder || '', onChange: handleChange })] })));
3339
3331
  }
3340
3332
 
3341
3333
  function TextInput(_a) {
@@ -3370,9 +3362,9 @@ function ItemFormPopup(props) {
3370
3362
  var user = useAuth().user;
3371
3363
  var handleSubmit = function (evt) { return __awaiter(_this, void 0, void 0, function () {
3372
3364
  var formItem, success, error_1, item, uuid, success, _a, _b, error_2;
3373
- var _c, _d, _e, _f;
3374
- return __generator(this, function (_g) {
3375
- switch (_g.label) {
3365
+ var _c, _d, _e, _f, _g;
3366
+ return __generator(this, function (_h) {
3367
+ switch (_h.label) {
3376
3368
  case 0:
3377
3369
  formItem = {};
3378
3370
  Array.from(evt.target).forEach(function (input) {
@@ -3380,7 +3372,7 @@ function ItemFormPopup(props) {
3380
3372
  formItem[input.name] = input.value;
3381
3373
  }
3382
3374
  });
3383
- formItem.position = new Geometry(props.position.lng, props.position.lat);
3375
+ formItem.position = { type: 'Point', coordinates: [props.position.lng, props.position.lat] };
3384
3376
  evt.preventDefault();
3385
3377
  setSpinner(true);
3386
3378
  formItem.text &&
@@ -3394,16 +3386,16 @@ function ItemFormPopup(props) {
3394
3386
  }));
3395
3387
  if (!props.item) return [3 /*break*/, 5];
3396
3388
  success = false;
3397
- _g.label = 1;
3389
+ _h.label = 1;
3398
3390
  case 1:
3399
- _g.trys.push([1, 3, , 4]);
3391
+ _h.trys.push([1, 3, , 4]);
3400
3392
  return [4 /*yield*/, ((_d = props.layer.api) === null || _d === void 0 ? void 0 : _d.updateItem(__assign(__assign({}, formItem), { id: props.item.id })))];
3401
3393
  case 2:
3402
- _g.sent();
3394
+ _h.sent();
3403
3395
  success = true;
3404
3396
  return [3 /*break*/, 4];
3405
3397
  case 3:
3406
- error_1 = _g.sent();
3398
+ error_1 = _h.sent();
3407
3399
  toast.error(error_1.toString());
3408
3400
  return [3 /*break*/, 4];
3409
3401
  case 4:
@@ -3420,28 +3412,28 @@ function ItemFormPopup(props) {
3420
3412
  item = items.find(function (i) { var _a, _b; return ((_a = i.user_created) === null || _a === void 0 ? void 0 : _a.id) === (user === null || user === void 0 ? void 0 : user.id) && ((_b = i.layer) === null || _b === void 0 ? void 0 : _b.itemType.name) === props.layer.itemType.name; });
3421
3413
  uuid = crypto.randomUUID();
3422
3414
  success = false;
3423
- _g.label = 6;
3415
+ _h.label = 6;
3424
3416
  case 6:
3425
- _g.trys.push([6, 11, , 12]);
3417
+ _h.trys.push([6, 11, , 12]);
3426
3418
  _a = props.layer.onlyOnePerOwner &&
3427
3419
  item;
3428
3420
  if (!_a) return [3 /*break*/, 8];
3429
3421
  return [4 /*yield*/, ((_e = props.layer.api) === null || _e === void 0 ? void 0 : _e.updateItem(__assign(__assign({}, formItem), { id: item.id })))];
3430
3422
  case 7:
3431
- _a = (_g.sent());
3432
- _g.label = 8;
3423
+ _a = (_h.sent());
3424
+ _h.label = 8;
3433
3425
  case 8:
3434
3426
  _b = (!props.layer.onlyOnePerOwner || !item);
3435
3427
  if (!_b) return [3 /*break*/, 10];
3436
3428
  return [4 /*yield*/, ((_f = props.layer.api) === null || _f === void 0 ? void 0 : _f.createItem(__assign(__assign({}, formItem), { id: uuid, name: formItem.name ? formItem.name : user === null || user === void 0 ? void 0 : user.first_name })))];
3437
3429
  case 9:
3438
- _b = (_g.sent());
3439
- _g.label = 10;
3430
+ _b = (_h.sent());
3431
+ _h.label = 10;
3440
3432
  case 10:
3441
3433
  success = true;
3442
3434
  return [3 /*break*/, 12];
3443
3435
  case 11:
3444
- error_2 = _g.sent();
3436
+ error_2 = _h.sent();
3445
3437
  toast.error(error_2.toString());
3446
3438
  return [3 /*break*/, 12];
3447
3439
  case 12:
@@ -3449,14 +3441,14 @@ function ItemFormPopup(props) {
3449
3441
  if (props.layer.onlyOnePerOwner && item)
3450
3442
  updateItem(__assign(__assign({}, item), formItem));
3451
3443
  if (!props.layer.onlyOnePerOwner || !item) {
3452
- addItem(__assign(__assign({}, formItem), { name: formItem.name ? formItem.name : user === null || user === void 0 ? void 0 : user.first_name, user_created: user, type: props.layer.itemType, id: uuid, layer: props.layer, public_edit: !user }));
3444
+ addItem(__assign(__assign({}, formItem), { name: (_g = (formItem.name ? formItem.name : user === null || user === void 0 ? void 0 : user.first_name)) !== null && _g !== void 0 ? _g : '', user_created: user !== null && user !== void 0 ? user : undefined, type: props.layer.itemType, id: uuid, layer: props.layer, public_edit: !user }));
3453
3445
  }
3454
3446
  toast.success('New item created');
3455
3447
  resetFilterTags();
3456
3448
  }
3457
3449
  setSpinner(false);
3458
3450
  map.closePopup();
3459
- _g.label = 13;
3451
+ _h.label = 13;
3460
3452
  case 13:
3461
3453
  props.setItemFormPopup(null);
3462
3454
  return [2 /*return*/];
@@ -4084,52 +4076,61 @@ var PopupButton = function (_a) {
4084
4076
  };
4085
4077
 
4086
4078
  function NavBar(_a) {
4079
+ var _this = this;
4087
4080
  var appName = _a.appName, userType = _a.userType;
4088
4081
  var _b = useAuth(), isAuthenticated = _b.isAuthenticated, user = _b.user, logout = _b.logout;
4089
4082
  var _c = useState({}), userProfile = _c[0], setUserProfile = _c[1];
4090
4083
  var items = useItems();
4091
4084
  useEffect(function () {
4085
+ var _a;
4092
4086
  var profile = user &&
4093
4087
  items.find(function (i) { var _a, _b; return ((_a = i.user_created) === null || _a === void 0 ? void 0 : _a.id) === user.id && ((_b = i.layer) === null || _b === void 0 ? void 0 : _b.itemType.name) === userType; });
4094
4088
  profile
4095
4089
  ? setUserProfile(profile)
4096
- : setUserProfile({ id: crypto.randomUUID(), name: user === null || user === void 0 ? void 0 : user.first_name, text: '' });
4090
+ : setUserProfile({ id: crypto.randomUUID(), name: (_a = user === null || user === void 0 ? void 0 : user.first_name) !== null && _a !== void 0 ? _a : '', text: '' });
4097
4091
  // eslint-disable-next-line react-hooks/exhaustive-deps
4098
4092
  }, [user, items]);
4099
- useEffect(function () { }, [userProfile]);
4093
+ // useEffect(() => {}, [userProfile])
4100
4094
  var nameRef = useRef(null);
4101
4095
  var _d = useState(0), nameWidth = _d[0], setNameWidth = _d[1];
4102
4096
  var location = useLocation();
4103
4097
  var _e = useState(false), showNav = _e[0], setShowNav = _e[1];
4104
4098
  useEffect(function () {
4105
- showNav && nameRef && setNameWidth(nameRef.current.scrollWidth);
4099
+ showNav && nameRef.current && setNameWidth(nameRef.current.scrollWidth);
4106
4100
  }, [nameRef, appName, showNav]);
4107
4101
  useEffect(function () {
4108
4102
  var params = new URLSearchParams(location.search);
4109
4103
  var embedded = params.get('embedded');
4110
4104
  embedded !== 'true' && setShowNav(true);
4111
4105
  }, [location]);
4112
- var onLogout = function () {
4113
- toast.promise(logout(), {
4114
- success: {
4115
- render: function () {
4116
- return 'Bye bye';
4117
- },
4118
- // other options
4119
- icon: '👋',
4120
- },
4121
- error: {
4122
- render: function (_a) {
4123
- var data = _a.data;
4124
- return "".concat(data);
4125
- },
4126
- },
4127
- pending: 'logging out ..',
4106
+ var onLogout = function () { return __awaiter(_this, void 0, void 0, function () {
4107
+ return __generator(this, function (_a) {
4108
+ switch (_a.label) {
4109
+ case 0: return [4 /*yield*/, toast.promise(logout(), {
4110
+ success: {
4111
+ render: function () {
4112
+ return 'Bye bye';
4113
+ },
4114
+ // other options
4115
+ icon: '👋',
4116
+ },
4117
+ error: {
4118
+ render: function (_a) {
4119
+ var data = _a.data;
4120
+ return JSON.stringify(data);
4121
+ },
4122
+ },
4123
+ pending: 'logging out ..',
4124
+ })];
4125
+ case 1:
4126
+ _a.sent();
4127
+ return [2 /*return*/];
4128
+ }
4128
4129
  });
4129
- };
4130
+ }); };
4130
4131
  if (showNav) {
4131
- return (jsx(Fragment, { children: jsxs("div", __assign({ className: 'tw-navbar tw-bg-base-100 tw-z-[10000] tw-shadow-xl tw-relative' }, { children: [jsx("button", __assign({ className: 'tw-btn tw-btn-square tw-btn-ghost', "data-te-sidenav-toggle-ref": true, "data-te-target": '#sidenav', "aria-controls": '#sidenav', "aria-haspopup": 'true' }, { children: jsx("svg", __assign({ xmlns: 'http://www.w3.org/2000/svg', fill: 'none', viewBox: '0 0 24 24', className: 'tw-inline-block tw-w-5 tw-h-5 tw-stroke-current' }, { children: jsx("path", { strokeLinecap: 'round', strokeLinejoin: 'round', strokeWidth: '2', d: 'M4 6h16M4 12h16M4 18h16' }) })) })), jsx("div", __assign({ className: 'tw-flex-1 tw-mr-2' }, { children: jsxs("div", __assign({ className: 'tw-flex-1 tw-truncate tw-grid tw-grid-flow-col', style: { maxWidth: nameWidth + 60 } }, { children: [jsx(Link, __assign({ className: 'tw-btn tw-btn-ghost tw-px-2 tw-normal-case tw-text-xl tw-flex-1 tw-truncate', to: '/' }, { children: jsx("h1", __assign({ ref: nameRef, className: 'tw-truncate' }, { children: appName })) })), jsx("button", __assign({ className: 'tw-btn tw-px-2 tw-btn-ghost', onClick: function () { return window.my_modal_3.showModal(); } }, { children: jsx(QuestionMarkIcon, { className: 'tw-h-5 tw-w-5' }) }))] })) })), isAuthenticated ? (jsxs("div", __assign({ className: 'tw-flex-none' }, { children: [jsxs(Link, __assign({ to: "".concat(userProfile.id && '/item/' + userProfile.id), className: 'tw-flex tw-items-center' }, { children: [(userProfile === null || userProfile === void 0 ? void 0 : userProfile.image) && (jsx("div", __assign({ className: 'tw-avatar' }, { children: jsx("div", __assign({ className: 'tw-w-10 tw-rounded-full' }, { children: jsx("img", { src: 'https://api.utopia-lab.org/assets/' + userProfile.image }) })) }))), jsx("div", __assign({ className: 'tw-ml-2 tw-mr-2' }, { children: userProfile.name || (user === null || user === void 0 ? void 0 : user.first_name) }))] })), jsxs("div", __assign({ className: 'tw-dropdown tw-dropdown-end' }, { children: [jsx("label", __assign({ tabIndex: 0, className: 'tw-btn tw-btn-ghost tw-btn-square' }, { children: jsx("svg", __assign({ xmlns: 'http://www.w3.org/2000/svg', className: 'tw-h-5 tw-w-5', viewBox: '0 0 20 20', fill: 'currentColor' }, { children: jsx("path", { d: 'M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z' }) })) })), jsxs("ul", __assign({ tabIndex: 0, className: 'tw-menu tw-menu-compact tw-dropdown-content tw-mt-3 tw-p-2 tw-shadow tw-bg-base-100 tw-rounded-box tw-w-52 !tw-z-[10000]' }, { children: [jsx("li", { children: jsx(Link, __assign({ to: "".concat(userProfile.id && '/edit-item/' + userProfile.id) }, { children: "Profile" })) }), jsx("li", { children: jsx(Link, __assign({ to: '/user-settings' }, { children: "Settings" })) }), jsx("li", { children: jsx("a", __assign({ onClick: function () {
4132
- onLogout();
4132
+ return (jsx(Fragment, { children: jsxs("div", __assign({ className: 'tw-navbar tw-bg-base-100 tw-z-[10000] tw-shadow-xl tw-relative' }, { children: [jsx("button", __assign({ className: 'tw-btn tw-btn-square tw-btn-ghost', "data-te-sidenav-toggle-ref": true, "data-te-target": '#sidenav', "aria-controls": '#sidenav', "aria-haspopup": 'true' }, { children: jsx("svg", __assign({ xmlns: 'http://www.w3.org/2000/svg', fill: 'none', viewBox: '0 0 24 24', className: 'tw-inline-block tw-w-5 tw-h-5 tw-stroke-current' }, { children: jsx("path", { strokeLinecap: 'round', strokeLinejoin: 'round', strokeWidth: '2', d: 'M4 6h16M4 12h16M4 18h16' }) })) })), jsx("div", __assign({ className: 'tw-flex-1 tw-mr-2' }, { children: jsxs("div", __assign({ className: 'tw-flex-1 tw-truncate tw-grid tw-grid-flow-col', style: { maxWidth: nameWidth + 60 } }, { children: [jsx(Link, __assign({ className: 'tw-btn tw-btn-ghost tw-px-2 tw-normal-case tw-text-xl tw-flex-1 tw-truncate', to: '/' }, { children: jsx("h1", __assign({ ref: nameRef, className: 'tw-truncate' }, { children: appName })) })), jsx("button", __assign({ className: 'tw-btn tw-px-2 tw-btn-ghost', onClick: function () { return window.my_modal_3.showModal(); } }, { children: jsx(QuestionMarkIcon, { className: 'tw-h-5 tw-w-5' }) }))] })) })), isAuthenticated ? (jsxs("div", __assign({ className: 'tw-flex-none' }, { children: [jsxs(Link, __assign({ to: "".concat(userProfile.id && '/item/' + userProfile.id), className: 'tw-flex tw-items-center' }, { children: [userProfile.image && (jsx("div", __assign({ className: 'tw-avatar' }, { children: jsx("div", __assign({ className: 'tw-w-10 tw-rounded-full' }, { children: jsx("img", { src: 'https://api.utopia-lab.org/assets/' + userProfile.image }) })) }))), jsx("div", __assign({ className: 'tw-ml-2 tw-mr-2' }, { children: userProfile.name || (user === null || user === void 0 ? void 0 : user.first_name) }))] })), jsxs("div", __assign({ className: 'tw-dropdown tw-dropdown-end' }, { children: [jsx("label", __assign({ tabIndex: 0, className: 'tw-btn tw-btn-ghost tw-btn-square' }, { children: jsx("svg", __assign({ xmlns: 'http://www.w3.org/2000/svg', className: 'tw-h-5 tw-w-5', viewBox: '0 0 20 20', fill: 'currentColor' }, { children: jsx("path", { d: 'M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z' }) })) })), jsxs("ul", __assign({ tabIndex: 0, className: 'tw-menu tw-menu-compact tw-dropdown-content tw-mt-3 tw-p-2 tw-shadow tw-bg-base-100 tw-rounded-box tw-w-52 !tw-z-[10000]' }, { children: [jsx("li", { children: jsx(Link, __assign({ to: "".concat(userProfile.id && '/edit-item/' + userProfile.id) }, { children: "Profile" })) }), jsx("li", { children: jsx(Link, __assign({ to: '/user-settings' }, { children: "Settings" })) }), jsx("li", { children: jsx("a", __assign({ onClick: function () {
4133
+ void onLogout();
4133
4134
  } }, { children: "Logout" })) })] }))] }))] }))) : (jsxs("div", { children: [jsxs("div", __assign({ className: 'tw-hidden md:tw-flex' }, { children: [jsx(Link, __assign({ to: '/login' }, { children: jsx("div", __assign({ className: 'tw-btn tw-btn-ghost tw-mr-2' }, { children: "Login" })) })), jsx(Link, __assign({ to: '/signup' }, { children: jsx("div", __assign({ className: 'tw-btn tw-btn-ghost tw-mr-2' }, { children: "Sign Up" })) }))] })), jsxs("div", __assign({ className: 'tw-dropdown tw-dropdown-end' }, { children: [jsx("label", __assign({ tabIndex: 1, className: 'tw-btn tw-btn-ghost md:tw-hidden' }, { children: jsx("svg", __assign({ xmlns: 'http://www.w3.org/2000/svg', className: 'tw-h-5 tw-w-5', viewBox: '0 0 20 20', fill: 'currentColor' }, { children: jsx("path", { d: 'M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z' }) })) })), jsxs("ul", __assign({ tabIndex: 1, className: 'tw-menu tw-dropdown-content tw-mt-3 tw-p-2 tw-shadow tw-bg-base-100 tw-rounded-box tw-w-52 !tw-z-[10000]' }, { children: [jsx("li", { children: jsx(Link, __assign({ to: '/login' }, { children: "Login" })) }), jsx("li", { children: jsx(Link, __assign({ to: '/signup' }, { children: "Sign Up" })) })] }))] }))] }))] })) }));
4134
4135
  }
4135
4136
  else
@@ -4447,7 +4448,7 @@ var OverlayItemsIndexPage = function (_a) {
4447
4448
  if (success) {
4448
4449
  toast.success('New item created');
4449
4450
  }
4450
- addItem(__assign(__assign({}, formItem), { user_created: user, id: uuid, layer: layer, public_edit: !user }));
4451
+ addItem(__assign(__assign({}, formItem), { user_created: user !== null && user !== void 0 ? user : undefined, id: uuid, layer: layer, public_edit: !user }));
4451
4452
  setLoading(false);
4452
4453
  setAddItemPopupType('');
4453
4454
  return [2 /*return*/];
@@ -4630,7 +4631,7 @@ var AttestationForm = function (_a) {
4630
4631
  var to;
4631
4632
  return __generator(this, function (_a) {
4632
4633
  to = [];
4633
- users === null || users === void 0 ? void 0 : users.map(function (u) { return to.push({ directus_users_id: u.user_created.id }); });
4634
+ users === null || users === void 0 ? void 0 : users.map(function (u) { var _a; return to.push({ directus_users_id: (_a = u.user_created) === null || _a === void 0 ? void 0 : _a.id }); });
4634
4635
  (api === null || api === void 0 ? void 0 : api.createItem) &&
4635
4636
  toast
4636
4637
  .promise(api.createItem({
@@ -4653,9 +4654,9 @@ var AttestationForm = function (_a) {
4653
4654
  var _a;
4654
4655
  return navigate('/item/' +
4655
4656
  ((_a = items.find(function (i) {
4656
- var _a;
4657
- return i.user_created.id === to[0].directus_users_id &&
4658
- ((_a = i.layer) === null || _a === void 0 ? void 0 : _a.itemType.name) === 'player';
4657
+ var _a, _b;
4658
+ return ((_a = i.user_created) === null || _a === void 0 ? void 0 : _a.id) === to[0].directus_users_id &&
4659
+ ((_b = i.layer) === null || _b === void 0 ? void 0 : _b.itemType.name) === 'player';
4659
4660
  })) === null || _a === void 0 ? void 0 : _a.id) +
4660
4661
  '?tab=2');
4661
4662
  });
@@ -5118,8 +5119,9 @@ var FlexView = function (_a) {
5118
5119
  };
5119
5120
 
5120
5121
  var OnepagerView = function (_a) {
5122
+ var _b;
5121
5123
  var item = _a.item;
5122
- return (jsxs("div", __assign({ className: 'tw-h-full tw-overflow-y-auto fade' }, { children: [jsx(GroupSubHeaderView, { item: item, shareBaseUrl: "https://www.wuerdekompass.org/aktivitaeten/gruppensuche/#/gruppe/".concat(item.slug) }), item.user_created.first_name && jsx(ContactInfoView, { heading: 'Du hast Fragen?', item: item }), jsx("div", __assign({ className: 'tw-my-10 tw-mt-2 tw-px-6 tw-text-sm ' }, { children: jsx(TextView, { rawText: item.text || 'Keine Beschreibung vorhanden' }) })), item.next_appointment && (jsxs("div", __assign({ className: 'tw-my-10 tw-px-6' }, { children: [jsx("h2", __assign({ className: 'tw-text-lg tw-font-semibold' }, { children: "N\u00E4chste Termine" })), jsx("div", __assign({ className: 'tw-mt-2 tw-text-sm' }, { children: jsx(TextView, { rawText: item.next_appointment }) }))] }))), ";"] })));
5124
+ return (jsxs("div", __assign({ className: 'tw-h-full tw-overflow-y-auto fade' }, { children: [jsx(GroupSubHeaderView, { item: item, shareBaseUrl: "https://www.wuerdekompass.org/aktivitaeten/gruppensuche/#/gruppe/".concat(item.slug) }), ((_b = item.user_created) === null || _b === void 0 ? void 0 : _b.first_name) && jsx(ContactInfoView, { heading: 'Du hast Fragen?', item: item }), jsx("div", __assign({ className: 'tw-my-10 tw-mt-2 tw-px-6 tw-text-sm ' }, { children: jsx(TextView, { rawText: item.text || 'Keine Beschreibung vorhanden' }) })), item.next_appointment && (jsxs("div", __assign({ className: 'tw-my-10 tw-px-6' }, { children: [jsx("h2", __assign({ className: 'tw-text-lg tw-font-semibold' }, { children: "N\u00E4chste Termine" })), jsx("div", __assign({ className: 'tw-mt-2 tw-text-sm' }, { children: jsx(TextView, { rawText: item.next_appointment }) }))] }))), ";"] })));
5123
5125
  };
5124
5126
 
5125
5127
  var SimpleView = function (_a) {
@@ -5219,7 +5221,7 @@ var TabsView = function (_a) {
5219
5221
  // eslint-disable-next-line react-hooks/exhaustive-deps
5220
5222
  }, [location.search]);
5221
5223
  return (jsxs("div", __assign({ role: 'tablist', className: 'tw-tabs tw-tabs-lifted tw-mt-2 tw-mb-2 tw-px-6' }, { children: [jsx("input", { type: 'radio', name: 'my_tabs_2', role: 'tab', className: 'tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]', "aria-label": "".concat(((_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemType.icon_as_labels) && activeTab !== 1 ? '📝' : '📝\u00A0Info'), checked: activeTab === 1 && true, onChange: function () { return updateActiveTab(1); } }), jsxs("div", __assign({ role: 'tabpanel', className: 'tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-280px)] tw-overflow-y-auto fade tw-pt-2 tw-pb-4 tw-mb-4 tw-overflow-x-hidden' }, { children: [((_c = item.layer) === null || _c === void 0 ? void 0 : _c.itemType.show_start_end) && (jsx("div", __assign({ className: 'tw-max-w-xs' }, { children: jsx(StartEndView, { item: item }) }))), jsx(TextView, { item: item }), jsx("div", { className: 'tw-h-4' }), jsx(TextView, { item: item, itemTextField: 'contact' })] })), ((_d = item.layer) === null || _d === void 0 ? void 0 : _d.itemType.questlog) && (jsxs(Fragment, { children: [jsx("input", { type: 'radio', name: 'my_tabs_2', role: 'tab', className: 'tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]', "aria-label": "".concat(item.layer.itemType.icon_as_labels && activeTab !== 2 ? '❤️' : '❤️\u00A0Credibility'), checked: activeTab === 2 && true, onChange: function () { return updateActiveTab(2); } }), jsx("div", __assign({ role: 'tabpanel', className: 'tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-280px)] tw-overflow-y-auto fade tw-pt-2 tw-pb-4 tw-mb-4 tw-overflow-x-hidden' }, { children: jsx("table", __assign({ className: 'sm:tw-table-sm md:tw-table-md' }, { children: jsx("tbody", { children: attestations
5222
- .filter(function (a) { return a.to.some(function (t) { return t.directus_users_id === item.user_created.id; }); })
5224
+ .filter(function (a) { return a.to.some(function (t) { var _a; return t.directus_users_id === ((_a = item.user_created) === null || _a === void 0 ? void 0 : _a.id); }); })
5223
5225
  .sort(function (a, b) {
5224
5226
  return new Date(b.date_created).getTime() - new Date(a.date_created).getTime();
5225
5227
  })
@@ -5636,7 +5638,7 @@ var MarkdownHint = function () {
5636
5638
  };
5637
5639
 
5638
5640
  var ProfileTextForm = function (_a) {
5639
- var state = _a.state, setState = _a.setState, dataField = _a.dataField, heading = _a.heading, size = _a.size, hideInputLabel = _a.hideInputLabel;
5641
+ var state = _a.state, setState = _a.setState, dataField = _a.dataField, heading = _a.heading, size = _a.size, hideInputLabel = _a.hideInputLabel, required = _a.required;
5640
5642
  var _b = useState(dataField || 'text'), field = _b[0], setField = _b[1];
5641
5643
  useEffect(function () {
5642
5644
  if (!dataField) {
@@ -5648,7 +5650,7 @@ var ProfileTextForm = function (_a) {
5648
5650
  var _a;
5649
5651
  return (__assign(__assign({}, prevState), (_a = {}, _a[field] = v, _a)));
5650
5652
  });
5651
- }, labelStyle: hideInputLabel ? 'tw-hidden' : '', containerStyle: size === 'full' ? 'tw-grow tw-h-full' : '', inputStyle: size === 'full' ? 'tw-h-full' : 'tw-h-24' })] })));
5653
+ }, labelStyle: hideInputLabel ? 'tw-hidden' : '', containerStyle: size === 'full' ? 'tw-grow tw-h-full' : '', inputStyle: size === 'full' ? 'tw-h-full' : 'tw-h-24', required: required })] })));
5652
5654
  };
5653
5655
 
5654
5656
  var componentMap = {
@@ -5897,6 +5899,7 @@ function ProfileForm() {
5897
5899
  item && hasUserPermission('items', 'update', item) && setUpdatePermission(true);
5898
5900
  }, [hasUserPermission, item]);
5899
5901
  useEffect(function () {
5902
+ var _a;
5900
5903
  var itemId = location.pathname.split('/')[2];
5901
5904
  var item = items.find(function (i) { return i.id === itemId; });
5902
5905
  item && setItem(item);
@@ -5904,7 +5907,7 @@ function ProfileForm() {
5904
5907
  var layer = layers.find(function (l) { return l.itemType.name === appState.userType; });
5905
5908
  setItem({
5906
5909
  id: crypto.randomUUID(),
5907
- name: user ? user.first_name : '',
5910
+ name: (_a = user === null || user === void 0 ? void 0 : user.first_name) !== null && _a !== void 0 ? _a : '',
5908
5911
  text: '',
5909
5912
  layer: layer,
5910
5913
  new: true,