From 1232a2543a29649bef63ef0cf67c5d5a77c78c47 Mon Sep 17 00:00:00 2001 From: hazzuk Date: Fri, 24 Jan 2025 21:40:25 +0000 Subject: [PATCH] feat(authfooter): dynamically display app version --- src/components/views/auth/AuthFooter.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/views/auth/AuthFooter.tsx b/src/components/views/auth/AuthFooter.tsx index 9eae8bb7262..992f5b42df2 100644 --- a/src/components/views/auth/AuthFooter.tsx +++ b/src/components/views/auth/AuthFooter.tsx @@ -7,16 +7,26 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com Please see LICENSE files in the repository root for full details. */ -import React, { ReactElement } from "react"; +import React, { ReactElement, useContext, useEffect, useState } from "react"; import SdkConfig from "../../../SdkConfig"; import { _t } from "../../../languageHandler"; +import MatrixClientContext from "../../../contexts/MatrixClientContext"; const AuthFooter = (): ReactElement => { + const context = useContext(MatrixClientContext); + const [appVersion, setAppVersion] = useState(""); + + useEffect(() => { + const version = SdkConfig.get("appVersion") || "unknown"; + setAppVersion(version); + }, []); + + const brandingConfig = SdkConfig.getObject("branding"); const links = brandingConfig?.get("auth_footer_links") ?? [ { text: "About", url: "https://elecord.app" }, - { text: "v2.0.1", url: "https://github.com/elecordapp/elecord-web/releases" }, + { text: `v${appVersion}`, url: "https://github.com/elecordapp/elecord-web/releases" }, { text: "Privacy", url: "https://github.com/elecordapp/elecord-web/blob/master/PRIVACY.md" }, { text: "GitHub", url: "https://github.com/elecordapp/elecord-web" }, ];