forked from MapComplete/MapComplete
Styling tweak
Add mapillary link to nearby_images Fix licenses Add missing assets First version of nearby-images
This commit is contained in:
parent
a4f2fa63a5
commit
7559f9259b
52 changed files with 674 additions and 207 deletions
|
@ -1,22 +1,31 @@
|
|||
import Combine from "../Base/Combine";
|
||||
import Attribution from "./Attribution";
|
||||
import Img from "../Base/Img";
|
||||
import {ProvidedImage} from "../../Logic/ImageProviders/ImageProvider";
|
||||
import ImageProvider, {ProvidedImage} from "../../Logic/ImageProviders/ImageProvider";
|
||||
import BaseUIElement from "../BaseUIElement";
|
||||
import {Mapillary} from "../../Logic/ImageProviders/Mapillary";
|
||||
|
||||
|
||||
export class AttributedImage extends Combine {
|
||||
|
||||
constructor(imageInfo: ProvidedImage) {
|
||||
constructor(imageInfo: {
|
||||
url: string,
|
||||
provider?: ImageProvider,
|
||||
date?: Date
|
||||
}
|
||||
) {
|
||||
let img: BaseUIElement;
|
||||
let attr: BaseUIElement
|
||||
img = new Img(imageInfo.url, false, {
|
||||
fallbackImage: imageInfo.provider === Mapillary.singleton ? "./assets/svg/blocked.svg" : undefined
|
||||
});
|
||||
attr = new Attribution(imageInfo.provider.GetAttributionFor(imageInfo.url),
|
||||
imageInfo.provider.SourceIcon(),
|
||||
)
|
||||
|
||||
let attr: BaseUIElement = undefined
|
||||
if(imageInfo.provider !== undefined){
|
||||
attr = new Attribution(imageInfo.provider?.GetAttributionFor(imageInfo.url),
|
||||
imageInfo.provider?.SourceIcon(),
|
||||
imageInfo.date
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
super([img, attr]);
|
||||
|
|
|
@ -4,10 +4,11 @@ import BaseUIElement from "../BaseUIElement";
|
|||
import {VariableUiElement} from "../Base/VariableUIElement";
|
||||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
import {LicenseInfo} from "../../Logic/ImageProviders/LicenseInfo";
|
||||
import {FixedUiElement} from "../Base/FixedUiElement";
|
||||
|
||||
export default class Attribution extends VariableUiElement {
|
||||
|
||||
constructor(license: UIEventSource<LicenseInfo>, icon: BaseUIElement) {
|
||||
constructor(license: UIEventSource<LicenseInfo>, icon: BaseUIElement, date?: Date) {
|
||||
if (license === undefined) {
|
||||
throw "No license source given in the attribution element"
|
||||
}
|
||||
|
@ -23,7 +24,8 @@ export default class Attribution extends VariableUiElement {
|
|||
new Combine([
|
||||
Translations.W(license?.title).SetClass("block"),
|
||||
Translations.W(license?.artist ?? "").SetClass("block font-bold"),
|
||||
Translations.W((license?.license ?? "") === "" ? "CC0" : (license?.license ?? ""))
|
||||
Translations.W((license?.license ?? "") === "" ? "CC0" : (license?.license ?? "")),
|
||||
date === undefined ? undefined : new FixedUiElement(date.toLocaleDateString())
|
||||
]).SetClass("flex flex-col")
|
||||
]).SetClass("flex flex-row bg-black text-white text-sm absolute bottom-0 left-0 p-0.5 pl-5 pr-3 rounded-lg no-images")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue