diff --git a/app/src/pages/MapContainer.tsx b/app/src/pages/MapContainer.tsx index 6b1b0b57..086f7aa6 100644 --- a/app/src/pages/MapContainer.tsx +++ b/app/src/pages/MapContainer.tsx @@ -19,6 +19,7 @@ import { PopupStartEndInput, PopupTextAreaInput, PopupTextInput, + HeaderView, } from 'utopia-ui' import { itemsApi } from '../api/itemsApi' @@ -105,7 +106,7 @@ function MapContainer({ layers, map }: { layers: LayerProps[]; map: any }) { layer.markerDefaultColor2 ? layer.markerDefaultColor2 : 'RGBA(35, 31, 32, 0.2)' } itemType={layer.itemType} - customEditLink='/edit-item' + customEditLink={layer.itemType.small_form_edit ? undefined : '/edit-item'} customEditParameter='id' public_edit_items={layer.public_edit_items} listed={layer.listed} @@ -114,11 +115,16 @@ function MapContainer({ layers, map }: { layers: LayerProps[]; map: any }) { {layer.itemType.show_start_end && } {layer.itemType.show_profile_button && ( - + )} {layer.itemType.show_text && } + {layer.itemType.show_header_view_in_form && } {layer.itemType.show_name_input && ( )} @@ -129,7 +135,7 @@ function MapContainer({ layers, map }: { layers: LayerProps[]; map: any }) {
diff --git a/lib/src/Components/Item/index.tsx b/lib/src/Components/Item/index.tsx index 143ca9bf..31116685 100644 --- a/lib/src/Components/Item/index.tsx +++ b/lib/src/Components/Item/index.tsx @@ -6,6 +6,7 @@ import { PopupCheckboxInput as PlainPopupCheckboxInput, PopupTextAreaInput as PlainPopupTextAreaInput, PopupStartEndInput as PlainPopupStartEndInput, + HeaderView as PlainHeaderView, } from '#components/Map/Subcomponents/ItemPopupComponents' import { templateify } from './templateify' @@ -20,3 +21,4 @@ export const PopupButton = templateify(PlainPopupButton) export const PopupCheckboxInput = templateify(PlainPopupCheckboxInput) export const PopupTextAreaInput = templateify(PlainPopupTextAreaInput) export const PopupStartEndInput = templateify(PlainPopupStartEndInput) +export const HeaderView = templateify(PlainHeaderView) diff --git a/lib/src/Components/Map/Subcomponents/ItemFormPopup.tsx b/lib/src/Components/Map/Subcomponents/ItemFormPopup.tsx index 65d9773d..e85e97fe 100644 --- a/lib/src/Components/Map/Subcomponents/ItemFormPopup.tsx +++ b/lib/src/Components/Map/Subcomponents/ItemFormPopup.tsx @@ -254,7 +254,7 @@ export function ItemFormPopup(props: Props) { onSubmit={(e) => handleSubmit(e)} > {popupForm.item ? ( -
+
) : (
{menuText} diff --git a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx index 89ef9697..d31f3cd3 100644 --- a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx +++ b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx @@ -37,7 +37,7 @@ export function HeaderView({ hideSubname = false, showAddress = false, }: { - item: Item + item?: Item api?: ItemsApi editCallback?: any deleteCallback?: any @@ -58,10 +58,10 @@ export function HeaderView({ const [imageLoaded, setImageLoaded] = useState(false) const avatar = - (item.image && appState.assetsApi.url + item.image + '?width=160&heigth=160') || - item.image_external - const title = item.name - const subtitle = item.subname + (item?.image && appState.assetsApi.url + item.image + '?width=160&heigth=160') || + item?.image_external + const title = item?.name + const subtitle = item?.subname const [address] = useState('') @@ -71,7 +71,7 @@ export function HeaderView({ setModalOpen(true) event.stopPropagation() } - + if (!item) return null return ( <>
diff --git a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/PopupTextAreaInput.tsx b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/PopupTextAreaInput.tsx index e56153f6..49447c18 100644 --- a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/PopupTextAreaInput.tsx +++ b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/PopupTextAreaInput.tsx @@ -22,6 +22,7 @@ export const PopupTextAreaInput = ({ dataField={dataField} placeholder={placeholder} inputStyle={style} + required={false} > ) } diff --git a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/index.tsx b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/index.tsx index c60493ea..8c0e92d0 100644 --- a/lib/src/Components/Map/Subcomponents/ItemPopupComponents/index.tsx +++ b/lib/src/Components/Map/Subcomponents/ItemPopupComponents/index.tsx @@ -5,3 +5,4 @@ export { PopupCheckboxInput } from './PopupCheckboxInput' export { TextView } from './TextView' export { StartEndView } from './StartEndView' export { PopupButton } from './PopupButton' +export { HeaderView } from './HeaderView' diff --git a/lib/src/types/ItemType.d.ts b/lib/src/types/ItemType.d.ts index df56aff7..b9f5325e 100644 --- a/lib/src/types/ItemType.d.ts +++ b/lib/src/types/ItemType.d.ts @@ -16,4 +16,8 @@ export interface ItemType { relations: boolean template: string questlog: boolean + small_form_edit?: boolean + botton_label?: string + text_input_label?: string + show_header_view_in_form?: boolean }