Add link to custom theme generator again
This commit is contained in:
parent
1755cdcf9a
commit
b5d3eb501d
2 changed files with 26 additions and 14 deletions
|
@ -2,7 +2,7 @@ import {Utils} from "../Utils";
|
||||||
|
|
||||||
export default class Constants {
|
export default class Constants {
|
||||||
|
|
||||||
public static vNumber = "0.22.1";
|
public static vNumber = "0.22.2";
|
||||||
|
|
||||||
public static ImgurApiKey = '7070e7167f0a25a'
|
public static ImgurApiKey = '7070e7167f0a25a'
|
||||||
public static readonly mapillary_client_token_v4 = "MLY|4441509239301885|b40ad2d3ea105435bd40c7e76993ae85"
|
public static readonly mapillary_client_token_v4 = "MLY|4441509239301885|b40ad2d3ea105435bd40c7e76993ae85"
|
||||||
|
|
|
@ -42,7 +42,7 @@ export default class ShareScreen extends Combine {
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [currentLocation]));
|
}, [currentLocation]));
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ export default class ShareScreen extends Combine {
|
||||||
|
|
||||||
for (const swtch of switches) {
|
for (const swtch of switches) {
|
||||||
|
|
||||||
const checkbox =new CheckBox(Translations.W(swtch.human), !swtch.reverse)
|
const checkbox = new CheckBox(Translations.W(swtch.human), !swtch.reverse)
|
||||||
optionCheckboxes.push(checkbox);
|
optionCheckboxes.push(checkbox);
|
||||||
optionParts.push(checkbox.GetValue().map((isEn) => {
|
optionParts.push(checkbox.GetValue().map((isEn) => {
|
||||||
if (isEn) {
|
if (isEn) {
|
||||||
|
@ -113,8 +113,8 @@ export default class ShareScreen extends Combine {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(layout.definitionRaw !== undefined){
|
if (layout.definitionRaw !== undefined) {
|
||||||
optionParts.push(new UIEventSource("userlayout="+(layout.definedAtUrl ?? layout.id)))
|
optionParts.push(new UIEventSource("userlayout=" + (layout.definedAtUrl ?? layout.id)))
|
||||||
}
|
}
|
||||||
|
|
||||||
const options = new Combine(optionCheckboxes).SetClass("flex flex-col")
|
const options = new Combine(optionCheckboxes).SetClass("flex flex-col")
|
||||||
|
@ -124,14 +124,14 @@ export default class ShareScreen extends Combine {
|
||||||
let path = window.location.pathname;
|
let path = window.location.pathname;
|
||||||
path = path.substr(0, path.lastIndexOf("/"));
|
path = path.substr(0, path.lastIndexOf("/"));
|
||||||
let id = layout.id.toLowerCase()
|
let id = layout.id.toLowerCase()
|
||||||
if(layout.definitionRaw !== undefined){
|
if (layout.definitionRaw !== undefined) {
|
||||||
id="theme.html"
|
id = "theme.html"
|
||||||
}
|
}
|
||||||
let literalText = `https://${host}${path}/${id}`
|
let literalText = `https://${host}${path}/${id}`
|
||||||
|
|
||||||
let hash = ""
|
let hash = ""
|
||||||
if(layout.definedAtUrl === undefined && layout.definitionRaw !== undefined){
|
if (layout.definedAtUrl === undefined && layout.definitionRaw !== undefined) {
|
||||||
hash = "#"+ LZString.compressToBase64( Utils.MinifyJSON(layout.definitionRaw))
|
hash = "#" + LZString.compressToBase64(Utils.MinifyJSON(layout.definitionRaw))
|
||||||
}
|
}
|
||||||
const parts = Utils.NoEmpty(Utils.NoNull(optionParts.map((eventSource) => eventSource.data)));
|
const parts = Utils.NoEmpty(Utils.NoNull(optionParts.map((eventSource) => eventSource.data)));
|
||||||
if (parts.length === 0) {
|
if (parts.length === 0) {
|
||||||
|
@ -189,18 +189,30 @@ export default class ShareScreen extends Combine {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
let downloadThemeConfig: BaseUIElement = undefined;
|
let downloadThemeConfig: BaseUIElement = undefined;
|
||||||
if(layout.definitionRaw !== undefined){
|
if (layout.definitionRaw !== undefined) {
|
||||||
downloadThemeConfig = new SubtleButton(Svg.download_svg(), new Combine([
|
const downloadThemeConfigAsJson = new SubtleButton(Svg.download_svg(), new Combine([
|
||||||
tr.downloadCustomTheme,
|
tr.downloadCustomTheme,
|
||||||
tr.downloadCustomThemeHelp.SetClass("subtle")
|
tr.downloadCustomThemeHelp.SetClass("subtle")
|
||||||
]).onClick(() => {
|
]).onClick(() => {
|
||||||
Utils.offerContentsAsDownloadableFile(layout.definitionRaw, layout.id+".mapcomplete-theme-definition.json", {
|
Utils.offerContentsAsDownloadableFile(layout.definitionRaw, layout.id + ".mapcomplete-theme-definition.json", {
|
||||||
mimetype:"application/json"
|
mimetype: "application/json"
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.SetClass("flex flex-col"))
|
.SetClass("flex flex-col"))
|
||||||
|
let editThemeConfig: BaseUIElement = undefined
|
||||||
|
if (layout.definedAtUrl === undefined) {
|
||||||
|
const patchedDefinition = JSON.parse(layout.definitionRaw)
|
||||||
|
patchedDefinition["language"] = Object.keys(patchedDefinition.title)
|
||||||
|
editThemeConfig = new SubtleButton(Svg.pencil_svg(), "Edit this theme on the custom theme generator",
|
||||||
|
{
|
||||||
|
url: `https://pietervdvn.github.io/mc/legacy/070/customGenerator.html#${btoa(JSON.stringify(patchedDefinition))}`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
downloadThemeConfig = new Combine([downloadThemeConfigAsJson, editThemeConfig]).SetClass("flex flex-col")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
super([
|
super([
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue