forked from MapComplete/MapComplete
Refactoring: move all code files into a src directory
This commit is contained in:
parent
de99f56ca8
commit
e75d2789d2
389 changed files with 0 additions and 12 deletions
29
src/UI/Image/AttributedImage.ts
Normal file
29
src/UI/Image/AttributedImage.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import Combine from "../Base/Combine"
|
||||
import Attribution from "./Attribution"
|
||||
import Img from "../Base/Img"
|
||||
import ImageProvider from "../../Logic/ImageProviders/ImageProvider"
|
||||
import BaseUIElement from "../BaseUIElement"
|
||||
import { Mapillary } from "../../Logic/ImageProviders/Mapillary"
|
||||
import { UIEventSource } from "../../Logic/UIEventSource"
|
||||
|
||||
export class AttributedImage extends Combine {
|
||||
constructor(imageInfo: { url: string; provider?: ImageProvider; date?: Date }) {
|
||||
let img: BaseUIElement
|
||||
img = new Img(imageInfo.url, false, {
|
||||
fallbackImage:
|
||||
imageInfo.provider === Mapillary.singleton ? "./assets/svg/blocked.svg" : undefined,
|
||||
})
|
||||
|
||||
let attr: BaseUIElement = undefined
|
||||
if (imageInfo.provider !== undefined) {
|
||||
attr = new Attribution(
|
||||
UIEventSource.FromPromise(imageInfo.provider?.DownloadAttribution(imageInfo.url)),
|
||||
imageInfo.provider?.SourceIcon(),
|
||||
imageInfo.date
|
||||
)
|
||||
}
|
||||
|
||||
super([img, attr])
|
||||
this.SetClass("block relative h-full")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue