From d4651cb5b27ccfa0b3c0d4f3fd28ea8036a67485 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 25 Mar 2021 10:56:30 -0400 Subject: [PATCH] Add a section thanking contributors. Fixes #27 --- .gitmodules | 4 + generate_translations.js | 12 ++ joinlemmy-translations | 2 +- lemmy-docs | 2 +- lemmy-translations | 1 + package.json | 1 + src/shared/components/donate-lines.tsx | 2 +- src/shared/components/link-line.tsx | 2 +- src/shared/components/main.tsx | 2 +- src/shared/components/sponsors.tsx | 107 ------------- src/shared/components/support.tsx | 205 +++++++++++++++++++++++++ src/shared/routes.ts | 6 +- update_translations.sh | 10 ++ yarn.lock | 5 + 14 files changed, 246 insertions(+), 115 deletions(-) create mode 160000 lemmy-translations delete mode 100644 src/shared/components/sponsors.tsx create mode 100644 src/shared/components/support.tsx create mode 100755 update_translations.sh diff --git a/.gitmodules b/.gitmodules index 079430b..31917be 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,3 +6,7 @@ path = joinlemmy-translations url = https://github.com/lemmynet/joinlemmy-translations branch = main +[submodule "lemmy-translations"] + path = lemmy-translations + url = https://github.com/lemmynet/lemmy-translations + branch = main diff --git a/generate_translations.js b/generate_translations.js index 60a37ba..da1791b 100644 --- a/generate_translations.js +++ b/generate_translations.js @@ -2,6 +2,8 @@ const fs = require("fs"); const translationDir = "joinlemmy-translations/translations/"; const outDir = "src/shared/translations/"; +const translatorsJsonFile = "lemmy-translations/translators.json"; + fs.mkdirSync(outDir, { recursive: true }); fs.readdir(translationDir, (_err, files) => { files.forEach(filename => { @@ -24,6 +26,16 @@ fs.readdir(translationDir, (_err, files) => { console.error(err); } }); + // Add the translators.json file + try { + const json = JSON.parse(fs.readFileSync(translatorsJsonFile, "utf8")); + let data = `export const translators = \n `; + data += JSON.stringify(json, null, 2) + ";"; + const target = outDir + "translators.ts"; + fs.writeFileSync(target, data); + } catch (err) { + console.error(err); + } }); // generate types for i18n keys diff --git a/joinlemmy-translations b/joinlemmy-translations index 73070de..8a980bc 160000 --- a/joinlemmy-translations +++ b/joinlemmy-translations @@ -1 +1 @@ -Subproject commit 73070de1ca98ac93a0258a7abc638b3c5479f62c +Subproject commit 8a980bc918bab79a426e44bd798b8a2480083aac diff --git a/lemmy-docs b/lemmy-docs index dbc8e80..b92b50a 160000 --- a/lemmy-docs +++ b/lemmy-docs @@ -1 +1 @@ -Subproject commit dbc8e80a726057b83f9312dce08d92d4c05087e3 +Subproject commit b92b50adce3b5ebf5913388ab224ceea9202ba32 diff --git a/lemmy-translations b/lemmy-translations new file mode 160000 index 0000000..4b82eea --- /dev/null +++ b/lemmy-translations @@ -0,0 +1 @@ +Subproject commit 4b82eeaaf4762e7a282548b675f40352c1f5ef33 diff --git a/package.json b/package.json index 0b35a34..dfd88b0 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "eslint": "^7.20.0", "eslint-plugin-prettier": "^3.3.1", "husky": "^5.2.0", + "iso-639-1": "^2.1.9", "lint-staged": "^10.5.4", "mini-css-extract-plugin": "^1.3.8", "node-sass": "^5.0.0", diff --git a/src/shared/components/donate-lines.tsx b/src/shared/components/donate-lines.tsx index 362136a..3c746c7 100644 --- a/src/shared/components/donate-lines.tsx +++ b/src/shared/components/donate-lines.tsx @@ -12,7 +12,7 @@ export class DonateLines extends Component { <>

- ### + ###

