Add first version of the food theme

This commit is contained in:
Pieter Vander Vennet 2021-09-02 21:22:34 +02:00
parent 23af637a81
commit 92e8f3f89d
20 changed files with 629 additions and 30 deletions

View file

@ -23,7 +23,10 @@ export default class Attribution extends Combine {
const reportBug = new Link(Svg.bug_ui().SetClass("small-image"), "https://github.com/pietervdvn/MapComplete/issues", true);
const layoutId = layoutToUse?.data?.id;
const osmChaLink = `https://osmcha.org/?filters=%7B%22comment%22%3A%5B%7B%22label%22%3A%22%23${layoutId}%22%2C%22value%22%3A%22%23${layoutId}%22%7D%5D%2C%22date__gte%22%3A%5B%7B%22label%22%3A%222020-07-05%22%2C%22value%22%3A%222020-07-05%22%7D%5D%2C%22editor%22%3A%5B%7B%22label%22%3A%22MapComplete%22%2C%22value%22%3A%22MapComplete%22%7D%5D%7D`
const now = new Date()
// Note: getMonth is zero-index, we want 1-index but with one substracted, so it checks out!
const startDate = now.getFullYear()+"-"+now.getMonth()+"-"+now.getDate()
const osmChaLink = `https://osmcha.org/?filters=%7B%22comment%22%3A%5B%7B%22label%22%3A%22%23${layoutId}%22%2C%22value%22%3A%22%23${layoutId}%22%7D%5D%2C%22date__gte%22%3A%5B%7B%22label%22%3A%22${startDate}%22%2C%22value%22%3A%222020-07-05%22%7D%5D%2C%22editor%22%3A%5B%7B%22label%22%3A%22MapComplete%22%2C%22value%22%3A%22MapComplete%22%7D%5D%7D`
const stats = new Link(Svg.statistics_ui().SetClass("small-image"), osmChaLink, true)

View file

@ -256,6 +256,9 @@ export class OH {
start?: string,
end?: string
} {
if(str === undefined){
return null
}
str = str.trim();
if (!str.startsWith("PH")) {
return null;

View file

@ -111,9 +111,10 @@ export class Translation extends BaseUIElement {
rtext = date.toLocaleString();
} else if (el.ConstructElement === undefined) {
console.error("ConstructElement is not defined", el);
throw "ConstructElement is not defined, you are working with a "+(typeof el)+":"+(el.constructor.name)
throw "ConstructElement is not defined, you are working with a " + (typeof el) + ":" + (el.constructor.name)
}else if(el["translations"] !== undefined){
rtext = el["translations"][lang]
} else {
Translation.forcedLanguage = lang; // This is a very dirty hack - it'll bite me one day
rtext = el.ConstructElement().innerHTML;
}
@ -126,7 +127,6 @@ export class Translation extends BaseUIElement {
}
newTranslations[lang] = template;
}
Translation.forcedLanguage = undefined;
return new Translation(newTranslations);
}