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.esm.js
CHANGED
@@ -432,6 +432,7 @@ function useItemsManager(initialItems) {
|
|
432
432
|
},
|
433
433
|
});
|
434
434
|
result.map((item) => {
|
435
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
435
436
|
dispatch({ type: 'ADD', item: { ...item, layer } });
|
436
437
|
return null;
|
437
438
|
});
|
@@ -580,6 +581,9 @@ const AuthContext = createContext({
|
|
580
581
|
requestPasswordReset: () => Promise.reject(Error('Unimplemented')),
|
581
582
|
passwordReset: () => Promise.reject(Error('Unimplemented')),
|
582
583
|
});
|
584
|
+
/**
|
585
|
+
* @category Auth
|
586
|
+
*/
|
583
587
|
const AuthProvider = ({ userApi, children }) => {
|
584
588
|
const [user, setUser] = useState(null);
|
585
589
|
const [token, setToken] = useState(null);
|
@@ -924,22 +928,6 @@ const useSetMapClicked = () => {
|
|
924
928
|
return setMapClicked;
|
925
929
|
};
|
926
930
|
|
927
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
928
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
929
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
930
|
-
function getValue(obj, path) {
|
931
|
-
if (!obj || typeof path !== 'string')
|
932
|
-
return undefined;
|
933
|
-
const pathArray = path.split('.'); // Use a different variable for the split path
|
934
|
-
for (let i = 0, len = pathArray.length; i < len; i++) {
|
935
|
-
if (!obj)
|
936
|
-
return undefined; // Check if obj is falsy at each step
|
937
|
-
// eslint-disable-next-line security/detect-object-injection
|
938
|
-
obj = obj[pathArray[i]]; // Dive one level deeper
|
939
|
-
}
|
940
|
-
return obj; // Return the final value
|
941
|
-
}
|
942
|
-
|
943
931
|
const hashTagRegex = /(#+[a-zA-Z0-9À-ÖØ-öø-ʸ_-]{1,})/g;
|
944
932
|
|
945
933
|
const TagContext = createContext({
|
@@ -1003,7 +991,7 @@ function useTagsManager(initialTags) {
|
|
1003
991
|
}
|
1004
992
|
};
|
1005
993
|
const getItemTags = useCallback((item) => {
|
1006
|
-
const text = item.
|
994
|
+
const text = item.text;
|
1007
995
|
const itemTagStrings = text?.match(hashTagRegex);
|
1008
996
|
const itemTags = [];
|
1009
997
|
itemTagStrings?.map((tag) => {
|
@@ -1012,18 +1000,15 @@ function useTagsManager(initialTags) {
|
|
1012
1000
|
}
|
1013
1001
|
return null;
|
1014
1002
|
});
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
need && itemTags.push(need);
|
1025
|
-
return null;
|
1026
|
-
});
|
1003
|
+
// Could be refactored as it occurs in multiple places
|
1004
|
+
item.offers?.forEach((o) => {
|
1005
|
+
const offer = tags.find((t) => t.id === o.tags_id);
|
1006
|
+
offer && itemTags.push(offer);
|
1007
|
+
});
|
1008
|
+
item.needs?.forEach((n) => {
|
1009
|
+
const need = tags.find((t) => t.id === n.tags_id);
|
1010
|
+
need && itemTags.push(need);
|
1011
|
+
});
|
1027
1012
|
return itemTags;
|
1028
1013
|
}, [tags]);
|
1029
1014
|
return { tags, addTag, setTagApi, setTagData, getItemTags, allTagsLoaded };
|
@@ -1183,6 +1168,9 @@ function FilterControl() {
|
|
1183
1168
|
}, children: 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: 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' }) }) })] })) }));
|
1184
1169
|
}
|
1185
1170
|
|
1171
|
+
/**
|
1172
|
+
* @category Templates
|
1173
|
+
*/
|
1186
1174
|
function MapOverlayPage({ children, className, backdrop, card = true, }) {
|
1187
1175
|
const closeScreen = () => {
|
1188
1176
|
navigate(`/${window.location.search ? window.location.search : ''}`);
|
@@ -1204,6 +1192,9 @@ function MapOverlayPage({ children, className, backdrop, card = true, }) {
|
|
1204
1192
|
return (jsx("div", { className: `tw-absolute tw-h-full tw-w-full tw-m-auto ${backdrop && 'tw-z-[2000]'}`, children: 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: 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, 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" })] }) }) }));
|
1205
1193
|
}
|
1206
1194
|
|
1195
|
+
/**
|
1196
|
+
* @category Auth
|
1197
|
+
*/
|
1207
1198
|
function LoginPage() {
|
1208
1199
|
const [email, setEmail] = useState('');
|
1209
1200
|
const [password, setPassword] = useState('');
|
@@ -1246,6 +1237,9 @@ function LoginPage() {
|
|
1246
1237
|
: 'tw-btn tw-btn-primary tw-btn-block', onClick: () => onLogin(), children: loading ? jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Login' }) })] }));
|
1247
1238
|
}
|
1248
1239
|
|
1240
|
+
/**
|
1241
|
+
* @category Auth
|
1242
|
+
*/
|
1249
1243
|
function SignupPage() {
|
1250
1244
|
const [email, setEmail] = useState('');
|
1251
1245
|
const [userName, setUserName] = useState('');
|
@@ -1289,6 +1283,9 @@ function SignupPage() {
|
|
1289
1283
|
: 'tw-btn tw-btn-primary tw-btn-block', onClick: () => onRegister(), children: loading ? jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Sign Up' }) })] }));
|
1290
1284
|
}
|
1291
1285
|
|
1286
|
+
/**
|
1287
|
+
* @category Auth
|
1288
|
+
*/
|
1292
1289
|
// eslint-disable-next-line react/prop-types
|
1293
1290
|
function RequestPasswordPage({ resetUrl }) {
|
1294
1291
|
const [email, setEmail] = useState('');
|
@@ -1317,6 +1314,9 @@ function RequestPasswordPage({ resetUrl }) {
|
|
1317
1314
|
: 'tw-btn tw-btn-primary tw-btn-block', onClick: () => onReset(), children: loading ? jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Send' }) })] }));
|
1318
1315
|
}
|
1319
1316
|
|
1317
|
+
/**
|
1318
|
+
* @category Auth
|
1319
|
+
*/
|
1320
1320
|
function SetNewPasswordPage() {
|
1321
1321
|
const [password, setPassword] = useState('');
|
1322
1322
|
const { passwordReset, loading } = useAuth();
|
@@ -2517,13 +2517,9 @@ const SearchControl = () => {
|
|
2517
2517
|
};
|
2518
2518
|
searchGeo();
|
2519
2519
|
setItemsResults(items.filter((item) => {
|
2520
|
-
if (item.layer?.itemNameField)
|
2521
|
-
item.name = getValue(item, item.layer.itemNameField);
|
2522
|
-
if (item.layer?.itemTextField)
|
2523
|
-
item.text = getValue(item, item.layer.itemTextField);
|
2524
2520
|
return (value.length > 2 &&
|
2525
2521
|
((item.layer?.listed && item.name.toLowerCase().includes(value.toLowerCase())) ||
|
2526
|
-
item.text
|
2522
|
+
item.text?.toLowerCase().includes(value.toLowerCase())));
|
2527
2523
|
}));
|
2528
2524
|
let phrase = value;
|
2529
2525
|
if (value.startsWith('#'))
|
@@ -2629,11 +2625,14 @@ const TagsControl = () => {
|
|
2629
2625
|
return (jsx("div", { className: 'tw-flex tw-flex-wrap tw-mt-4 tw-w-[calc(100vw-2rem)] tw-max-w-xs', children: filterTags.map((tag) => (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: [jsx("div", { className: 'tw-card-actions tw-justify-end', children: 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" }) }), jsxs("b", { children: ["#", decodeTag(tag.name)] })] }, tag.id))) }));
|
2630
2626
|
};
|
2631
2627
|
|
2632
|
-
|
2628
|
+
/**
|
2629
|
+
* @category Map
|
2630
|
+
*/
|
2631
|
+
const PopupButton = ({ url, parameterField, text, item, }) => {
|
2633
2632
|
const params = new URLSearchParams(window.location.search);
|
2634
2633
|
const getItemTags = useGetItemTags();
|
2635
|
-
return (jsx(Link, { to: `${url}/${parameterField ?
|
2636
|
-
backgroundColor: `${
|
2634
|
+
return (jsx(Link, { to: `${url}/${parameterField ? item?.id : ''}?${params}`, children: jsx("button", { style: {
|
2635
|
+
backgroundColor: `${item?.color ?? (item && (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : (item?.layer?.markerDefaultColor ?? '#000')))}`,
|
2637
2636
|
}, className: 'tw-btn tw-text-white tw-btn-sm tw-float-right tw-mt-1', children: text }) }));
|
2638
2637
|
};
|
2639
2638
|
|
@@ -2652,24 +2651,28 @@ function fixUrls(message) {
|
|
2652
2651
|
return message;
|
2653
2652
|
}
|
2654
2653
|
|
2655
|
-
|
2654
|
+
/**
|
2655
|
+
* @category Map
|
2656
|
+
*/
|
2657
|
+
const TextView = ({ item, itemId, text, truncate = false, rawText, itemTextField, }) => {
|
2658
|
+
if (item) {
|
2659
|
+
text = item.text;
|
2660
|
+
itemId = item.id;
|
2661
|
+
}
|
2656
2662
|
const tags = useTags();
|
2657
2663
|
const addFilterTag = useAddFilterTag();
|
2658
|
-
let
|
2664
|
+
let innerText = '';
|
2659
2665
|
let replacedText = '';
|
2660
2666
|
if (rawText) {
|
2661
|
-
|
2662
|
-
}
|
2663
|
-
else if (itemTextField && item) {
|
2664
|
-
text = getValue(item, itemTextField);
|
2667
|
+
innerText = replacedText = rawText;
|
2665
2668
|
}
|
2666
|
-
else {
|
2667
|
-
|
2669
|
+
else if (text) {
|
2670
|
+
innerText = text;
|
2668
2671
|
}
|
2669
|
-
if (
|
2670
|
-
|
2671
|
-
if (
|
2672
|
-
replacedText = fixUrls(
|
2672
|
+
if (innerText && truncate)
|
2673
|
+
innerText = truncateText(removeMarkdownKeepLinksAndParagraphs(innerText), 100);
|
2674
|
+
if (innerText)
|
2675
|
+
replacedText = fixUrls(innerText);
|
2673
2676
|
if (replacedText) {
|
2674
2677
|
replacedText = replacedText.replace(/(?<!\]?\()https?:\/\/[^\s)]+(?!\))/g, (url) => {
|
2675
2678
|
let shortUrl = url;
|
@@ -2705,11 +2708,11 @@ const TextView = ({ item, truncate = false, itemTextField, rawText, }) => {
|
|
2705
2708
|
// eslint-disable-next-line react/prop-types
|
2706
2709
|
const CustomImage = ({ alt, src, title }) => (jsx("img", { className: 'tw-max-w-full tw-rounded tw-shadow', src: src, alt: alt, title: title }));
|
2707
2710
|
const CustomExternalLink = ({ href, children }) => (jsxs("a", { className: 'tw-font-bold tw-underline', href: href, target: '_blank', rel: 'noreferrer', children: [' ', children] }));
|
2708
|
-
const CustomHashTagLink = ({ children, tag,
|
2711
|
+
const CustomHashTagLink = ({ children, tag, itemId, }) => {
|
2709
2712
|
return (jsx("a", { style: { color: tag ? tag.color : '#faa', fontWeight: 'bold', cursor: 'pointer' }, onClick: (e) => {
|
2710
2713
|
e.stopPropagation();
|
2711
2714
|
addFilterTag(tag);
|
2712
|
-
}, children: decodeTag(children) }, tag ? tag.name +
|
2715
|
+
}, children: decodeTag(children) }, tag ? tag.name + itemId : itemId));
|
2713
2716
|
};
|
2714
2717
|
// eslint-disable-next-line react/display-name
|
2715
2718
|
const MemoizedVideoEmbed = memo(({ url }) => (jsx("iframe", { className: 'tw-w-full', src: url, allow: 'fullscreen; picture-in-picture', allowFullScreen: true })));
|
@@ -2731,7 +2734,7 @@ const TextView = ({ item, truncate = false, itemTextField, rawText, }) => {
|
|
2731
2734
|
console.log(tags);
|
2732
2735
|
const tag = tags.find((t) => t.name.toLowerCase() === decodeURI(href).slice(1).toLowerCase());
|
2733
2736
|
if (tag)
|
2734
|
-
return (jsx(CustomHashTagLink, { tag: tag,
|
2737
|
+
return (jsx(CustomHashTagLink, { tag: tag, itemId: itemId, children: children }));
|
2735
2738
|
else
|
2736
2739
|
return children;
|
2737
2740
|
}
|
@@ -2811,7 +2814,7 @@ function UtopiaMapInner({ children, geo, showFilterControl = false, showGratitud
|
|
2811
2814
|
if (!init.current) {
|
2812
2815
|
donationWidget &&
|
2813
2816
|
setTimeout(() => {
|
2814
|
-
toast(jsxs(Fragment, { children: [jsx(TextView, { rawText: '## Do you like this Map?' }), jsxs("div", { children: [jsx(TextView, { rawText: 'Support us building free opensource maps and help us grow 🌱☀️' }), jsx(PopupButton, { url: 'https://opencollective.com/utopia-project', text: 'Donate' })] })] }), { autoClose: false });
|
2817
|
+
toast(jsxs(Fragment, { children: [jsx(TextView, { itemId: '', rawText: '## Do you like this Map?' }), jsxs("div", { children: [jsx(TextView, { itemId: '', rawText: 'Support us building free opensource maps and help us grow 🌱☀️' }), jsx(PopupButton, { url: 'https://opencollective.com/utopia-project', text: 'Donate' })] })] }), { autoClose: false });
|
2815
2818
|
}, 600000);
|
2816
2819
|
init.current = true;
|
2817
2820
|
}
|
@@ -2842,8 +2845,6 @@ function UtopiaMapInner({ children, geo, showFilterControl = false, showGratitud
|
|
2842
2845
|
let title = '';
|
2843
2846
|
if (item?.name)
|
2844
2847
|
title = item.name;
|
2845
|
-
else if (item?.layer?.itemNameField)
|
2846
|
-
title = getValue(item, item.layer.itemNameField);
|
2847
2848
|
document.title = `${document.title.split('-')[0]} - ${title}`;
|
2848
2849
|
}
|
2849
2850
|
},
|
@@ -2866,15 +2867,13 @@ function UtopiaMapInner({ children, geo, showFilterControl = false, showGratitud
|
|
2866
2867
|
let title = '';
|
2867
2868
|
if (ref.item.name)
|
2868
2869
|
title = ref.item.name;
|
2869
|
-
else if (ref.item.layer?.itemNameField)
|
2870
|
-
title = getValue(ref.item.name, ref.item.layer.itemNameField);
|
2871
2870
|
document.title = `${document.title.split('-')[0]} - ${title}`;
|
2872
2871
|
document
|
2873
2872
|
.querySelector('meta[property="og:title"]')
|
2874
2873
|
?.setAttribute('content', ref.item.name);
|
2875
2874
|
document
|
2876
2875
|
.querySelector('meta[property="og:description"]')
|
2877
|
-
?.setAttribute('content', ref.item.text);
|
2876
|
+
?.setAttribute('content', ref.item.text ?? '');
|
2878
2877
|
}
|
2879
2878
|
}
|
2880
2879
|
}
|
@@ -2911,6 +2910,9 @@ function UtopiaMapInner({ children, geo, showFilterControl = false, showGratitud
|
|
2911
2910
|
} })), jsx(MapEventListener, {}), jsx(AddButton, { triggerAction: setSelectNewItemPosition }), selectNewItemPosition != null && (jsx(SelectPosition, { setSelectNewItemPosition: setSelectNewItemPosition }))] }));
|
2912
2911
|
}
|
2913
2912
|
|
2913
|
+
/**
|
2914
|
+
* @category Map
|
2915
|
+
*/
|
2914
2916
|
function UtopiaMap({ height = '500px', width = '100%', center = [50.6, 9.5], zoom = 10, children, geo, showFilterControl = false, showGratitudeControl = false, showLayerControl = true, infoText, donationWidget, }) {
|
2915
2917
|
return (jsx(ContextWrapper, { children: jsx(MapContainer, { style: { height, width }, center: new LatLng(center[0], center[1]), zoom: zoom, zoomControl: false, maxZoom: 19, children: jsx(UtopiaMapInner, { geo: geo, showFilterControl: showFilterControl, showGratitudeControl: showGratitudeControl, showLayerControl: showLayerControl, infoText: infoText, donationWidget: donationWidget, children: children }) }) }));
|
2916
2918
|
}
|
@@ -2973,6 +2975,9 @@ const rgbToHex = (r, g, b) => '#' +
|
|
2973
2975
|
})
|
2974
2976
|
.join('');
|
2975
2977
|
|
2978
|
+
/**
|
2979
|
+
* @category Input
|
2980
|
+
*/
|
2976
2981
|
function TextAreaInput({ labelTitle, dataField, labelStyle, containerStyle, inputStyle, defaultValue, placeholder, required = true, updateFormValue, }) {
|
2977
2982
|
const ref = useRef(null);
|
2978
2983
|
const [inputValue, setInputValue] = useState(defaultValue);
|
@@ -2994,6 +2999,9 @@ function TextAreaInput({ labelTitle, dataField, labelStyle, containerStyle, inpu
|
|
2994
2999
|
return (jsxs("div", { className: `tw-form-control tw-w-full ${containerStyle || ''}`, children: [labelTitle ? (jsx("label", { className: 'tw-label', children: jsx("span", { className: `tw-label-text tw-text-base-content ${labelStyle}`, children: labelTitle }) })) : null, jsx("textarea", { required: required, ref: ref, value: inputValue, name: dataField, className: `tw-textarea tw-textarea-bordered tw-w-full tw-leading-5 ${inputStyle || ''}`, placeholder: placeholder || '', onChange: handleChange })] }));
|
2995
3000
|
}
|
2996
3001
|
|
3002
|
+
/**
|
3003
|
+
* @category Input
|
3004
|
+
*/
|
2997
3005
|
function TextInput({ labelTitle, labelStyle, type, dataField, containerStyle, inputStyle, defaultValue, placeholder, autocomplete, pattern, required = true, updateFormValue, }) {
|
2998
3006
|
const [inputValue, setInputValue] = useState(defaultValue || '');
|
2999
3007
|
useEffect(() => {
|
@@ -3123,7 +3131,7 @@ function ItemFormPopup(props) {
|
|
3123
3131
|
key: props.position.toString(),
|
3124
3132
|
setPopupTitle,
|
3125
3133
|
})
|
3126
|
-
: '')) : (jsxs(Fragment, { children: [jsx(TextInput, { type: 'text', placeholder: 'Name', dataField: 'name', defaultValue: props.item ? props.item.name : '', inputStyle: '' }), jsx(TextAreaInput, { placeholder: 'Text', dataField: 'text', defaultValue: props.item
|
3134
|
+
: '')) : (jsxs(Fragment, { children: [jsx(TextInput, { type: 'text', placeholder: 'Name', dataField: 'name', defaultValue: props.item ? props.item.name : '', inputStyle: '' }), jsx(TextAreaInput, { placeholder: 'Text', dataField: 'text', defaultValue: props.item?.text ?? '', inputStyle: 'tw-h-40 tw-mt-5' }, props.position.toString())] })), jsx("div", { className: 'tw-flex tw-justify-center', children: jsx("button", { className: spinner
|
3127
3135
|
? 'tw-btn tw-btn-disabled tw-mt-5 tw-place-self-center'
|
3128
3136
|
: 'tw-btn tw-mt-5 tw-place-self-center', type: 'submit', children: spinner ? jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Save' }) })] }) }));
|
3129
3137
|
}
|
@@ -3179,15 +3187,13 @@ const DialogModal = ({ title, isOpened, onClose, children, showCloseButton = tru
|
|
3179
3187
|
}
|
3180
3188
|
}, [isOpened]);
|
3181
3189
|
if (isOpened) {
|
3182
|
-
return (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,
|
3183
|
-
// eslint-disable-next-line react/no-unknown-property
|
3184
|
-
onCancel: onClose, onClick: (e) => ref.current && !isClickInsideRectangle(e, ref.current) && closeOnClickOutside && onClose(), children: jsxs("div", { className: 'tw-card-body tw-p-2', children: [jsx("h2", { className: 'tw-text-2xl tw-font-semibold tw-mb-2 tw-text-center', children: title }), children, showCloseButton && (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" }))] }) }));
|
3190
|
+
return (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: jsxs("div", { className: 'tw-card-body tw-p-2', children: [jsx("h2", { className: 'tw-text-2xl tw-font-semibold tw-mb-2 tw-text-center', children: title }), children, showCloseButton && (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" }))] }) }));
|
3185
3191
|
}
|
3186
3192
|
else
|
3187
3193
|
return jsx(Fragment, {});
|
3188
3194
|
};
|
3189
3195
|
|
3190
|
-
function HeaderView({ item, api, editCallback, deleteCallback, setPositionCallback,
|
3196
|
+
function HeaderView({ item, api, editCallback, deleteCallback, setPositionCallback, loading, hideMenu = false, big = false, truncateSubname = true, hideSubname = false, showAddress = false, }) {
|
3191
3197
|
const [modalOpen, setModalOpen] = useState(false);
|
3192
3198
|
const hasUserPermission = useHasUserPermission();
|
3193
3199
|
const navigate = useNavigate();
|
@@ -3196,22 +3202,10 @@ function HeaderView({ item, api, editCallback, deleteCallback, setPositionCallba
|
|
3196
3202
|
useEffect(() => {
|
3197
3203
|
setImageLoaded(false);
|
3198
3204
|
}, [item]);
|
3199
|
-
const avatar =
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
: item.layer?.itemAvatarField &&
|
3204
|
-
item &&
|
3205
|
-
getValue(item, item.layer?.itemAvatarField) &&
|
3206
|
-
appState.assetsApi.url +
|
3207
|
-
getValue(item, item.layer?.itemAvatarField) +
|
3208
|
-
`${big ? '?width=160&heigth=160' : '?width=80&heigth=80'}`;
|
3209
|
-
const title = itemNameField
|
3210
|
-
? getValue(item, itemNameField)
|
3211
|
-
: item.layer?.itemNameField && item && getValue(item, item.layer.itemNameField);
|
3212
|
-
const subtitle = itemSubnameField
|
3213
|
-
? getValue(item, itemSubnameField)
|
3214
|
-
: item.layer?.itemSubnameField && item && getValue(item, item.layer.itemSubnameField);
|
3205
|
+
const avatar = item.image &&
|
3206
|
+
appState.assetsApi.url + item.image + `${big ? '?width=160&heigth=160' : '?width=80&heigth=80'}`;
|
3207
|
+
const title = item.name;
|
3208
|
+
const subtitle = item.subname;
|
3215
3209
|
const [address] = useState('');
|
3216
3210
|
const params = new URLSearchParams(window.location.search);
|
3217
3211
|
const openDeleteModal = async (event) => {
|
@@ -3224,7 +3218,7 @@ function HeaderView({ item, api, editCallback, deleteCallback, setPositionCallba
|
|
3224
3218
|
!hideMenu && (jsxs("div", { className: 'tw-dropdown tw-dropdown-bottom', children: [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: jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', className: 'tw-h-5 tw-w-5', viewBox: '0 0 20 20', fill: 'currentColor', children: jsx("path", { d: 'M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z' }) }) }), jsxs("ul", { 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 &&
|
3225
3219
|
hasUserPermission(api.collectionName, 'update', item) &&
|
3226
3220
|
editCallback && (jsx("li", { children: jsx("a", { className: '!tw-text-base-content tw-cursor-pointer', onClick: (e) => item.layer?.customEditLink
|
3227
|
-
? navigate(`${item.layer.customEditLink}${item.layer.customEditParameter ? `/${
|
3221
|
+
? navigate(`${item.layer.customEditLink}${item.layer.customEditParameter ? `/${item.id}${params && '?' + params}` : ''} `)
|
3228
3222
|
: editCallback(e), children: jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', className: 'tw-h-5 tw-w-5', viewBox: '0 0 20 20', fill: 'currentColor', children: jsx("path", { d: '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 &&
|
3229
3223
|
hasUserPermission(api.collectionName, 'update', item) &&
|
3230
3224
|
setPositionCallback && (jsx("li", { children: jsx("a", { className: '!tw-text-base-content tw-cursor-pointer', onClick: setPositionCallback, children: 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: 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 &&
|
@@ -3288,10 +3282,13 @@ const ItemViewPopup = forwardRef((props, ref) => {
|
|
3288
3282
|
navigate('/');
|
3289
3283
|
}, loading: loading }), jsx("div", { className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade', children: props.children ? (Children.toArray(props.children).map((child) => isValidElement(child)
|
3290
3284
|
? cloneElement(child, { item: props.item })
|
3291
|
-
: '')) : (jsx(TextView, { item: props.item })) }), jsxs("div", { className: 'tw-flex -tw-mb-1 tw-flex-row tw-mr-2 tw-mt-1', children: [infoExpanded ? (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)}` })) : (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" })), jsx("div", { className: 'tw-grow' })] })] }) }));
|
3285
|
+
: '')) : (jsx(TextView, { text: props.item.text, itemId: props.item.id })) }), jsxs("div", { className: 'tw-flex -tw-mb-1 tw-flex-row tw-mr-2 tw-mt-1', children: [infoExpanded ? (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)}` })) : (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" })), jsx("div", { className: 'tw-grow' })] })] }) }));
|
3292
3286
|
});
|
3293
3287
|
|
3294
|
-
|
3288
|
+
/**
|
3289
|
+
* @category Map
|
3290
|
+
*/
|
3291
|
+
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,
|
3295
3292
|
// eslint-disable-next-line camelcase
|
3296
3293
|
public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }) => {
|
3297
3294
|
const filterTags = useFilterTags();
|
@@ -3328,16 +3325,8 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3328
3325
|
markerDefaultColor2,
|
3329
3326
|
api,
|
3330
3327
|
itemType,
|
3331
|
-
itemNameField,
|
3332
|
-
itemSubnameField,
|
3333
|
-
itemTextField,
|
3334
|
-
itemAvatarField,
|
3335
|
-
itemColorField,
|
3336
|
-
itemOwnerField,
|
3337
|
-
itemTagsField,
|
3338
|
-
itemOffersField,
|
3339
|
-
itemNeedsField,
|
3340
3328
|
onlyOnePerOwner,
|
3329
|
+
// Can we just use editCallback for all cases?
|
3341
3330
|
customEditLink,
|
3342
3331
|
customEditParameter,
|
3343
3332
|
// eslint-disable-next-line camelcase
|
@@ -3345,6 +3334,7 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3345
3334
|
listed,
|
3346
3335
|
setItemFormPopup,
|
3347
3336
|
itemFormPopup,
|
3337
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
3348
3338
|
clusterRef,
|
3349
3339
|
});
|
3350
3340
|
api &&
|
@@ -3361,15 +3351,6 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3361
3351
|
markerDefaultColor2,
|
3362
3352
|
api,
|
3363
3353
|
itemType,
|
3364
|
-
itemNameField,
|
3365
|
-
itemSubnameField,
|
3366
|
-
itemTextField,
|
3367
|
-
itemAvatarField,
|
3368
|
-
itemColorField,
|
3369
|
-
itemOwnerField,
|
3370
|
-
itemTagsField,
|
3371
|
-
itemOffersField,
|
3372
|
-
itemNeedsField,
|
3373
3354
|
onlyOnePerOwner,
|
3374
3355
|
customEditLink,
|
3375
3356
|
customEditParameter,
|
@@ -3378,6 +3359,7 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3378
3359
|
listed,
|
3379
3360
|
setItemFormPopup,
|
3380
3361
|
itemFormPopup,
|
3362
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
3381
3363
|
clusterRef,
|
3382
3364
|
});
|
3383
3365
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
@@ -3405,29 +3387,18 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3405
3387
|
.filter((item) => (item.group_type && isGroupTypeVisible(item.group_type)) ||
|
3406
3388
|
visibleGroupTypes.length === 0)
|
3407
3389
|
.map((item) => {
|
3408
|
-
if (
|
3409
|
-
// eslint-disable-next-line security/detect-object-injection
|
3410
|
-
if (getValue(item, itemTextField))
|
3411
|
-
item[itemTextField] = getValue(item, itemTextField);
|
3412
|
-
// eslint-disable-next-line security/detect-object-injection
|
3413
|
-
else
|
3414
|
-
item[itemTextField] = '';
|
3390
|
+
if (item.position?.coordinates[0] && item.position?.coordinates[1]) {
|
3415
3391
|
if (item.tags) {
|
3416
|
-
|
3417
|
-
item[itemTextField] = item[itemTextField] + '\n\n';
|
3392
|
+
item.text += '\n\n';
|
3418
3393
|
item.tags.map((tag) => {
|
3419
|
-
|
3420
|
-
|
3421
|
-
// eslint-disable-next-line security/detect-object-injection
|
3422
|
-
return (item[itemTextField] = item[itemTextField] + `#${encodeTag(tag)} `);
|
3394
|
+
if (!item.text?.includes(`#${encodeTag(tag)}`)) {
|
3395
|
+
item.text += `#${encodeTag(tag)}`;
|
3423
3396
|
}
|
3424
|
-
|
3425
|
-
return item[itemTextField];
|
3397
|
+
return item.text;
|
3426
3398
|
});
|
3427
3399
|
}
|
3428
3400
|
if (allTagsLoaded && allItemsLoaded) {
|
3429
|
-
|
3430
|
-
item[itemTextField].match(hashTagRegex)?.map((tag) => {
|
3401
|
+
item.text?.match(hashTagRegex)?.map((tag) => {
|
3431
3402
|
if (!tags.find((t) => t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase()) &&
|
3432
3403
|
!newTagsToAdd.find((t) => t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase())) {
|
3433
3404
|
const newTag = {
|
@@ -3442,18 +3413,20 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3442
3413
|
!tagsReady && setTagsReady(true);
|
3443
3414
|
}
|
3444
3415
|
const itemTags = getItemTags(item);
|
3445
|
-
const latitude =
|
3446
|
-
const longitude =
|
3416
|
+
const latitude = item.position.coordinates[1];
|
3417
|
+
const longitude = item.position.coordinates[0];
|
3447
3418
|
let color1 = markerDefaultColor;
|
3448
3419
|
let color2 = markerDefaultColor2;
|
3449
|
-
if (
|
3450
|
-
color1 =
|
3451
|
-
|
3420
|
+
if (item.color) {
|
3421
|
+
color1 = item.color;
|
3422
|
+
}
|
3423
|
+
else if (itemTags[0]) {
|
3452
3424
|
color1 = itemTags[0].color;
|
3453
3425
|
}
|
3454
|
-
if (itemTags
|
3426
|
+
if (itemTags[0] && item.color) {
|
3455
3427
|
color2 = itemTags[0].color;
|
3456
|
-
|
3428
|
+
}
|
3429
|
+
else if (itemTags[1]) {
|
3457
3430
|
color2 = itemTags[1].color;
|
3458
3431
|
}
|
3459
3432
|
return (jsxs(Marker, { ref: (r) => {
|
@@ -3473,7 +3446,7 @@ public_edit_items, listed = true, setItemFormPopup, itemFormPopup, clusterRef, }
|
|
3473
3446
|
if (!(item.id in leafletRefs && leafletRefs[item.id].popup === r)) {
|
3474
3447
|
r && addPopup(item, r);
|
3475
3448
|
}
|
3476
|
-
}, item: item, setItemFormPopup: setItemFormPopup }, item.id + item.name) })), jsx(Tooltip, { offset: [0, -38], direction: 'top', children: item.name
|
3449
|
+
}, item: item, setItemFormPopup: setItemFormPopup }, item.id + item.name) })), jsx(Tooltip, { offset: [0, -38], direction: 'top', children: item.name })] }, item.id));
|
3477
3450
|
}
|
3478
3451
|
else
|
3479
3452
|
return null;
|
@@ -3486,6 +3459,9 @@ function isComponentWithType(node) {
|
|
3486
3459
|
return isValidElement(node) && typeof node.type !== 'string' && '__TYPE' in node.type;
|
3487
3460
|
}
|
3488
3461
|
|
3462
|
+
/**
|
3463
|
+
* @category Map
|
3464
|
+
*/
|
3489
3465
|
function Tags({ data, api }) {
|
3490
3466
|
const setTagData = useSetTagData();
|
3491
3467
|
const setTagApi = useSetTagApi();
|
@@ -3518,7 +3494,10 @@ function Tags({ data, api }) {
|
|
3518
3494
|
return jsx(Fragment, {});
|
3519
3495
|
}
|
3520
3496
|
|
3521
|
-
|
3497
|
+
/**
|
3498
|
+
* @category Map
|
3499
|
+
*/
|
3500
|
+
function Permissions({ data, api, adminRole }) {
|
3522
3501
|
const setPermissionData = useSetPermissionData();
|
3523
3502
|
const setPermissionApi = useSetPermissionApi();
|
3524
3503
|
const setAdminRole = useSetAdminRole();
|
@@ -3532,6 +3511,9 @@ function Permissions({ data, api, adminRole, }) {
|
|
3532
3511
|
return jsx(Fragment, {});
|
3533
3512
|
}
|
3534
3513
|
|
3514
|
+
/**
|
3515
|
+
* @category Map
|
3516
|
+
*/
|
3535
3517
|
const ItemForm = ({ children, item, title, setPopupTitle, }) => {
|
3536
3518
|
useEffect(() => {
|
3537
3519
|
setPopupTitle && title && setPopupTitle(title);
|
@@ -3545,6 +3527,9 @@ const ItemForm = ({ children, item, title, setPopupTitle, }) => {
|
|
3545
3527
|
};
|
3546
3528
|
ItemForm.__TYPE = 'ItemForm';
|
3547
3529
|
|
3530
|
+
/**
|
3531
|
+
* @category Map
|
3532
|
+
*/
|
3548
3533
|
const ItemView = ({ children, item }) => {
|
3549
3534
|
return (jsx("div", { children: children
|
3550
3535
|
? Children.toArray(children).map((child) => isValidElement(child) ? cloneElement(child, { item }) : null)
|
@@ -3552,6 +3537,9 @@ const ItemView = ({ children, item }) => {
|
|
3552
3537
|
};
|
3553
3538
|
ItemView.__TYPE = 'ItemView';
|
3554
3539
|
|
3540
|
+
/**
|
3541
|
+
* @category Input
|
3542
|
+
*/
|
3555
3543
|
function SelectBox(props) {
|
3556
3544
|
const { labelTitle, labelDescription, defaultValue, containerStyle, placeholder, labelStyle, options, updateFormValue, } = props;
|
3557
3545
|
const [value, setValue] = useState(defaultValue || '');
|
@@ -3564,22 +3552,37 @@ function SelectBox(props) {
|
|
3564
3552
|
})] })] }));
|
3565
3553
|
}
|
3566
3554
|
|
3555
|
+
/**
|
3556
|
+
* @category Map
|
3557
|
+
*/
|
3567
3558
|
const PopupTextAreaInput = ({ dataField, placeholder, style, item, }) => {
|
3568
3559
|
return (jsx(TextAreaInput, { defaultValue: item?.text ? item.text : '', dataField: dataField, placeholder: placeholder, inputStyle: style }));
|
3569
3560
|
};
|
3570
3561
|
|
3562
|
+
/**
|
3563
|
+
* @category Map
|
3564
|
+
*/
|
3571
3565
|
const PopupStartEndInput = ({ item, showLabels = true, updateStartValue, updateEndValue, }) => {
|
3572
3566
|
return (jsxs("div", { className: 'tw-grid tw-grid-cols-2 tw-gap-2', children: [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 }), 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 })] }));
|
3573
3567
|
};
|
3574
3568
|
|
3569
|
+
/**
|
3570
|
+
* @category Map
|
3571
|
+
*/
|
3575
3572
|
const PopupTextInput = ({ dataField, placeholder, style, item, }) => {
|
3576
3573
|
return (jsx(TextInput, { defaultValue: item?.name ? item.name : '', dataField: dataField, placeholder: placeholder, inputStyle: style, type: 'text', containerStyle: 'tw-mt-4' }));
|
3577
3574
|
};
|
3578
3575
|
|
3576
|
+
/**
|
3577
|
+
* @category Map
|
3578
|
+
*/
|
3579
3579
|
const PopupCheckboxInput = ({ dataField, label, item, }) => {
|
3580
3580
|
return (jsxs("label", { htmlFor: item?.id, className: 'tw-label tw-justify-normal tw-pt-1 tw-pb-1', children: [jsx("input", { id: item?.id, type: 'checkbox', name: dataField, className: 'tw-checkbox tw-checkbox-xs tw-checkbox-success', checked: item?.public_edit }), jsx("span", { className: 'tw-text-sm tw-label-text tw-mx-2 tw-cursor-pointer', children: label })] }));
|
3581
3581
|
};
|
3582
3582
|
|
3583
|
+
/**
|
3584
|
+
* @category Map
|
3585
|
+
*/
|
3583
3586
|
const StartEndView = ({ item }) => {
|
3584
3587
|
return (jsxs("div", { className: 'tw-flex tw-flex-row tw-mb-4 tw-mt-1', children: [jsxs("div", { className: 'tw-basis-2/5 tw-flex tw-flex-row', children: [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: 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' }) }), jsx("time", { className: 'tw-align-middle', dateTime: item && item.start ? item.start.substring(0, 10) : '', children: item && item.start ? new Date(item.start).toLocaleDateString() : '' })] }), jsx("div", { className: 'tw-basis-1/5 tw-place-content-center', children: jsx("span", { children: "-" }) }), jsxs("div", { className: 'tw-basis-2/5 tw-flex tw-flex-row', children: [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: 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' }) }), jsx("time", { className: 'tw-align-middle', dateTime: item && item.end ? item.end.substring(0, 10) : '', children: item && item.end ? new Date(item.end).toLocaleDateString() : '' })] })] }));
|
3585
3588
|
};
|
@@ -3647,6 +3650,9 @@ const SetAppState = ({ assetsApi, userType, }) => {
|
|
3647
3650
|
return jsx(Fragment, {});
|
3648
3651
|
};
|
3649
3652
|
|
3653
|
+
/**
|
3654
|
+
* @category AppShell
|
3655
|
+
*/
|
3650
3656
|
function AppShell({ appName, children, assetsApi, userType, }) {
|
3651
3657
|
return (jsx(ContextWrapper, { children: jsxs("div", { className: 'tw-flex tw-flex-col tw-h-full', children: [jsx(SetAppState, { assetsApi: assetsApi, userType: userType }), jsx(NavBar, { userType: userType, appName: appName }), jsx("div", { id: 'app-content', className: 'tw-flex-grow', children: children })] }) }));
|
3652
3658
|
}
|
@@ -3668,6 +3674,9 @@ function SidebarSubmenu({ submenu, name, icon, }) {
|
|
3668
3674
|
}) }) })] }));
|
3669
3675
|
}
|
3670
3676
|
|
3677
|
+
/**
|
3678
|
+
* @category AppShell
|
3679
|
+
*/
|
3671
3680
|
function SideBar({ routes, bottomRoutes }) {
|
3672
3681
|
// prevent react18 from calling useEffect twice
|
3673
3682
|
const init = useRef(false);
|
@@ -3710,10 +3719,16 @@ function SideBar({ routes, bottomRoutes }) {
|
|
3710
3719
|
(!slim ? 'tw-rotate-180' : ''), onClick: () => toggleSlim() })] }) })] }) }));
|
3711
3720
|
}
|
3712
3721
|
|
3722
|
+
/**
|
3723
|
+
* @category AppShell
|
3724
|
+
*/
|
3713
3725
|
function Content({ children }) {
|
3714
3726
|
return (jsx("div", { className: 'tw-flex tw-flex-col tw-w-full tw-h-full tw-bg-base-200 tw-relative', children: children }));
|
3715
3727
|
}
|
3716
3728
|
|
3729
|
+
/**
|
3730
|
+
* @category AppShell
|
3731
|
+
*/
|
3717
3732
|
const Sitemap = ({ url }) => {
|
3718
3733
|
const [sitemap, setSitemap] = useState('');
|
3719
3734
|
const items = useItems();
|
@@ -3741,6 +3756,9 @@ function Subtitle({ styleClass, children }) {
|
|
3741
3756
|
return jsx("div", { className: `tw-text-xl tw-font-semibold ${styleClass}`, children: children });
|
3742
3757
|
}
|
3743
3758
|
|
3759
|
+
/**
|
3760
|
+
* @category Templates
|
3761
|
+
*/
|
3744
3762
|
function TitleCard({ title, hideTitle, children, topMargin, TopSideButtons, className, }) {
|
3745
3763
|
return (jsxs("div", { className: 'tw-card tw-w-full tw-p-6 tw-bg-base-100 tw-shadow-xl tw-h-fit tw-mb-4 ' +
|
3746
3764
|
(className || '') +
|
@@ -3748,6 +3766,9 @@ function TitleCard({ title, hideTitle, children, topMargin, TopSideButtons, clas
|
|
3748
3766
|
(topMargin || 'tw-mt-6'), children: [!hideTitle && (jsxs(Fragment, { children: [jsxs(Subtitle, { styleClass: TopSideButtons ? 'tw-inline-block' : '', children: [title, TopSideButtons && (jsx("div", { className: 'tw-inline-block tw-float-right', children: TopSideButtons }))] }), jsx("div", { className: 'tw-divider tw-mt-2' })] })), jsx("div", { className: 'tw-h-full tw-bg-transparent tw-w-full tw-pb-6 tw-bg-base-100', children: children })] }));
|
3749
3767
|
}
|
3750
3768
|
|
3769
|
+
/**
|
3770
|
+
* @category Templates
|
3771
|
+
*/
|
3751
3772
|
function CardPage({ title, hideTitle, children, parents, }) {
|
3752
3773
|
return (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: jsxs("div", { className: 'tw-w-full xl:tw-max-w-6xl ', children: [jsx("div", { className: 'tw-text-sm tw-breadcrumbs', children: jsxs("ul", { children: [jsx("li", { children: jsx(Link, { to: '/', children: "Home" }) }), parents?.map((b, i) => (jsx("li", { children: jsx(Link, { to: b.path, children: b.name }) }, i))), jsx("li", { children: title })] }) }), jsx(TitleCard, { hideTitle: hideTitle, title: title, topMargin: 'tw-my-2', className: ' tw-mb-4', children: children })] }) }));
|
3753
3774
|
}
|
@@ -3800,6 +3821,9 @@ const CircleLayout = ({ items, radius, fontSize, }) => {
|
|
3800
3821
|
return (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) => (jsx("div", { className: 'tw-absolute', style: { fontSize }, children: item }, item))) }));
|
3801
3822
|
};
|
3802
3823
|
|
3824
|
+
/**
|
3825
|
+
* @category Templates
|
3826
|
+
*/
|
3803
3827
|
const MoonCalendar = () => {
|
3804
3828
|
const today = startOfToday();
|
3805
3829
|
const [currMonth, setCurrMonth] = useState(() => format(today, 'MMM-yyyy'));
|
@@ -3822,6 +3846,9 @@ const MoonCalendar = () => {
|
|
3822
3846
|
], radius: 120, fontSize: '0.8em' })] }), jsxs("div", { className: 'tw-flex tw-flex-row', children: [jsx(ChevronLeftIcon, { className: 'tw-w-6 tw-h-6 tw-cursor-pointer', onClick: getPrevMonth }), jsxs("p", { className: 'tw-text-center tw-p-1 tw-h-full tw-grow', children: ["from ", format(getLastNewMoon(), 'dd.MM'), " - to ", format(getNextNewMoon(), 'dd.MM')] }), jsx(ChevronRightIcon$1, { className: 'tw-w-6 tw-h-6 tw-cursor-pointer', onClick: getNextMonth })] })] }));
|
3823
3847
|
};
|
3824
3848
|
|
3849
|
+
/**
|
3850
|
+
* @category Templates
|
3851
|
+
*/
|
3825
3852
|
const SelectUser = () => {
|
3826
3853
|
const appState = useAppState();
|
3827
3854
|
const items = useItems();
|
@@ -3844,18 +3871,22 @@ const DateUserInfo = ({ item }) => {
|
|
3844
3871
|
return (jsxs("div", { className: 'tw-flex -tw-mb-1 tw-flex-row tw-mr-2 -tw-mt-2', onClick: (e) => e.stopPropagation(), children: [infoExpanded ? (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)}` })) : (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" })), jsx("div", { className: 'tw-grow ' })] }));
|
3845
3872
|
};
|
3846
3873
|
|
3847
|
-
const ItemCard = ({ i, loading, url,
|
3874
|
+
const ItemCard = ({ i, loading, url, deleteCallback, }) => {
|
3848
3875
|
const navigate = useNavigate();
|
3849
3876
|
const windowDimensions = useWindowDimensions();
|
3850
3877
|
return (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: () => {
|
3878
|
+
// We could have an onClick callback instead
|
3851
3879
|
const params = new URLSearchParams(window.location.search);
|
3852
3880
|
if (windowDimensions.width < 786 && i.position)
|
3853
|
-
navigate('/' +
|
3881
|
+
navigate('/' + i.id + `${params ? `?${params}` : ''}`);
|
3854
3882
|
else
|
3855
|
-
navigate(url +
|
3856
|
-
}, children: [jsx(HeaderView, { loading: loading, item: i, api: i.layer?.api,
|
3883
|
+
navigate(url + i.id + `${params ? `?${params}` : ''}`);
|
3884
|
+
}, children: [jsx(HeaderView, { loading: loading, item: i, api: i.layer?.api, editCallback: () => navigate('/edit-item/' + i.id), deleteCallback: () => deleteCallback(i) }), jsxs("div", { className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade', children: [i.layer?.itemType.show_start_end && jsx(StartEndView, { item: i }), i.layer?.itemType.show_text && jsx(TextView, { truncate: true, text: i.text, itemId: i.id })] }), jsx(DateUserInfo, { item: i })] }));
|
3857
3885
|
};
|
3858
3886
|
|
3887
|
+
/**
|
3888
|
+
* @category Templates
|
3889
|
+
*/
|
3859
3890
|
const OverlayItemsIndexPage = ({ url, layerName, parameterField, plusButton = true, }) => {
|
3860
3891
|
const [loading, setLoading] = useState(false);
|
3861
3892
|
const [addItemPopupType, setAddItemPopupType] = useState('');
|
@@ -3951,7 +3982,7 @@ const OverlayItemsIndexPage = ({ url, layerName, parameterField, plusButton = tr
|
|
3951
3982
|
: 0;
|
3952
3983
|
return dateB - dateA; // Subtracts milliseconds which are numbers
|
3953
3984
|
})
|
3954
|
-
.map((i, k) => (jsx("div", { className: 'tw-break-inside-avoid tw-mb-6', children: jsx(ItemCard, { i: i, loading: loading, url: url,
|
3985
|
+
.map((i, k) => (jsx("div", { className: 'tw-break-inside-avoid tw-mb-6', children: jsx(ItemCard, { i: i, loading: loading, url: url, deleteCallback: () => deleteItem(i) }) }, k))), addItemPopupType === 'place' && (jsx("form", { ref: tabRef, autoComplete: 'off', onSubmit: (e) => submitNewItem(e), children: 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: [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: jsx("p", { className: 'tw-text-center', children: "\u2715" }) }), jsx(TextInput, { type: 'text', placeholder: 'Name', dataField: 'name', defaultValue: '', inputStyle: '' }), layer?.itemType.show_start_end_input && jsx(PopupStartEndInput, {}), jsx(TextAreaInput, { placeholder: 'Text', dataField: 'text', defaultValue: '', inputStyle: 'tw-h-40 tw-mt-5' }), jsx("div", { className: 'tw-flex tw-justify-center', children: jsx("button", { className: loading
|
3955
3986
|
? 'tw-btn tw-btn-disabled tw-mt-5 tw-place-self-center'
|
3956
3987
|
: 'tw-btn tw-mt-5 tw-place-self-center', type: 'submit', children: loading ? jsx("span", { className: 'tw-loading tw-loading-spinner' }) : 'Save' }) })] }) }))] }) })] }) }), plusButton && (jsx(PlusButton, { layer: layer, triggerAction: () => {
|
3957
3988
|
setAddItemPopupType('place');
|
@@ -4032,6 +4063,9 @@ const EmojiPicker = ({ selectedEmoji, selectedColor, selectedShape, setSelectedE
|
|
4032
4063
|
return (jsxs(Fragment, { children: [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 && (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: [jsx("div", { className: 'tw-grid tw-grid-cols-6 tw-gap-2 tw-pb-2', children: emojis.map((emoji) => (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))) }), jsx("hr", {}), jsx("div", { className: 'tw-grid tw-grid-cols-3 tw-gap-2 tw-py-2', children: shapes.map((shape) => (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: jsx("div", { className: `tw-h-12 tw-mask tw-mask-${shape} tw-bg-neutral-content` }) }, shape))) }), jsx("hr", {}), jsx("div", { className: 'tw-grid tw-grid-cols-6 tw-gap-2 tw-py-2 tw-px-6', children: colors.map((color) => (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: jsx("div", { className: `tw-h-8 tw-w-8 tw-rounded-full tw-bg-[${color}]` }) }, color))) })] }))] }));
|
4033
4064
|
};
|
4034
4065
|
|
4066
|
+
/**
|
4067
|
+
* @category Templates
|
4068
|
+
*/
|
4035
4069
|
const AttestationForm = ({ api }) => {
|
4036
4070
|
const items = useItems();
|
4037
4071
|
const appState = useAppState();
|
@@ -4110,6 +4144,9 @@ function groupAndCount(arr) {
|
|
4110
4144
|
}, []);
|
4111
4145
|
return grouped.sort((a, b) => b.count - a.count);
|
4112
4146
|
}
|
4147
|
+
/**
|
4148
|
+
* @category Templates
|
4149
|
+
*/
|
4113
4150
|
const MarketView = () => {
|
4114
4151
|
const [offers, setOffers] = useState([]);
|
4115
4152
|
const [needs, setNeeds] = useState([]);
|
@@ -4119,21 +4156,16 @@ const MarketView = () => {
|
|
4119
4156
|
useEffect(() => {
|
4120
4157
|
setOffers([]);
|
4121
4158
|
setNeeds([]);
|
4122
|
-
items
|
4123
|
-
|
4124
|
-
|
4125
|
-
|
4126
|
-
|
4127
|
-
|
4128
|
-
|
4129
|
-
|
4130
|
-
|
4131
|
-
|
4132
|
-
tag && setNeeds((current) => [...current, tag]);
|
4133
|
-
return null;
|
4134
|
-
});
|
4135
|
-
return null;
|
4136
|
-
});
|
4159
|
+
for (const item of items) {
|
4160
|
+
item.offers?.forEach((o) => {
|
4161
|
+
const tag = tags.find((t) => t.id === o.tags_id);
|
4162
|
+
tag && setOffers((current) => [...current, tag]);
|
4163
|
+
});
|
4164
|
+
item.needs?.forEach((n) => {
|
4165
|
+
const tag = tags.find((t) => t.id === n.tags_id);
|
4166
|
+
tag && setNeeds((current) => [...current, tag]);
|
4167
|
+
});
|
4168
|
+
}
|
4137
4169
|
// eslint-disable-next-line no-console
|
4138
4170
|
console.log(offers);
|
4139
4171
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
@@ -4141,6 +4173,9 @@ const MarketView = () => {
|
|
4141
4173
|
return (jsx(MapOverlayPage, { className: 'tw-rounded-none tw-overflow-y-auto tw-bg-base-200 !tw-p-4', children: jsxs("div", { className: 'tw-grid tw-grid-cols-1 md:tw-grid-cols-2', children: [jsxs("div", { children: [jsx("p", { className: 'tw-text-lg tw-font-bold', children: "Offers" }), jsx("div", { className: 'tw-flex tw-flex-wrap', children: groupAndCount(offers).map((o) => (jsx(TagView, { onClick: () => navigate(`/?tags=${o.object.name}`), tag: o.object, count: o.count }, o.object.id))) })] }), jsxs("div", { children: [jsx("p", { className: 'tw-text-lg tw-font-bold', children: "Needs" }), jsx("div", { className: 'tw-flex tw-flex-wrap', children: groupAndCount(needs).map((o) => (jsx(TagView, { onClick: () => navigate(`/?tags=${o.object.name}`), tag: o.object, count: o.count }, o.object.id))) })] })] }) }));
|
4142
4174
|
};
|
4143
4175
|
|
4176
|
+
/**
|
4177
|
+
* @category Profile
|
4178
|
+
*/
|
4144
4179
|
function UserSettings() {
|
4145
4180
|
const { user, updateUser, loading /* token */ } = useAuth();
|
4146
4181
|
const [id, setId] = useState('');
|
@@ -4398,7 +4433,7 @@ styleInject(css_248z$1);
|
|
4398
4433
|
const GalleryView = ({ item }) => {
|
4399
4434
|
const [index, setIndex] = useState(-1);
|
4400
4435
|
const appState = useAppState();
|
4401
|
-
const images = item.gallery
|
4436
|
+
const images = item.gallery?.map((i, j) => {
|
4402
4437
|
return {
|
4403
4438
|
src: appState.assetsApi.url + `${i.directus_files_id.id}.jpg`,
|
4404
4439
|
width: i.directus_files_id.width,
|
@@ -4406,6 +4441,8 @@ const GalleryView = ({ item }) => {
|
|
4406
4441
|
index: j,
|
4407
4442
|
};
|
4408
4443
|
});
|
4444
|
+
if (!images)
|
4445
|
+
throw new Error('GalleryView: images is undefined');
|
4409
4446
|
return (jsxs("div", { className: 'tw-mx-6 tw-mb-6', children: [jsx(RowsPhotoAlbum, { photos: images, targetRowHeight: 150, onClick: ({ index: current }) => setIndex(current) }), jsx(ReactLightbox, { index: index, slides: images, open: index >= 0, close: () => setIndex(-1) })] }));
|
4410
4447
|
};
|
4411
4448
|
|
@@ -4487,8 +4524,30 @@ const ProfileStartEndView = ({ item }) => {
|
|
4487
4524
|
return (jsx("div", { className: 'tw-mt-2 tw-px-6 tw-max-w-xs', children: jsx(StartEndView, { item: item }) }));
|
4488
4525
|
};
|
4489
4526
|
|
4490
|
-
const
|
4491
|
-
|
4527
|
+
const get = (value, path, defaultValue) => {
|
4528
|
+
const segments = path.split(/[\.\[\]]/g);
|
4529
|
+
let current = value;
|
4530
|
+
for (const key of segments) {
|
4531
|
+
if (current === null)
|
4532
|
+
return defaultValue;
|
4533
|
+
if (current === void 0)
|
4534
|
+
return defaultValue;
|
4535
|
+
const dequoted = key.replace(/['"]/g, "");
|
4536
|
+
if (dequoted.trim() === "")
|
4537
|
+
continue;
|
4538
|
+
current = current[dequoted];
|
4539
|
+
}
|
4540
|
+
if (current === void 0)
|
4541
|
+
return defaultValue;
|
4542
|
+
return current;
|
4543
|
+
};
|
4544
|
+
|
4545
|
+
const ProfileTextView = ({ item, dataField = 'text', heading, hideWhenEmpty, }) => {
|
4546
|
+
const text = get(item, dataField);
|
4547
|
+
if (typeof text !== 'string') {
|
4548
|
+
throw new Error('ProfileTextView: text is not a string');
|
4549
|
+
}
|
4550
|
+
return (jsxs("div", { className: 'tw-my-10 tw-mt-2 tw-px-6', children: [!(text === '' && hideWhenEmpty) && (jsx("h2", { className: 'tw-text-lg tw-font-semibold', children: heading })), jsx("div", { className: 'tw-mt-2 tw-text-sm', children: jsx(TextView, { itemId: item.id, rawText: text }) })] }));
|
4492
4551
|
};
|
4493
4552
|
|
4494
4553
|
const componentMap$1 = {
|
@@ -4502,21 +4561,23 @@ const componentMap$1 = {
|
|
4502
4561
|
const FlexView = ({ item }) => {
|
4503
4562
|
// eslint-disable-next-line no-console
|
4504
4563
|
console.log(item);
|
4505
|
-
return (jsx("div", { className: 'tw-h-full tw-overflow-y-auto fade', children: item.layer?.itemType.profileTemplate.map(
|
4564
|
+
return (jsx("div", { className: 'tw-h-full tw-overflow-y-auto fade', children: item.layer?.itemType.profileTemplate.map(
|
4565
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4566
|
+
(templateItem) => {
|
4506
4567
|
const TemplateComponent = componentMap$1[templateItem.collection];
|
4507
4568
|
return TemplateComponent ? (jsx(TemplateComponent, { item: item, ...templateItem.item }, templateItem.id)) : (jsx("div", { children: "Component not found" }, templateItem.id));
|
4508
4569
|
}) }));
|
4509
4570
|
};
|
4510
4571
|
|
4511
4572
|
const OnepagerView = ({ item }) => {
|
4512
|
-
return (jsxs("div", { className: 'tw-h-full tw-overflow-y-auto fade', children: [jsx(GroupSubHeaderView, { item: item, shareBaseUrl: `https://www.wuerdekompass.org/aktivitaeten/gruppensuche/#/gruppe/${item.slug}` }), item.user_created?.first_name && jsx(ContactInfoView, { heading: 'Du hast Fragen?', item: item }), jsx("div", { className: 'tw-my-10 tw-mt-2 tw-px-6 tw-text-sm ', children: jsx(TextView, { rawText: item.text
|
4573
|
+
return (jsxs("div", { className: 'tw-h-full tw-overflow-y-auto fade', children: [jsx(GroupSubHeaderView, { item: item, shareBaseUrl: `https://www.wuerdekompass.org/aktivitaeten/gruppensuche/#/gruppe/${item.slug}` }), item.user_created?.first_name && jsx(ContactInfoView, { heading: 'Du hast Fragen?', item: item }), jsx("div", { className: 'tw-my-10 tw-mt-2 tw-px-6 tw-text-sm ', children: jsx(TextView, { itemId: item.id, rawText: item.text ?? 'Keine Beschreibung vorhanden' }) }), item.next_appointment && (jsxs("div", { className: 'tw-my-10 tw-px-6', children: [jsx("h2", { className: 'tw-text-lg tw-font-semibold', children: "N\u00E4chste Termine" }), jsx("div", { className: 'tw-mt-2 tw-text-sm', children: jsx(TextView, { itemId: item.id, rawText: item.next_appointment }) })] })), ";"] }));
|
4513
4574
|
};
|
4514
4575
|
|
4515
4576
|
const SimpleView = ({ item }) => {
|
4516
|
-
return (jsx("div", { className: 'tw-mt-8 tw-h-full tw-overflow-y-auto fade tw-px-6', children: jsx(TextView, { item: item }) }));
|
4577
|
+
return (jsx("div", { className: 'tw-mt-8 tw-h-full tw-overflow-y-auto fade tw-px-6', children: jsx(TextView, { text: item.text, itemId: item.id }) }));
|
4517
4578
|
};
|
4518
4579
|
|
4519
|
-
function ActionButton({ item, triggerAddButton, triggerItemSelected, existingRelations, itemType,
|
4580
|
+
function ActionButton({ item, triggerAddButton, triggerItemSelected, existingRelations, itemType, collection = 'items', customStyle, }) {
|
4520
4581
|
const hasUserPermission = useHasUserPermission();
|
4521
4582
|
const [modalOpen, setModalOpen] = useState(false);
|
4522
4583
|
const [search, setSearch] = useState('');
|
@@ -4526,15 +4587,19 @@ function ActionButton({ item, triggerAddButton, triggerItemSelected, existingRel
|
|
4526
4587
|
.filter((i) => !itemType || i.layer?.itemType.name === itemType)
|
4527
4588
|
.filter((i) => !existingRelations.some((s) => s.id === i.id))
|
4528
4589
|
.filter((i) => i.id !== item.id);
|
4590
|
+
const backgroundColor = item.color ??
|
4591
|
+
(getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color
|
4592
|
+
? getItemTags(item)[0].color
|
4593
|
+
: item.layer?.markerDefaultColor);
|
4529
4594
|
return (jsx(Fragment, { children: hasUserPermission(collection, 'update', item) && (jsxs(Fragment, { children: [jsxs("div", { className: `tw-absolute tw-right-4 tw-bottom-4 tw-flex tw-flex-col ${customStyle}`, children: [triggerItemSelected && (jsx("button", { tabIndex: 0, className: 'tw-z-500 tw-btn tw-btn-circle tw-shadow', onClick: () => {
|
4530
4595
|
setModalOpen(true);
|
4531
4596
|
}, style: {
|
4532
|
-
backgroundColor
|
4597
|
+
backgroundColor,
|
4533
4598
|
color: '#fff',
|
4534
4599
|
}, children: 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: 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 && (jsx("button", { tabIndex: 0, className: 'tw-z-500 tw-btn tw-btn-circle tw-shadow tw-mt-2', onClick: () => {
|
4535
4600
|
triggerAddButton();
|
4536
4601
|
}, style: {
|
4537
|
-
backgroundColor
|
4602
|
+
backgroundColor,
|
4538
4603
|
color: '#fff',
|
4539
4604
|
}, children: 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: jsx("path", { strokeLinecap: 'round', strokeLinejoin: 'round', d: 'M12 4.5v15m7.5-7.5h-15' }) }) }))] }), 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: [jsx(TextInput, { defaultValue: '', placeholder: '\uD83D\uDD0D Search', containerStyle: 'lg:col-span-2 tw-m-4 ', updateFormValue: (val) => {
|
4540
4605
|
setSearch(val);
|
@@ -4550,20 +4615,11 @@ function ActionButton({ item, triggerAddButton, triggerItemSelected, existingRel
|
|
4550
4615
|
}, children: jsx(HeaderView, { item: i, hideMenu: true }) }, i.id))) })] })] })) }));
|
4551
4616
|
}
|
4552
4617
|
|
4553
|
-
function LinkedItemsHeaderView({ item, unlinkCallback,
|
4618
|
+
function LinkedItemsHeaderView({ item, unlinkCallback, loading, unlinkPermission, }) {
|
4554
4619
|
const appState = useAppState();
|
4555
|
-
const avatar =
|
4556
|
-
|
4557
|
-
|
4558
|
-
item &&
|
4559
|
-
getValue(item, item.layer?.itemAvatarField) &&
|
4560
|
-
appState.assetsApi.url + getValue(item, item.layer?.itemAvatarField);
|
4561
|
-
const title = itemNameField
|
4562
|
-
? getValue(item, itemNameField)
|
4563
|
-
: item.layer?.itemNameField && item && getValue(item, item.layer.itemNameField);
|
4564
|
-
const subtitle = itemSubnameField
|
4565
|
-
? getValue(item, itemSubnameField)
|
4566
|
-
: item.layer?.itemSubnameField && item && getValue(item, item.layer.itemSubnameField);
|
4620
|
+
const avatar = appState.assetsApi.url + item.image;
|
4621
|
+
const title = item.name;
|
4622
|
+
const subtitle = item.subname;
|
4567
4623
|
useEffect(() => { }, [item]);
|
4568
4624
|
return (jsx(Fragment, { children: jsxs("div", { className: 'tw-flex tw-flex-row', children: [jsx("div", { className: 'tw-grow tw-max-w-[calc(100%-60px)] }', children: jsxs("div", { className: 'flex items-center', children: [avatar && (jsx("img", { className: 'tw-w-10 tw-inline tw-rounded-full', src: avatar, alt: item.name + ' logo' })), jsxs("div", { className: `${avatar ? 'tw-ml-2' : ''} tw-overflow-hidden`, children: [jsx("div", { className: 'tw-text-xl tw-font-semibold tw-truncate', children: title }), subtitle && (jsx("div", { className: 'tw-text-xs tw-truncate tw-text-gray-500 ', children: subtitle }))] })] }) }), jsx("div", { className: 'tw-col-span-1', onClick: (e) => e.stopPropagation(), children: unlinkPermission && (jsxs("div", { className: 'tw-dropdown tw-dropdown-bottom', children: [jsx("label", { tabIndex: 0, className: ' tw-btn tw-m-1 tw-leading-3 tw-border-none tw-min-h-0 tw-h-6', children: jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', className: 'tw-h-5 tw-w-5', viewBox: '0 0 20 20', fill: 'currentColor', children: jsx("path", { d: 'M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z' }) }) }), 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: (jsx("li", { children: jsx("a", { className: 'tw-cursor-pointer !tw-text-error', onClick: () => unlinkCallback(item.id), children: loading ? (jsx("span", { className: 'tw-loading tw-loading-spinner tw-loading-sm' })) : (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: 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' }) })) }) })) })] })) })] }) }));
|
4569
4625
|
}
|
@@ -4600,16 +4656,19 @@ const TabsView = ({ attestations, item, offers, needs, relations, updatePermissi
|
|
4600
4656
|
setActiveTab(urlTab ? Number(urlTab) : 1);
|
4601
4657
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
4602
4658
|
}, [location.search]);
|
4603
|
-
return (jsxs("div", { role: 'tablist', className: 'tw-tabs tw-tabs-lifted tw-mt-2 tw-mb-2 tw-px-6', children: [jsx("input", { type: 'radio', name: 'my_tabs_2', role: 'tab', className: 'tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]', "aria-label": `${item.layer?.itemType.icon_as_labels && activeTab !== 1 ? '📝' : '📝\u00A0Info'}`, checked: activeTab === 1 && true, onChange: () => updateActiveTab(1) }), 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 && (jsx("div", { className: 'tw-max-w-xs', children: jsx(StartEndView, { item: item }) })), jsx(TextView, { item: item }), jsx("div", { className: 'tw-h-4' }), jsx(TextView, {
|
4659
|
+
return (jsxs("div", { role: 'tablist', className: 'tw-tabs tw-tabs-lifted tw-mt-2 tw-mb-2 tw-px-6', children: [jsx("input", { type: 'radio', name: 'my_tabs_2', role: 'tab', className: 'tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]', "aria-label": `${item.layer?.itemType.icon_as_labels && activeTab !== 1 ? '📝' : '📝\u00A0Info'}`, checked: activeTab === 1 && true, onChange: () => updateActiveTab(1) }), 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 && (jsx("div", { className: 'tw-max-w-xs', children: jsx(StartEndView, { item: item }) })), jsx(TextView, { text: item.text, itemId: item.id }), jsx("div", { className: 'tw-h-4' }), jsx(TextView, { text: item.contact, itemId: item.id })] }), item.layer?.itemType.questlog && (jsxs(Fragment, { children: [jsx("input", { type: 'radio', name: 'my_tabs_2', role: 'tab', className: 'tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]', "aria-label": `${item.layer.itemType.icon_as_labels && activeTab !== 2 ? '❤️' : '❤️\u00A0Trust'}`, checked: activeTab === 2 && true, onChange: () => updateActiveTab(2) }), 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: jsx("table", { className: 'sm:tw-table-sm md:tw-table-md', children: jsx("tbody", { children: attestations
|
4604
4660
|
.filter((a) => a.to.some((t) => t.directus_users_id === item.user_created?.id))
|
4605
4661
|
.sort((a, b) => new Date(b.date_created).getTime() - new Date(a.date_created).getTime())
|
4606
4662
|
.map((a, i) => (jsxs("tr", { children: [jsx("td", { children: 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 }) }), jsx("td", { children: jsx("div", { className: 'tw-mr-2', children: jsx("i", { children: a.text }) }) }), jsx("td", { children: jsx(Link, { to: '/item/' + getUserProfile(a.user_created.id)?.id, children: jsxs("div", { className: 'flex items-center gap-3', children: [jsx("div", { className: 'tw-avatar', children: jsx("div", { className: 'tw-mask tw-rounded-full h-8 w-8 tw-mr-2', children: jsx("img", { src: appState.assetsApi.url +
|
4607
4663
|
getUserProfile(a.user_created.id)?.image, alt: 'Avatar' }) }) }), jsxs("div", { children: [jsx("div", { className: 'font-bold', children: getUserProfile(a.user_created.id)?.name }), jsx("div", { className: 'tw-text-xs opacity-50 tw-text-zinc-500', children: timeAgo(a.date_created) })] })] }) }) })] }, i))) }) }) })] })), item.layer?.itemType.offers_and_needs && (jsxs(Fragment, { children: [jsx("input", { type: 'radio', name: 'my_tabs_2', role: 'tab', className: `tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 ${!(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) }), 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: jsx("div", { className: 'tw-h-full', children: jsxs("div", { className: 'tw-grid tw-grid-cols-1', children: [offers.length > 0 ? (jsxs("div", { className: 'tw-col-span-1', children: [jsx("h3", { className: '-tw-mb-2', children: "Offers" }), jsx("div", { className: 'tw-flex tw-flex-wrap tw-mb-4', children: offers.map((o) => (jsx(TagView, { tag: o, onClick: () => {
|
4608
4664
|
addFilterTag(o);
|
4609
4665
|
} }, o.id))) })] })) : (''), needs.length > 0 ? (jsxs("div", { className: 'tw-col-span-1', children: [jsx("h3", { className: '-tw-mb-2 tw-col-span-1', children: "Needs" }), jsx("div", { className: 'tw-flex tw-flex-wrap tw-mb-4', children: needs.map((n) => (jsx(TagView, { tag: n, onClick: () => addFilterTag(n) }, n.id))) })] })) : ('')] }) }) })] })), item.layer?.itemType.relations && (jsxs(Fragment, { children: [jsx("input", { type: 'radio', name: 'my_tabs_2', role: 'tab', className: 'tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]', "aria-label": `${item.layer.itemType.icon_as_labels && activeTab !== 7 ? '🔗' : '🔗\u00A0Links'}`, checked: activeTab === 7 && true, onChange: () => updateActiveTab(7) }), 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: jsx("div", { className: 'tw-h-full', children: 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 &&
|
4610
|
-
relations.map((i) => (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: [jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: unlinkItem, loading: loading }), jsx("div", { className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade', children: jsx(TextView, { truncate: true,
|
4666
|
+
relations.map((i) => (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: [jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: unlinkItem, loading: loading }), jsx("div", { className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade', children: jsx(TextView, { truncate: true, text: i.text, itemId: item.id }) })] }, i.id))), updatePermission && (jsx(ActionButton, { collection: 'items', item: item, existingRelations: relations, triggerItemSelected: linkItem }))] }) }) })] }))] }));
|
4611
4667
|
};
|
4612
4668
|
|
4669
|
+
/**
|
4670
|
+
* @category Profile
|
4671
|
+
*/
|
4613
4672
|
function ProfileView({ attestationApi }) {
|
4614
4673
|
const [item, setItem] = useState();
|
4615
4674
|
const [updatePermission, setUpdatePermission] = useState(false);
|
@@ -4658,28 +4717,23 @@ function ProfileView({ attestationApi }) {
|
|
4658
4717
|
setOffers([]);
|
4659
4718
|
setNeeds([]);
|
4660
4719
|
setRelations([]);
|
4661
|
-
item?.
|
4662
|
-
|
4663
|
-
|
4664
|
-
|
4665
|
-
|
4666
|
-
|
4667
|
-
|
4668
|
-
|
4669
|
-
|
4670
|
-
tag && setNeeds((current) => [...current, tag]);
|
4671
|
-
return null;
|
4672
|
-
});
|
4673
|
-
item?.relations?.map((r) => {
|
4720
|
+
item?.offers?.forEach((o) => {
|
4721
|
+
const tag = tags.find((t) => t.id === o.tags_id);
|
4722
|
+
tag && setOffers((current) => [...current, tag]);
|
4723
|
+
});
|
4724
|
+
item?.needs?.forEach((n) => {
|
4725
|
+
const tag = tags.find((t) => t.id === n.tags_id);
|
4726
|
+
tag && setNeeds((current) => [...current, tag]);
|
4727
|
+
});
|
4728
|
+
item?.relations?.forEach((r) => {
|
4674
4729
|
const item = items.find((i) => i.id === r.related_items_id);
|
4675
4730
|
item && setRelations((current) => [...current, item]);
|
4676
|
-
return null;
|
4677
4731
|
});
|
4678
4732
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
4679
4733
|
}, [item, items]);
|
4680
4734
|
useEffect(() => {
|
4681
|
-
const setMap =
|
4682
|
-
|
4735
|
+
const setMap = (marker, x) => {
|
4736
|
+
map.setView(new LatLng(item?.position?.coordinates[1], item?.position?.coordinates[0] + x / 4), undefined);
|
4683
4737
|
setTimeout(() => {
|
4684
4738
|
marker.openPopup();
|
4685
4739
|
}, 500);
|
@@ -4727,7 +4781,7 @@ function ProfileView({ attestationApi }) {
|
|
4727
4781
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
4728
4782
|
}, [selectPosition]);
|
4729
4783
|
useEffect(() => {
|
4730
|
-
setTemplate(item?.layer?.itemType.template
|
4784
|
+
setTemplate(item?.layer?.itemType.template ?? appState.userType);
|
4731
4785
|
}, [appState.userType, item]);
|
4732
4786
|
return (jsx(Fragment, { children: item && (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: jsxs(Fragment, { children: [jsx("div", { className: 'tw-px-6 tw-pt-6', children: jsx(HeaderView, { api: item.layer?.api, item: item, deleteCallback: (e) => handleDelete(e, item, setLoading, removeItem, map, navigate), editCallback: () => navigate('/edit-item/' + item.id), setPositionCallback: () => {
|
4733
4787
|
map.closePopup();
|
@@ -4975,14 +5029,18 @@ const MarkdownHint = () => {
|
|
4975
5029
|
return (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: [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: 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 && (jsxs("a", { href: 'https://www.markdownguide.org/cheat-sheet/#basic-syntax', target: '_blank', rel: 'noreferrer', children: [jsx("span", { className: 'Button-label tw-ml-1', children: "Markdown is support" }), ' '] }))] }));
|
4976
5030
|
};
|
4977
5031
|
|
4978
|
-
const ProfileTextForm = ({ state, setState,
|
5032
|
+
const ProfileTextForm = ({ state, setState,
|
5033
|
+
// Is this really used?
|
5034
|
+
dataField, heading, size, hideInputLabel, required, }) => {
|
4979
5035
|
const [field, setField] = useState(dataField || 'text');
|
4980
5036
|
useEffect(() => {
|
4981
5037
|
if (!dataField) {
|
4982
5038
|
setField('text');
|
4983
5039
|
}
|
4984
5040
|
}, [dataField]);
|
4985
|
-
return (jsxs("div", { className: 'tw-h-full tw-flex tw-flex-col tw-mt-4', children: [jsxs("div", { className: 'tw-flex tw-justify-between tw-items-center', children: [jsxs("label", { htmlFor: 'nextAppointment', className: 'tw-block tw-text-sm tw-font-medium tw-text-gray-500 tw-mb-1', children: [heading || 'Text', ":"] }), jsx(MarkdownHint, {})] }), jsx(TextAreaInput, { placeholder: '...',
|
5041
|
+
return (jsxs("div", { className: 'tw-h-full tw-flex tw-flex-col tw-mt-4', children: [jsxs("div", { className: 'tw-flex tw-justify-between tw-items-center', children: [jsxs("label", { htmlFor: 'nextAppointment', className: 'tw-block tw-text-sm tw-font-medium tw-text-gray-500 tw-mb-1', children: [heading || 'Text', ":"] }), jsx(MarkdownHint, {})] }), jsx(TextAreaInput, { placeholder: '...',
|
5042
|
+
// eslint-disable-next-line security/detect-object-injection
|
5043
|
+
defaultValue: state[field], updateFormValue: (v) => setState((prevState) => ({
|
4986
5044
|
...prevState,
|
4987
5045
|
[field]: v,
|
4988
5046
|
})), labelStyle: hideInputLabel ? 'tw-hidden' : '', containerStyle: size === 'full' ? 'tw-grow tw-h-full' : '', inputStyle: size === 'full' ? 'tw-h-full' : 'tw-h-24', required: required })] }));
|
@@ -5184,16 +5242,19 @@ const TabsForm = ({ item, state, setState, updatePermission, linkItem, unlinkIte
|
|
5184
5242
|
})), containerStyle: 'tw-grow', inputStyle: `tw-h-full ${!item.layer.itemType.show_start_end_input && 'tw-border-t-0 tw-rounded-tl-none'}` }), jsx("div", { children: jsx(TextAreaInput, { placeholder: 'contact info ...', defaultValue: state.contact || '', updateFormValue: (c) => setState((prevState) => ({
|
5185
5243
|
...prevState,
|
5186
5244
|
contact: c,
|
5187
|
-
})), inputStyle: 'tw-h-24', containerStyle: 'tw-pt-4' }) })] }) }), item.layer?.itemType.offers_and_needs && (jsxs(Fragment, { children: [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) }), 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: jsxs("div", { className: 'tw-h-full', children: [jsx("div", { className: 'tw-w-full tw-h-[calc(50%-0.75em)] tw-mb-4', children: jsx(TagsWidget, { defaultTags: state.offers, onUpdate: (v) => setState((prevState) => ({
|
5245
|
+
})), inputStyle: 'tw-h-24', containerStyle: 'tw-pt-4', required: false }) })] }) }), item.layer?.itemType.offers_and_needs && (jsxs(Fragment, { children: [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) }), 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: jsxs("div", { className: 'tw-h-full', children: [jsx("div", { className: 'tw-w-full tw-h-[calc(50%-0.75em)] tw-mb-4', children: jsx(TagsWidget, { defaultTags: state.offers, onUpdate: (v) => setState((prevState) => ({
|
5188
5246
|
...prevState,
|
5189
5247
|
offers: v,
|
5190
5248
|
})), 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' }) }), jsx("div", { className: 'tw-w-full tw-h-[calc(50%-1.5em)]', children: jsx(TagsWidget, { defaultTags: state.needs, onUpdate: (v) => setState((prevState) => ({
|
5191
5249
|
...prevState,
|
5192
5250
|
needs: v,
|
5193
5251
|
})), 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 && (jsxs(Fragment, { children: [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) }), 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: jsx("div", { className: 'tw-h-full', children: 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 &&
|
5194
|
-
state.relations.map((i) => (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: [jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: (id) => unlinkItem(id, item, updateItem), loading: loading }), jsx("div", { className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade', children: jsx(TextView, { truncate: true,
|
5252
|
+
state.relations.map((i) => (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: [jsx(LinkedItemsHeaderView, { unlinkPermission: updatePermission, item: i, unlinkCallback: (id) => unlinkItem(id, item, updateItem), loading: loading }), jsx("div", { className: 'tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade', children: jsx(TextView, { truncate: true, itemId: item.id }) })] }, i.id))), updatePermission && (jsx(ActionButton, { customStyle: '!tw-bottom-24', collection: 'items', item: item, existingRelations: state.relations, triggerItemSelected: (id) => linkItem(id, item, updateItem) }))] }) }) })] }))] }));
|
5195
5253
|
};
|
5196
5254
|
|
5255
|
+
/**
|
5256
|
+
* @category Profile
|
5257
|
+
*/
|
5197
5258
|
function ProfileForm() {
|
5198
5259
|
const [state, setState] = useState({
|
5199
5260
|
color: '',
|
@@ -5250,11 +5311,10 @@ function ProfileForm() {
|
|
5250
5311
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
5251
5312
|
}, [items]);
|
5252
5313
|
useEffect(() => {
|
5253
|
-
const newColor = item.
|
5254
|
-
|
5255
|
-
: getItemTags(item) && getItemTags(item)[0]?.color
|
5314
|
+
const newColor = item.color ??
|
5315
|
+
(getItemTags(item) && getItemTags(item)[0]?.color
|
5256
5316
|
? getItemTags(item)[0].color
|
5257
|
-
: item.layer?.markerDefaultColor;
|
5317
|
+
: item.layer?.markerDefaultColor);
|
5258
5318
|
const offers = (item.offers ?? []).reduce((acc, o) => {
|
5259
5319
|
const offer = tags.find((t) => t.id === o.tags_id);
|
5260
5320
|
if (offer)
|
@@ -5274,7 +5334,7 @@ function ProfileForm() {
|
|
5274
5334
|
return acc;
|
5275
5335
|
}, []);
|
5276
5336
|
setState({
|
5277
|
-
color: newColor,
|
5337
|
+
color: newColor ?? '',
|
5278
5338
|
id: item?.id ?? '',
|
5279
5339
|
group_type: item?.group_type ?? '',
|
5280
5340
|
status: item?.status ?? '',
|
@@ -5285,7 +5345,8 @@ function ProfileForm() {
|
|
5285
5345
|
telephone: item?.telephone ?? '',
|
5286
5346
|
next_appointment: item?.next_appointment ?? '',
|
5287
5347
|
image: item?.image ?? '',
|
5288
|
-
|
5348
|
+
// Do we actually mean marker_icon here?
|
5349
|
+
marker_icon: item?.markerIcon ?? '',
|
5289
5350
|
offers,
|
5290
5351
|
needs,
|
5291
5352
|
relations,
|
@@ -5296,17 +5357,21 @@ function ProfileForm() {
|
|
5296
5357
|
}, [item, tags, items]);
|
5297
5358
|
const [template, setTemplate] = useState('');
|
5298
5359
|
useEffect(() => {
|
5299
|
-
setTemplate(item.layer?.itemType.template
|
5360
|
+
setTemplate(item.layer?.itemType.template ?? appState.userType);
|
5300
5361
|
}, [appState.userType, item]);
|
5301
5362
|
return (jsx(Fragment, { children: 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: jsx("form", { className: 'tw-h-full', onSubmit: (e) => {
|
5302
5363
|
e.preventDefault();
|
5303
5364
|
void onUpdateItem(state, item, tags, addTag, setLoading, navigate, updateItem, addItem, user, urlParams);
|
5304
5365
|
}, children: jsxs("div", { className: 'tw-flex tw-flex-col tw-h-full', children: [jsx(FormHeader, { item: item, state: state, setState: setState }), template === 'onepager' && (jsx(OnepagerForm, { item: item, state: state, setState: setState })), template === 'simple' && jsx(SimpleForm, { state: state, setState: setState }), template === 'flex' && (jsx(FlexForm, { item: item, state: state, setState: setState })), template === 'tabs' && (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 })), jsx("div", { className: 'tw-mt-4', children: jsx("button", { className: loading ? ' tw-loading tw-btn tw-float-right' : 'tw-btn tw-float-right', type: 'submit', style: {
|
5305
|
-
|
5366
|
+
// We could refactor this, it is used several times at different locations
|
5367
|
+
backgroundColor: `${item.color ?? (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item?.layer?.markerDefaultColor)}`,
|
5306
5368
|
color: '#fff',
|
5307
5369
|
}, children: "Update" }) })] }) }) }) }));
|
5308
5370
|
}
|
5309
5371
|
|
5372
|
+
/**
|
5373
|
+
* @category Gaming
|
5374
|
+
*/
|
5310
5375
|
function Modal({ children, showOnStartup, }) {
|
5311
5376
|
useEffect(() => {
|
5312
5377
|
if (showOnStartup) {
|
@@ -5317,6 +5382,9 @@ function Modal({ children, showOnStartup, }) {
|
|
5317
5382
|
return (jsx(Fragment, { children: jsxs("dialog", { id: 'my_modal_3', className: 'tw-modal tw-transition-all tw-duration-300', children: [jsxs("form", { method: 'dialog', className: 'tw-modal-box tw-transition-none', children: [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] }), jsx("form", { method: 'dialog', className: 'tw-modal-backdrop', children: jsx("button", { children: "close" }) })] }) }));
|
5318
5383
|
}
|
5319
5384
|
|
5385
|
+
/**
|
5386
|
+
* @category Gaming
|
5387
|
+
*/
|
5320
5388
|
function Quests() {
|
5321
5389
|
const questsOpen = useQuestsOpen();
|
5322
5390
|
const setQuestsOpen = useSetQuestOpen();
|
@@ -5335,5 +5403,5 @@ function Quests() {
|
|
5335
5403
|
return (jsx(Fragment, { children: questsOpen ? (jsx("div", { className: 'tw-card tw-w-48 tw-bg-base-100 tw-shadow-xl tw-absolute tw-bottom-4 tw-left-4 tw-z-[2000]', children: jsxs("div", { className: 'tw-card-body tw-p-4 tw-pt-0', children: [jsx("div", { className: 'tw-card-actions tw-justify-end', children: jsx("label", { className: 'tw-btn tw-btn-sm tw-btn-circle tw-btn-ghost tw-absolute tw-right-1 tw-top-1', onClick: () => setQuestsOpen(false), children: "\u2715" }) }), jsxs("h2", { className: 'tw-card-title tw-m-auto ', children: ["Level 1", jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', fill: 'none', viewBox: '0 0 24 24', strokeWidth: 1.5, stroke: '#aaa', className: 'tw-w-5 tw-h-5 tw-cursor-pointer', children: jsx("path", { strokeLinecap: 'round', strokeLinejoin: 'round', d: 'M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z' }) })] }), jsxs("ul", { className: 'tw-flex-row', children: [jsx("li", { children: jsxs("label", { className: 'tw-label tw-justify-normal tw-pt-1 tw-pb-0', children: [jsx("input", { type: 'checkbox', readOnly: true, className: 'tw-checkbox tw-checkbox-xs tw-checkbox-success', checked: isAuthenticated || false }), jsx("span", { className: 'tw-text-sm tw-label-text tw-mx-2', children: "Sign Up" })] }) }), jsx("li", { children: jsxs("label", { className: 'tw-label tw-justify-normal tw-pt-1 tw-pb-0', children: [jsx("input", { type: 'checkbox', readOnly: true, className: 'tw-checkbox tw-checkbox-xs tw-checkbox-success', checked: !!profile?.text }), jsx("span", { className: 'tw-text-sm tw-label-text tw-mx-2', children: "Fill Profile" })] }) }), jsx("li", { children: jsxs("label", { className: 'tw-label tw-justify-normal tw-pt-1 tw-pb-0', children: [jsx("input", { type: 'checkbox', readOnly: true, className: 'tw-checkbox tw-checkbox-xs tw-checkbox-success', checked: !!profile?.image }), jsx("span", { className: 'tw-text-sm tw-label-text tw-mx-2', children: "Upload Avatar" })] }) })] }), ' '] }) })) : ('') }));
|
5336
5404
|
}
|
5337
5405
|
|
5338
|
-
export { AppShell, AttestationForm, AuthProvider, CardPage, Content, ItemForm, ItemView, Layer, LoginPage, MapOverlayPage, MarketView, Modal, MoonCalendar, OverlayItemsIndexPage, Permissions, PopupButton, PopupCheckboxInput, PopupStartEndInput, PopupTextAreaInput, PopupTextInput, ProfileForm, ProfileView, Quests, RequestPasswordPage, SelectBox, SelectUser, SetNewPasswordPage, SideBar, SignupPage, Sitemap, StartEndView, Tags, TextAreaInput, TextInput, TextView, TitleCard, UserSettings, UtopiaMap };
|
5406
|
+
export { AppShell, AttestationForm, AuthProvider, CardPage, Content, ItemForm, ItemView, Layer, LoginPage, MapOverlayPage, MarketView, Modal, MoonCalendar, OverlayItemsIndexPage, Permissions, PlusButton, PopupButton, PopupCheckboxInput, PopupStartEndInput, PopupTextAreaInput, PopupTextInput, ProfileForm, ProfileView, Quests, RequestPasswordPage, SelectBox, SelectUser, SetNewPasswordPage, SideBar, SignupPage, Sitemap, StartEndView, Tags, TextAreaInput, TextInput, TextView, TitleCard, UserSettings, UtopiaMap, useAuth };
|
5339
5407
|
//# sourceMappingURL=index.esm.js.map
|