diff --git a/joinlemmy-translations b/joinlemmy-translations index 3aadc09..e4067b8 160000 --- a/joinlemmy-translations +++ b/joinlemmy-translations @@ -1 +1 @@ -Subproject commit 3aadc092ceba43fee043391900b1109b7753f70b +Subproject commit e4067b8c02e8dbd9e9375518d8e28155f98cd733 diff --git a/src/shared/components/about.tsx b/src/shared/components/about.tsx index 0da9161..288e4ef 100644 --- a/src/shared/components/about.tsx +++ b/src/shared/components/about.tsx @@ -2,6 +2,7 @@ import { Component } from "inferno"; import { Helmet } from "inferno-helmet"; import { i18n } from "../i18next"; import { T } from "inferno-i18next"; +import { isBrowser } from "../utils"; const title = i18n.t("about_title"); @@ -9,6 +10,13 @@ export class About extends Component { constructor(props: any, context: any) { super(props, context); } + + componentDidMount() { + if (isBrowser()) { + window.scrollTo(0, 0); + } + } + render() { return (
diff --git a/src/shared/components/donate-lines.tsx b/src/shared/components/donate-lines.tsx index 3c746c7..ce8da4b 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/support.tsx b/src/shared/components/donate.tsx similarity index 97% rename from src/shared/components/support.tsx rename to src/shared/components/donate.tsx index 9bf451f..62561e4 100644 --- a/src/shared/components/support.tsx +++ b/src/shared/components/donate.tsx @@ -5,6 +5,7 @@ import { i18n } from "../i18next"; import { T } from "inferno-i18next"; import { translators } from "../translations/translators"; import { languagesAll, countries } from "countries-list"; +import { isBrowser } from "../utils"; const title = i18n.t("support_title"); const avatarSize = 40; @@ -85,10 +86,17 @@ export interface Translator { link?: string; } -export class Support extends Component { +export class Donate extends Component { constructor(props: any, context: any) { super(props, context); } + + componentDidMount() { + if (isBrowser()) { + window.scrollTo(0, 0); + } + } + render() { return (
diff --git a/src/shared/components/link-line.tsx b/src/shared/components/link-line.tsx index 3797483..4253674 100644 --- a/src/shared/components/link-line.tsx +++ b/src/shared/components/link-line.tsx @@ -13,7 +13,7 @@ export class LinkLine extends Component { {i18n.t("join")} {i18n.t("about")} {i18n.t("apps")} - {i18n.t("support")} + {i18n.t("donate")} {i18n.t("docs")} diff --git a/src/shared/components/main.tsx b/src/shared/components/main.tsx index cc0865a..365d814 100644 --- a/src/shared/components/main.tsx +++ b/src/shared/components/main.tsx @@ -4,7 +4,7 @@ import { Helmet } from "inferno-helmet"; import { DonateLines } from "./donate-lines"; import { i18n } from "../i18next"; import { T } from "inferno-i18next"; -import { getDocsLanguage } from "../utils"; +import { getDocsLanguage, isBrowser } from "../utils"; const title = i18n.t("lemmy_title"); @@ -13,6 +13,11 @@ export class Main extends Component { super(props, context); } + componentDidMount() { + if (isBrowser()) { + window.scrollTo(0, 0); + } + } joinServer() { return ( @@ -257,7 +262,7 @@ export class Main extends Component {

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

diff --git a/src/shared/routes.ts b/src/shared/routes.ts index ee9e634..2935e1c 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 { Instances } from "./components/instances"; import { Contact } from "./components/contact"; -import { Support } from "./components/support"; +import { Donate } from "./components/donate"; import { About } from "./components/about"; export const routes: IRouteProps[] = [ @@ -35,6 +35,11 @@ export const routes: IRouteProps[] = [ { path: `/support`, exact: true, - component: Support, + component: Donate, + }, + { + path: `/donate`, + exact: true, + component: Donate, }, ]; diff --git a/src/shared/utils.ts b/src/shared/utils.ts index 4a5f11b..16dc598 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -14,3 +14,7 @@ let SHORTNUM_SI_FORMAT = new Intl.NumberFormat("en-US", { export function numToSI(value: any) { return SHORTNUM_SI_FORMAT.format(value); } + +export function isBrowser() { + return typeof window !== "undefined"; +}