mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
fix search issues
This commit is contained in:
parent
8269f79563
commit
0d366f7577
@ -116,10 +116,9 @@ export const SearchControl = () => {
|
||||
{itemsResults.slice(0, 5).map(item => (
|
||||
<div key={item.id} className='tw-cursor-pointer hover:tw-font-bold' onClick={() => {
|
||||
const marker = Object.entries(leafletRefs).find(r => r[1].item == item)?.[1].marker;
|
||||
if(marker){
|
||||
resetFilterTags();
|
||||
if(marker && filterTags.length == 0){
|
||||
navigate(`/${item.layer.name}/${item.id}`)
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
navigate("item/"+item.id)
|
||||
|
||||
@ -36,7 +36,6 @@ export function OverlayItemProfile() {
|
||||
const updateItem = useUpdateItem();
|
||||
const [item, setItem] = useState<Item>({} as Item)
|
||||
const map = useMap();
|
||||
const windowDimension = useWindowDimensions();
|
||||
const layers = useLayers();
|
||||
const selectPosition = useSelectPosition();
|
||||
const removeItem = useRemoveItem();
|
||||
@ -77,8 +76,12 @@ export function OverlayItemProfile() {
|
||||
const itemId = location.pathname.split("/")[2];
|
||||
const item = items.find(i => i.id === itemId);
|
||||
item && setItem(item);
|
||||
resetFilterTags();
|
||||
if (item && filterTags.length == 0) {
|
||||
|
||||
|
||||
}, [items,location])
|
||||
|
||||
useEffect(() => {
|
||||
if (item) {
|
||||
if(item.position) {
|
||||
const marker = Object.entries(leafletRefs).find(r => r[1].item == item)?.[1].marker;
|
||||
marker && clusterRef?.zoomToShowLayer(marker, () => {
|
||||
@ -97,8 +100,9 @@ export function OverlayItemProfile() {
|
||||
);
|
||||
}
|
||||
}
|
||||
}, [item])
|
||||
|
||||
|
||||
}, [items, activeTab, leafletRefs])
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
@ -116,7 +120,7 @@ export function OverlayItemProfile() {
|
||||
const item = items.find(i => i.id == r.related_items_id)
|
||||
item && setRelations(current => [...current, item])
|
||||
})
|
||||
}, [item, items])
|
||||
}, [item])
|
||||
|
||||
useEffect(() => {
|
||||
item && item.user_created && hasUserPermission("items", "update", item) && setUpdatePermission(true);
|
||||
@ -234,7 +238,7 @@ export function OverlayItemProfile() {
|
||||
return (
|
||||
<>
|
||||
{item &&
|
||||
<MapOverlayPage className={`tw-mx-4 tw-mt-4 tw-max-h-[calc(100dvh-96px)] tw-h-[calc(100dvh-96px)] md:tw-w-[calc(50%-32px)] tw-w-[calc(100%-32px)] tw-min-w-80 tw-max-w-3xl !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'}`}>
|
||||
<MapOverlayPage key ={item.id} className={`tw-mx-4 tw-mt-4 tw-max-h-[calc(100dvh-96px)] tw-h-[calc(100dvh-96px)] md:tw-w-[calc(50%-32px)] tw-w-[calc(100%-32px)] tw-min-w-80 tw-max-w-3xl !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'}`}>
|
||||
|
||||
<>
|
||||
<HeaderView api={item.layer?.api} item={item} deleteCallback={handleDelete} editCallback={() => navigate("/edit-item/" + item.id)} setPositionCallback={()=>{map.closePopup();setSelectPosition(item); navigate("/")}} big />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user