diff --git a/src/shared/components/link-line.tsx b/src/shared/components/link-line.tsx index a5e2e52..df81166 100644 --- a/src/shared/components/link-line.tsx +++ b/src/shared/components/link-line.tsx @@ -11,7 +11,7 @@ export class LinkLine extends Component { <> {i18n.t("join")} {i18n.t("apps")} - {i18n.t("sponsors")} + {i18n.t("support")} {i18n.t("docs")} {

- {i18n.t("support_donate")} + {i18n.t("support_donate")}

diff --git a/src/shared/components/sponsors.tsx b/src/shared/components/sponsors.tsx deleted file mode 100644 index 1ae0c90..0000000 --- a/src/shared/components/sponsors.tsx +++ /dev/null @@ -1,107 +0,0 @@ -import { Component } from "inferno"; -import { Helmet } from "inferno-helmet"; -import { DonateLines } from "./donate-lines"; -import { i18n } from "../i18next"; - -const title = i18n.t("sponsors_title"); - -interface LinkedSponsor { - name: string; - link: string; -} - -let silverSponsors: LinkedSponsor[] = [ - { name: "RedJoker", link: "https://iww.org" }, -]; -let highlightedSponsors = ["DQW", "Alex Benishek"]; -let sponsors = [ - "seahorse", - "Tommaso", - "Jamie Gray", - "Brendan", - "mexicanhalloween", - "William Moore", - "Rachel Schmitz", - "comradeda", - "Jonathan Cremin", - "Arthur Nieuwland", - "Forrest Weghorst", - "Andre Vallestero", -]; - -export class Sponsors extends Component { - constructor(props: any, context: any) { - super(props, context); - } - render() { - return ( -
- - - -
-
-

{i18n.t("donate_to_lemmy")}

- -
- -
- -
-

{i18n.t("sponsors")}

-

{i18n.t("silver_sponsors_desc")}

-
-
-

{i18n.t("general_sponsors_desc")}

-
- {highlightedSponsors.map(s => ( -
-
{s}
-
- ))} - {sponsors.map(s => ( -
-
{s}
-
- ))} -
-
- -
-

Crypto

- - - - - - - - - - - - - -
bitcoin - 1Hefs7miXS5ff5Ck5xvmjKjXf5242KzRtK -
ethereum - 0x400c96c96acbC6E7B3B43B1dc1BB446540a88A01 -
monero - - 41taVyY6e1xApqKyMVDRVxJ76sPkfZhALLTjRvVKpaAh2pBd4wv9RgYj1tSPrx8wc6iE1uWUfjtQdTmTy2FGMeChGVKPQuV - -
-
-
-
- ); - } -} diff --git a/src/shared/components/support.tsx b/src/shared/components/support.tsx new file mode 100644 index 0000000..1ff4f98 --- /dev/null +++ b/src/shared/components/support.tsx @@ -0,0 +1,205 @@ +import { Component } from "inferno"; +import { Helmet } from "inferno-helmet"; +import { DonateLines } from "./donate-lines"; +import { i18n } from "../i18next"; +import { T } from "inferno-i18next"; +import { translators } from "../translations/translators"; +import ISO6391 from "iso-639-1"; + +const title = i18n.t("support_title"); + +interface LinkedSponsor { + name: string; + link: string; +} + +let silverSponsors: LinkedSponsor[] = [ + { name: "RedJoker", link: "https://iww.org" }, +]; +let highlightedSponsors = ["DQW", "Alex Benishek"]; +let sponsors = [ + "seahorse", + "Tommaso", + "Jamie Gray", + "Brendan", + "mexicanhalloween", + "William Moore", + "Rachel Schmitz", + "comradeda", + "Jonathan Cremin", + "Arthur Nieuwland", + "Forrest Weghorst", + "Andre Vallestero", +]; + +export interface Coder { + name: string; + link?: string; +} + +let coders: Coder[] = [ + { name: "dessalines", link: "https://mastodon.social/@dessalines" }, + { name: "Nutomic", link: "https://lemmy.ml/u/nutomic" }, + { name: "asonix", link: "https://github.com/asonix" }, + { name: "krawieck", link: "https://github.com/krawieck" }, + { name: "shilangyu", link: "https://github.com/shilangyu" }, + { name: "uuttff8", link: "https://github.com/uuttff8" }, + { name: "eiknat", link: "https://github.com/eiknat" }, + { name: "ernestwisniewski", link: "https://github.com/ernestwisniewski" }, + { name: "zacanger", link: "https://github.com/zacanger" }, + { name: "iav", link: "https://github.com/iav" }, +]; + +export interface Translation { + lang: string; + translators: Translator[]; +} + +export interface Translator { + name: string; + link?: string; +} + +export class Support extends Component { + constructor(props: any, context: any) { + super(props, context); + } + render() { + return ( +
+ + + +
+
+

{i18n.t("support_lemmy")}

+ +
+ +
+
+

{i18n.t("contributers")}

+ {this.codersLine()} + {this.translatorsLine()} +
+
+

{i18n.t("sponsors")}

+

{i18n.t("silver_sponsors_desc")}

+
+ {silverSponsors.map(s => ( + + ))} +
+
+

{i18n.t("general_sponsors_desc")}

+
+ {highlightedSponsors.map(s => ( +
+
{s}
+
+ ))} + {sponsors.map(s => ( +
+
{s}
+
+ ))} +
+
+ +
+

Crypto

+ + + + + + + + + + + + + +
bitcoin + 1Hefs7miXS5ff5Ck5xvmjKjXf5242KzRtK +
ethereum + 0x400c96c96acbC6E7B3B43B1dc1BB446540a88A01 +
monero + + 41taVyY6e1xApqKyMVDRVxJ76sPkfZhALLTjRvVKpaAh2pBd4wv9RgYj1tSPrx8wc6iE1uWUfjtQdTmTy2FGMeChGVKPQuV + +
+
+
+
+ ); + } + + translatorsLine() { + return ( +
+

+ {i18n.t("thanks_translators")} + {convertTranslators().map(t => ( + + {ISO6391.getNativeName(t.lang) || t.lang} + : + {t.translators.map((translator, i) => ( + + {translator.link ? ( + {translator.name} + ) : ( + {translator.name} + )} + {i != t.translators.length - 1 ? ", " : " "} + + ))} + + ))} +

+

+ + ## + +

+
+ ); + } + + codersLine() { + return ( +
+

+ {i18n.t("thanks_coders")} + {coders.map((coder, i) => ( + + {coder.link ? ( + {coder.name} + ) : ( + {coder.name} + )} + {i != coders.length - 1 ? ", " : " "} + + ))} +

+
+ ); + } +} + +function convertTranslators(): Translation[] { + let trans: Translation[] = []; + for (const [key, value] of Object.entries(translators)) { + let t: Translation = { + lang: key, + translators: value, + }; + trans.push(t); + } + return trans; +} diff --git a/src/shared/routes.ts b/src/shared/routes.ts index 327bdea..23dc9af 100644 --- a/src/shared/routes.ts +++ b/src/shared/routes.ts @@ -3,7 +3,7 @@ import { Main } from "./components/main"; import { Apps } from "./components/apps"; import { Join } from "./components/join"; import { Contact } from "./components/contact"; -import { Sponsors } from "./components/sponsors"; +import { Support } from "./components/support"; export const routes: IRouteProps[] = [ { @@ -27,8 +27,8 @@ export const routes: IRouteProps[] = [ component: Contact, }, { - path: `/sponsors`, + path: `/support`, exact: true, - component: Sponsors, + component: Support, }, ]; diff --git a/update_translations.sh b/update_translations.sh new file mode 100755 index 0000000..2fd7b0c --- /dev/null +++ b/update_translations.sh @@ -0,0 +1,10 @@ +#!/bin/bash +pushd ../joinlemmy-translations +git fetch weblate +git merge weblate/main +git push +popd +git submodule update --remote +git add joinlemmy-translations +git commit -m"Updating joinlemmy-translations." +git push diff --git a/yarn.lock b/yarn.lock index 652c235..8af2c1d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4588,6 +4588,11 @@ isexe@^2.0.0: resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= +iso-639-1@^2.1.9: + version "2.1.9" + resolved "https://registry.yarnpkg.com/iso-639-1/-/iso-639-1-2.1.9.tgz#e41b11d4f1808e5316d0252c3fa16eeb9b37bb58" + integrity sha512-owRu9up+Cpx/hwSzm83j6G8PtC7U99UCtPVItsafefNfEgMl+pi8KBwhXwJkJfp6IouyYWFxj8n24SvCWpKZEQ== + isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89"