Add contributors to attribution panel

This commit is contained in:
pietervdvn 2021-05-19 19:39:55 +02:00
parent 19930b1d51
commit caba824a54
5 changed files with 24 additions and 114 deletions

View file

@ -28,7 +28,7 @@ export default class AllKnownLayers {
if (typeof layer === "string") {
continue;
}
if(layer.builtin !== undefined){
if (layer.builtin !== undefined) {
// This is a builtin layer of which stuff is overridden - skip
continue;
}
@ -37,7 +37,9 @@ export default class AllKnownLayers {
sharedLayers.set(layer.id, parsed);
sharedLayers[layer.id] = parsed;
} catch (e) {
console.error("Could not parse a layer in theme ", layout.id, "due to", e)
if (!Utils.runningFromConsole) {
console.error("Could not parse a layer in theme ", layout.id, "due to", e)
}
}
}
}

View file

@ -10,7 +10,8 @@ import SmallLicense from "../../Models/smallLicense";
import {Utils} from "../../Utils";
import Link from "../Base/Link";
import {VariableUiElement} from "../Base/VariableUIElement";
import {UIElement} from "../UIElement";
import * as contributors from "../../assets/contributors.json"
/**
* The attribution panel shown on mobile
*/
@ -57,6 +58,7 @@ export default class AttributionPanel extends Combine {
})),
"<br/>",
AttributionPanel.CodeContributors(),
"<h3>", Translations.t.general.attribution.iconAttribution.title.Clone().SetClass("pt-6 pb-3"), "</h3>",
...Utils.NoNull(Array.from(layoutToUse.data.ExtractImages()))
.map(AttributionPanel.IconAttribution)
@ -65,7 +67,19 @@ export default class AttributionPanel extends Combine {
this.SetStyle("max-width: calc(100vw - 5em); width: 40em;")
}
private static IconAttribution(iconPath: string) {
private static CodeContributors() : UIElement{
const total = contributors.contributors.length;
const filtered = contributors.contributors
.splice(10, total - 10)
.map(c => c.contributor)
.join(", ")
return Translations.t.general.attribution.codeContributionsBy.Subs({contributors: filtered, hiddenCount: total - 10});
}
private static IconAttribution(iconPath: string) : UIElement{
if (iconPath.startsWith("http")) {
iconPath = "." + new URL(iconPath).pathname;
}

View file

@ -1,108 +1 @@
{
"contributors": [
{
"contributor": "Noémie",
"commits": 1
},
{
"contributor": "Schouppe Joost",
"commits": 1
},
{
"contributor": "tbowdecl97",
"commits": 1
},
{
"contributor": "Thibault Molleman",
"commits": 1
},
{
"contributor": "Tomas Fiers",
"commits": 1
},
{
"contributor": "David Haberthür",
"commits": 2
},
{
"contributor": "graveelius",
"commits": 2
},
{
"contributor": "pbarban",
"commits": 2
},
{
"contributor": "Sebastian Kürten",
"commits": 2
},
{
"contributor": "Stanislas Gueniffey",
"commits": 2
},
{
"contributor": "Mateusz Konieczny",
"commits": 4
},
{
"contributor": "dependabot[bot]",
"commits": 5
},
{
"contributor": "pelderson",
"commits": 6
},
{
"contributor": "Binnette",
"commits": 7
},
{
"contributor": "Flo Edelmann",
"commits": 7
},
{
"contributor": "Joost",
"commits": 7
},
{
"contributor": "yopaseopor",
"commits": 7
},
{
"contributor": "Midgard",
"commits": 8
},
{
"contributor": "Bavo Vanderghote",
"commits": 12
},
{
"contributor": "ToastHawaii",
"commits": 15
},
{
"contributor": "Pieter Fiers",
"commits": 31
},
{
"contributor": "Win Olario",
"commits": 31
},
{
"contributor": "Christian Neumann",
"commits": 33
},
{
"contributor": "Tobias",
"commits": 35
},
{
"contributor": "pietervdvn",
"commits": 512
},
{
"contributor": "Pieter Vander Vennet",
"commits": 669
}
]
}
{"contributors":[{"contributor":"Pieter Vander Vennet", "commits":691},{"contributor":"pietervdvn", "commits":587},{"contributor":"Tobias", "commits":35},{"contributor":"Christian Neumann", "commits":33},{"contributor":"Win Olario", "commits":31},{"contributor":"Pieter Fiers", "commits":31},{"contributor":"ToastHawaii", "commits":15},{"contributor":"Sebastian Kürten", "commits":14},{"contributor":"Bavo Vanderghote", "commits":12},{"contributor":"Joost", "commits":9},{"contributor":"Midgard", "commits":8},{"contributor":"yopaseopor", "commits":7},{"contributor":"Flo Edelmann", "commits":7},{"contributor":"Binnette", "commits":7},{"contributor":"pelderson", "commits":6},{"contributor":"dependabot[bot]", "commits":6},{"contributor":"Mateusz Konieczny", "commits":4},{"contributor":"Léo Villeveygoux", "commits":3},{"contributor":"Stanislas Gueniffey", "commits":2},{"contributor":"pbarban", "commits":2},{"contributor":"graveelius", "commits":2},{"contributor":"David Haberthür", "commits":2},{"contributor":"Tomas Fiers", "commits":1},{"contributor":"Thibault Molleman", "commits":1},{"contributor":"tbowdecl97", "commits":1},{"contributor":"Schouppe Joost", "commits":1},{"contributor":"Noémie", "commits":1},{"contributor":"mozita", "commits":1},{"contributor":"Hosted Weblate", "commits":1}]}

View file

@ -78,7 +78,8 @@
"title": "Used icons"
},
"mapContributionsBy": "The current visible data has edits made by {contributors}",
"mapContributionsByAndHidden": "The current visible data has edits made by {contributors} and {hiddenCount} more contributors"
"mapContributionsByAndHidden": "The current visible data has edits made by {contributors} and {hiddenCount} more contributors",
"codeContributionsBy": "MapComplete has been built by {contributors} and <a href='https://github.com/pietervdvn/MapComplete/graphs/contributors' target='_blank'>{hiddenCount} more contributors</a>"
},
"sharescreen": {
"intro": "<h3>Share this map</h3> Share this map by copying the link below and sending it to friends and family:",

View file

@ -20,7 +20,7 @@
"generate:layeroverview": "ts-node scripts/generateLayerOverview.ts --no-fail",
"generate:licenses": "ts-node scripts/generateLicenseInfo.ts --no-fail",
"generate:report": "cd Docs/Tools && ./compileStats.sh && git commit . -m 'New statistics ands graphs' && git push",
"generate:contributor-list": "git log --pretty='%aN' | sort | uniq -c | sort -h| sed 's/ *\\([0-9]*\\) \\(.*\\)$/{\"contributor\":\"\\2\", \"commits\":\\1}/' | tr '\\n' ',' | sed 's/^/{\"contributors\":[/' | sed 's/,$/]}/' > assets/contributors.json",
"generate:contributor-list": "git log --pretty='%aN' | sort | uniq -c | sort -hr | sed 's/ *\\([0-9]*\\) \\(.*\\)$/{\"contributor\":\"\\2\", \"commits\":\\1}/' | tr '\\n' ',' | sed 's/^/{\"contributors\":[/' | sed 's/,$/]}/' > assets/contributors.json",
"validate:layeroverview": "ts-node scripts/generateLayerOverview.ts --report",
"validate:licenses": "ts-node scripts/generateLicenseInfo.ts --report",
"optimize-images": "cd assets/generated/ && find -name '*.png' -exec optipng '{}' \\; && echo 'PNGs are optimized'",