2021-06-11 22:51:45 +02:00
|
|
|
import { DropDown } from "../Input/DropDown"
|
|
|
|
import Translations from "../i18n/Translations"
|
2021-06-14 19:21:33 +02:00
|
|
|
import { UIEventSource } from "../../Logic/UIEventSource"
|
2021-12-21 18:35:31 +01:00
|
|
|
import { OsmConnection } from "../../Logic/Osm/OsmConnection"
|
2022-01-08 17:44:23 +01:00
|
|
|
import { Translation } from "../i18n/Translation"
|
2021-06-11 22:51:45 +02:00
|
|
|
|
2021-09-09 00:05:51 +02:00
|
|
|
export default class LicensePicker extends DropDown<string> {
|
2022-01-08 17:44:23 +01:00
|
|
|
private static readonly cc0 = "CC0"
|
|
|
|
private static readonly ccbysa = "CC-BY-SA 4.0"
|
|
|
|
private static readonly ccby = "CC-BY 4.0"
|
|
|
|
|
2022-01-26 21:40:38 +01:00
|
|
|
constructor(state: { osmConnection: OsmConnection }) {
|
2021-06-15 00:55:12 +02:00
|
|
|
super(
|
|
|
|
Translations.t.image.willBePublished.Clone(),
|
2021-06-11 22:51:45 +02:00
|
|
|
[
|
2022-01-26 21:40:38 +01:00
|
|
|
{ value: LicensePicker.cc0, shown: Translations.t.image.cco.Clone() },
|
|
|
|
{ value: LicensePicker.ccbysa, shown: Translations.t.image.ccbs.Clone() },
|
|
|
|
{ value: LicensePicker.ccby, shown: Translations.t.image.ccb.Clone() },
|
2021-06-11 22:51:45 +02:00
|
|
|
],
|
2022-04-19 23:43:28 +02:00
|
|
|
state?.osmConnection?.GetPreference("pictures-license") ??
|
|
|
|
new UIEventSource<string>("CC0"),
|
|
|
|
{
|
|
|
|
select_class: "w-min bg-indigo-100 p-1 rounded hover:bg-indigo-200",
|
|
|
|
}
|
2021-06-11 22:51:45 +02:00
|
|
|
)
|
2021-09-09 00:05:51 +02:00
|
|
|
this.SetClass("flex flex-col sm:flex-row").SetStyle("float:left")
|
2021-06-11 22:51:45 +02:00
|
|
|
}
|
2021-09-09 00:05:51 +02:00
|
|
|
|
2022-01-26 21:40:38 +01:00
|
|
|
public static LicenseExplanations(): Map<string, Translation> {
|
2022-01-08 17:44:23 +01:00
|
|
|
let dict = new Map<string, Translation>()
|
2022-01-26 21:40:38 +01:00
|
|
|
|
|
|
|
dict.set(LicensePicker.cc0, Translations.t.image.ccoExplanation)
|
|
|
|
dict.set(LicensePicker.ccby, Translations.t.image.ccbExplanation)
|
|
|
|
dict.set(LicensePicker.ccbysa, Translations.t.image.ccbsExplanation)
|
2022-01-08 17:44:23 +01:00
|
|
|
|
|
|
|
return dict
|
|
|
|
}
|
2021-06-11 22:51:45 +02:00
|
|
|
}
|