diff --git a/frontend/next.config.js b/frontend/next.config.js index 5206c370..92de6dd9 100644 --- a/frontend/next.config.js +++ b/frontend/next.config.js @@ -1,7 +1,18 @@ +const pkg = require("./package.json"); + +const commitHash = require("child_process") + .execSync("git log --pretty=format:\"%h\" -n1") + .toString() + .trim(); + /** @type {import('next').NextConfig} */ module.exports = { output: "export", reactStrictMode: false, + env: { + APP_VERSION: pkg.version, + COMMIT_HASH: commitHash, + }, webpack: (config) => { // RainbowKit related dependencies config.externals.push("pino-pretty", "lokijs", "encoding"); diff --git a/frontend/src/comps/Footer/Footer.tsx b/frontend/src/comps/Footer/Footer.tsx index bbef8596..98160e12 100644 --- a/frontend/src/comps/Footer/Footer.tsx +++ b/frontend/src/comps/Footer/Footer.tsx @@ -3,6 +3,7 @@ import { palette } from "@/src/colors"; import { TextButton } from "@/src/comps/Button/TextButton"; import { useConfigModal } from "@/src/comps/ConfigModal/ConfigModal"; +import { APP_VERSION, COMMIT_HASH } from "@/src/env"; import { css } from "@/styled-system/css"; import Image from "next/image"; import Link from "next/link"; @@ -12,11 +13,21 @@ import logo from "./footer-logo.svg"; export function Footer() { const { open: openConfigModal } = useConfigModal(); - const links: Array<[string, string | (() => void)]> = [ - ["Liquity", "https://liquity.org"], - ["Disclaimer", "https://example.org"], + const links: Array<[ + string | [string, string], + string | (() => void), + ]> = [ + // ["Liquity", "https://liquity.org"], + // ["Disclaimer", "https://example.org"], // ["Privacy Policy", "https://example.org"], ["Settings", openConfigModal], + [ + [ + `${APP_VERSION}-${COMMIT_HASH}`, + `Version ${APP_VERSION} (${COMMIT_HASH})`, + ], + "https://github.com/liquity/bold/tree/" + COMMIT_HASH, + ], ]; return ( @@ -61,40 +72,45 @@ export function Footer() { gap: 16, })} > - {links.map(([label, href], index) => ( -