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 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
|
||||
const title = item?.name ?? item?.layer?.item_default_name
|
||||
const subtitle = item?.subname
|
||||
@ -243,8 +243,8 @@ export function HeaderView({
|
||||
</div>
|
||||
</div>
|
||||
<div onClick={(e) => e.stopPropagation()} className={`${big ? 'tw:mt-5' : 'tw:mt-1'}`}>
|
||||
{(api?.deleteItem || item.layer?.api?.updateItem) &&
|
||||
(hasUserPermission(api?.collectionName!, 'delete', item) ||
|
||||
{(api?.deleteItem ?? item.layer?.api?.updateItem) &&
|
||||
(hasUserPermission(api?.collectionName!, 'delete', item) ??
|
||||
hasUserPermission(api?.collectionName!, 'update', item)) &&
|
||||
!hideMenu && (
|
||||
<div className='tw:dropdown tw:dropdown-bottom tw:dropdown-center'>
|
||||
|
||||
@ -25,10 +25,10 @@ interface GeocodeResponse {
|
||||
export function useReverseGeocode(
|
||||
coordinates?: [number, number] | null,
|
||||
enabled: boolean = true,
|
||||
accuracy: 'municipality' | 'street' | 'house_number' = 'municipality'
|
||||
accuracy: 'municipality' | 'street' | 'house_number' = 'municipality',
|
||||
) {
|
||||
const [address, setAddress] = useState<string>('')
|
||||
const [loading, setLoading] = useState<boolean>(false)
|
||||
const [address, setAddress] = useState('')
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
@ -65,13 +65,13 @@ export function useReverseGeocode(
|
||||
|
||||
switch (accuracy) {
|
||||
case 'municipality':
|
||||
addressString = municipality || ''
|
||||
addressString = municipality ?? ''
|
||||
break
|
||||
case 'street':
|
||||
if (props.street && municipality) {
|
||||
addressString = `${props.street}, ${municipality}`
|
||||
} else {
|
||||
addressString = municipality || ''
|
||||
addressString = municipality ?? ''
|
||||
}
|
||||
break
|
||||
case 'house_number':
|
||||
@ -80,7 +80,7 @@ export function useReverseGeocode(
|
||||
} else if (props.street && municipality) {
|
||||
addressString = `${props.street}, ${municipality}`
|
||||
} else {
|
||||
addressString = municipality || ''
|
||||
addressString = municipality ?? ''
|
||||
}
|
||||
break
|
||||
}
|
||||
@ -90,8 +90,10 @@ export function useReverseGeocode(
|
||||
setAddress('')
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Unknown error occurred')
|
||||
const errorMessage = err instanceof Error ? err.message : 'Unknown error occurred'
|
||||
setError(errorMessage)
|
||||
setAddress('')
|
||||
throw err
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user