Skip to content

Commit

Permalink
feat: add git commit version to footer and dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
kittybest committed Jan 10, 2025
1 parent f0ad8f3 commit 2b4fa32
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"prebuild": "EXPORT NEXT_PUBLIC_COMMIT_HASH=`git log --pretty=format:'%h' -n`",
"build": "next build",
"dev": "next dev",
"lint": "next lint",
Expand Down
4 changes: 4 additions & 0 deletions packages/interface/src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import Image from "next/image";
import { FaGithub, FaDiscord } from "react-icons/fa";
import { FaXTwitter } from "react-icons/fa6";

import { config } from "~/config";

import { Logo } from "./ui/Logo";

export const Footer = (): JSX.Element => (
Expand All @@ -26,6 +28,8 @@ export const Footer = (): JSX.Element => (
</div>

<div className="flex justify-end gap-4">
<p className="text-red flex items-center">Git Version: {config.commitHash}</p>

<a className="flex items-center gap-1" href="https://maci.pse.dev" rel="noreferrer" target="_blank">
<span>Docs</span>

Expand Down
1 change: 1 addition & 0 deletions packages/interface/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const config = {
roundLogo: process.env.NEXT_PUBLIC_ROUND_LOGO,
semaphoreSubgraphUrl: process.env.NEXT_PUBLIC_SEMAPHORE_SUBGRAPH,
treeUrl: process.env.NEXT_PUBLIC_TREE_URL,
commitHash: process.env.NEXT_PUBLIC_COMMIT_HASH,
};

export const theme = {
Expand Down
4 changes: 4 additions & 0 deletions packages/interface/src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ module.exports = createEnv({

NEXT_PUBLIC_SEMAPHORE_SUBGRAPH: z.string().url().optional(),
NEXT_PUBLIC_TREE_URL: z.string().url().optional(),

NEXT_PUBLIC_COMMIT_HASH: z.string(),
},

/**
Expand Down Expand Up @@ -83,6 +85,8 @@ module.exports = createEnv({

NEXT_PUBLIC_SEMAPHORE_SUBGRAPH: process.env.NEXT_PUBLIC_SEMAPHORE_SUBGRAPH,
NEXT_PUBLIC_TREE_URL: process.env.NEXT_PUBLIC_TREE_URL,

NEXT_PUBLIC_COMMIT_HASH: process.env.NEXT_PUBLIC_COMMIT_HASH,
},
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially
Expand Down
11 changes: 10 additions & 1 deletion packages/interface/src/pages/coordinator/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { config } from "~/config";
import { Layout } from "~/layouts/DefaultLayout";

const CoordinatorPage = (): JSX.Element => <Layout requireAuth>This is the coordinator page.</Layout>;
const CoordinatorPage = (): JSX.Element => (
<Layout requireAuth>
<div>
<p>This is the coordinator page.</p>

<p>You are using version with commit: {config.commitHash}</p>
</div>
</Layout>
);

export default CoordinatorPage;

0 comments on commit 2b4fa32

Please sign in to comment.