utopia-ui 3.0.60 → 3.0.62
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/README.md +5 -3
- package/dist/index.cjs +269 -199
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +396 -27
- package/dist/index.esm.js +268 -200
- package/dist/index.esm.js.map +1 -1
- package/dist/types/cypress/support/component.d.ts +9 -0
- package/dist/types/cypress.config.d.ts +2 -0
- package/dist/types/src/Components/AppShell/AppShell.d.ts +4 -0
- package/dist/types/src/Components/AppShell/Content.d.ts +3 -0
- package/dist/types/src/Components/AppShell/SideBar.d.ts +3 -0
- package/dist/types/src/Components/AppShell/Sitemap.d.ts +3 -0
- package/dist/types/src/Components/AppShell/index.d.ts +1 -1
- package/dist/types/src/Components/Auth/LoginPage.d.ts +3 -0
- package/dist/types/src/Components/Auth/RequestPasswordPage.d.ts +3 -0
- package/dist/types/src/Components/Auth/SetNewPasswordPage.d.ts +3 -0
- package/dist/types/src/Components/Auth/SignupPage.d.ts +3 -0
- package/dist/types/src/Components/Auth/index.d.ts +1 -1
- package/dist/types/src/Components/Auth/useAuth.d.ts +5 -1
- package/dist/types/src/Components/Gaming/Modal.d.ts +3 -0
- package/dist/types/src/Components/Gaming/Quests.d.ts +3 -0
- package/dist/types/src/Components/Input/SelectBox.d.ts +3 -0
- package/dist/types/src/Components/Input/TextAreaInput.d.ts +3 -0
- package/dist/types/src/Components/Input/TextInput.d.ts +3 -0
- package/dist/types/src/Components/Map/ItemForm.d.ts +3 -0
- package/dist/types/src/Components/Map/ItemView.d.ts +3 -0
- package/dist/types/src/Components/Map/Layer.d.ts +8 -1
- package/dist/types/src/Components/Map/Permissions.d.ts +11 -2
- package/dist/types/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.d.ts +1 -4
- package/dist/types/src/Components/Map/Subcomponents/ItemPopupComponents/PopupButton.d.ts +4 -2
- package/dist/types/src/Components/Map/Subcomponents/ItemPopupComponents/PopupCheckboxInput.d.ts +3 -0
- package/dist/types/src/Components/Map/Subcomponents/ItemPopupComponents/PopupStartEndInput.d.ts +3 -0
- package/dist/types/src/Components/Map/Subcomponents/ItemPopupComponents/PopupTextAreaInput.d.ts +3 -0
- package/dist/types/src/Components/Map/Subcomponents/ItemPopupComponents/PopupTextInput.d.ts +3 -0
- package/dist/types/src/Components/Map/Subcomponents/ItemPopupComponents/StartEndView.d.ts +3 -0
- package/dist/types/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.d.ts +7 -2
- package/dist/types/src/Components/Map/Tags.d.ts +3 -0
- package/dist/types/src/Components/Map/UtopiaMap.d.ts +3 -0
- package/dist/types/src/Components/Map/index.d.ts +2 -2
- package/dist/types/src/Components/Profile/ProfileForm.d.ts +3 -0
- package/dist/types/src/Components/Profile/ProfileView.d.ts +3 -0
- package/dist/types/src/Components/Profile/Subcomponents/ActionsButton.d.ts +1 -2
- package/dist/types/src/Components/Profile/Subcomponents/LinkedItemsHeaderView.d.ts +1 -4
- package/dist/types/src/Components/Profile/UserSettings.d.ts +3 -0
- package/dist/types/src/Components/Templates/AttestationForm.d.ts +3 -0
- package/dist/types/src/Components/Templates/CardPage.d.ts +3 -0
- package/dist/types/src/Components/Templates/ItemCard.d.ts +1 -2
- package/dist/types/src/Components/Templates/MapOverlayPage.d.ts +3 -0
- package/dist/types/src/Components/Templates/MarketView.d.ts +3 -0
- package/dist/types/src/Components/Templates/MoonCalendar.d.ts +3 -0
- package/dist/types/src/Components/Templates/OverlayItemsIndexPage.d.ts +4 -1
- package/dist/types/src/Components/Templates/SelectUser.d.ts +3 -0
- package/dist/types/src/Components/Templates/TitleCard.d.ts +3 -0
- package/dist/types/src/index.d.ts +7 -8
- package/package.json +12 -5
- package/dist/Components/AppShell/AppShell.d.ts +0 -8
- package/dist/Components/AppShell/Content.d.ts +0 -6
- package/dist/Components/AppShell/ContextWrapper.d.ts +0 -6
- package/dist/Components/AppShell/NavBar.d.ts +0 -4
- package/dist/Components/AppShell/SetAppState.d.ts +0 -5
- package/dist/Components/AppShell/SideBar.d.ts +0 -13
- package/dist/Components/AppShell/SidebarSubmenu.d.ts +0 -8
- package/dist/Components/AppShell/Sitemap.d.ts +0 -3
- package/dist/Components/AppShell/hooks/useAppState.d.ts +0 -17
- package/dist/Components/AppShell/hooks/useAssets.d.ts +0 -13
- package/dist/Components/AppShell/index.d.ts +0 -4
- package/dist/Components/Auth/LoginPage.d.ts +0 -1
- package/dist/Components/Auth/RequestPasswordPage.d.ts +0 -3
- package/dist/Components/Auth/SetNewPasswordPage.d.ts +0 -1
- package/dist/Components/Auth/SignupPage.d.ts +0 -1
- package/dist/Components/Auth/index.d.ts +0 -5
- package/dist/Components/Auth/useAuth.d.ts +0 -27
- package/dist/Components/Gaming/Modal.d.ts +0 -5
- package/dist/Components/Gaming/Quests.d.ts +0 -1
- package/dist/Components/Gaming/hooks/useQuests.d.ts +0 -13
- package/dist/Components/Gaming/index.d.ts +0 -2
- package/dist/Components/Input/Autocomplete.d.ts +0 -7
- package/dist/Components/Input/ComboBoxInput.d.ts +0 -8
- package/dist/Components/Input/SelectBox.d.ts +0 -16
- package/dist/Components/Input/TextAreaInput.d.ts +0 -13
- package/dist/Components/Input/TextInput.d.ts +0 -16
- package/dist/Components/Input/index.d.ts +0 -3
- package/dist/Components/Map/ItemForm.d.ts +0 -17
- package/dist/Components/Map/ItemView.d.ts +0 -14
- package/dist/Components/Map/Layer.d.ts +0 -2
- package/dist/Components/Map/Permissions.d.ts +0 -7
- package/dist/Components/Map/Subcomponents/AddButton.d.ts +0 -4
- package/dist/Components/Map/Subcomponents/Controls/Control.d.ts +0 -6
- package/dist/Components/Map/Subcomponents/Controls/FilterControl.d.ts +0 -1
- package/dist/Components/Map/Subcomponents/Controls/GratitudeControl.d.ts +0 -1
- package/dist/Components/Map/Subcomponents/Controls/LayerControl.d.ts +0 -1
- package/dist/Components/Map/Subcomponents/Controls/LocateControl.d.ts +0 -3
- package/dist/Components/Map/Subcomponents/Controls/QuestControl.d.ts +0 -1
- package/dist/Components/Map/Subcomponents/Controls/SearchControl.d.ts +0 -1
- package/dist/Components/Map/Subcomponents/Controls/SidebarControl.d.ts +0 -1
- package/dist/Components/Map/Subcomponents/Controls/TagsControl.d.ts +0 -1
- package/dist/Components/Map/Subcomponents/ItemFormPopup.d.ts +0 -2
- package/dist/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.d.ts +0 -18
- package/dist/Components/Map/Subcomponents/ItemPopupComponents/PopupButton.d.ts +0 -7
- package/dist/Components/Map/Subcomponents/ItemPopupComponents/PopupCheckboxInput.d.ts +0 -6
- package/dist/Components/Map/Subcomponents/ItemPopupComponents/PopupStartEndInput.d.ts +0 -9
- package/dist/Components/Map/Subcomponents/ItemPopupComponents/PopupTextAreaInput.d.ts +0 -7
- package/dist/Components/Map/Subcomponents/ItemPopupComponents/PopupTextInput.d.ts +0 -7
- package/dist/Components/Map/Subcomponents/ItemPopupComponents/StartEndView.d.ts +0 -4
- package/dist/Components/Map/Subcomponents/ItemPopupComponents/TextView.d.ts +0 -6
- package/dist/Components/Map/Subcomponents/ItemViewPopup.d.ts +0 -9
- package/dist/Components/Map/Subcomponents/SelectPosition.d.ts +0 -3
- package/dist/Components/Map/Tags.d.ts +0 -6
- package/dist/Components/Map/UtopiaMap.d.ts +0 -4
- package/dist/Components/Map/UtopiaMapInner.d.ts +0 -4
- package/dist/Components/Map/hooks/useClusterRef.d.ts +0 -12
- package/dist/Components/Map/hooks/useDebounce.d.ts +0 -1
- package/dist/Components/Map/hooks/useFilter.d.ts +0 -41
- package/dist/Components/Map/hooks/useItems.d.ts +0 -27
- package/dist/Components/Map/hooks/useLayers.d.ts +0 -14
- package/dist/Components/Map/hooks/useLeafletRefs.d.ts +0 -22
- package/dist/Components/Map/hooks/usePermissions.d.ts +0 -24
- package/dist/Components/Map/hooks/useSelectPosition.d.ts +0 -24
- package/dist/Components/Map/hooks/useTags.d.ts +0 -24
- package/dist/Components/Map/hooks/useTimeout.d.ts +0 -4
- package/dist/Components/Map/hooks/useWindowDimension.d.ts +0 -4
- package/dist/Components/Map/index.d.ts +0 -13
- package/dist/Components/Map/setItemLocation.d.ts +0 -1
- package/dist/Components/Profile/ProfileForm.d.ts +0 -1
- package/dist/Components/Profile/ProfileView.d.ts +0 -4
- package/dist/Components/Profile/Subcomponents/ActionsButton.d.ts +0 -10
- package/dist/Components/Profile/Subcomponents/AvatarWidget.d.ts +0 -8
- package/dist/Components/Profile/Subcomponents/ColorPicker.d.ts +0 -6
- package/dist/Components/Profile/Subcomponents/ContactInfoForm.d.ts +0 -5
- package/dist/Components/Profile/Subcomponents/ContactInfoView.d.ts +0 -5
- package/dist/Components/Profile/Subcomponents/FormHeader.d.ts +0 -5
- package/dist/Components/Profile/Subcomponents/GroupSubHeaderView.d.ts +0 -6
- package/dist/Components/Profile/Subcomponents/GroupSubheaderForm.d.ts +0 -18
- package/dist/Components/Profile/Subcomponents/LinkedItemsHeaderView.d.ts +0 -7
- package/dist/Components/Profile/Subcomponents/MarkdownHint.d.ts +0 -1
- package/dist/Components/Profile/Subcomponents/PlusButton.d.ts +0 -7
- package/dist/Components/Profile/Subcomponents/ProfileStartEndForm.d.ts +0 -5
- package/dist/Components/Profile/Subcomponents/ProfileStartEndView.d.ts +0 -4
- package/dist/Components/Profile/Subcomponents/ProfileTextForm.d.ts +0 -10
- package/dist/Components/Profile/Subcomponents/ProfileTextView.d.ts +0 -7
- package/dist/Components/Profile/Subcomponents/RelationCard.d.ts +0 -6
- package/dist/Components/Profile/Subcomponents/SocialShareBar.d.ts +0 -6
- package/dist/Components/Profile/Subcomponents/SocialShareButton.d.ts +0 -6
- package/dist/Components/Profile/Subcomponents/TagsWidget.d.ts +0 -6
- package/dist/Components/Profile/Templates/FlexForm.d.ts +0 -7
- package/dist/Components/Profile/Templates/FlexView.d.ts +0 -4
- package/dist/Components/Profile/Templates/OnepagerForm.d.ts +0 -7
- package/dist/Components/Profile/Templates/OnepagerView.d.ts +0 -4
- package/dist/Components/Profile/Templates/SimpleForm.d.ts +0 -4
- package/dist/Components/Profile/Templates/SimpleView.d.ts +0 -4
- package/dist/Components/Profile/Templates/TabsForm.d.ts +0 -10
- package/dist/Components/Profile/Templates/TabsView.d.ts +0 -13
- package/dist/Components/Profile/UserSettings.d.ts +0 -1
- package/dist/Components/Profile/hooks/useClickOutside.d.ts +0 -2
- package/dist/Components/Profile/index.d.ts +0 -4
- package/dist/Components/Profile/itemFunctions.d.ts +0 -5
- package/dist/Components/Templates/AttestationForm.d.ts +0 -4
- package/dist/Components/Templates/CardPage.d.ts +0 -10
- package/dist/Components/Templates/CircleLayout.d.ts +0 -5
- package/dist/Components/Templates/DateUserInfo.d.ts +0 -4
- package/dist/Components/Templates/DialogModal.d.ts +0 -12
- package/dist/Components/Templates/EmojiPicker.d.ts +0 -10
- package/dist/Components/Templates/ItemCard.d.ts +0 -7
- package/dist/Components/Templates/MapOverlayPage.d.ts +0 -7
- package/dist/Components/Templates/MarketView.d.ts +0 -1
- package/dist/Components/Templates/MoonCalendar.d.ts +0 -1
- package/dist/Components/Templates/OverlayItemsIndexPage.d.ts +0 -5
- package/dist/Components/Templates/SelectUser.d.ts +0 -1
- package/dist/Components/Templates/TagView.d.ts +0 -7
- package/dist/Components/Templates/TitleCard.d.ts +0 -11
- package/dist/Components/Templates/index.d.ts +0 -8
- package/dist/Components/Typography/ErrorText.d.ts +0 -5
- package/dist/Components/Typography/Subtitle.d.ts +0 -6
- package/dist/Utils/ContainsUUID.d.ts +0 -1
- package/dist/Utils/FormatTags.d.ts +0 -2
- package/dist/Utils/HashTagRegex.d.ts +0 -1
- package/dist/Utils/MarkerIconFactory.d.ts +0 -2
- package/dist/Utils/Moon.d.ts +0 -7
- package/dist/Utils/RandomColor.d.ts +0 -1
- package/dist/Utils/ReplaceURLs.d.ts +0 -3
- package/dist/Utils/ReverseGeocoder.d.ts +0 -1
- package/dist/Utils/TimeAgo.d.ts +0 -1
- package/dist/index.js +0 -5268
- package/dist/index.js.map +0 -1
- package/dist/setupTest.d.ts +0 -1
- package/dist/src/Components/AppShell/AppShell.d.ts +0 -7
- package/dist/src/Components/AppShell/Content.d.ts +0 -5
- package/dist/src/Components/AppShell/ContextWrapper.d.ts +0 -6
- package/dist/src/Components/AppShell/NavBar.d.ts +0 -4
- package/dist/src/Components/AppShell/SetAppState.d.ts +0 -5
- package/dist/src/Components/AppShell/SideBar.d.ts +0 -12
- package/dist/src/Components/AppShell/SidebarSubmenu.d.ts +0 -7
- package/dist/src/Components/AppShell/Sitemap.d.ts +0 -3
- package/dist/src/Components/AppShell/hooks/useAppState.d.ts +0 -16
- package/dist/src/Components/AppShell/hooks/useAssets.d.ts +0 -12
- package/dist/src/Components/AppShell/index.d.ts +0 -4
- package/dist/src/Components/Auth/LoginPage.d.ts +0 -1
- package/dist/src/Components/Auth/RequestPasswordPage.d.ts +0 -3
- package/dist/src/Components/Auth/SetNewPasswordPage.d.ts +0 -1
- package/dist/src/Components/Auth/SignupPage.d.ts +0 -1
- package/dist/src/Components/Auth/index.d.ts +0 -5
- package/dist/src/Components/Auth/useAuth.d.ts +0 -26
- package/dist/src/Components/Gaming/Modal.d.ts +0 -4
- package/dist/src/Components/Gaming/Quests.d.ts +0 -1
- package/dist/src/Components/Gaming/hooks/useQuests.d.ts +0 -12
- package/dist/src/Components/Gaming/index.d.ts +0 -2
- package/dist/src/Components/Input/Autocomplete.d.ts +0 -7
- package/dist/src/Components/Input/ComboBoxInput.d.ts +0 -8
- package/dist/src/Components/Input/SelectBox.d.ts +0 -16
- package/dist/src/Components/Input/TextAreaInput.d.ts +0 -13
- package/dist/src/Components/Input/TextInput.d.ts +0 -16
- package/dist/src/Components/Input/index.d.ts +0 -3
- package/dist/src/Components/Map/ItemForm.d.ts +0 -16
- package/dist/src/Components/Map/ItemView.d.ts +0 -14
- package/dist/src/Components/Map/Layer.d.ts +0 -2
- package/dist/src/Components/Map/Permissions.d.ts +0 -7
- package/dist/src/Components/Map/Subcomponents/AddButton.d.ts +0 -3
- package/dist/src/Components/Map/Subcomponents/Controls/Control.d.ts +0 -6
- package/dist/src/Components/Map/Subcomponents/Controls/FilterControl.d.ts +0 -1
- package/dist/src/Components/Map/Subcomponents/Controls/GratitudeControl.d.ts +0 -1
- package/dist/src/Components/Map/Subcomponents/Controls/LayerControl.d.ts +0 -1
- package/dist/src/Components/Map/Subcomponents/Controls/LocateControl.d.ts +0 -3
- package/dist/src/Components/Map/Subcomponents/Controls/QuestControl.d.ts +0 -1
- package/dist/src/Components/Map/Subcomponents/Controls/SearchControl.d.ts +0 -1
- package/dist/src/Components/Map/Subcomponents/Controls/SidebarControl.d.ts +0 -1
- package/dist/src/Components/Map/Subcomponents/Controls/TagsControl.d.ts +0 -1
- package/dist/src/Components/Map/Subcomponents/ItemFormPopup.d.ts +0 -2
- package/dist/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.d.ts +0 -15
- package/dist/src/Components/Map/Subcomponents/ItemPopupComponents/PopupButton.d.ts +0 -7
- package/dist/src/Components/Map/Subcomponents/ItemPopupComponents/PopupCheckboxInput.d.ts +0 -6
- package/dist/src/Components/Map/Subcomponents/ItemPopupComponents/PopupStartEndInput.d.ts +0 -9
- package/dist/src/Components/Map/Subcomponents/ItemPopupComponents/PopupTextAreaInput.d.ts +0 -7
- package/dist/src/Components/Map/Subcomponents/ItemPopupComponents/PopupTextInput.d.ts +0 -7
- package/dist/src/Components/Map/Subcomponents/ItemPopupComponents/StartEndView.d.ts +0 -4
- package/dist/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.d.ts +0 -6
- package/dist/src/Components/Map/Subcomponents/ItemViewPopup.d.ts +0 -8
- package/dist/src/Components/Map/Subcomponents/SelectPosition.d.ts +0 -3
- package/dist/src/Components/Map/Tags.d.ts +0 -6
- package/dist/src/Components/Map/UtopiaMap.d.ts +0 -4
- package/dist/src/Components/Map/UtopiaMapInner.d.ts +0 -4
- package/dist/src/Components/Map/hooks/useClusterRef.d.ts +0 -11
- package/dist/src/Components/Map/hooks/useDebounce.d.ts +0 -1
- package/dist/src/Components/Map/hooks/useFilter.d.ts +0 -40
- package/dist/src/Components/Map/hooks/useItems.d.ts +0 -26
- package/dist/src/Components/Map/hooks/useLayers.d.ts +0 -13
- package/dist/src/Components/Map/hooks/useLeafletRefs.d.ts +0 -21
- package/dist/src/Components/Map/hooks/usePermissions.d.ts +0 -23
- package/dist/src/Components/Map/hooks/useSelectPosition.d.ts +0 -23
- package/dist/src/Components/Map/hooks/useTags.d.ts +0 -23
- package/dist/src/Components/Map/hooks/useTimeout.d.ts +0 -4
- package/dist/src/Components/Map/hooks/useWindowDimension.d.ts +0 -4
- package/dist/src/Components/Map/index.d.ts +0 -13
- package/dist/src/Components/Map/setItemLocation.d.ts +0 -1
- package/dist/src/Components/Profile/ProfileForm.d.ts +0 -1
- package/dist/src/Components/Profile/ProfileView.d.ts +0 -4
- package/dist/src/Components/Profile/Subcomponents/ActionsButton.d.ts +0 -10
- package/dist/src/Components/Profile/Subcomponents/AvatarWidget.d.ts +0 -7
- package/dist/src/Components/Profile/Subcomponents/ColorPicker.d.ts +0 -6
- package/dist/src/Components/Profile/Subcomponents/ContactInfoForm.d.ts +0 -5
- package/dist/src/Components/Profile/Subcomponents/ContactInfoView.d.ts +0 -5
- package/dist/src/Components/Profile/Subcomponents/FormHeader.d.ts +0 -5
- package/dist/src/Components/Profile/Subcomponents/GalleryView.d.ts +0 -6
- package/dist/src/Components/Profile/Subcomponents/GroupSubHeaderView.d.ts +0 -6
- package/dist/src/Components/Profile/Subcomponents/GroupSubheaderForm.d.ts +0 -18
- package/dist/src/Components/Profile/Subcomponents/LinkedItemsHeaderView.d.ts +0 -7
- package/dist/src/Components/Profile/Subcomponents/MarkdownHint.d.ts +0 -1
- package/dist/src/Components/Profile/Subcomponents/PlusButton.d.ts +0 -7
- package/dist/src/Components/Profile/Subcomponents/ProfileStartEndForm.d.ts +0 -5
- package/dist/src/Components/Profile/Subcomponents/ProfileStartEndView.d.ts +0 -4
- package/dist/src/Components/Profile/Subcomponents/ProfileTextForm.d.ts +0 -10
- package/dist/src/Components/Profile/Subcomponents/ProfileTextView.d.ts +0 -7
- package/dist/src/Components/Profile/Subcomponents/RelationCard.d.ts +0 -6
- package/dist/src/Components/Profile/Subcomponents/SocialShareBar.d.ts +0 -6
- package/dist/src/Components/Profile/Subcomponents/SocialShareButton.d.ts +0 -6
- package/dist/src/Components/Profile/Subcomponents/TagsWidget.d.ts +0 -6
- package/dist/src/Components/Profile/Templates/FlexForm.d.ts +0 -7
- package/dist/src/Components/Profile/Templates/FlexView.d.ts +0 -4
- package/dist/src/Components/Profile/Templates/OnepagerForm.d.ts +0 -7
- package/dist/src/Components/Profile/Templates/OnepagerView.d.ts +0 -4
- package/dist/src/Components/Profile/Templates/SimpleForm.d.ts +0 -4
- package/dist/src/Components/Profile/Templates/SimpleView.d.ts +0 -4
- package/dist/src/Components/Profile/Templates/TabsForm.d.ts +0 -10
- package/dist/src/Components/Profile/Templates/TabsView.d.ts +0 -13
- package/dist/src/Components/Profile/UserSettings.d.ts +0 -1
- package/dist/src/Components/Profile/hooks/useClickOutside.d.ts +0 -2
- package/dist/src/Components/Profile/index.d.ts +0 -4
- package/dist/src/Components/Profile/itemFunctions.d.ts +0 -5
- package/dist/src/Components/Templates/AttestationForm.d.ts +0 -4
- package/dist/src/Components/Templates/CardPage.d.ts +0 -9
- package/dist/src/Components/Templates/CircleLayout.d.ts +0 -5
- package/dist/src/Components/Templates/DateUserInfo.d.ts +0 -4
- package/dist/src/Components/Templates/DialogModal.d.ts +0 -11
- package/dist/src/Components/Templates/EmojiPicker.d.ts +0 -10
- package/dist/src/Components/Templates/ItemCard.d.ts +0 -7
- package/dist/src/Components/Templates/MapOverlayPage.d.ts +0 -6
- package/dist/src/Components/Templates/MarketView.d.ts +0 -1
- package/dist/src/Components/Templates/MoonCalendar.d.ts +0 -1
- package/dist/src/Components/Templates/OverlayItemsIndexPage.d.ts +0 -5
- package/dist/src/Components/Templates/SelectUser.d.ts +0 -1
- package/dist/src/Components/Templates/TagView.d.ts +0 -7
- package/dist/src/Components/Templates/TitleCard.d.ts +0 -10
- package/dist/src/Components/Templates/index.d.ts +0 -8
- package/dist/src/Components/Typography/ErrorText.d.ts +0 -5
- package/dist/src/Components/Typography/Subtitle.d.ts +0 -5
- package/dist/src/Utils/ContainsUUID.d.ts +0 -1
- package/dist/src/Utils/FormatTags.d.ts +0 -2
- package/dist/src/Utils/GetValue.d.ts +0 -1
- package/dist/src/Utils/HashTagRegex.d.ts +0 -1
- package/dist/src/Utils/MarkerIconFactory.d.ts +0 -2
- package/dist/src/Utils/Moon.d.ts +0 -7
- package/dist/src/Utils/RandomColor.d.ts +0 -1
- package/dist/src/Utils/ReplaceURLs.d.ts +0 -3
- package/dist/src/Utils/ReverseGeocoder.d.ts +0 -1
- package/dist/src/Utils/TimeAgo.d.ts +0 -1
- package/dist/src/index.d.ts +0 -15
- package/dist/vite.config.d.ts +0 -2
- /package/dist/{src/Components/Input/TextInput.spec.d.ts → types/src/Components/Input/TextInput.cy.d.ts} +0 -0
package/dist/index.cjs
CHANGED
@@ -434,6 +434,7 @@ function useItemsManager(initialItems) {
|
|
434
434
|
},
|
435
435
|
});
|
436
436
|
result.map((item) => {
|
437
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
437
438
|
dispatch({ type: 'ADD', item: { ...item, layer } });
|
438
439
|
return null;
|
439
440
|
});
|
@@ -582,6 +583,9 @@ const AuthContext = react.createContext({
|
|
582
583
|
requestPasswordReset: () => Promise.reject(Error('Unimplemented')),
|
583
584
|
passwordReset: () => Promise.reject(Error('Unimplemented')),
|
584
585
|
});
|
586
|
+
/**
|
587
|
+
* @category Auth
|
588
|
+
*/
|
585
589
|
const AuthProvider = ({ userApi, children }) => {
|
586
590
|
const [user, setUser] = react.useState(null);
|
587
591
|
const [token, setToken] = react.useState(null);
|
@@ -926,22 +930,6 @@ const useSetMapClicked = () => {
|
|
926
930
|
return setMapClicked;
|
927
931
|
};
|
928
932
|
|
929
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
930
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
931
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
932
|
-
function getValue(obj, path) {
|
933
|
-
if (!obj || typeof path !== 'string')
|
934
|
-
return undefined;
|
935
|
-
const pathArray = path.split('.'); // Use a different variable for the split path
|
936
|
-
for (let i = 0, len = pathArray.length; i < len; i++) {
|
937
|
-
if (!obj)
|
938
|
-
return undefined; // Check if obj is falsy at each step
|
939
|
-
// eslint-disable-next-line security/detect-object-injection
|
940
|
-
obj = obj[pathArray[i]]; // Dive one level deeper
|
941
|
-
}
|
942
|
-
return obj; // Return the final value
|
943
|
-
}
|
944
|
-
|
945
933
|
const hashTagRegex = /(#+[a-zA-Z0-9À-ÖØ-öø-ʸ_-]{1,})/g;
|
946
934
|
|
947
935
|
const TagContext = react.createContext({
|
@@ -1005,7 +993,7 @@ function useTagsManager(initialTags) {
|
|
1005
993
|
}
|
1006
994
|
};
|
1007
995
|
const getItemTags = react.useCallback((item) => {
|
1008
|
-
const text = item.
|
996
|
+
const text = item.text;
|
1009
997
|
const itemTagStrings = text?.match(hashTagRegex);
|
1010
998
|
const itemTags = [];
|
1011
999
|
itemTagStrings?.map((tag) => {
|
@@ -1014,18 +1002,15 @@ function useTagsManager(initialTags) {
|
|
1014
1002
|
}
|
1015
1003
|
return null;
|
1016
1004
|
});
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
need && itemTags.push(need);
|
1027
|
-
return null;
|
1028
|
-
});
|
1005
|
+
// Could be refactored as it occurs in multiple places
|
1006
|
+
item.offers?.forEach((o) => {
|
1007
|
+
const offer = tags.find((t) => t.id === o.tags_id);
|
1008
|
+
offer && itemTags.push(offer);
|
1009
|
+
});
|
1010
|
+
item.needs?.forEach((n) => {
|
1011
|
+
const need = tags.find((t) => t.id === n.tags_id);
|
1012
|
+
need && itemTags.push(need);
|
1013
|
+
});
|
1029
1014
|
return itemTags;
|
1030
1015
|
}, [tags]);
|
1031
1016
|
return { tags, addTag, setTagApi, setTagData, getItemTags, allTagsLoaded };
|
@@ -1185,6 +1170,9 @@ function FilterControl() {
|
|
1185
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' }) }) })] })) }));
|
1186
1171
|
}
|
1187
1172
|
|
1173
|
+
/**
|
1174
|
+
* @category Templates
|
1175
|
+
*/
|
1188
1176
|
function MapOverlayPage({ children, className, backdrop, card = true, }) {
|
1189
1177
|
const closeScreen = () => {
|
1190
1178
|
navigate(`/${window.location.search ? window.location.search : ''}`);
|
@@ -1206,6 +1194,9 @@ function MapOverlayPage({ children, className, backdrop, card = true, }) {
|
|
1206
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" })] }) }) }));
|
1207
1195
|
}
|
1208
1196
|
|
1197
|
+
/**
|
1198
|
+
* @category Auth
|
1199
|
+
*/
|
1209
1200
|
function LoginPage() {
|
1210
1201
|
const [email, setEmail] = react.useState('');
|
1211
1202
|
const [password, setPassword] = react.useState('');
|
@@ -1248,6 +1239,9 @@ function LoginPage() {
|
|
1248
1239
|
: 'tw-btn tw-btn-primary tw-btn-block', onClick: () => onLogin(), children: loading ? jsxRuntime.jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Login' }) })] }));
|
1249
1240
|
}
|
1250
1241
|
|
1242
|
+
/**
|
1243
|
+
* @category Auth
|
1244
|
+
*/
|
1251
1245
|
function SignupPage() {
|
1252
1246
|
const [email, setEmail] = react.useState('');
|
1253
1247
|
const [userName, setUserName] = react.useState('');
|
@@ -1291,6 +1285,9 @@ function SignupPage() {
|
|
1291
1285
|
: 'tw-btn tw-btn-primary tw-btn-block', onClick: () => onRegister(), children: loading ? jsxRuntime.jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Sign Up' }) })] }));
|
1292
1286
|
}
|
1293
1287
|
|
1288
|
+
/**
|
1289
|
+
* @category Auth
|
1290
|
+
*/
|
1294
1291
|
// eslint-disable-next-line react/prop-types
|
1295
1292
|
function RequestPasswordPage({ resetUrl }) {
|
1296
1293
|
const [email, setEmail] = react.useState('');
|
@@ -1319,6 +1316,9 @@ function RequestPasswordPage({ resetUrl }) {
|
|
1319
1316
|
: 'tw-btn tw-btn-primary tw-btn-block', onClick: () => onReset(), children: loading ? jsxRuntime.jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Send' }) })] }));
|
1320
1317
|
}
|
1321
1318
|
|
1319
|
+
/**
|
1320
|
+
* @category Auth
|
1321
|
+
*/
|
1322
1322
|
function SetNewPasswordPage() {
|
1323
1323
|
const [password, setPassword] = react.useState('');
|
1324
1324
|
const { passwordReset, loading } = useAuth();
|
@@ -2519,13 +2519,9 @@ const SearchControl = () => {
|
|
2519
2519
|
};
|
2520
2520
|
searchGeo();
|
2521
2521
|
setItemsResults(items.filter((item) => {
|
2522
|
-
if (item.layer?.itemNameField)
|
2523
|
-
item.name = getValue(item, item.layer.itemNameField);
|
2524
|
-
if (item.layer?.itemTextField)
|
2525
|
-
item.text = getValue(item, item.layer.itemTextField);
|
2526
2522
|
return (value.length > 2 &&
|
2527
2523
|
((item.layer?.listed && item.name.toLowerCase().includes(value.toLowerCase())) ||
|
2528
|
-
item.text
|
2524
|
+
item.text?.toLowerCase().includes(value.toLowerCase())));
|
2529
2525
|
}));
|
2530
2526
|
let phrase = value;
|
2531
2527
|
if (value.startsWith('#'))
|
@@ -2631,11 +2627,14 @@ const TagsControl = () => {
|
|
2631
2627
|
return (jsxRuntime.jsx("div", { className: 'tw-flex tw-flex-wrap tw-mt-4 tw-w-[calc(100vw-2rem)] tw-max-w-xs', children: filterTags.map((tag) => (jsxRuntime.jsxs("div", { className: 'tw-rounded-2xl tw-text-white tw-p-2 tw-px-4 tw-shadow-xl tw-card tw-mr-2 tw-mb-2', style: { backgroundColor: tag.color }, children: [jsxRuntime.jsx("div", { className: 'tw-card-actions tw-justify-end', children: jsxRuntime.jsx("label", { className: 'tw-btn tw-btn-xs tw-btn-circle tw-absolute tw--right-2 tw--top-2 tw-bg-white tw-text-gray-600', onClick: () => removeFilterTag(tag.name), children: "\u2715" }) }), jsxRuntime.jsxs("b", { children: ["#", decodeTag(tag.name)] })] }, tag.id))) }));
|
2632
2628
|
};
|
2633
2629
|
|
2634
|
-
|
2630
|
+
/**
|
2631
|
+
* @category Map
|
2632
|
+
*/
|
2633
|
+
const PopupButton = ({ url, parameterField, text, item, }) => {
|
2635
2634
|
const params = new URLSearchParams(window.location.search);
|
2636
2635
|
const getItemTags = useGetItemTags();
|
2637
|
-
return (jsxRuntime.jsx(reactRouterDom.Link, { to: `${url}/${parameterField ?
|
2638
|
-
backgroundColor: `${
|
2636
|
+
return (jsxRuntime.jsx(reactRouterDom.Link, { to: `${url}/${parameterField ? item?.id : ''}?${params}`, children: jsxRuntime.jsx("button", { style: {
|
2637
|
+
backgroundColor: `${item?.color ?? (item && (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : (item?.layer?.markerDefaultColor ?? '#000')))}`,
|
2639
2638
|
}, className: 'tw-btn tw-text-white tw-btn-sm tw-float-right tw-mt-1', children: text }) }));
|
2640
2639
|
};
|
2641
2640
|
|
@@ -2654,24 +2653,28 @@ function fixUrls(message) {
|
|
2654
2653
|
return message;
|
2655
2654
|
}
|
2656
2655
|
|
2657
|
-
|
2656
|
+
/**
|
2657
|
+
* @category Map
|
2658
|
+
*/
|
2659
|
+
const TextView = ({ item, itemId, text, truncate = false, rawText, itemTextField, }) => {
|
2660
|
+
if (item) {
|
2661
|
+
text = item.text;
|
2662
|
+
itemId = item.id;
|
2663
|
+
}
|
2658
2664
|
const tags = useTags();
|
2659
2665
|
const addFilterTag = useAddFilterTag();
|
2660
|
-
let
|
2666
|
+
let innerText = '';
|
2661
2667
|
let replacedText = '';
|
2662
2668
|
if (rawText) {
|
2663
|
-
|
2664
|
-
}
|
2665
|
-
else if (itemTextField && item) {
|
2666
|
-
text = getValue(item, itemTextField);
|
2669
|
+
innerText = replacedText = rawText;
|
2667
2670
|
}
|
2668
|
-
else {
|
2669
|
-
|
2671
|
+
else if (text) {
|
2672
|
+
innerText = text;
|
2670
2673
|
}
|
2671
|
-
if (
|
2672
|
-
|
2673
|
-
if (
|
2674
|
-
replacedText = fixUrls(
|
2674
|
+
if (innerText && truncate)
|
2675
|
+
innerText = truncateText(removeMarkdownKeepLinksAndParagraphs(innerText), 100);
|
2676
|
+
if (innerText)
|
2677
|
+
replacedText = fixUrls(innerText);
|
2675
2678
|
if (replacedText) {
|
2676
2679
|
replacedText = replacedText.replace(/(?<!\]?\()https?:\/\/[^\s)]+(?!\))/g, (url) => {
|
2677
2680
|
let shortUrl = url;
|
@@ -2707,11 +2710,11 @@ const TextView = ({ item, truncate = false, itemTextField, rawText, }) => {
|
|
2707
2710
|
// eslint-disable-next-line react/prop-types
|
2708
2711
|
const CustomImage = ({ alt, src, title }) => (jsxRuntime.jsx("img", { className: 'tw-max-w-full tw-rounded tw-shadow', src: src, alt: alt, title: title }));
|
2709
2712
|
const CustomExternalLink = ({ href, children }) => (jsxRuntime.jsxs("a", { className: 'tw-font-bold tw-underline', href: href, target: '_blank', rel: 'noreferrer', children: [' ', children] }));
|
2710
|
-
const CustomHashTagLink = ({ children, tag,
|
2713
|
+
const CustomHashTagLink = ({ children, tag, itemId, }) => {
|
2711
2714
|
return (jsxRuntime.jsx("a", { style: { color: tag ? tag.color : '#faa', fontWeight: 'bold', cursor: 'pointer' }, onClick: (e) => {
|
2712
2715
|
e.stopPropagation();
|
2713
2716
|
addFilterTag(tag);
|
2714
|
-
}, children: decodeTag(children) }, tag ? tag.name +
|
2717
|
+
}, children: decodeTag(children) }, tag ? tag.name + itemId : itemId));
|
2715
2718
|
};
|
2716
2719
|
// eslint-disable-next-line react/display-name
|
2717
2720
|
const MemoizedVideoEmbed = react.memo(({ url }) => (jsxRuntime.jsx("iframe", { className: 'tw-w-full', src: url, allow: 'fullscreen; picture-in-picture', allowFullScreen: true })));
|
@@ -2733,7 +2736,7 @@ const TextView = ({ item, truncate = false, itemTextField, rawText, }) => {
|
|
2733
2736
|
console.log(tags);
|
2734
2737
|
const tag = tags.find((t) => t.name.toLowerCase() === decodeURI(href).slice(1).toLowerCase());
|
2735
2738
|
if (tag)
|
2736
|
-
return (jsxRuntime.jsx(CustomHashTagLink, { tag: tag,
|
2739
|
+
return (jsxRuntime.jsx(CustomHashTagLink, { tag: tag, itemId: itemId, children: children }));
|
2737
2740
|
else
|
2738
2741
|
return children;
|
2739
2742
|
}
|
@@ -2813,7 +2816,7 @@ function UtopiaMapInner({ children, geo, showFilterControl = false, showGratitud
|
|
2813
2816
|
if (!init.current) {
|
2814
2817
|
donationWidget &&
|
2815
2818
|
setTimeout(() => {
|
2816
|
-
reactToastify.toast(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TextView, { rawText: '## Do you like this Map?' }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(TextView, { rawText: 'Support us building free opensource maps and help us grow 🌱☀️' }), jsxRuntime.jsx(PopupButton, { url: 'https://opencollective.com/utopia-project', text: 'Donate' })] })] }), { autoClose: false });
|
2819
|
+
reactToastify.toast(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TextView, { itemId: '', rawText: '## Do you like this Map?' }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(TextView, { itemId: '', rawText: 'Support us building free opensource maps and help us grow 🌱☀️' }), jsxRuntime.jsx(PopupButton, { url: 'https://opencollective.com/utopia-project', text: 'Donate' })] })] }), { autoClose: false });
|
2817
2820
|
}, 600000);
|
2818
2821
|
init.current = true;
|
2819
2822
|
}
|
@@ -2844,8 +2847,6 @@ function UtopiaMapInner({ children, geo, showFilterControl = false, showGratitud
|
|
2844
2847
|
let title = '';
|
2845
2848
|
if (item?.name)
|
2846
2849
|
title = item.name;
|
2847
|
-
else if (item?.layer?.itemNameField)
|
2848
|
-
title = getValue(item, item.layer.itemNameField);
|
2849
2850
|
document.title = `${document.title.split('-')[0]} - ${title}`;
|
2850
2851
|
}
|
2851
2852
|
},
|
@@ -2868,15 +2869,13 @@ function UtopiaMapInner({ children, geo, showFilterControl = false, showGratitud
|
|
2868
2869
|
let title = '';
|
2869
2870
|
if (ref.item.name)
|
2870
2871
|
title = ref.item.name;
|
2871
|
-
else if (ref.item.layer?.itemNameField)
|
2872
|
-
title = getValue(ref.item.name, ref.item.layer.itemNameField);
|
2873
2872
|
document.title = `${document.title.split('-')[0]} - ${title}`;
|
2874
2873
|
document
|
2875
2874
|
.querySelector('meta[property="og:title"]')
|
2876
2875
|
?.setAttribute('content', ref.item.name);
|
2877
2876
|
document
|
2878
2877
|
.querySelector('meta[property="og:description"]')
|
2879
|
-
?.setAttribute('content', ref.item.text);
|
2878
|
+
?.setAttribute('content', ref.item.text ?? '');
|
2880
2879
|
}
|
2881
2880
|
}
|
2882
2881
|
}
|
@@ -2913,6 +2912,9 @@ function UtopiaMapInner({ children, geo, showFilterControl = false, showGratitud
|
|
2913
2912
|
} })), jsxRuntime.jsx(MapEventListener, {}), jsxRuntime.jsx(AddButton, { triggerAction: setSelectNewItemPosition }), selectNewItemPosition != null && (jsxRuntime.jsx(SelectPosition, { setSelectNewItemPosition: setSelectNewItemPosition }))] }));
|
2914
2913
|
}
|
2915
2914
|
|
2915
|
+
/**
|
2916
|
+
* @category Map
|
2917
|
+
*/
|
2916
2918
|
function UtopiaMap({ height = '500px', width = '100%', center = [50.6, 9.5], zoom = 10, children, geo, showFilterControl = false, showGratitudeControl = false, showLayerControl = true, infoText, donationWidget, }) {
|
2917
2919
|
return (jsxRuntime.jsx(ContextWrapper, { children: jsxRuntime.jsx(reactLeaflet.MapContainer, { style: { height, width }, center: new leaflet.LatLng(center[0], center[1]), zoom: zoom, zoomControl: false, maxZoom: 19, children: jsxRuntime.jsx(UtopiaMapInner, { geo: geo, showFilterControl: showFilterControl, showGratitudeControl: showGratitudeControl, showLayerControl: showLayerControl, infoText: infoText, donationWidget: donationWidget, children: children }) }) }));
|
2918
2920
|
}
|
@@ -2975,6 +2977,9 @@ const rgbToHex = (r, g, b) => '#' +
|
|
2975
2977
|
})
|
2976
2978
|
.join('');
|
2977
2979
|
|
2980
|
+
/**
|
2981
|
+
* @category Input
|
2982
|
+
*/
|
2978
2983
|
function TextAreaInput({ labelTitle, dataField, labelStyle, containerStyle, inputStyle, defaultValue, placeholder, required = true, updateFormValue, }) {
|
2979
2984
|
const ref = react.useRef(null);
|
2980
2985
|
const [inputValue, setInputValue] = react.useState(defaultValue);
|
@@ -2996,6 +3001,9 @@ function TextAreaInput({ labelTitle, dataField, labelStyle, containerStyle, inpu
|
|
2996
3001
|
return (jsxRuntime.jsxs("div", { className: `tw-form-control tw-w-full ${containerStyle || ''}`, children: [labelTitle ? (jsxRuntime.jsx("label", { className: 'tw-label', children: jsxRuntime.jsx("span", { className: `tw-label-text tw-text-base-content ${labelStyle}`, children: labelTitle }) })) : null, jsxRuntime.jsx("textarea", { required: required, ref: ref, value: inputValue, name: dataField, className: `tw-textarea tw-textarea-bordered tw-w-full tw-leading-5 ${inputStyle || ''}`, placeholder: placeholder || '', onChange: handleChange })] }));
|
2997
3002
|
}
|
2998
3003
|
|
3004
|
+
/**
|
3005
|
+
* @category Input
|
3006
|
+
*/
|
2999
3007
|
function TextInput({ labelTitle, labelStyle, type, dataField, containerStyle, inputStyle, defaultValue, placeholder, autocomplete, pattern, required = true, updateFormValue, }) {
|
3000
3008
|
const [inputValue, setInputValue] = react.useState(defaultValue || '');
|
3001
3009
|
react.useEffect(() => {
|
@@ -3125,7 +3133,7 @@ function ItemFormPopup(props) {
|
|
3125
3133
|
key: props.position.toString(),
|
3126
3134
|
setPopupTitle,
|
3127
3135
|
})
|
3128
|
-
: '')) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TextInput, { type: 'text', placeholder: 'Name', dataField: 'name', defaultValue: props.item ? props.item.name : '', inputStyle: '' }), jsxRuntime.jsx(TextAreaInput, { placeholder: 'Text', dataField: 'text', defaultValue: props.item
|
3136
|
+
: '')) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TextInput, { type: 'text', placeholder: 'Name', dataField: 'name', defaultValue: props.item ? props.item.name : '', inputStyle: '' }), jsxRuntime.jsx(TextAreaInput, { placeholder: 'Text', dataField: 'text', defaultValue: props.item?.text ?? '', inputStyle: 'tw-h-40 tw-mt-5' }, props.position.toString())] })), jsxRuntime.jsx("div", { className: 'tw-flex tw-justify-center', children: jsxRuntime.jsx("button", { className: spinner
|
3129
3137
|
? 'tw-btn tw-btn-disabled tw-mt-5 tw-place-self-center'
|
3130
3138
|
: 'tw-btn tw-mt-5 tw-place-self-center', type: 'submit', children: spinner ? jsxRuntime.jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Save' }) })] }) }));
|
3131
3139
|
}
|
@@ -3181,15 +3189,13 @@ const DialogModal = ({ title, isOpened, onClose, children, showCloseButton = tru
|
|
3181
3189
|
}
|
3182
3190
|
}, [isOpened]);
|
3183
3191
|
if (isOpened) {
|
3184
|
-
return (jsxRuntime.jsx("dialog", { className: `${className ?? ''} tw-card tw-shadow-xl tw-absolute tw-right-0 tw-top-0 tw-bottom-0 tw-left-0 tw-m-auto tw-transition-opacity tw-duration-300 tw-p-4 tw-max-w-xl tw-bg-base-100`, ref: ref,
|
3185
|
-
// eslint-disable-next-line react/no-unknown-property
|
3186
|
-
onCancel: onClose, onClick: (e) => ref.current && !isClickInsideRectangle(e, ref.current) && closeOnClickOutside && onClose(), children: jsxRuntime.jsxs("div", { className: 'tw-card-body tw-p-2', children: [jsxRuntime.jsx("h2", { className: 'tw-text-2xl tw-font-semibold tw-mb-2 tw-text-center', children: title }), children, showCloseButton && (jsxRuntime.jsx("button", { className: 'tw-btn tw-btn-sm tw-btn-circle tw-btn-ghost tw-absolute tw-right-2 tw-top-2', onClick: onClose, children: "\u2715" }))] }) }));
|
3192
|
+
return (jsxRuntime.jsx("dialog", { className: `${className ?? ''} tw-card tw-shadow-xl tw-absolute tw-right-0 tw-top-0 tw-bottom-0 tw-left-0 tw-m-auto tw-transition-opacity tw-duration-300 tw-p-4 tw-max-w-xl tw-bg-base-100`, ref: ref, onCancel: onClose, onClick: (e) => ref.current && !isClickInsideRectangle(e, ref.current) && closeOnClickOutside && onClose(), children: jsxRuntime.jsxs("div", { className: 'tw-card-body tw-p-2', children: [jsxRuntime.jsx("h2", { className: 'tw-text-2xl tw-font-semibold tw-mb-2 tw-text-center', children: title }), children, showCloseButton && (jsxRuntime.jsx("button", { className: 'tw-btn tw-btn-sm tw-btn-circle tw-btn-ghost tw-absolute tw-right-2 tw-top-2', onClick: onClose, children: "\u2715" }))] }) }));
|
3187
3193
|
}
|
3188
3194
|
else
|
3189
3195
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
3190
3196
|
};
|
3191
3197
|
|
3192
|
-
function HeaderView({ item, api, editCallback, deleteCallback, setPositionCallback,
|
3198
|
+
function HeaderView({ item, api, editCallback, deleteCallback, setPositionCallback, loading, hideMenu = false, big = false, truncateSubname = true, hideSubname = false, showAddress = false, }) {
|
3193
3199
|
const [modalOpen, setModalOpen] = react.useState(false);
|
3194
3200
|
const hasUserPermission = useHasUserPermission();
|
3195
3201
|
const navigate = reactRouterDom.useNavigate();
|
@@ -3198,22 +3204,10 @@ function HeaderView({ item, api, editCallback, deleteCallback, setPositionCallba
|
|
3198
3204
|
react.useEffect(() => {
|
3199
3205
|
setImageLoaded(false);
|
3200
3206
|
}, [item]);
|
3201
|
-
const avatar =
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3205
|
-
: item.layer?.itemAvatarField &&
|
3206
|
-
item &&
|
3207
|
-
getValue(item, item.layer?.itemAvatarField) &&
|
3208
|
-
appState.assetsApi.url +
|
3209
|
-
getValue(item, item.layer?.itemAvatarField) +
|
3210
|
-
`${big ? '?width=160&heigth=160' : '?width=80&heigth=80'}`;
|
3211
|
-
const title = itemNameField
|
3212
|
-
? getValue(item, itemNameField)
|
3213
|
-
: item.layer?.itemNameField && item && getValue(item, item.layer.itemNameField);
|
3214
|
-
const subtitle = itemSubnameField
|
3215
|
-
? getValue(item, itemSubnameField)
|
3216
|
-
: item.layer?.itemSubnameField && item && getValue(item, item.layer.itemSubnameField);
|
3207
|
+
const avatar = item.image &&
|
3208
|
+
appState.assetsApi.url + item.image + `${big ? '?width=160&heigth=160' : '?width=80&heigth=80'}`;
|
3209
|
+
const title = item.name;
|
3210
|
+
const subtitle = item.subname;
|
3217
3211
|
const [address] = react.useState('');
|
3218
3212
|
const params = new URLSearchParams(window.location.search);
|
3219
3213
|
const openDeleteModal = async (event) => {
|
@@ -3226,7 +3220,7 @@ function HeaderView({ item, api, editCallback, deleteCallback, setPositionCallba
|
|
3226
3220
|
!hideMenu && (jsxRuntime.jsxs("div", { className: 'tw-dropdown tw-dropdown-bottom', children: [jsxRuntime.jsx("label", { tabIndex: 0, className: 'tw-bg-base-100 tw-btn tw-m-1 tw-leading-3 tw-border-none tw-min-h-0 tw-h-6', children: jsxRuntime.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', className: 'tw-h-5 tw-w-5', viewBox: '0 0 20 20', fill: 'currentColor', children: jsxRuntime.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' }) }) }), jsxRuntime.jsxs("ul", { tabIndex: 0, className: 'tw-dropdown-content tw-menu tw-p-2 tw-shadow tw-bg-base-100 tw-rounded-box tw-z-1000', children: [api?.updateItem &&
|
3227
3221
|
hasUserPermission(api.collectionName, 'update', item) &&
|
3228
3222
|
editCallback && (jsxRuntime.jsx("li", { children: jsxRuntime.jsx("a", { className: '!tw-text-base-content tw-cursor-pointer', onClick: (e) => item.layer?.customEditLink
|
3229
|
-
? navigate(`${item.layer.customEditLink}${item.layer.customEditParameter ? `/${
|
3223
|
+
? navigate(`${item.layer.customEditLink}${item.layer.customEditParameter ? `/${item.id}${params && '?' + params}` : ''} `)
|
3230
3224
|
: editCallback(e), children: jsxRuntime.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', className: 'tw-h-5 tw-w-5', viewBox: '0 0 20 20', fill: 'currentColor', children: jsxRuntime.jsx("path", { d: 'M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z' }) }) }) })), api?.updateItem &&
|
3231
3225
|
hasUserPermission(api.collectionName, 'update', item) &&
|
3232
3226
|
setPositionCallback && (jsxRuntime.jsx("li", { children: jsxRuntime.jsx("a", { className: '!tw-text-base-content tw-cursor-pointer', onClick: setPositionCallback, children: jsxRuntime.jsx("svg", { stroke: 'currentColor', fill: 'currentColor', strokeWidth: '0', viewBox: '0 0 512 512', className: 'tw-w-5 tw-h-5', xmlns: 'http://www.w3.org/2000/svg', children: jsxRuntime.jsx("path", { d: 'M256 0c17.7 0 32 14.3 32 32V42.4c93.7 13.9 167.7 88 181.6 181.6H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H469.6c-13.9 93.7-88 167.7-181.6 181.6V480c0 17.7-14.3 32-32 32s-32-14.3-32-32V469.6C130.3 455.7 56.3 381.7 42.4 288H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H42.4C56.3 130.3 130.3 56.3 224 42.4V32c0-17.7 14.3-32 32-32zM107.4 288c12.5 58.3 58.4 104.1 116.6 116.6V384c0-17.7 14.3-32 32-32s32 14.3 32 32v20.6c58.3-12.5 104.1-58.4 116.6-116.6H384c-17.7 0-32-14.3-32-32s14.3-32 32-32h20.6C392.1 165.7 346.3 119.9 288 107.4V128c0 17.7-14.3 32-32 32s-32-14.3-32-32V107.4C165.7 119.9 119.9 165.7 107.4 224H128c17.7 0 32 14.3 32 32s-14.3 32-32 32H107.4zM256 224a32 32 0 1 1 0 64 32 32 0 1 1 0-64z' }) }) }) })), api?.deleteItem &&
|
@@ -3290,10 +3284,13 @@ const ItemViewPopup = react.forwardRef((props, ref) => {
|
|
3290
3284
|
navigate('/');
|
3291
3285
|
}, loading: loading }), jsxRuntime.jsx("div", { className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade', children: props.children ? (react.Children.toArray(props.children).map((child) => react.isValidElement(child)
|
3292
3286
|
? react.cloneElement(child, { item: props.item })
|
3293
|
-
: '')) : (jsxRuntime.jsx(TextView, { item: props.item })) }), jsxRuntime.jsxs("div", { className: 'tw-flex -tw-mb-1 tw-flex-row tw-mr-2 tw-mt-1', children: [infoExpanded ? (jsxRuntime.jsx("p", { className: 'tw-italic tw-min-h-[21px] !tw-my-0 tw-text-gray-500', children: `${props.item.date_updated && props.item.date_updated !== props.item.date_created ? 'updated' : 'posted'} ${props.item && props.item.user_created && props.item.user_created.first_name ? `by ${props.item.user_created.first_name}` : ''} ${props.item.date_updated ? timeAgo(props.item.date_updated) : timeAgo(props.item.date_created)}` })) : (jsxRuntime.jsx("p", { className: '!tw-my-0 tw-min-h-[21px] tw-font-bold tw-cursor-pointer tw-text-gray-500', onClick: () => setInfoExpanded(true), children: "\u24D8" })), jsxRuntime.jsx("div", { className: 'tw-grow' })] })] }) }));
|
3287
|
+
: '')) : (jsxRuntime.jsx(TextView, { text: props.item.text, itemId: props.item.id })) }), jsxRuntime.jsxs("div", { className: 'tw-flex -tw-mb-1 tw-flex-row tw-mr-2 tw-mt-1', children: [infoExpanded ? (jsxRuntime.jsx("p", { className: 'tw-italic tw-min-h-[21px] !tw-my-0 tw-text-gray-500', children: `${props.item.date_updated && props.item.date_updated !== props.item.date_created ? 'updated' : 'posted'} ${props.item && props.item.user_created && props.item.user_created.first_name ? `by ${props.item.user_created.first_name}` : ''} ${props.item.date_updated ? timeAgo(props.item.date_updated) : timeAgo(props.item.date_created)}` })) : (jsxRuntime.jsx("p", { className: '!tw-my-0 tw-min-h-[21px] tw-font-bold tw-cursor-pointer tw-text-gray-500', onClick: () => setInfoExpanded(true), children: "\u24D8" })), jsxRuntime.jsx("div", { className: 'tw-grow' })] })] }) }));
|
3294
3288
|
});
|
3295
3289
|
|
3296
|
-
|
3290
|
+
/**
|
3291
|
+
* @category Map
|
3292
|
+
*/
|
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, onlyOnePerOwner = false, customEditLink, customEditParameter,
|
3297
3294
|
// eslint-disable-next-line camelcase
|
3298
3295
|
public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }) => {
|
3299
3296
|
const filterTags = useFilterTags();
|
@@ -3330,16 +3327,8 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3330
3327
|
markerDefaultColor2,
|
3331
3328
|
api,
|
3332
3329
|
itemType,
|
3333
|
-
itemNameField,
|
3334
|
-
itemSubnameField,
|
3335
|
-
itemTextField,
|
3336
|
-
itemAvatarField,
|
3337
|
-
itemColorField,
|
3338
|
-
itemOwnerField,
|
3339
|
-
itemTagsField,
|
3340
|
-
itemOffersField,
|
3341
|
-
itemNeedsField,
|
3342
3330
|
onlyOnePerOwner,
|
3331
|
+
// Can we just use editCallback for all cases?
|
3343
3332
|
customEditLink,
|
3344
3333
|
customEditParameter,
|
3345
3334
|
// eslint-disable-next-line camelcase
|
@@ -3347,6 +3336,7 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3347
3336
|
listed,
|
3348
3337
|
setItemFormPopup,
|
3349
3338
|
itemFormPopup,
|
3339
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
3350
3340
|
clusterRef,
|
3351
3341
|
});
|
3352
3342
|
api &&
|
@@ -3363,15 +3353,6 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3363
3353
|
markerDefaultColor2,
|
3364
3354
|
api,
|
3365
3355
|
itemType,
|
3366
|
-
itemNameField,
|
3367
|
-
itemSubnameField,
|
3368
|
-
itemTextField,
|
3369
|
-
itemAvatarField,
|
3370
|
-
itemColorField,
|
3371
|
-
itemOwnerField,
|
3372
|
-
itemTagsField,
|
3373
|
-
itemOffersField,
|
3374
|
-
itemNeedsField,
|
3375
3356
|
onlyOnePerOwner,
|
3376
3357
|
customEditLink,
|
3377
3358
|
customEditParameter,
|
@@ -3380,6 +3361,7 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3380
3361
|
listed,
|
3381
3362
|
setItemFormPopup,
|
3382
3363
|
itemFormPopup,
|
3364
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
3383
3365
|
clusterRef,
|
3384
3366
|
});
|
3385
3367
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
@@ -3407,29 +3389,18 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3407
3389
|
.filter((item) => (item.group_type && isGroupTypeVisible(item.group_type)) ||
|
3408
3390
|
visibleGroupTypes.length === 0)
|
3409
3391
|
.map((item) => {
|
3410
|
-
if (
|
3411
|
-
// eslint-disable-next-line security/detect-object-injection
|
3412
|
-
if (getValue(item, itemTextField))
|
3413
|
-
item[itemTextField] = getValue(item, itemTextField);
|
3414
|
-
// eslint-disable-next-line security/detect-object-injection
|
3415
|
-
else
|
3416
|
-
item[itemTextField] = '';
|
3392
|
+
if (item.position?.coordinates[0] && item.position?.coordinates[1]) {
|
3417
3393
|
if (item.tags) {
|
3418
|
-
|
3419
|
-
item[itemTextField] = item[itemTextField] + '\n\n';
|
3394
|
+
item.text += '\n\n';
|
3420
3395
|
item.tags.map((tag) => {
|
3421
|
-
|
3422
|
-
|
3423
|
-
// eslint-disable-next-line security/detect-object-injection
|
3424
|
-
return (item[itemTextField] = item[itemTextField] + `#${encodeTag(tag)} `);
|
3396
|
+
if (!item.text?.includes(`#${encodeTag(tag)}`)) {
|
3397
|
+
item.text += `#${encodeTag(tag)}`;
|
3425
3398
|
}
|
3426
|
-
|
3427
|
-
return item[itemTextField];
|
3399
|
+
return item.text;
|
3428
3400
|
});
|
3429
3401
|
}
|
3430
3402
|
if (allTagsLoaded && allItemsLoaded) {
|
3431
|
-
|
3432
|
-
item[itemTextField].match(hashTagRegex)?.map((tag) => {
|
3403
|
+
item.text?.match(hashTagRegex)?.map((tag) => {
|
3433
3404
|
if (!tags.find((t) => t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase()) &&
|
3434
3405
|
!newTagsToAdd.find((t) => t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase())) {
|
3435
3406
|
const newTag = {
|
@@ -3444,18 +3415,20 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3444
3415
|
!tagsReady && setTagsReady(true);
|
3445
3416
|
}
|
3446
3417
|
const itemTags = getItemTags(item);
|
3447
|
-
const latitude =
|
3448
|
-
const longitude =
|
3418
|
+
const latitude = item.position.coordinates[1];
|
3419
|
+
const longitude = item.position.coordinates[0];
|
3449
3420
|
let color1 = markerDefaultColor;
|
3450
3421
|
let color2 = markerDefaultColor2;
|
3451
|
-
if (
|
3452
|
-
color1 =
|
3453
|
-
|
3422
|
+
if (item.color) {
|
3423
|
+
color1 = item.color;
|
3424
|
+
}
|
3425
|
+
else if (itemTags[0]) {
|
3454
3426
|
color1 = itemTags[0].color;
|
3455
3427
|
}
|
3456
|
-
if (itemTags
|
3428
|
+
if (itemTags[0] && item.color) {
|
3457
3429
|
color2 = itemTags[0].color;
|
3458
|
-
|
3430
|
+
}
|
3431
|
+
else if (itemTags[1]) {
|
3459
3432
|
color2 = itemTags[1].color;
|
3460
3433
|
}
|
3461
3434
|
return (jsxRuntime.jsxs(reactLeaflet.Marker, { ref: (r) => {
|
@@ -3475,7 +3448,7 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3475
3448
|
if (!(item.id in leafletRefs && leafletRefs[item.id].popup === r)) {
|
3476
3449
|
r && addPopup(item, r);
|
3477
3450
|
}
|
3478
|
-
}, item: item, setItemFormPopup: setItemFormPopup }, item.id + item.name) })), jsxRuntime.jsx(reactLeaflet.Tooltip, { offset: [0, -38], direction: 'top', children: item.name
|
3451
|
+
}, item: item, setItemFormPopup: setItemFormPopup }, item.id + item.name) })), jsxRuntime.jsx(reactLeaflet.Tooltip, { offset: [0, -38], direction: 'top', children: item.name })] }, item.id));
|
3479
3452
|
}
|
3480
3453
|
else
|
3481
3454
|
return null;
|
@@ -3488,6 +3461,9 @@ function isComponentWithType(node) {
|
|
3488
3461
|
return react.isValidElement(node) && typeof node.type !== 'string' && '__TYPE' in node.type;
|
3489
3462
|
}
|
3490
3463
|
|
3464
|
+
/**
|
3465
|
+
* @category Map
|
3466
|
+
*/
|
3491
3467
|
function Tags({ data, api }) {
|
3492
3468
|
const setTagData = useSetTagData();
|
3493
3469
|
const setTagApi = useSetTagApi();
|
@@ -3520,7 +3496,10 @@ function Tags({ data, api }) {
|
|
3520
3496
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
3521
3497
|
}
|
3522
3498
|
|
3523
|
-
|
3499
|
+
/**
|
3500
|
+
* @category Map
|
3501
|
+
*/
|
3502
|
+
function Permissions({ data, api, adminRole }) {
|
3524
3503
|
const setPermissionData = useSetPermissionData();
|
3525
3504
|
const setPermissionApi = useSetPermissionApi();
|
3526
3505
|
const setAdminRole = useSetAdminRole();
|
@@ -3534,6 +3513,9 @@ function Permissions({ data, api, adminRole, }) {
|
|
3534
3513
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
3535
3514
|
}
|
3536
3515
|
|
3516
|
+
/**
|
3517
|
+
* @category Map
|
3518
|
+
*/
|
3537
3519
|
const ItemForm = ({ children, item, title, setPopupTitle, }) => {
|
3538
3520
|
react.useEffect(() => {
|
3539
3521
|
setPopupTitle && title && setPopupTitle(title);
|
@@ -3547,6 +3529,9 @@ const ItemForm = ({ children, item, title, setPopupTitle, }) => {
|
|
3547
3529
|
};
|
3548
3530
|
ItemForm.__TYPE = 'ItemForm';
|
3549
3531
|
|
3532
|
+
/**
|
3533
|
+
* @category Map
|
3534
|
+
*/
|
3550
3535
|
const ItemView = ({ children, item }) => {
|
3551
3536
|
return (jsxRuntime.jsx("div", { children: children
|
3552
3537
|
? react.Children.toArray(children).map((child) => react.isValidElement(child) ? react.cloneElement(child, { item }) : null)
|
@@ -3554,6 +3539,9 @@ const ItemView = ({ children, item }) => {
|
|
3554
3539
|
};
|
3555
3540
|
ItemView.__TYPE = 'ItemView';
|
3556
3541
|
|
3542
|
+
/**
|
3543
|
+
* @category Input
|
3544
|
+
*/
|
3557
3545
|
function SelectBox(props) {
|
3558
3546
|
const { labelTitle, labelDescription, defaultValue, containerStyle, placeholder, labelStyle, options, updateFormValue, } = props;
|
3559
3547
|
const [value, setValue] = react.useState(defaultValue || '');
|
@@ -3566,22 +3554,37 @@ function SelectBox(props) {
|
|
3566
3554
|
})] })] }));
|
3567
3555
|
}
|
3568
3556
|
|
3557
|
+
/**
|
3558
|
+
* @category Map
|
3559
|
+
*/
|
3569
3560
|
const PopupTextAreaInput = ({ dataField, placeholder, style, item, }) => {
|
3570
3561
|
return (jsxRuntime.jsx(TextAreaInput, { defaultValue: item?.text ? item.text : '', dataField: dataField, placeholder: placeholder, inputStyle: style }));
|
3571
3562
|
};
|
3572
3563
|
|
3564
|
+
/**
|
3565
|
+
* @category Map
|
3566
|
+
*/
|
3573
3567
|
const PopupStartEndInput = ({ item, showLabels = true, updateStartValue, updateEndValue, }) => {
|
3574
3568
|
return (jsxRuntime.jsxs("div", { className: 'tw-grid tw-grid-cols-2 tw-gap-2', children: [jsxRuntime.jsx(TextInput, { type: 'date', placeholder: 'start', dataField: 'start', inputStyle: 'tw-text-sm tw-px-2', labelTitle: showLabels ? 'start' : '', defaultValue: item && item.start ? item.start.substring(0, 10) : '', autocomplete: 'one-time-code', updateFormValue: updateStartValue }), jsxRuntime.jsx(TextInput, { type: 'date', placeholder: 'end', dataField: 'end', inputStyle: 'tw-text-sm tw-px-2', labelTitle: showLabels ? 'end' : '', defaultValue: item && item.end ? item.end.substring(0, 10) : '', autocomplete: 'one-time-code', updateFormValue: updateEndValue })] }));
|
3575
3569
|
};
|
3576
3570
|
|
3571
|
+
/**
|
3572
|
+
* @category Map
|
3573
|
+
*/
|
3577
3574
|
const PopupTextInput = ({ dataField, placeholder, style, item, }) => {
|
3578
3575
|
return (jsxRuntime.jsx(TextInput, { defaultValue: item?.name ? item.name : '', dataField: dataField, placeholder: placeholder, inputStyle: style, type: 'text', containerStyle: 'tw-mt-4' }));
|
3579
3576
|
};
|
3580
3577
|
|
3578
|
+
/**
|
3579
|
+
* @category Map
|
3580
|
+
*/
|
3581
3581
|
const PopupCheckboxInput = ({ dataField, label, item, }) => {
|
3582
3582
|
return (jsxRuntime.jsxs("label", { htmlFor: item?.id, className: 'tw-label tw-justify-normal tw-pt-1 tw-pb-1', children: [jsxRuntime.jsx("input", { id: item?.id, type: 'checkbox', name: dataField, className: 'tw-checkbox tw-checkbox-xs tw-checkbox-success', checked: item?.public_edit }), jsxRuntime.jsx("span", { className: 'tw-text-sm tw-label-text tw-mx-2 tw-cursor-pointer', children: label })] }));
|
3583
3583
|
};
|
3584
3584
|
|
3585
|
+
/**
|
3586
|
+
* @category Map
|
3587
|
+
*/
|
3585
3588
|
const StartEndView = ({ item }) => {
|
3586
3589
|
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() : '' })] })] }));
|
3587
3590
|
};
|
@@ -3649,6 +3652,9 @@ const SetAppState = ({ assetsApi, userType, }) => {
|
|
3649
3652
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
3650
3653
|
};
|
3651
3654
|
|
3655
|
+
/**
|
3656
|
+
* @category AppShell
|
3657
|
+
*/
|
3652
3658
|
function AppShell({ appName, children, assetsApi, userType, }) {
|
3653
3659
|
return (jsxRuntime.jsx(ContextWrapper, { children: jsxRuntime.jsxs("div", { className: 'tw-flex tw-flex-col tw-h-full', children: [jsxRuntime.jsx(SetAppState, { assetsApi: assetsApi, userType: userType }), jsxRuntime.jsx(NavBar, { userType: userType, appName: appName }), jsxRuntime.jsx("div", { id: 'app-content', className: 'tw-flex-grow', children: children })] }) }));
|
3654
3660
|
}
|
@@ -3670,6 +3676,9 @@ function SidebarSubmenu({ submenu, name, icon, }) {
|
|
3670
3676
|
}) }) })] }));
|
3671
3677
|
}
|
3672
3678
|
|
3679
|
+
/**
|
3680
|
+
* @category AppShell
|
3681
|
+
*/
|
3673
3682
|
function SideBar({ routes, bottomRoutes }) {
|
3674
3683
|
// prevent react18 from calling useEffect twice
|
3675
3684
|
const init = react.useRef(false);
|
@@ -3712,10 +3721,16 @@ function SideBar({ routes, bottomRoutes }) {
|
|
3712
3721
|
(!slim ? 'tw-rotate-180' : ''), onClick: () => toggleSlim() })] }) })] }) }));
|
3713
3722
|
}
|
3714
3723
|
|
3724
|
+
/**
|
3725
|
+
* @category AppShell
|
3726
|
+
*/
|
3715
3727
|
function Content({ children }) {
|
3716
3728
|
return (jsxRuntime.jsx("div", { className: 'tw-flex tw-flex-col tw-w-full tw-h-full tw-bg-base-200 tw-relative', children: children }));
|
3717
3729
|
}
|
3718
3730
|
|
3731
|
+
/**
|
3732
|
+
* @category AppShell
|
3733
|
+
*/
|
3719
3734
|
const Sitemap = ({ url }) => {
|
3720
3735
|
const [sitemap, setSitemap] = react.useState('');
|
3721
3736
|
const items = useItems();
|
@@ -3743,6 +3758,9 @@ function Subtitle({ styleClass, children }) {
|
|
3743
3758
|
return jsxRuntime.jsx("div", { className: `tw-text-xl tw-font-semibold ${styleClass}`, children: children });
|
3744
3759
|
}
|
3745
3760
|
|
3761
|
+
/**
|
3762
|
+
* @category Templates
|
3763
|
+
*/
|
3746
3764
|
function TitleCard({ title, hideTitle, children, topMargin, TopSideButtons, className, }) {
|
3747
3765
|
return (jsxRuntime.jsxs("div", { className: 'tw-card tw-w-full tw-p-6 tw-bg-base-100 tw-shadow-xl tw-h-fit tw-mb-4 ' +
|
3748
3766
|
(className || '') +
|
@@ -3750,6 +3768,9 @@ function TitleCard({ title, hideTitle, children, topMargin, TopSideButtons, clas
|
|
3750
3768
|
(topMargin || 'tw-mt-6'), children: [!hideTitle && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Subtitle, { styleClass: TopSideButtons ? 'tw-inline-block' : '', children: [title, TopSideButtons && (jsxRuntime.jsx("div", { className: 'tw-inline-block tw-float-right', children: TopSideButtons }))] }), jsxRuntime.jsx("div", { className: 'tw-divider tw-mt-2' })] })), jsxRuntime.jsx("div", { className: 'tw-h-full tw-bg-transparent tw-w-full tw-pb-6 tw-bg-base-100', children: children })] }));
|
3751
3769
|
}
|
3752
3770
|
|
3771
|
+
/**
|
3772
|
+
* @category Templates
|
3773
|
+
*/
|
3753
3774
|
function CardPage({ title, hideTitle, children, parents, }) {
|
3754
3775
|
return (jsxRuntime.jsx("main", { className: 'tw-flex-1 tw-overflow-y-auto tw-overflow-x-hidden tw-pt-2 tw-px-6 tw-min-w-80 tw-flex tw-justify-center', children: jsxRuntime.jsxs("div", { className: 'tw-w-full xl:tw-max-w-6xl ', children: [jsxRuntime.jsx("div", { className: 'tw-text-sm tw-breadcrumbs', children: jsxRuntime.jsxs("ul", { children: [jsxRuntime.jsx("li", { children: jsxRuntime.jsx(reactRouterDom.Link, { to: '/', children: "Home" }) }), parents?.map((b, i) => (jsxRuntime.jsx("li", { children: jsxRuntime.jsx(reactRouterDom.Link, { to: b.path, children: b.name }) }, i))), jsxRuntime.jsx("li", { children: title })] }) }), jsxRuntime.jsx(TitleCard, { hideTitle: hideTitle, title: title, topMargin: 'tw-my-2', className: ' tw-mb-4', children: children })] }) }));
|
3755
3776
|
}
|
@@ -3802,6 +3823,9 @@ const CircleLayout = ({ items, radius, fontSize, }) => {
|
|
3802
3823
|
return (jsxRuntime.jsx("div", { className: 'tw-absolute tw-mx-auto tw-flex tw-justify-center tw-items-center tw-h-full tw-w-full', ref: containerRef, children: items.map((item) => (jsxRuntime.jsx("div", { className: 'tw-absolute', style: { fontSize }, children: item }, item))) }));
|
3803
3824
|
};
|
3804
3825
|
|
3826
|
+
/**
|
3827
|
+
* @category Templates
|
3828
|
+
*/
|
3805
3829
|
const MoonCalendar = () => {
|
3806
3830
|
const today = dateFns.startOfToday();
|
3807
3831
|
const [currMonth, setCurrMonth] = react.useState(() => dateFns.format(today, 'MMM-yyyy'));
|
@@ -3824,6 +3848,9 @@ const MoonCalendar = () => {
|
|
3824
3848
|
], radius: 120, fontSize: '0.8em' })] }), jsxRuntime.jsxs("div", { className: 'tw-flex tw-flex-row', children: [jsxRuntime.jsx(outline.ChevronLeftIcon, { className: 'tw-w-6 tw-h-6 tw-cursor-pointer', onClick: getPrevMonth }), jsxRuntime.jsxs("p", { className: 'tw-text-center tw-p-1 tw-h-full tw-grow', children: ["from ", dateFns.format(getLastNewMoon(), 'dd.MM'), " - to ", dateFns.format(getNextNewMoon(), 'dd.MM')] }), jsxRuntime.jsx(outline.ChevronRightIcon, { className: 'tw-w-6 tw-h-6 tw-cursor-pointer', onClick: getNextMonth })] })] }));
|
3825
3849
|
};
|
3826
3850
|
|
3851
|
+
/**
|
3852
|
+
* @category Templates
|
3853
|
+
*/
|
3827
3854
|
const SelectUser = () => {
|
3828
3855
|
const appState = useAppState();
|
3829
3856
|
const items = useItems();
|
@@ -3846,18 +3873,22 @@ const DateUserInfo = ({ item }) => {
|
|
3846
3873
|
return (jsxRuntime.jsxs("div", { className: 'tw-flex -tw-mb-1 tw-flex-row tw-mr-2 -tw-mt-2', onClick: (e) => e.stopPropagation(), children: [infoExpanded ? (jsxRuntime.jsx("p", { className: 'tw-italic tw-min-h-[21px] !tw-my-0 tw-text-gray-500', onClick: () => setInfoExpanded(false), children: `${item.date_updated && item.date_updated !== item.date_created ? 'updated' : 'posted'} ${item && item.user_created && item.user_created.first_name ? `by ${item.user_created.first_name}` : ''} ${item.date_updated ? timeAgo(item.date_updated) : timeAgo(item.date_created)}` })) : (jsxRuntime.jsx("p", { className: '!tw-my-0 tw-min-h-[21px] tw-font-bold tw-cursor-pointer tw-text-gray-500', onClick: () => setInfoExpanded(true), children: "\u24D8" })), jsxRuntime.jsx("div", { className: 'tw-grow ' })] }));
|
3847
3874
|
};
|
3848
3875
|
|
3849
|
-
const ItemCard = ({ i, loading, url,
|
3876
|
+
const ItemCard = ({ i, loading, url, deleteCallback, }) => {
|
3850
3877
|
const navigate = reactRouterDom.useNavigate();
|
3851
3878
|
const windowDimensions = useWindowDimensions();
|
3852
3879
|
return (jsxRuntime.jsxs("div", { className: 'tw-cursor-pointer tw-card tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-bg-base-100 tw-text-base-content tw-p-4 tw-mb-4 tw-h-fit', onClick: () => {
|
3880
|
+
// We could have an onClick callback instead
|
3853
3881
|
const params = new URLSearchParams(window.location.search);
|
3854
3882
|
if (windowDimensions.width < 786 && i.position)
|
3855
|
-
navigate('/' +
|
3883
|
+
navigate('/' + i.id + `${params ? `?${params}` : ''}`);
|
3856
3884
|
else
|
3857
|
-
navigate(url +
|
3858
|
-
}, children: [jsxRuntime.jsx(HeaderView, { loading: loading, item: i, api: i.layer?.api,
|
3885
|
+
navigate(url + i.id + `${params ? `?${params}` : ''}`);
|
3886
|
+
}, children: [jsxRuntime.jsx(HeaderView, { loading: loading, item: i, api: i.layer?.api, editCallback: () => navigate('/edit-item/' + i.id), deleteCallback: () => deleteCallback(i) }), jsxRuntime.jsxs("div", { className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade', children: [i.layer?.itemType.show_start_end && jsxRuntime.jsx(StartEndView, { item: i }), i.layer?.itemType.show_text && jsxRuntime.jsx(TextView, { truncate: true, text: i.text, itemId: i.id })] }), jsxRuntime.jsx(DateUserInfo, { item: i })] }));
|
3859
3887
|
};
|
3860
3888
|
|
3889
|
+
/**
|
3890
|
+
* @category Templates
|
3891
|
+
*/
|
3861
3892
|
const OverlayItemsIndexPage = ({ url, layerName, parameterField, plusButton = true, }) => {
|
3862
3893
|
const [loading, setLoading] = react.useState(false);
|
3863
3894
|
const [addItemPopupType, setAddItemPopupType] = react.useState('');
|
@@ -3953,7 +3984,7 @@ const OverlayItemsIndexPage = ({ url, layerName, parameterField, plusButton = tr
|
|
3953
3984
|
: 0;
|
3954
3985
|
return dateB - dateA; // Subtracts milliseconds which are numbers
|
3955
3986
|
})
|
3956
|
-
.map((i, k) => (jsxRuntime.jsx("div", { className: 'tw-break-inside-avoid tw-mb-6', children: jsxRuntime.jsx(ItemCard, { i: i, loading: loading, url: url,
|
3987
|
+
.map((i, k) => (jsxRuntime.jsx("div", { className: 'tw-break-inside-avoid tw-mb-6', children: jsxRuntime.jsx(ItemCard, { i: i, loading: loading, url: url, deleteCallback: () => deleteItem(i) }) }, k))), addItemPopupType === 'place' && (jsxRuntime.jsx("form", { ref: tabRef, autoComplete: 'off', onSubmit: (e) => submitNewItem(e), children: jsxRuntime.jsxs("div", { className: 'tw-cursor-pointer tw-break-inside-avoid tw-card tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-bg-base-100 tw-text-base-content tw-p-6 tw-mb-10', children: [jsxRuntime.jsx("label", { className: 'tw-btn tw-btn-sm tw-rounded-2xl tw-btn-circle tw-btn-ghost hover:tw-bg-transparent tw-absolute tw-right-0 tw-top-0 tw-text-gray-600', onClick: () => setAddItemPopupType(''), children: jsxRuntime.jsx("p", { className: 'tw-text-center', children: "\u2715" }) }), jsxRuntime.jsx(TextInput, { type: 'text', placeholder: 'Name', dataField: 'name', defaultValue: '', inputStyle: '' }), layer?.itemType.show_start_end_input && jsxRuntime.jsx(PopupStartEndInput, {}), jsxRuntime.jsx(TextAreaInput, { placeholder: 'Text', dataField: 'text', defaultValue: '', inputStyle: 'tw-h-40 tw-mt-5' }), jsxRuntime.jsx("div", { className: 'tw-flex tw-justify-center', children: jsxRuntime.jsx("button", { className: loading
|
3957
3988
|
? 'tw-btn tw-btn-disabled tw-mt-5 tw-place-self-center'
|
3958
3989
|
: 'tw-btn tw-mt-5 tw-place-self-center', type: 'submit', children: loading ? jsxRuntime.jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Save' }) })] }) }))] }) })] }) }), plusButton && (jsxRuntime.jsx(PlusButton, { layer: layer, triggerAction: () => {
|
3959
3990
|
setAddItemPopupType('place');
|
@@ -4034,6 +4065,9 @@ const EmojiPicker = ({ selectedEmoji, selectedColor, selectedShape, setSelectedE
|
|
4034
4065
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { onClick: toggleDropdown, className: `tw-cursor-pointer ${selectedEmoji === 'select badge' ? 'tw-text-sm !tw-p-9 tw-text-center ' : 'tw-text-6xl'} tw-mask tw-mask-${selectedShape} tw-p-6 tw-bg-[${selectedColor}]`, children: selectedEmoji }), isOpen && (jsxRuntime.jsxs("div", { className: 'tw-absolute tw-z-3000 tw-top-0 tw-left-1/2 tw-transform tw--translate-x-1/2 tw-mt-12 tw-bg-base-100 tw-rounded-2xl tw-shadow-lg tw-p-2 tw-w-full', children: [jsxRuntime.jsx("div", { className: 'tw-grid tw-grid-cols-6 tw-gap-2 tw-pb-2', children: emojis.map((emoji) => (jsxRuntime.jsx("button", { onClick: () => selectEmoji(emoji), className: `tw-cursor-pointer tw-text-2xl tw-p-2 hover:tw-bg-base-200 tw-rounded-md ${emoji === selectedEmoji && 'tw-bg-base-300'}`, children: emoji }, emoji))) }), jsxRuntime.jsx("hr", {}), jsxRuntime.jsx("div", { className: 'tw-grid tw-grid-cols-3 tw-gap-2 tw-py-2', children: shapes.map((shape) => (jsxRuntime.jsx("div", { className: `tw-cursor-pointer hover:tw-bg-base-200 tw-rounded-md tw-p-2 ${shape === selectedShape && 'tw-bg-base-300'}`, onClick: () => selectShape(shape), children: jsxRuntime.jsx("div", { className: `tw-h-12 tw-mask tw-mask-${shape} tw-bg-neutral-content` }) }, shape))) }), jsxRuntime.jsx("hr", {}), jsxRuntime.jsx("div", { className: 'tw-grid tw-grid-cols-6 tw-gap-2 tw-py-2 tw-px-6', children: colors.map((color) => (jsxRuntime.jsx("div", { className: `tw-cursor-pointer hover:tw-bg-base-200 tw-rounded-md tw-p-2 tw-flex tw-justify-center tw-items-center ${color === selectedColor && 'tw-bg-base-300'}`, onClick: () => selectColor(color), children: jsxRuntime.jsx("div", { className: `tw-h-8 tw-w-8 tw-rounded-full tw-bg-[${color}]` }) }, color))) })] }))] }));
|
4035
4066
|
};
|
4036
4067
|
|
4068
|
+
/**
|
4069
|
+
* @category Templates
|
4070
|
+
*/
|
4037
4071
|
const AttestationForm = ({ api }) => {
|
4038
4072
|
const items = useItems();
|
4039
4073
|
const appState = useAppState();
|
@@ -4112,6 +4146,9 @@ function groupAndCount(arr) {
|
|
4112
4146
|
}, []);
|
4113
4147
|
return grouped.sort((a, b) => b.count - a.count);
|
4114
4148
|
}
|
4149
|
+
/**
|
4150
|
+
* @category Templates
|
4151
|
+
*/
|
4115
4152
|
const MarketView = () => {
|
4116
4153
|
const [offers, setOffers] = react.useState([]);
|
4117
4154
|
const [needs, setNeeds] = react.useState([]);
|
@@ -4121,21 +4158,16 @@ const MarketView = () => {
|
|
4121
4158
|
react.useEffect(() => {
|
4122
4159
|
setOffers([]);
|
4123
4160
|
setNeeds([]);
|
4124
|
-
items
|
4125
|
-
|
4126
|
-
|
4127
|
-
|
4128
|
-
|
4129
|
-
|
4130
|
-
|
4131
|
-
|
4132
|
-
|
4133
|
-
|
4134
|
-
tag && setNeeds((current) => [...current, tag]);
|
4135
|
-
return null;
|
4136
|
-
});
|
4137
|
-
return null;
|
4138
|
-
});
|
4161
|
+
for (const item of items) {
|
4162
|
+
item.offers?.forEach((o) => {
|
4163
|
+
const tag = tags.find((t) => t.id === o.tags_id);
|
4164
|
+
tag && setOffers((current) => [...current, tag]);
|
4165
|
+
});
|
4166
|
+
item.needs?.forEach((n) => {
|
4167
|
+
const tag = tags.find((t) => t.id === n.tags_id);
|
4168
|
+
tag && setNeeds((current) => [...current, tag]);
|
4169
|
+
});
|
4170
|
+
}
|
4139
4171
|
// eslint-disable-next-line no-console
|
4140
4172
|
console.log(offers);
|
4141
4173
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
@@ -4143,6 +4175,9 @@ const MarketView = () => {
|
|
4143
4175
|
return (jsxRuntime.jsx(MapOverlayPage, { className: 'tw-rounded-none tw-overflow-y-auto tw-bg-base-200 !tw-p-4', children: jsxRuntime.jsxs("div", { className: 'tw-grid tw-grid-cols-1 md:tw-grid-cols-2', children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("p", { className: 'tw-text-lg tw-font-bold', children: "Offers" }), jsxRuntime.jsx("div", { className: 'tw-flex tw-flex-wrap', children: groupAndCount(offers).map((o) => (jsxRuntime.jsx(TagView, { onClick: () => navigate(`/?tags=${o.object.name}`), tag: o.object, count: o.count }, o.object.id))) })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("p", { className: 'tw-text-lg tw-font-bold', children: "Needs" }), jsxRuntime.jsx("div", { className: 'tw-flex tw-flex-wrap', children: groupAndCount(needs).map((o) => (jsxRuntime.jsx(TagView, { onClick: () => navigate(`/?tags=${o.object.name}`), tag: o.object, count: o.count }, o.object.id))) })] })] }) }));
|
4144
4176
|
};
|
4145
4177
|
|
4178
|
+
/**
|
4179
|
+
* @category Profile
|
4180
|
+
*/
|
4146
4181
|
function UserSettings() {
|
4147
4182
|
const { user, updateUser, loading /* token */ } = useAuth();
|
4148
4183
|
const [id, setId] = react.useState('');
|
@@ -4400,7 +4435,7 @@ styleInject(css_248z$1);
|
|
4400
4435
|
const GalleryView = ({ item }) => {
|
4401
4436
|
const [index, setIndex] = react.useState(-1);
|
4402
4437
|
const appState = useAppState();
|
4403
|
-
const images = item.gallery
|
4438
|
+
const images = item.gallery?.map((i, j) => {
|
4404
4439
|
return {
|
4405
4440
|
src: appState.assetsApi.url + `${i.directus_files_id.id}.jpg`,
|
4406
4441
|
width: i.directus_files_id.width,
|
@@ -4408,6 +4443,8 @@ const GalleryView = ({ item }) => {
|
|
4408
4443
|
index: j,
|
4409
4444
|
};
|
4410
4445
|
});
|
4446
|
+
if (!images)
|
4447
|
+
throw new Error('GalleryView: images is undefined');
|
4411
4448
|
return (jsxRuntime.jsxs("div", { className: 'tw-mx-6 tw-mb-6', children: [jsxRuntime.jsx(reactPhotoAlbum.RowsPhotoAlbum, { photos: images, targetRowHeight: 150, onClick: ({ index: current }) => setIndex(current) }), jsxRuntime.jsx(ReactLightbox, { index: index, slides: images, open: index >= 0, close: () => setIndex(-1) })] }));
|
4412
4449
|
};
|
4413
4450
|
|
@@ -4489,8 +4526,30 @@ const ProfileStartEndView = ({ item }) => {
|
|
4489
4526
|
return (jsxRuntime.jsx("div", { className: 'tw-mt-2 tw-px-6 tw-max-w-xs', children: jsxRuntime.jsx(StartEndView, { item: item }) }));
|
4490
4527
|
};
|
4491
4528
|
|
4492
|
-
const
|
4493
|
-
|
4529
|
+
const get = (value, path, defaultValue) => {
|
4530
|
+
const segments = path.split(/[\.\[\]]/g);
|
4531
|
+
let current = value;
|
4532
|
+
for (const key of segments) {
|
4533
|
+
if (current === null)
|
4534
|
+
return defaultValue;
|
4535
|
+
if (current === void 0)
|
4536
|
+
return defaultValue;
|
4537
|
+
const dequoted = key.replace(/['"]/g, "");
|
4538
|
+
if (dequoted.trim() === "")
|
4539
|
+
continue;
|
4540
|
+
current = current[dequoted];
|
4541
|
+
}
|
4542
|
+
if (current === void 0)
|
4543
|
+
return defaultValue;
|
4544
|
+
return current;
|
4545
|
+
};
|
4546
|
+
|
4547
|
+
const ProfileTextView = ({ item, dataField = 'text', heading, hideWhenEmpty, }) => {
|
4548
|
+
const text = get(item, dataField);
|
4549
|
+
if (typeof text !== 'string') {
|
4550
|
+
throw new Error('ProfileTextView: text is not a string');
|
4551
|
+
}
|
4552
|
+
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 }) })] }));
|
4494
4553
|
};
|
4495
4554
|
|
4496
4555
|
const componentMap$1 = {
|
@@ -4504,21 +4563,23 @@ const componentMap$1 = {
|
|
4504
4563
|
const FlexView = ({ item }) => {
|
4505
4564
|
// eslint-disable-next-line no-console
|
4506
4565
|
console.log(item);
|
4507
|
-
return (jsxRuntime.jsx("div", { className: 'tw-h-full tw-overflow-y-auto fade', children: item.layer?.itemType.profileTemplate.map(
|
4566
|
+
return (jsxRuntime.jsx("div", { className: 'tw-h-full tw-overflow-y-auto fade', children: item.layer?.itemType.profileTemplate.map(
|
4567
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4568
|
+
(templateItem) => {
|
4508
4569
|
const TemplateComponent = componentMap$1[templateItem.collection];
|
4509
4570
|
return TemplateComponent ? (jsxRuntime.jsx(TemplateComponent, { item: item, ...templateItem.item }, templateItem.id)) : (jsxRuntime.jsx("div", { children: "Component not found" }, templateItem.id));
|
4510
4571
|
}) }));
|
4511
4572
|
};
|
4512
4573
|
|
4513
4574
|
const OnepagerView = ({ item }) => {
|
4514
|
-
return (jsxRuntime.jsxs("div", { className: 'tw-h-full tw-overflow-y-auto fade', children: [jsxRuntime.jsx(GroupSubHeaderView, { item: item, shareBaseUrl: `https://www.wuerdekompass.org/aktivitaeten/gruppensuche/#/gruppe/${item.slug}` }), item.user_created?.first_name && jsxRuntime.jsx(ContactInfoView, { heading: 'Du hast Fragen?', item: item }), jsxRuntime.jsx("div", { className: 'tw-my-10 tw-mt-2 tw-px-6 tw-text-sm ', children: jsxRuntime.jsx(TextView, { rawText: item.text
|
4575
|
+
return (jsxRuntime.jsxs("div", { className: 'tw-h-full tw-overflow-y-auto fade', children: [jsxRuntime.jsx(GroupSubHeaderView, { item: item, shareBaseUrl: `https://www.wuerdekompass.org/aktivitaeten/gruppensuche/#/gruppe/${item.slug}` }), item.user_created?.first_name && jsxRuntime.jsx(ContactInfoView, { heading: 'Du hast Fragen?', item: item }), jsxRuntime.jsx("div", { className: 'tw-my-10 tw-mt-2 tw-px-6 tw-text-sm ', children: jsxRuntime.jsx(TextView, { itemId: item.id, rawText: item.text ?? 'Keine Beschreibung vorhanden' }) }), item.next_appointment && (jsxRuntime.jsxs("div", { className: 'tw-my-10 tw-px-6', children: [jsxRuntime.jsx("h2", { className: 'tw-text-lg tw-font-semibold', children: "N\u00E4chste Termine" }), jsxRuntime.jsx("div", { className: 'tw-mt-2 tw-text-sm', children: jsxRuntime.jsx(TextView, { itemId: item.id, rawText: item.next_appointment }) })] })), ";"] }));
|
4515
4576
|
};
|
4516
4577
|
|
4517
4578
|
const SimpleView = ({ item }) => {
|
4518
|
-
return (jsxRuntime.jsx("div", { className: 'tw-mt-8 tw-h-full tw-overflow-y-auto fade tw-px-6', children: jsxRuntime.jsx(TextView, { item: item }) }));
|
4579
|
+
return (jsxRuntime.jsx("div", { className: 'tw-mt-8 tw-h-full tw-overflow-y-auto fade tw-px-6', children: jsxRuntime.jsx(TextView, { text: item.text, itemId: item.id }) }));
|
4519
4580
|
};
|
4520
4581
|
|
4521
|
-
function ActionButton({ item, triggerAddButton, triggerItemSelected, existingRelations, itemType,
|
4582
|
+
function ActionButton({ item, triggerAddButton, triggerItemSelected, existingRelations, itemType, collection = 'items', customStyle, }) {
|
4522
4583
|
const hasUserPermission = useHasUserPermission();
|
4523
4584
|
const [modalOpen, setModalOpen] = react.useState(false);
|
4524
4585
|
const [search, setSearch] = react.useState('');
|
@@ -4528,15 +4589,19 @@ function ActionButton({ item, triggerAddButton, triggerItemSelected, existingRel
|
|
4528
4589
|
.filter((i) => !itemType || i.layer?.itemType.name === itemType)
|
4529
4590
|
.filter((i) => !existingRelations.some((s) => s.id === i.id))
|
4530
4591
|
.filter((i) => i.id !== item.id);
|
4592
|
+
const backgroundColor = item.color ??
|
4593
|
+
(getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color
|
4594
|
+
? getItemTags(item)[0].color
|
4595
|
+
: item.layer?.markerDefaultColor);
|
4531
4596
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: hasUserPermission(collection, 'update', item) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: `tw-absolute tw-right-4 tw-bottom-4 tw-flex tw-flex-col ${customStyle}`, children: [triggerItemSelected && (jsxRuntime.jsx("button", { tabIndex: 0, className: 'tw-z-500 tw-btn tw-btn-circle tw-shadow', onClick: () => {
|
4532
4597
|
setModalOpen(true);
|
4533
4598
|
}, style: {
|
4534
|
-
backgroundColor
|
4599
|
+
backgroundColor,
|
4535
4600
|
color: '#fff',
|
4536
4601
|
}, children: jsxRuntime.jsx("svg", { className: 'tw-h-5 tw-w-5', stroke: 'currentColor', fill: 'currentColor', strokeWidth: '0', viewBox: '0 0 512 512', xmlns: 'http://www.w3.org/2000/svg', children: jsxRuntime.jsx("path", { d: 'M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z' }) }) })), triggerAddButton && (jsxRuntime.jsx("button", { tabIndex: 0, className: 'tw-z-500 tw-btn tw-btn-circle tw-shadow tw-mt-2', onClick: () => {
|
4537
4602
|
triggerAddButton();
|
4538
4603
|
}, style: {
|
4539
|
-
backgroundColor
|
4604
|
+
backgroundColor,
|
4540
4605
|
color: '#fff',
|
4541
4606
|
}, children: jsxRuntime.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', fill: 'none', viewBox: '0 0 24 24', strokeWidth: '4', stroke: 'currentColor', className: 'tw-w-5 tw-h-5', children: jsxRuntime.jsx("path", { strokeLinecap: 'round', strokeLinejoin: 'round', d: 'M12 4.5v15m7.5-7.5h-15' }) }) }))] }), jsxRuntime.jsxs(DialogModal, { title: 'Select', isOpened: modalOpen, onClose: () => setModalOpen(false), className: 'tw-w-xl sm:tw-w-2xl tw-min-h-80 tw-bg-base-200', children: [jsxRuntime.jsx(TextInput, { defaultValue: '', placeholder: '\uD83D\uDD0D Search', containerStyle: 'lg:col-span-2 tw-m-4 ', updateFormValue: (val) => {
|
4542
4607
|
setSearch(val);
|
@@ -4552,20 +4617,11 @@ function ActionButton({ item, triggerAddButton, triggerItemSelected, existingRel
|
|
4552
4617
|
}, children: jsxRuntime.jsx(HeaderView, { item: i, hideMenu: true }) }, i.id))) })] })] })) }));
|
4553
4618
|
}
|
4554
4619
|
|
4555
|
-
function LinkedItemsHeaderView({ item, unlinkCallback,
|
4620
|
+
function LinkedItemsHeaderView({ item, unlinkCallback, loading, unlinkPermission, }) {
|
4556
4621
|
const appState = useAppState();
|
4557
|
-
const avatar =
|
4558
|
-
|
4559
|
-
|
4560
|
-
item &&
|
4561
|
-
getValue(item, item.layer?.itemAvatarField) &&
|
4562
|
-
appState.assetsApi.url + getValue(item, item.layer?.itemAvatarField);
|
4563
|
-
const title = itemNameField
|
4564
|
-
? getValue(item, itemNameField)
|
4565
|
-
: item.layer?.itemNameField && item && getValue(item, item.layer.itemNameField);
|
4566
|
-
const subtitle = itemSubnameField
|
4567
|
-
? getValue(item, itemSubnameField)
|
4568
|
-
: item.layer?.itemSubnameField && item && getValue(item, item.layer.itemSubnameField);
|
4622
|
+
const avatar = appState.assetsApi.url + item.image;
|
4623
|
+
const title = item.name;
|
4624
|
+
const subtitle = item.subname;
|
4569
4625
|
react.useEffect(() => { }, [item]);
|
4570
4626
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { className: 'tw-flex tw-flex-row', children: [jsxRuntime.jsx("div", { className: 'tw-grow tw-max-w-[calc(100%-60px)] }', children: jsxRuntime.jsxs("div", { className: 'flex items-center', children: [avatar && (jsxRuntime.jsx("img", { className: 'tw-w-10 tw-inline tw-rounded-full', src: avatar, alt: item.name + ' logo' })), jsxRuntime.jsxs("div", { className: `${avatar ? 'tw-ml-2' : ''} tw-overflow-hidden`, children: [jsxRuntime.jsx("div", { className: 'tw-text-xl tw-font-semibold tw-truncate', children: title }), subtitle && (jsxRuntime.jsx("div", { className: 'tw-text-xs tw-truncate tw-text-gray-500 ', children: subtitle }))] })] }) }), jsxRuntime.jsx("div", { className: 'tw-col-span-1', onClick: (e) => e.stopPropagation(), children: unlinkPermission && (jsxRuntime.jsxs("div", { className: 'tw-dropdown tw-dropdown-bottom', children: [jsxRuntime.jsx("label", { tabIndex: 0, className: ' tw-btn tw-m-1 tw-leading-3 tw-border-none tw-min-h-0 tw-h-6', children: jsxRuntime.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', className: 'tw-h-5 tw-w-5', viewBox: '0 0 20 20', fill: 'currentColor', children: jsxRuntime.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' }) }) }), jsxRuntime.jsx("ul", { tabIndex: 0, className: 'tw-dropdown-content tw-menu tw-p-2 tw-shadow tw-bg-base-100 tw-rounded-box tw-z-1000', children: (jsxRuntime.jsx("li", { children: jsxRuntime.jsx("a", { className: 'tw-cursor-pointer !tw-text-error', onClick: () => unlinkCallback(item.id), children: loading ? (jsxRuntime.jsx("span", { className: 'tw-loading tw-loading-spinner tw-loading-sm' })) : (jsxRuntime.jsx("svg", { className: 'tw-h-5 tw-w-5', stroke: 'currentColor', fill: 'currentColor', strokeWidth: '0', viewBox: '0 0 512 512', xmlns: 'http://www.w3.org/2000/svg', children: jsxRuntime.jsx("path", { d: 'M304.083 405.907c4.686 4.686 4.686 12.284 0 16.971l-44.674 44.674c-59.263 59.262-155.693 59.266-214.961 0-59.264-59.265-59.264-155.696 0-214.96l44.675-44.675c4.686-4.686 12.284-4.686 16.971 0l39.598 39.598c4.686 4.686 4.686 12.284 0 16.971l-44.675 44.674c-28.072 28.073-28.072 73.75 0 101.823 28.072 28.072 73.75 28.073 101.824 0l44.674-44.674c4.686-4.686 12.284-4.686 16.971 0l39.597 39.598zm-56.568-260.216c4.686 4.686 12.284 4.686 16.971 0l44.674-44.674c28.072-28.075 73.75-28.073 101.824 0 28.072 28.073 28.072 73.75 0 101.823l-44.675 44.674c-4.686 4.686-4.686 12.284 0 16.971l39.598 39.598c4.686 4.686 12.284 4.686 16.971 0l44.675-44.675c59.265-59.265 59.265-155.695 0-214.96-59.266-59.264-155.695-59.264-214.961 0l-44.674 44.674c-4.686 4.686-4.686 12.284 0 16.971l39.597 39.598zm234.828 359.28l22.627-22.627c9.373-9.373 9.373-24.569 0-33.941L63.598 7.029c-9.373-9.373-24.569-9.373-33.941 0L7.029 29.657c-9.373 9.373-9.373 24.569 0 33.941l441.373 441.373c9.373 9.372 24.569 9.372 33.941 0z' }) })) }) })) })] })) })] }) }));
|
4571
4627
|
}
|
@@ -4602,16 +4658,19 @@ const TabsView = ({ attestations, item, offers, needs, relations, updatePermissi
|
|
4602
4658
|
setActiveTab(urlTab ? Number(urlTab) : 1);
|
4603
4659
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
4604
4660
|
}, [location.search]);
|
4605
|
-
return (jsxRuntime.jsxs("div", { role: 'tablist', className: 'tw-tabs tw-tabs-lifted tw-mt-2 tw-mb-2 tw-px-6', children: [jsxRuntime.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": `${item.layer?.itemType.icon_as_labels && activeTab !== 1 ? '📝' : '📝\u00A0Info'}`, checked: activeTab === 1 && true, onChange: () => updateActiveTab(1) }), jsxRuntime.jsxs("div", { 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: [item.layer?.itemType.show_start_end && (jsxRuntime.jsx("div", { className: 'tw-max-w-xs', children: jsxRuntime.jsx(StartEndView, { item: item }) })), jsxRuntime.jsx(TextView, { item: item }), jsxRuntime.jsx("div", { className: 'tw-h-4' }), jsxRuntime.jsx(TextView, {
|
4661
|
+
return (jsxRuntime.jsxs("div", { role: 'tablist', className: 'tw-tabs tw-tabs-lifted tw-mt-2 tw-mb-2 tw-px-6', children: [jsxRuntime.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": `${item.layer?.itemType.icon_as_labels && activeTab !== 1 ? '📝' : '📝\u00A0Info'}`, checked: activeTab === 1 && true, onChange: () => updateActiveTab(1) }), jsxRuntime.jsxs("div", { 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: [item.layer?.itemType.show_start_end && (jsxRuntime.jsx("div", { className: 'tw-max-w-xs', children: jsxRuntime.jsx(StartEndView, { item: item }) })), jsxRuntime.jsx(TextView, { text: item.text, itemId: item.id }), jsxRuntime.jsx("div", { className: 'tw-h-4' }), jsxRuntime.jsx(TextView, { text: item.contact, itemId: item.id })] }), item.layer?.itemType.questlog && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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": `${item.layer.itemType.icon_as_labels && activeTab !== 2 ? '❤️' : '❤️\u00A0Trust'}`, checked: activeTab === 2 && true, onChange: () => updateActiveTab(2) }), jsxRuntime.jsx("div", { 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: jsxRuntime.jsx("table", { className: 'sm:tw-table-sm md:tw-table-md', children: jsxRuntime.jsx("tbody", { children: attestations
|
4606
4662
|
.filter((a) => a.to.some((t) => t.directus_users_id === item.user_created?.id))
|
4607
4663
|
.sort((a, b) => new Date(b.date_created).getTime() - new Date(a.date_created).getTime())
|
4608
4664
|
.map((a, i) => (jsxRuntime.jsxs("tr", { children: [jsxRuntime.jsx("td", { children: jsxRuntime.jsx("div", { className: `tw-cursor-pointer tw-text-3xl tw-mask tw-mask-${a.shape} tw-p-3 tw-mr-2 tw-shadow-xl tw-bg-[${a.color}]`, children: a.emoji }) }), jsxRuntime.jsx("td", { children: jsxRuntime.jsx("div", { className: 'tw-mr-2', children: jsxRuntime.jsx("i", { children: a.text }) }) }), jsxRuntime.jsx("td", { children: jsxRuntime.jsx(reactRouterDom.Link, { to: '/item/' + getUserProfile(a.user_created.id)?.id, children: jsxRuntime.jsxs("div", { className: 'flex items-center gap-3', children: [jsxRuntime.jsx("div", { className: 'tw-avatar', children: jsxRuntime.jsx("div", { className: 'tw-mask tw-rounded-full h-8 w-8 tw-mr-2', children: jsxRuntime.jsx("img", { src: appState.assetsApi.url +
|
4609
4665
|
getUserProfile(a.user_created.id)?.image, alt: 'Avatar' }) }) }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: 'font-bold', children: getUserProfile(a.user_created.id)?.name }), jsxRuntime.jsx("div", { className: 'tw-text-xs opacity-50 tw-text-zinc-500', children: timeAgo(a.date_created) })] })] }) }) })] }, i))) }) }) })] })), item.layer?.itemType.offers_and_needs && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("input", { type: 'radio', name: 'my_tabs_2', role: 'tab', className: `tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 ${!(item.layer.itemType.icon_as_labels && activeTab !== 3) && 'tw-min-w-[10.4em]'} [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]`, "aria-label": `${item.layer.itemType.icon_as_labels && activeTab !== 3 ? '♻️' : '♻️\u00A0Offers & Needs'}`, checked: activeTab === 3 && true, onChange: () => updateActiveTab(3) }), jsxRuntime.jsx("div", { role: 'tabpanel', className: 'tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-268px)] tw-overflow-y-auto fade tw-pt-4 tw-pb-1', children: jsxRuntime.jsx("div", { className: 'tw-h-full', children: jsxRuntime.jsxs("div", { className: 'tw-grid tw-grid-cols-1', children: [offers.length > 0 ? (jsxRuntime.jsxs("div", { className: 'tw-col-span-1', children: [jsxRuntime.jsx("h3", { className: '-tw-mb-2', children: "Offers" }), jsxRuntime.jsx("div", { className: 'tw-flex tw-flex-wrap tw-mb-4', children: offers.map((o) => (jsxRuntime.jsx(TagView, { tag: o, onClick: () => {
|
4610
4666
|
addFilterTag(o);
|
4611
4667
|
} }, o.id))) })] })) : (''), needs.length > 0 ? (jsxRuntime.jsxs("div", { className: 'tw-col-span-1', children: [jsxRuntime.jsx("h3", { className: '-tw-mb-2 tw-col-span-1', children: "Needs" }), jsxRuntime.jsx("div", { className: 'tw-flex tw-flex-wrap tw-mb-4', children: needs.map((n) => (jsxRuntime.jsx(TagView, { tag: n, onClick: () => addFilterTag(n) }, n.id))) })] })) : ('')] }) }) })] })), item.layer?.itemType.relations && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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": `${item.layer.itemType.icon_as_labels && activeTab !== 7 ? '🔗' : '🔗\u00A0Links'}`, checked: activeTab === 7 && true, onChange: () => updateActiveTab(7) }), jsxRuntime.jsx("div", { role: 'tabpanel', className: 'tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-280px)] tw-overflow-y-auto tw-pt-4 tw-pb-1 -tw-mr-4 -tw-mb-4 tw-overflow-x-hidden', children: jsxRuntime.jsx("div", { className: 'tw-h-full', children: jsxRuntime.jsxs("div", { className: 'tw-grid tw-grid-cols-1 sm:tw-grid-cols-2 md:tw-grid-cols-1 lg:tw-grid-cols-1 xl:tw-grid-cols-1 2xl:tw-grid-cols-2 tw-pb-4', children: [relations &&
|
4612
|
-
relations.map((i) => (jsxRuntime.jsxs("div", { className: 'tw-cursor-pointer tw-card tw-bg-base-200 tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-text-base-content tw-p-6 tw-mr-4 tw-mb-4', onClick: () => navigate('/item/' + i.id), children: [jsxRuntime.jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: unlinkItem, loading: loading }), jsxRuntime.jsx("div", { className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade', children: jsxRuntime.jsx(TextView, { truncate: true,
|
4668
|
+
relations.map((i) => (jsxRuntime.jsxs("div", { className: 'tw-cursor-pointer tw-card tw-bg-base-200 tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-text-base-content tw-p-6 tw-mr-4 tw-mb-4', onClick: () => navigate('/item/' + i.id), children: [jsxRuntime.jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: unlinkItem, loading: loading }), jsxRuntime.jsx("div", { className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade', children: jsxRuntime.jsx(TextView, { truncate: true, text: i.text, itemId: item.id }) })] }, i.id))), updatePermission && (jsxRuntime.jsx(ActionButton, { collection: 'items', item: item, existingRelations: relations, triggerItemSelected: linkItem }))] }) }) })] }))] }));
|
4613
4669
|
};
|
4614
4670
|
|
4671
|
+
/**
|
4672
|
+
* @category Profile
|
4673
|
+
*/
|
4615
4674
|
function ProfileView({ attestationApi }) {
|
4616
4675
|
const [item, setItem] = react.useState();
|
4617
4676
|
const [updatePermission, setUpdatePermission] = react.useState(false);
|
@@ -4660,28 +4719,23 @@ function ProfileView({ attestationApi }) {
|
|
4660
4719
|
setOffers([]);
|
4661
4720
|
setNeeds([]);
|
4662
4721
|
setRelations([]);
|
4663
|
-
item?.
|
4664
|
-
|
4665
|
-
|
4666
|
-
|
4667
|
-
|
4668
|
-
|
4669
|
-
|
4670
|
-
|
4671
|
-
|
4672
|
-
tag && setNeeds((current) => [...current, tag]);
|
4673
|
-
return null;
|
4674
|
-
});
|
4675
|
-
item?.relations?.map((r) => {
|
4722
|
+
item?.offers?.forEach((o) => {
|
4723
|
+
const tag = tags.find((t) => t.id === o.tags_id);
|
4724
|
+
tag && setOffers((current) => [...current, tag]);
|
4725
|
+
});
|
4726
|
+
item?.needs?.forEach((n) => {
|
4727
|
+
const tag = tags.find((t) => t.id === n.tags_id);
|
4728
|
+
tag && setNeeds((current) => [...current, tag]);
|
4729
|
+
});
|
4730
|
+
item?.relations?.forEach((r) => {
|
4676
4731
|
const item = items.find((i) => i.id === r.related_items_id);
|
4677
4732
|
item && setRelations((current) => [...current, item]);
|
4678
|
-
return null;
|
4679
4733
|
});
|
4680
4734
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
4681
4735
|
}, [item, items]);
|
4682
4736
|
react.useEffect(() => {
|
4683
|
-
const setMap =
|
4684
|
-
|
4737
|
+
const setMap = (marker, x) => {
|
4738
|
+
map.setView(new leaflet.LatLng(item?.position?.coordinates[1], item?.position?.coordinates[0] + x / 4), undefined);
|
4685
4739
|
setTimeout(() => {
|
4686
4740
|
marker.openPopup();
|
4687
4741
|
}, 500);
|
@@ -4729,7 +4783,7 @@ function ProfileView({ attestationApi }) {
|
|
4729
4783
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
4730
4784
|
}, [selectPosition]);
|
4731
4785
|
react.useEffect(() => {
|
4732
|
-
setTemplate(item?.layer?.itemType.template
|
4786
|
+
setTemplate(item?.layer?.itemType.template ?? appState.userType);
|
4733
4787
|
}, [appState.userType, item]);
|
4734
4788
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: item && (jsxRuntime.jsx(MapOverlayPage, { className: `!tw-p-0 tw-mx-4 tw-mt-4 tw-mb-4 md:tw-w-[calc(50%-32px)] tw-w-[calc(100%-32px)] tw-min-w-80 tw-max-w-3xl !tw-left-0 sm:!tw-left-auto tw-top-0 tw-bottom-0 tw-transition-opacity tw-duration-500 ${!selectPosition ? 'tw-opacity-100 tw-pointer-events-auto' : 'tw-opacity-0 tw-pointer-events-none'}`, children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: 'tw-px-6 tw-pt-6', children: jsxRuntime.jsx(HeaderView, { api: item.layer?.api, item: item, deleteCallback: (e) => handleDelete(e, item, setLoading, removeItem, map, navigate), editCallback: () => navigate('/edit-item/' + item.id), setPositionCallback: () => {
|
4735
4789
|
map.closePopup();
|
@@ -4977,14 +5031,18 @@ const MarkdownHint = () => {
|
|
4977
5031
|
return (jsxRuntime.jsxs("div", { onClick: () => setExpended(true), title: 'Markdown is supported', className: 'flex tw-flex-row tw-text-gray-400 tw-cursor-pointer tw-items-center', children: [jsxRuntime.jsx("svg", { "aria-hidden": 'true', height: '16', viewBox: '0 0 16 16', version: '1.1', width: '16', "data-view-component": 'true', className: 'octicon octicon-markdown', fill: 'rgb(156 163 175 / var(--tw-text-opacity))', children: jsxRuntime.jsx("path", { d: 'M14.85 3c.63 0 1.15.52 1.14 1.15v7.7c0 .63-.51 1.15-1.15 1.15H1.15C.52 13 0 12.48 0 11.84V4.15C0 3.52.52 3 1.15 3ZM9 11V5H7L5.5 7 4 5H2v6h2V8l1.5 1.92L7 8v3Zm2.99.5L14.5 8H13V5h-2v3H9.5Z' }) }), expended && (jsxRuntime.jsxs("a", { href: 'https://www.markdownguide.org/cheat-sheet/#basic-syntax', target: '_blank', rel: 'noreferrer', children: [jsxRuntime.jsx("span", { className: 'Button-label tw-ml-1', children: "Markdown is support" }), ' '] }))] }));
|
4978
5032
|
};
|
4979
5033
|
|
4980
|
-
const ProfileTextForm = ({ state, setState,
|
5034
|
+
const ProfileTextForm = ({ state, setState,
|
5035
|
+
// Is this really used?
|
5036
|
+
dataField, heading, size, hideInputLabel, required, }) => {
|
4981
5037
|
const [field, setField] = react.useState(dataField || 'text');
|
4982
5038
|
react.useEffect(() => {
|
4983
5039
|
if (!dataField) {
|
4984
5040
|
setField('text');
|
4985
5041
|
}
|
4986
5042
|
}, [dataField]);
|
4987
|
-
return (jsxRuntime.jsxs("div", { className: 'tw-h-full tw-flex tw-flex-col tw-mt-4', children: [jsxRuntime.jsxs("div", { className: 'tw-flex tw-justify-between tw-items-center', children: [jsxRuntime.jsxs("label", { htmlFor: 'nextAppointment', className: 'tw-block tw-text-sm tw-font-medium tw-text-gray-500 tw-mb-1', children: [heading || 'Text', ":"] }), jsxRuntime.jsx(MarkdownHint, {})] }), jsxRuntime.jsx(TextAreaInput, { placeholder: '...',
|
5043
|
+
return (jsxRuntime.jsxs("div", { className: 'tw-h-full tw-flex tw-flex-col tw-mt-4', children: [jsxRuntime.jsxs("div", { className: 'tw-flex tw-justify-between tw-items-center', children: [jsxRuntime.jsxs("label", { htmlFor: 'nextAppointment', className: 'tw-block tw-text-sm tw-font-medium tw-text-gray-500 tw-mb-1', children: [heading || 'Text', ":"] }), jsxRuntime.jsx(MarkdownHint, {})] }), jsxRuntime.jsx(TextAreaInput, { placeholder: '...',
|
5044
|
+
// eslint-disable-next-line security/detect-object-injection
|
5045
|
+
defaultValue: state[field], updateFormValue: (v) => setState((prevState) => ({
|
4988
5046
|
...prevState,
|
4989
5047
|
[field]: v,
|
4990
5048
|
})), labelStyle: hideInputLabel ? 'tw-hidden' : '', containerStyle: size === 'full' ? 'tw-grow tw-h-full' : '', inputStyle: size === 'full' ? 'tw-h-full' : 'tw-h-24', required: required })] }));
|
@@ -5186,16 +5244,19 @@ const TabsForm = ({ item, state, setState, updatePermission, linkItem, unlinkIte
|
|
5186
5244
|
})), containerStyle: 'tw-grow', inputStyle: `tw-h-full ${!item.layer.itemType.show_start_end_input && 'tw-border-t-0 tw-rounded-tl-none'}` }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx(TextAreaInput, { placeholder: 'contact info ...', defaultValue: state.contact || '', updateFormValue: (c) => setState((prevState) => ({
|
5187
5245
|
...prevState,
|
5188
5246
|
contact: c,
|
5189
|
-
})), inputStyle: 'tw-h-24', containerStyle: 'tw-pt-4' }) })] }) }), item.layer?.itemType.offers_and_needs && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("input", { type: 'radio', name: 'my_tabs_2', role: 'tab', className: 'tw-tab tw-min-w-[10em] [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]', "aria-label": 'Offers & Needs', checked: activeTab === 3 && true, onChange: () => updateActiveTab(3) }), jsxRuntime.jsx("div", { role: 'tabpanel', className: 'tw-tab-content tw-bg-base-100 tw-border-[var(--fallback-bc,oklch(var(--bc)/0.2))] tw-rounded-box tw-h-[calc(100dvh-332px)] tw-min-h-56 tw-border-none', children: jsxRuntime.jsxs("div", { className: 'tw-h-full', children: [jsxRuntime.jsx("div", { className: 'tw-w-full tw-h-[calc(50%-0.75em)] tw-mb-4', children: jsxRuntime.jsx(TagsWidget, { defaultTags: state.offers, onUpdate: (v) => setState((prevState) => ({
|
5247
|
+
})), inputStyle: 'tw-h-24', containerStyle: 'tw-pt-4', required: false }) })] }) }), item.layer?.itemType.offers_and_needs && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("input", { type: 'radio', name: 'my_tabs_2', role: 'tab', className: 'tw-tab tw-min-w-[10em] [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]', "aria-label": 'Offers & Needs', checked: activeTab === 3 && true, onChange: () => updateActiveTab(3) }), jsxRuntime.jsx("div", { role: 'tabpanel', className: 'tw-tab-content tw-bg-base-100 tw-border-[var(--fallback-bc,oklch(var(--bc)/0.2))] tw-rounded-box tw-h-[calc(100dvh-332px)] tw-min-h-56 tw-border-none', children: jsxRuntime.jsxs("div", { className: 'tw-h-full', children: [jsxRuntime.jsx("div", { className: 'tw-w-full tw-h-[calc(50%-0.75em)] tw-mb-4', children: jsxRuntime.jsx(TagsWidget, { defaultTags: state.offers, onUpdate: (v) => setState((prevState) => ({
|
5190
5248
|
...prevState,
|
5191
5249
|
offers: v,
|
5192
5250
|
})), placeholder: 'enter your offers', containerStyle: 'tw-bg-transparent tw-w-full tw-h-full tw-mt-3 tw-text-xs tw-h-[calc(100%-1rem)] tw-min-h-[5em] tw-pb-2 tw-overflow-auto' }) }), jsxRuntime.jsx("div", { className: 'tw-w-full tw-h-[calc(50%-1.5em)]', children: jsxRuntime.jsx(TagsWidget, { defaultTags: state.needs, onUpdate: (v) => setState((prevState) => ({
|
5193
5251
|
...prevState,
|
5194
5252
|
needs: v,
|
5195
5253
|
})), placeholder: 'enter your needs', containerStyle: 'tw-bg-transparent tw-w-full tw-h-full tw-mt-3 tw-text-xs tw-h-[calc(100%-1rem)] tw-min-h-[5em] tw-pb-2 tw-overflow-auto' }) })] }) })] })), item.layer?.itemType.relations && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("input", { type: 'radio', name: 'my_tabs_2', role: 'tab', className: 'tw-tab [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]', "aria-label": 'Links', checked: activeTab === 7 && true, onChange: () => updateActiveTab(7) }), jsxRuntime.jsx("div", { role: 'tabpanel', className: 'tw-tab-content tw-bg-base-100 tw-rounded-box tw-h-[calc(100dvh-332px)] tw-overflow-y-auto tw-pt-4 tw-pb-1 -tw-mx-4 tw-overflow-x-hidden fade', children: jsxRuntime.jsx("div", { className: 'tw-h-full', children: jsxRuntime.jsxs("div", { className: 'tw-grid tw-grid-cols-1 sm:tw-grid-cols-2 md:tw-grid-cols-1 lg:tw-grid-cols-1 xl:tw-grid-cols-1 2xl:tw-grid-cols-2 tw-mb-4', children: [state.relations &&
|
5196
|
-
state.relations.map((i) => (jsxRuntime.jsxs("div", { className: 'tw-cursor-pointer tw-card tw-bg-base-200 tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-text-base-content tw-mx-4 tw-p-6 tw-mb-4', onClick: () => navigate('/item/' + i.id), children: [jsxRuntime.jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: (id) => unlinkItem(id, item, updateItem), loading: loading }), jsxRuntime.jsx("div", { className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade', children: jsxRuntime.jsx(TextView, { truncate: true,
|
5254
|
+
state.relations.map((i) => (jsxRuntime.jsxs("div", { className: 'tw-cursor-pointer tw-card tw-bg-base-200 tw-border-[1px] tw-border-base-300 tw-card-body tw-shadow-xl tw-text-base-content tw-mx-4 tw-p-6 tw-mb-4', onClick: () => navigate('/item/' + i.id), children: [jsxRuntime.jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: (id) => unlinkItem(id, item, updateItem), loading: loading }), jsxRuntime.jsx("div", { className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade', children: jsxRuntime.jsx(TextView, { truncate: true, itemId: item.id }) })] }, i.id))), updatePermission && (jsxRuntime.jsx(ActionButton, { customStyle: '!tw-bottom-24', collection: 'items', item: item, existingRelations: state.relations, triggerItemSelected: (id) => linkItem(id, item, updateItem) }))] }) }) })] }))] }));
|
5197
5255
|
};
|
5198
5256
|
|
5257
|
+
/**
|
5258
|
+
* @category Profile
|
5259
|
+
*/
|
5199
5260
|
function ProfileForm() {
|
5200
5261
|
const [state, setState] = react.useState({
|
5201
5262
|
color: '',
|
@@ -5252,11 +5313,10 @@ function ProfileForm() {
|
|
5252
5313
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
5253
5314
|
}, [items]);
|
5254
5315
|
react.useEffect(() => {
|
5255
|
-
const newColor = item.
|
5256
|
-
|
5257
|
-
: getItemTags(item) && getItemTags(item)[0]?.color
|
5316
|
+
const newColor = item.color ??
|
5317
|
+
(getItemTags(item) && getItemTags(item)[0]?.color
|
5258
5318
|
? getItemTags(item)[0].color
|
5259
|
-
: item.layer?.markerDefaultColor;
|
5319
|
+
: item.layer?.markerDefaultColor);
|
5260
5320
|
const offers = (item.offers ?? []).reduce((acc, o) => {
|
5261
5321
|
const offer = tags.find((t) => t.id === o.tags_id);
|
5262
5322
|
if (offer)
|
@@ -5276,7 +5336,7 @@ function ProfileForm() {
|
|
5276
5336
|
return acc;
|
5277
5337
|
}, []);
|
5278
5338
|
setState({
|
5279
|
-
color: newColor,
|
5339
|
+
color: newColor ?? '',
|
5280
5340
|
id: item?.id ?? '',
|
5281
5341
|
group_type: item?.group_type ?? '',
|
5282
5342
|
status: item?.status ?? '',
|
@@ -5287,7 +5347,8 @@ function ProfileForm() {
|
|
5287
5347
|
telephone: item?.telephone ?? '',
|
5288
5348
|
next_appointment: item?.next_appointment ?? '',
|
5289
5349
|
image: item?.image ?? '',
|
5290
|
-
|
5350
|
+
// Do we actually mean marker_icon here?
|
5351
|
+
marker_icon: item?.markerIcon ?? '',
|
5291
5352
|
offers,
|
5292
5353
|
needs,
|
5293
5354
|
relations,
|
@@ -5298,17 +5359,21 @@ function ProfileForm() {
|
|
5298
5359
|
}, [item, tags, items]);
|
5299
5360
|
const [template, setTemplate] = react.useState('');
|
5300
5361
|
react.useEffect(() => {
|
5301
|
-
setTemplate(item.layer?.itemType.template
|
5362
|
+
setTemplate(item.layer?.itemType.template ?? appState.userType);
|
5302
5363
|
}, [appState.userType, item]);
|
5303
5364
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(MapOverlayPage, { backdrop: true, className: 'tw-mx-4 tw-mt-4 tw-mb-4 tw-overflow-x-hidden tw-w-[calc(100%-32px)] md:tw-w-[calc(50%-32px)] tw-max-w-3xl !tw-left-auto tw-top-0 tw-bottom-0', children: jsxRuntime.jsx("form", { className: 'tw-h-full', onSubmit: (e) => {
|
5304
5365
|
e.preventDefault();
|
5305
5366
|
void onUpdateItem(state, item, tags, addTag, setLoading, navigate, updateItem, addItem, user, urlParams);
|
5306
5367
|
}, children: jsxRuntime.jsxs("div", { className: 'tw-flex tw-flex-col tw-h-full', children: [jsxRuntime.jsx(FormHeader, { item: item, state: state, setState: setState }), template === 'onepager' && (jsxRuntime.jsx(OnepagerForm, { item: item, state: state, setState: setState })), template === 'simple' && jsxRuntime.jsx(SimpleForm, { state: state, setState: setState }), template === 'flex' && (jsxRuntime.jsx(FlexForm, { item: item, state: state, setState: setState })), template === 'tabs' && (jsxRuntime.jsx(TabsForm, { loading: loading, item: item, state: state, setState: setState, updatePermission: updatePermission, linkItem: (id) => linkItem(id, item, updateItem), unlinkItem: (id) => unlinkItem(id, item, updateItem), setUrlParams: setUrlParams })), jsxRuntime.jsx("div", { className: 'tw-mt-4', children: jsxRuntime.jsx("button", { className: loading ? ' tw-loading tw-btn tw-float-right' : 'tw-btn tw-float-right', type: 'submit', style: {
|
5307
|
-
|
5368
|
+
// We could refactor this, it is used several times at different locations
|
5369
|
+
backgroundColor: `${item.color ?? (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item?.layer?.markerDefaultColor)}`,
|
5308
5370
|
color: '#fff',
|
5309
5371
|
}, children: "Update" }) })] }) }) }) }));
|
5310
5372
|
}
|
5311
5373
|
|
5374
|
+
/**
|
5375
|
+
* @category Gaming
|
5376
|
+
*/
|
5312
5377
|
function Modal({ children, showOnStartup, }) {
|
5313
5378
|
react.useEffect(() => {
|
5314
5379
|
if (showOnStartup) {
|
@@ -5319,6 +5384,9 @@ function Modal({ children, showOnStartup, }) {
|
|
5319
5384
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("dialog", { id: 'my_modal_3', className: 'tw-modal tw-transition-all tw-duration-300', children: [jsxRuntime.jsxs("form", { method: 'dialog', className: 'tw-modal-box tw-transition-none', children: [jsxRuntime.jsx("button", { className: 'tw-btn tw-btn-sm tw-btn-circle tw-btn-ghost tw-absolute tw-right-2 tw-top-2 focus:tw-outline-none', children: "\u2715" }), children] }), jsxRuntime.jsx("form", { method: 'dialog', className: 'tw-modal-backdrop', children: jsxRuntime.jsx("button", { children: "close" }) })] }) }));
|
5320
5385
|
}
|
5321
5386
|
|
5387
|
+
/**
|
5388
|
+
* @category Gaming
|
5389
|
+
*/
|
5322
5390
|
function Quests() {
|
5323
5391
|
const questsOpen = useQuestsOpen();
|
5324
5392
|
const setQuestsOpen = useSetQuestOpen();
|
@@ -5352,6 +5420,7 @@ exports.Modal = Modal;
|
|
5352
5420
|
exports.MoonCalendar = MoonCalendar;
|
5353
5421
|
exports.OverlayItemsIndexPage = OverlayItemsIndexPage;
|
5354
5422
|
exports.Permissions = Permissions;
|
5423
|
+
exports.PlusButton = PlusButton;
|
5355
5424
|
exports.PopupButton = PopupButton;
|
5356
5425
|
exports.PopupCheckboxInput = PopupCheckboxInput;
|
5357
5426
|
exports.PopupStartEndInput = PopupStartEndInput;
|
@@ -5375,4 +5444,5 @@ exports.TextView = TextView;
|
|
5375
5444
|
exports.TitleCard = TitleCard;
|
5376
5445
|
exports.UserSettings = UserSettings;
|
5377
5446
|
exports.UtopiaMap = UtopiaMap;
|
5447
|
+
exports.useAuth = useAuth;
|
5378
5448
|
//# sourceMappingURL=index.cjs.map
|