mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-03-01 12:44:17 +00:00
fixed linting
This commit is contained in:
parent
5b958a26ff
commit
68aa70ec0d
@ -74,7 +74,7 @@ export function HeaderView({
|
|||||||
const { distance } = useGeoDistance(item?.position ?? undefined)
|
const { distance } = useGeoDistance(item?.position ?? undefined)
|
||||||
|
|
||||||
const avatar =
|
const avatar =
|
||||||
(item?.image && appState.assetsApi.url + item.image + '?width=160&heigth=160') ||
|
(item?.image && appState.assetsApi.url + item.image + '?width=160&heigth=160') ??
|
||||||
item?.image_external
|
item?.image_external
|
||||||
const title = item?.name ?? item?.layer?.item_default_name
|
const title = item?.name ?? item?.layer?.item_default_name
|
||||||
const subtitle = item?.subname
|
const subtitle = item?.subname
|
||||||
@ -243,8 +243,8 @@ export function HeaderView({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div onClick={(e) => e.stopPropagation()} className={`${big ? 'tw:mt-5' : 'tw:mt-1'}`}>
|
<div onClick={(e) => e.stopPropagation()} className={`${big ? 'tw:mt-5' : 'tw:mt-1'}`}>
|
||||||
{(api?.deleteItem || item.layer?.api?.updateItem) &&
|
{(api?.deleteItem ?? item.layer?.api?.updateItem) &&
|
||||||
(hasUserPermission(api?.collectionName!, 'delete', item) ||
|
(hasUserPermission(api?.collectionName!, 'delete', item) ??
|
||||||
hasUserPermission(api?.collectionName!, 'update', item)) &&
|
hasUserPermission(api?.collectionName!, 'update', item)) &&
|
||||||
!hideMenu && (
|
!hideMenu && (
|
||||||
<div className='tw:dropdown tw:dropdown-bottom tw:dropdown-center'>
|
<div className='tw:dropdown tw:dropdown-bottom tw:dropdown-center'>
|
||||||
|
|||||||
@ -25,10 +25,10 @@ interface GeocodeResponse {
|
|||||||
export function useReverseGeocode(
|
export function useReverseGeocode(
|
||||||
coordinates?: [number, number] | null,
|
coordinates?: [number, number] | null,
|
||||||
enabled: boolean = true,
|
enabled: boolean = true,
|
||||||
accuracy: 'municipality' | 'street' | 'house_number' = 'municipality'
|
accuracy: 'municipality' | 'street' | 'house_number' = 'municipality',
|
||||||
) {
|
) {
|
||||||
const [address, setAddress] = useState<string>('')
|
const [address, setAddress] = useState('')
|
||||||
const [loading, setLoading] = useState<boolean>(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [error, setError] = useState<string | null>(null)
|
const [error, setError] = useState<string | null>(null)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -65,13 +65,13 @@ export function useReverseGeocode(
|
|||||||
|
|
||||||
switch (accuracy) {
|
switch (accuracy) {
|
||||||
case 'municipality':
|
case 'municipality':
|
||||||
addressString = municipality || ''
|
addressString = municipality ?? ''
|
||||||
break
|
break
|
||||||
case 'street':
|
case 'street':
|
||||||
if (props.street && municipality) {
|
if (props.street && municipality) {
|
||||||
addressString = `${props.street}, ${municipality}`
|
addressString = `${props.street}, ${municipality}`
|
||||||
} else {
|
} else {
|
||||||
addressString = municipality || ''
|
addressString = municipality ?? ''
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'house_number':
|
case 'house_number':
|
||||||
@ -80,7 +80,7 @@ export function useReverseGeocode(
|
|||||||
} else if (props.street && municipality) {
|
} else if (props.street && municipality) {
|
||||||
addressString = `${props.street}, ${municipality}`
|
addressString = `${props.street}, ${municipality}`
|
||||||
} else {
|
} else {
|
||||||
addressString = municipality || ''
|
addressString = municipality ?? ''
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -90,8 +90,10 @@ export function useReverseGeocode(
|
|||||||
setAddress('')
|
setAddress('')
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(err instanceof Error ? err.message : 'Unknown error occurred')
|
const errorMessage = err instanceof Error ? err.message : 'Unknown error occurred'
|
||||||
|
setError(errorMessage)
|
||||||
setAddress('')
|
setAddress('')
|
||||||
|
throw err
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user