diff --git a/.eleventy.js b/.eleventy.js index df43924..67d1c3d 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,6 +1,6 @@ const eleventyNavigationPlugin = require("@11ty/eleventy-navigation"); -module.exports = function(eleventyConfig) { +module.exports = function (eleventyConfig) { eleventyConfig.addWatchTarget("./src/scss/"); eleventyConfig.addPlugin(eleventyNavigationPlugin); @@ -11,10 +11,39 @@ module.exports = function(eleventyConfig) { "node_modules/@fortawesome/fontawesome-free/webfonts/": "font", "node_modules/flag-icon-css/flags/4x3/(de|us)*": "flags" }); - eleventyConfig.addShortcode("translatedUrl", function(currentLocale, newLocale) { + eleventyConfig.addShortcode("translatedUrl", function (currentLocale, newLocale) { return this.page.url.replace(new RegExp(`\/${currentLocale}\/`), `/${newLocale}/`); }); + eleventyConfig.addFilter('year', function (value) { + return value * 12; + }); + + eleventyConfig.addFilter("sum", function (value) { + return value.map(d => d.amount).reduce((a, b) => a + b); + }); + + eleventyConfig.addFilter("amount", function (value) { + // TODO update language dynamically + return value.toLocaleString('de', {minimumFractionDigits: 2}); + }); + + eleventyConfig.addFilter("banktransfers", function (donations) { + return donations + .flatMap(y => y.donations) + .filter(d => d.via === 'banktransfer') + .filter(d => d.first) + .length; + }); + + eleventyConfig.addFilter("cash", function (donations) { + return donations + .flatMap(y => y.donations) + .filter(d => d.via === 'cash') + .filter(d => d.first) + .length; + }); + return { dir: { input: "src", diff --git a/package.json b/package.json index 3fff056..8fb77eb 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "browser-sync": "^2.26.14" }, "devDependencies": { - "@11ty/eleventy": "^0.12.1", + "@11ty/eleventy": "^1.0.0-canary.32", "@11ty/eleventy-navigation": "^0.2.0", "cpx": "^1.5.0", "node-sass": "^6.0.0", diff --git a/src/_data/donations.json b/src/_data/donations.json index 51e2993..e9b4451 100644 --- a/src/_data/donations.json +++ b/src/_data/donations.json @@ -1,10 +1,68 @@ -{ - "banktransfer": { - "number": 5, - "color": "success" +[ + { + "year": 2021, + "donations": [ + { + "date": "01.06.2021", + "amount": 20, + "via": "banktransfer", + "from": "Rumo", + "first": true + }, + { + "date": "26.04.2021", + "amount": 8.96, + "via": "banktransfer", + "from": null, + "first": false + }, + { + "date": "23.03.2021", + "amount": 30, + "via": "banktransfer", + "from": null, + "first": true + }, + { + "date": "19.02.2021", + "amount": 20, + "via": "banktransfer", + "from": null, + "first": true + }, + { + "date": "02.02.2021", + "amount": 9.01, + "via": "opencollective", + "from": "Dennis H.", + "first": true + }, + { + "date": "20.01.2021", + "amount": 10, + "via": "banktransfer", + "from": null, + "first": true + }, + { + "date": "17.01.2021", + "amount": 4.41, + "via": "opencollective", + "from": "Michael Haak", + "first": true + } + ] }, - "cash": { - "number": 0, - "color": "inactive" + { + "year": 2020, + "donations": [ + { + "date": "04.12.2020", + "amount": 10, + "via": "banktransfer", + "from": null, + "first": true + } + ] } -} +] diff --git a/src/_data/expenses.json b/src/_data/expenses.json new file mode 100644 index 0000000..fc616d1 --- /dev/null +++ b/src/_data/expenses.json @@ -0,0 +1,50 @@ +[ + { + "name": { + "en": "Websites", + "de": "Webseiten" + }, + "type": "Webhosting", + "provider": "netcup", + "amount": 1.99 + }, + { + "name": "Diana", + "type": "VPS", + "provider": "Hetzner", + "amount": 2.96 + }, + { + "name": "Ceres", + "type": "VPS", + "provider": "netcup", + "amount": 5.5 + }, + { + "name": "Venus", + "type": "VPS", + "provider": "netcup", + "amount": 3.33 + }, + { + "name": "Luna", + "type": "Root-Server", + "provider": "netcup", + "amount": 14 + }, + { + "name": "Vesta", + "type": "Root-Server", + "provider": "netcup", + "amount": 11.49 + }, + { + "name": { + "en": "Additional IPv4", + "de": "Zusätzliche IPv4" + }, + "type": "IPv4", + "provider": "netcup", + "amount": 1 + } +] diff --git a/src/_data/services.json b/src/_data/services.json index e29b754..4021de7 100644 --- a/src/_data/services.json +++ b/src/_data/services.json @@ -2,7 +2,7 @@ { "id": "searx", "name": "Searx", - "icon": "fas fa-search", + "icon": "si si-search", "url": "https://searx.sp-codes.de", "status": "https://searx.sp-codes.de", "summary": { @@ -13,7 +13,7 @@ { "id": "matrix", "name": "Matrix", - "icon": "fas fa-comments", + "icon": "si si-comments", "url": "https://chat.sp-codes.de", "status": "https://matrix.sp-codes.de/_matrix/static/", "summary": { @@ -24,7 +24,7 @@ { "id": "jitsi", "name": "Jitsi Meet", - "icon": "fas fa-users", + "icon": "si si-users", "url": "https://jitsi.sp-codes.de", "status": "https://jitsi.sp-codes.de", "summary": { @@ -35,7 +35,7 @@ { "id": "mastodon", "name": "Mastodon", - "icon": "fab fa-mastodon", + "icon": "si si-mastodon", "url": "https://social.sp-codes.de", "status": "https://social.sp-codes.de/health", "beta": true, @@ -47,7 +47,7 @@ { "id": "gitea", "name": "Gitea", - "icon": "fas fa-code", + "icon": "si si-gitea", "url": "https://git.sp-codes.de", "status": "https://git.sp-codes.de", "summary": { @@ -58,7 +58,7 @@ { "id": "connectivitycheck", "name": "Captive Portal Check", - "icon": "fas fa-wifi", + "icon": "si si-wifi", "status": "https://connectivitycheck.sp-codes.de/generate204", "summary": { "de": "Eine datenschutzfreundliches Tool, um Anmeldeseiten in WLAN-Netzwerken zu erkennen.", @@ -68,7 +68,7 @@ { "id": "firefox-sync", "name": "Firefox Sync", - "icon": "fab fa-firefox-browser", + "icon": "si si-firefox-browser", "status": "https://sync.firefox.sp-codes.de/token/", "summary": { "de": "Ein Service um Firefox Einstellungen, Lesezeichen, offene Tabs und vieles mehr über verschiedene Geräte zu synchronisieren.", @@ -78,7 +78,7 @@ { "id": "shields", "name": "Shields", - "icon": "fas fa-tags", + "icon": "si si-tags", "url": "https://shields.sp-codes.de", "status": "https://shields.sp-codes.de", "summary": { @@ -89,7 +89,7 @@ { "id": "translate", "name": "LibreTranslate", - "icon": "fas fa-language", + "icon": "si si-language", "url": "https://translate.sp-codes.de", "status": "https://translate.sp-codes.de", "beta": true, @@ -101,7 +101,7 @@ { "id": "invidious", "name": "Invidious", - "icon": "fab fa-youtube", + "icon": "si si-youtube", "url": "https://invidious.sp-codes.de", "status": "https://invidious.sp-codes.de", "summary": { @@ -112,7 +112,7 @@ { "id": "nitter", "name": "Nitter", - "icon": "fab fa-twitter", + "icon": "si si-twitter", "url": "https://nitter.sp-codes.de", "status": "https://nitter.sp-codes.de", "summary": { diff --git a/src/_data/strings.json b/src/_data/strings.json index 5748020..244dd09 100644 --- a/src/_data/strings.json +++ b/src/_data/strings.json @@ -38,5 +38,49 @@ "maintenance": { "de": "Wartung", "en": "Maintenance" + }, + "date": { + "de": "Datum", + "en": "Date" + }, + "amount": { + "de": "Betrag", + "en": "Amount" + }, + "via": { + "de": "Via", + "en": "Via" + }, + "from": { + "de": "Von", + "en": "Form" + }, + "banktransfer": { + "de": "Überweisung", + "en": "Bank transfer" + }, + "total": { + "de": "Gesamt", + "en": "Total" + }, + "name": { + "de": "Name", + "en": "Name" + }, + "type": { + "de": "Typ", + "en": "Type" + }, + "provider": { + "de": "Anbieter", + "en": "Provider" + }, + "month": { + "de": "Monat", + "en": "Month" + }, + "year": { + "de": "Jahr", + "en": "Year" } } diff --git a/src/_includes/donations-current.html b/src/_includes/donations-current.html new file mode 100644 index 0000000..cf9dc75 --- /dev/null +++ b/src/_includes/donations-current.html @@ -0,0 +1,36 @@ +
+ + + + + + + + + + + {% for donation in donations[0].donations %} + + + {% if donation.via == 'opencollective' %} + + {% else %} + + {% endif %} + {% if donation.from %} + + {% else %} + + {% endif %} + + + {% endfor %} + + + + + + + +
{{strings.date[locale]}}{{strings.via[locale]}}{{strings.from[locale]}}{{strings.amount[locale]}}
{{donation.date}}Open Collective{{strings[donation.via][locale]}}{{donation.from}}***{{donation.amount | amount}} €
{{strings.total[locale]}}{{donations[0].donations | sum | amount}} €
+
diff --git a/src/_includes/donations.html b/src/_includes/donations.html new file mode 100644 index 0000000..7887454 --- /dev/null +++ b/src/_includes/donations.html @@ -0,0 +1,40 @@ +{% for year in donations %} +

{{year.year}}

+ +
+ + + + + + + + + + + {% for donation in year.donations %} + + + {% if donation.via == 'opencollective' %} + + {% else %} + + {% endif %} + {% if donation.from %} + + {% else %} + + {% endif %} + + + {% endfor %} + + + + + + + +
{{strings.date[locale]}}{{strings.via[locale]}}{{strings.from[locale]}}{{strings.amount[locale]}}
{{donation.date}}Open Collective{{strings[donation.via][locale]}}{{donation.from}}***{{donation.amount | amount}} €
{{strings.total[locale]}}{{year.donations | sum | amount}} €
+
+{% endfor %} diff --git a/src/_includes/expenses-current.html b/src/_includes/expenses-current.html new file mode 100644 index 0000000..542e1b9 --- /dev/null +++ b/src/_includes/expenses-current.html @@ -0,0 +1,35 @@ +
+ + + + + + + + + + + + {% for expense in expenses %} + + {% if expense.name[locale] %} + + {% else %} + + {% endif %} + + + + + + {% endfor %} + + + + + + + + +
{{strings.name[locale]}}{{strings.type[locale]}}{{strings.provider[locale]}}{{strings.amount[locale]}} / {{strings.month[locale]}}{{strings.amount[locale]}} / {{strings.year[locale]}}
{{expense.name[locale]}}{{expense.name}}{{expense.type}}{{expense.provider}}{{expense.amount | amount}} €{{expense.amount | year | amount}} €
{{strings.total[locale]}}{{expenses | sum | amount}} €{{expenses | sum | year | amount}} €
+
diff --git a/src/_includes/layouts/base.njk b/src/_includes/layouts/base.njk index 4d3ad77..fc410de 100644 --- a/src/_includes/layouts/base.njk +++ b/src/_includes/layouts/base.njk @@ -40,7 +40,7 @@ title: sp-codes