forked from MapComplete/MapComplete
UI: don't show 'open image on website' if it is not defined
This commit is contained in:
parent
55c8ec95f3
commit
2f7f71787d
1 changed files with 4 additions and 2 deletions
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
export let image: Partial<ProvidedImage> & { id: string; url: string }
|
export let image: Partial<ProvidedImage> & { id: string; url: string }
|
||||||
let fallbackImage: string = undefined
|
let fallbackImage: string = undefined
|
||||||
if (image.provider === Mapillary.singleton) {
|
if (image?.provider === Mapillary.singleton) {
|
||||||
fallbackImage = "./assets/svg/blocked.svg"
|
fallbackImage = "./assets/svg/blocked.svg"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
| Store<Feature<Geometry, HotspotProperties>[]> = []
|
| Store<Feature<Geometry, HotspotProperties>[]> = []
|
||||||
|
|
||||||
let loaded = false
|
let loaded = false
|
||||||
let visitUrl = image.provider.visitUrl(image)
|
let visitUrl = image.provider?.visitUrl(image)
|
||||||
let showBigPreview = new UIEventSource(false)
|
let showBigPreview = new UIEventSource(false)
|
||||||
onDestroy(
|
onDestroy(
|
||||||
showBigPreview.addCallbackAndRun((shown) => {
|
showBigPreview.addCallbackAndRun((shown) => {
|
||||||
|
@ -115,10 +115,12 @@
|
||||||
{#if $$slots["dot-menu-actions"] || visitUrl !== undefined}
|
{#if $$slots["dot-menu-actions"] || visitUrl !== undefined}
|
||||||
<DotMenu dotsPosition="top-0 left-0 absolute" hideBackground>
|
<DotMenu dotsPosition="top-0 left-0 absolute" hideBackground>
|
||||||
<slot name="dot-menu-actions" />
|
<slot name="dot-menu-actions" />
|
||||||
|
{#if visitUrl !== undefined}
|
||||||
<a href={visitUrl} target="_blank" rel="noopener">
|
<a href={visitUrl} target="_blank" rel="noopener">
|
||||||
<ExternalLinkIcon class="w-6" />
|
<ExternalLinkIcon class="w-6" />
|
||||||
<Tr t={Translations.t.image.openOnWebsite.Subs(image.provider)} />
|
<Tr t={Translations.t.image.openOnWebsite.Subs(image.provider)} />
|
||||||
</a>
|
</a>
|
||||||
|
{/if}
|
||||||
</DotMenu>
|
</DotMenu>
|
||||||
{/if}
|
{/if}
|
||||||
{#if !loaded}
|
{#if !loaded}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue