/* eslint-disable @typescript-eslint/no-unnecessary-condition */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable import/no-relative-parent-imports */ /* eslint-disable array-callback-return */ /* eslint-disable new-cap */ /* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable react-hooks/exhaustive-deps */ import { useEffect, useState } from 'react' import { UtopiaMap, Layer, PopupView, PopupButton, StartEndView, TextView, PopupForm, PopupStartEndInput, PopupTextAreaInput, PopupTextInput, } from 'utopia-ui' import { itemsApi } from '../api/itemsApi' import { config } from '../config' import type { Place } from '../api/directus' import type { LayerProps } from 'utopia-ui' interface layerApi { id: string api: itemsApi } function MapContainer({ layers, map }: { layers: LayerProps[]; map: any }) { const [apis, setApis] = useState([]) useEffect(() => { // get timestamp for the end of the current day const now = new Date() const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate()) const etartOfDayISO = startOfDay.toISOString() layers.map((layer: LayerProps) => { apis && setApis((current) => [ ...current, { id: layer.id, api: new itemsApi('items', layer.id, undefined, { _or: [ { end: { _gt: etartOfDayISO, }, }, { end: { _null: true, }, }, ], }), }, ]) }) }, [layers]) useEffect(() => {}, [apis]) return ( <> {layers && apis && layers.map((layer) => ( api.id === layer.id)?.api} > {layer.itemType.show_start_end && } {layer.itemType.show_profile_button && ( )} {layer.itemType.show_text && } {layer.itemType.show_name_input && ( )} {layer.itemType.show_start_end_input && ( )} {layer.itemType.show_text_input && (
)} { // layer.public_edit_items && } {layer.itemType.custom_text && (

{layer.itemType.custom_text}

)} {layer.item_presets && Object.entries(layer.item_presets).map((ip: any) => ( ))}
))}
) } export default MapContainer