Skip to content

Commit

Permalink
[google-maps-input] Remove broken annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Oct 6, 2020
1 parent 43cec0b commit fe03e4c
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions packages/@sanity/google-maps-input/src/diff/GeopointMove.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react'
import * as ReactDOM from 'react-dom'
import {useUserColor} from '@sanity/base/user-color'
import {ObjectDiff, DiffAnnotationTooltipContent} from '@sanity/field/diff'
import {ObjectDiff} from '@sanity/field/diff'
import {Marker} from '../map/Marker'
import {Arrow} from '../map/Arrow'
import {Geopoint} from '../types'
Expand All @@ -19,25 +18,6 @@ export function GeopointMove({diff, api, map, label}: Props) {
const userColor = useUserColor(annotation ? annotation.author : null) || undefined
const fromRef = React.useRef<google.maps.Marker>()
const toRef = React.useRef<google.maps.Marker>()
const infoEl = React.useRef(document.createElement('div'))
const infoWindow = React.useRef(new api.InfoWindow({content: infoEl.current}))
const openInfoOn = (ref: React.MutableRefObject<google.maps.Marker | undefined>) =>
React.useCallback(() => {
const current = ref.current
if (!current) {
return
}

infoWindow.current.open(map, current)

const position = current.getPosition()
if (position) {
map.panTo(position)
}
}, [infoWindow.current, map])

const openInfoOnFrom = openInfoOn(fromRef)
const openInfoOnTo = openInfoOn(toRef)

return (
<>
Expand All @@ -48,7 +28,6 @@ export function GeopointMove({diff, api, map, label}: Props) {
position={from}
zIndex={0}
opacity={0.75}
onClick={openInfoOnFrom}
markerRef={fromRef}
color={userColor}
/>
Expand All @@ -60,17 +39,11 @@ export function GeopointMove({diff, api, map, label}: Props) {
map={map}
position={to}
zIndex={2}
onClick={openInfoOnTo}
markerRef={toRef}
label={label}
color={userColor}
/>
)}
{annotation &&
ReactDOM.createPortal(
<DiffAnnotationTooltipContent annotations={[annotation]} />,
infoEl.current
)}
</>
)
}

0 comments on commit fe03e4c

Please sign in to comment.