From dfc7bfdc98d34a4fe786ca51c42abcb0bc212395 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 14 Oct 2023 16:43:40 -0400 Subject: [PATCH] Addressing PR comments. --- .gitmodules | 2 +- joinlemmy-translations | 2 +- lemmy-stats-crawler | 2 +- src/shared/components/apps.tsx | 2 +- src/shared/components/common.tsx | 44 ++++---- src/shared/components/crypto.tsx | 59 ++++++++++ src/shared/components/donate-definitions.ts | 30 +---- src/shared/components/donate.tsx | 41 +------ src/shared/components/icon.tsx | 1 + src/shared/components/instance-picker.tsx | 96 +++++++--------- src/shared/components/instances.tsx | 61 ++++++++-- src/shared/components/main.tsx | 119 +++++++++++--------- src/shared/components/navbar.tsx | 5 +- src/shared/components/news.tsx | 38 +++---- src/shared/routes.ts | 6 + 15 files changed, 271 insertions(+), 237 deletions(-) create mode 100644 src/shared/components/crypto.tsx diff --git a/.gitmodules b/.gitmodules index 3b90af3..fadfe36 100644 --- a/.gitmodules +++ b/.gitmodules @@ -17,4 +17,4 @@ [submodule "lemmy-stats-crawler"] path = lemmy-stats-crawler url = https://github.com/LemmyNet/lemmy-stats-crawler.git - branch = upgrade_deps_1 + branch = main diff --git a/joinlemmy-translations b/joinlemmy-translations index cacc71e..229a931 160000 --- a/joinlemmy-translations +++ b/joinlemmy-translations @@ -1 +1 @@ -Subproject commit cacc71ec5453b4c4d8d701a495659cfc8f92b058 +Subproject commit 229a9319ba1130723928e58fcbdbfccad45a4e81 diff --git a/lemmy-stats-crawler b/lemmy-stats-crawler index 0e5578a..ff8a2db 160000 --- a/lemmy-stats-crawler +++ b/lemmy-stats-crawler @@ -1 +1 @@ -Subproject commit 0e5578aaf34e0293c489eea64dbe7444c12732ec +Subproject commit ff8a2db505771c9f142ab31626b49de54a756192 diff --git a/src/shared/components/apps.tsx b/src/shared/components/apps.tsx index 547af7e..2813887 100644 --- a/src/shared/components/apps.tsx +++ b/src/shared/components/apps.tsx @@ -70,7 +70,7 @@ const AppDetailsCard = ({ app }: AppDetailsCardProps) => ( ); const AppTitle = ({ title }) => ( -
{title}
+
{title}
); const MobileAppsBlock = () => ( diff --git a/src/shared/components/common.tsx b/src/shared/components/common.tsx index 7679d81..0b7c64f 100644 --- a/src/shared/components/common.tsx +++ b/src/shared/components/common.tsx @@ -6,7 +6,6 @@ import { END_FUNDRAISER_DATE, FUNDED_DEVS, FUNDED_DEV_GOAL, - MEDIAN_DEV_MONTHLY_EUR, MEDIAN_DEV_SALARY, TOTAL_RECURRING_MONTHLY_EUR, TOTAL_SUPPORTERS, @@ -42,7 +41,7 @@ export const DonateDesc = () => (

# - + # # @@ -76,6 +75,12 @@ export const DonateButtons = () => ( ## + + Crypto + ); @@ -89,14 +94,18 @@ const FundingGoal = () => ( {i18n.t("per_month", { formattedCount: "" })} - - {i18n.t("supporters", { - formattedCount: NUMBER_FORMAT.format(TOTAL_SUPPORTERS), - })} - -

- €{NUMBER_FORMAT.format(MEDIAN_DEV_MONTHLY_EUR * FUNDED_DEV_GOAL)} +
+ {i18n.t("devs_funded", { + formattedCount1: FUNDED_DEVS.toFixed(1), + formattedCount2: FUNDED_DEV_GOAL, + })} + *
( max={FUNDED_DEV_GOAL} >
-
+ {i18n.t("supporters", { + formattedCount: NUMBER_FORMAT.format(TOTAL_SUPPORTERS), })} - > - {i18n.t("devs_funded", { - formattedCount1: FUNDED_DEVS.toFixed(2), - formattedCount2: FUNDED_DEV_GOAL, - })} - *
{monthsBetween(new Date(), END_FUNDRAISER_DATE)} months remaining @@ -124,12 +126,12 @@ const FundingGoal = () => (
); -export const SupportDonateBlock = () => ( +export const DonateBlock = () => (

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

diff --git a/src/shared/components/crypto.tsx b/src/shared/components/crypto.tsx new file mode 100644 index 0000000..a21bf8d --- /dev/null +++ b/src/shared/components/crypto.tsx @@ -0,0 +1,59 @@ +import { Helmet } from "inferno-helmet"; +import { Badge } from "./common"; + +const title = "Crypto"; + +interface Crypto { + name: string; + address: string; +} + +const CRYPTOS: Crypto[] = [ + { + name: "bitcoin", + address: "1Hefs7miXS5ff5Ck5xvmjKjXf5242KzRtK", + }, + { + name: "ethereum", + address: "0x400c96c96acbC6E7B3B43B1dc1BB446540a88A01", + }, + { + name: "monero", + address: + "41taVyY6e1xApqKyMVDRVxJ76sPkfZhALLTjRvVKpaAh2pBd4wv9RgYj1tSPrx8wc6iE1uWUfjtQdTmTy2FGMeChGVKPQuV", + }, + { + name: "cardano", + address: + "addr1q858t89l2ym6xmrugjs0af9cslfwvnvsh2xxp6x4dcez7pf5tushkp4wl7zxfhm2djp6gq60dk4cmc7seaza5p3slx0sakjutm", + }, +]; + +export const Crypto = () => ( +
+ + + +
{title}
+
+
+ + {CRYPTOS.map(c => ( + + + + + ))} +
{c.name} + + {c.address} + + } + /> +
+
+
+
+); diff --git a/src/shared/components/donate-definitions.ts b/src/shared/components/donate-definitions.ts index 0a7371a..e02ecdb 100644 --- a/src/shared/components/donate-definitions.ts +++ b/src/shared/components/donate-definitions.ts @@ -99,8 +99,8 @@ export interface Coder { } export const CODERS: Coder[] = [ - { name: "dessalines", link: "https://mastodon.social/@dessalines" }, - { name: "Nutomic", link: "https://lemmy.ml/u/nutomic" }, + { name: "dessalines", link: "https://github.com/dessalines" }, + { name: "Nutomic", link: "https://github.com/nutomic" }, { name: "phiresky", link: "https://github.com/phiresky" }, { name: "SleeplessOne1917", link: "https://github.com/SleeplessOne1917" }, { name: "asonix", link: "https://github.com/asonix" }, @@ -124,32 +124,6 @@ export interface Translator { link?: string; } -export interface Crypto { - name: string; - address: string; -} - -export const CRYPTOS: Crypto[] = [ - { - name: "bitcoin", - address: "1Hefs7miXS5ff5Ck5xvmjKjXf5242KzRtK", - }, - { - name: "ethereum", - address: "0x400c96c96acbC6E7B3B43B1dc1BB446540a88A01", - }, - { - name: "monero", - address: - "41taVyY6e1xApqKyMVDRVxJ76sPkfZhALLTjRvVKpaAh2pBd4wv9RgYj1tSPrx8wc6iE1uWUfjtQdTmTy2FGMeChGVKPQuV", - }, - { - name: "cardano", - address: - "addr1q858t89l2ym6xmrugjs0af9cslfwvnvsh2xxp6x4dcez7pf5tushkp4wl7zxfhm2djp6gq60dk4cmc7seaza5p3slx0sakjutm", - }, -]; - interface FundingPlatform { supporterCount: number; monthlyEUR: number; diff --git a/src/shared/components/donate.tsx b/src/shared/components/donate.tsx index cbe5986..5d61039 100644 --- a/src/shared/components/donate.tsx +++ b/src/shared/components/donate.tsx @@ -5,12 +5,7 @@ import { T } from "inferno-i18next"; import { translators } from "../translations/translators"; import { languagesAll, countries } from "countries-list"; import { isBrowser } from "../utils"; -import { - Badge, - BottomSpacer, - SupportDonateBlock, - TEXT_GRADIENT, -} from "./common"; +import { Badge, BottomSpacer, DonateBlock, TEXT_GRADIENT } from "./common"; import { CODERS, GOLD_SPONSORS, @@ -20,7 +15,6 @@ import { LATINUM_SPONSORS, GENERAL_SPONSORS, Translation, - CRYPTOS, } from "./donate-definitions"; import classNames from "classnames"; import { Icon } from "./icon"; @@ -44,7 +38,7 @@ const ContributorsBlock = () => ( # # @@ -191,32 +185,6 @@ const GeneralSponsorCard = () => { ); }; -const CryptoBlock = () => ( -
- -
-
- - {CRYPTOS.map(c => ( - - - - - ))} -
{c.name} - - {c.address} - - } - /> -
-
-
-
-); - interface PersonBadgeData { name: string; link?: string; @@ -284,16 +252,15 @@ export class Donate extends Component { } render() { - const title = i18n.t("support_title"); + const title = i18n.t("donate_title"); return (
- + -
); diff --git a/src/shared/components/icon.tsx b/src/shared/components/icon.tsx index 27ff774..3e7017f 100644 --- a/src/shared/components/icon.tsx +++ b/src/shared/components/icon.tsx @@ -2,6 +2,7 @@ export enum IconSize { Small = "w-3 h-3", Medium = "w-4 h-4", Large = "w-6 h-6", + Largest = "w-8 h-8", } interface IconProps { diff --git a/src/shared/components/instance-picker.tsx b/src/shared/components/instance-picker.tsx index 72d43b6..6b8801c 100644 --- a/src/shared/components/instance-picker.tsx +++ b/src/shared/components/instance-picker.tsx @@ -8,7 +8,10 @@ import { Icon } from "./icon"; enum Step { Interest, Language, - Join, +} + +interface Props { + reset?: boolean; } interface State { @@ -17,14 +20,21 @@ interface State { language?: string; } -export class InstancePicker extends Component { +export class InstancePicker extends Component { state: State = { activeStep: Step.Interest, }; + constructor(props: any, context: any) { super(props, context); } + componentWillReceiveProps(): void { + this.setState({ + activeStep: Step.Interest, + }); + } + render() { return ( @@ -43,23 +53,18 @@ export class InstancePicker extends Component {

{i18n.t("what_topic")}

- {TOPICS.map(c => ( -
- -
- ))} +
+ {TOPICS.map(c => ( + + ))} +
)} {this.state.activeStep == Step.Language && ( @@ -67,36 +72,24 @@ export class InstancePicker extends Component {

{i18n.t("what_language")}

-
- +
+ + {LANGUAGES.map(l => ( + + ))}
- {LANGUAGES.map(l => ( -
- -
- ))} )} @@ -117,13 +110,6 @@ export class InstancePicker extends Component { > {i18n.t("languages")} -
  • - {i18n.t("join")} -
  • diff --git a/src/shared/components/instances.tsx b/src/shared/components/instances.tsx index ea4eb7f..75890b8 100644 --- a/src/shared/components/instances.tsx +++ b/src/shared/components/instances.tsx @@ -12,20 +12,44 @@ import { All_TOPIC, TOPICS, } from "./instances-definitions"; -import { Icon } from "./icon"; +import { Icon, IconSize } from "./icon"; import { I18nKeys } from "i18next"; const TitleBlock = () => (
    - + ## -

    - {i18n.t("instance_totals", { - instances: numToSI(instance_stats.stats.crawled_instances), - users: numToSI(instance_stats.stats.users_active_month), +

    + > +
    +
    +
    + +
    +
    {i18n.t("servers")}
    +
    + {numToSI(instance_stats.stats.crawled_instances)} +
    +
    {i18n.t("lemmyverse")}
    +
    +
    +
    + +
    +
    {i18n.t("active_users")}*
    +
    + {numToSI(instance_stats.stats.users_active_month)} +
    +
    {new Date().toLocaleDateString()}
    +
    +
    +
    +

    {i18n.t("instance_disclaimer")}

    ); @@ -122,7 +146,7 @@ const InstanceCard = ({ instance }: InstanceCardProps) => { class="btn btn-primary text-white sm:max-md:btn-block bg-gradient-to-r from-[#69D066] to-[#03A80E] normal-case" href={buildUrl(domain)} > - {i18n.t("join_a_server")} + {i18n.t("browse_instance")}
    @@ -80,8 +83,8 @@ const SeeAllServersButton = () => ( ); -const FollowCommunitiesBlock = () => ( -
    +const FollowCommunitiesBlock = ({ i }: MainProps) => ( +
    (

    {i18n.t("lemmy_long_desc")}

    - +
    ); const FeatureCard = ({ pic, title, subtitle, classes }) => ( -
    +
    @@ -247,13 +250,13 @@ const MoreFeaturesBlock = () => ( # # # @@ -276,7 +279,7 @@ const MoreFeaturesBlock = () => (
    } text={ - + {i18n.t("mobile_apps_for_ios_and_android")} } @@ -297,7 +300,7 @@ const MoreFeaturesBlock = () => ( } text={ - ### + ### } /> @@ -313,7 +316,7 @@ const MoreFeaturesBlock = () => ( icons={
    :
    } text={ - ## + ## } /> @@ -325,8 +328,8 @@ const MoreFeaturesBlock = () => ( } text={ - ## - # + ## + # } /> @@ -356,7 +359,7 @@ const MoreFeaturesBlock = () => ( #
    # @@ -372,11 +375,11 @@ const MoreFeaturesBlock = () => ( } text={ - ## - # - # - # - # + ## + # + # + # + # } /> @@ -411,13 +414,19 @@ const MoreFeaturesBlock = () => ( const MoreFeaturesCard = ({ icons, text }) => (
    -
    {icons}
    +
    + {icons} +

    {text}

    ); export class Main extends Component { + state = { + resetInstancePicker: false, + }; + constructor(props: any, context: any) { super(props, context); } @@ -432,7 +441,7 @@ export class Main extends Component { const title = i18n.t("lemmy_title"); return (
    - + @@ -441,15 +450,15 @@ export class Main extends Component { className="bg-top bg-no-repeat bg-contain opacity-20 absolute" />
    - + +
    - - +
    diff --git a/src/shared/components/navbar.tsx b/src/shared/components/navbar.tsx index 22f1db1..415b492 100644 --- a/src/shared/components/navbar.tsx +++ b/src/shared/components/navbar.tsx @@ -82,7 +82,10 @@ export const Navbar = ({ footer = false }) => (
    {footer ? ( - + {i18n.t("copyright_line")} ) : ( diff --git a/src/shared/components/news.tsx b/src/shared/components/news.tsx index 486ae21..8ba3c4c 100644 --- a/src/shared/components/news.tsx +++ b/src/shared/components/news.tsx @@ -2,20 +2,17 @@ import { Component } from "inferno"; import { Link } from "inferno-router"; import { Helmet } from "inferno-helmet"; import { i18n } from "../i18next"; -import { isBrowser } from "../utils"; +import { isBrowser, mdToHtml } from "../utils"; import { news_md } from "../translations/news"; -import { Badge, BottomSpacer, TEXT_GRADIENT } from "./common"; -import { Icon } from "./icon"; +import { BottomSpacer, TEXT_GRADIENT } from "./common"; const title = i18n.t("news"); -const authors = ["nutomic", "dessalines"]; const news_reversed = news_md.reverse(); interface NewsInfo { title: string; dateStr: string; preview: string; - authors: Array; url: string; } @@ -27,7 +24,6 @@ function buildNewsInfoArray(): Array { dateStr: split[0], title: split[1], preview: split[2] || previewMarkdown(n.markdown), - authors, url: `news/${titleToUrl(n.title)}`, }; }); @@ -38,7 +34,11 @@ function titleToUrl(title: string): string { } function previewMarkdown(markdown: string): string { - return markdown.replace(/#/g, "").slice(0, 100).concat("..."); + return markdown + .replace(/#/g, "") + .replace(/[\n\r]/g, " ") + .slice(0, 100) + .concat("..."); } const TitleBlock = () => ( @@ -61,14 +61,13 @@ const NewsCard = ({ news }: NewsProps) => ( {news.title}
    {news.dateStr}
    - -
    - {authors.map(name => ( - - ))} -
    -
    {news.preview}
    + {news.preview && ( +
    + )}
    (
    ); -const AuthorBadge = ({ name }) => ( - - - {name} -
    - } - /> -); - export class News extends Component { constructor(props: any, context: any) { super(props, context); diff --git a/src/shared/routes.ts b/src/shared/routes.ts index 384a04f..3f7df93 100644 --- a/src/shared/routes.ts +++ b/src/shared/routes.ts @@ -6,6 +6,7 @@ import { Contact } from "./components/contact"; import { Donate } from "./components/donate"; import { News } from "./components/news"; import { NewsItem } from "./components/news-item"; +import { Crypto } from "./components/crypto"; export const routes: IRouteProps[] = [ { @@ -48,4 +49,9 @@ export const routes: IRouteProps[] = [ exact: true, component: Donate, }, + { + path: `/crypto`, + exact: true, + component: Crypto, + }, ];