Skip to content

Commit

Permalink
feat: display revision hash in footer
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 committed Sep 30, 2024
1 parent a174926 commit d613501
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 40 deletions.
2 changes: 1 addition & 1 deletion build/esbuild-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const esBuildContext: esbuild.BuildOptions = {
outdir: "static/dist",
define: createEnvDefines(["SUPABASE_URL", "SUPABASE_ANON_KEY"], {
SUPABASE_STORAGE_KEY: generateSupabaseStorageKey(),
commitHash: execSync(`git rev-parse --short HEAD`).toString().trim(),
GIT_REVISION: execSync(`git rev-parse --short HEAD`).toString().trim(),
NODE_ENV: process.env.NODE_ENV || "development",
}),
};
Expand Down
4 changes: 0 additions & 4 deletions build/index.ts

This file was deleted.

2 changes: 2 additions & 0 deletions src/home/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { fetchIssuesFull } from "./fetch-github/fetch-issues-full";
import { readyToolbar } from "./ready-toolbar";
import { renderErrorInModal } from "./rendering/display-popup-modal";
import { applyAvatarsToIssues } from "./rendering/render-github-issues";
import { renderGitRevision } from "./rendering/render-github-login-button";
import { generateSortingToolbar } from "./sorting/generate-sorting-buttons";
import { TaskManager } from "./task-manager";

Expand All @@ -18,6 +19,7 @@ window.addEventListener("unhandledrejection", (event: PromiseRejectionEvent) =>
event.preventDefault();
});

renderGitRevision();
initiateDevRelTracking();
generateSortingToolbar();
renderServiceMessage();
Expand Down
8 changes: 8 additions & 0 deletions src/home/rendering/render-github-login-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { renderErrorInModal } from "./display-popup-modal";
declare const SUPABASE_URL: string; // @DEV: passed in at build time check build/esbuild-build.ts
declare const SUPABASE_ANON_KEY: string; // @DEV: passed in at build time check build/esbuild-build.ts
declare const NODE_ENV: string; // @DEV: passed in at build time check build/esbuild-build.ts
declare const GIT_REVISION: string; // @DEV: passed in at build time check build/esbuild-build.ts
declare const SUPABASE_STORAGE_KEY: string; // @DEV: passed in at build time check build/esbuild-build.ts

const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
Expand Down Expand Up @@ -59,4 +60,11 @@ export function renderGitHubLoginButton() {
}
}

export function renderGitRevision() {
const gitRevision = document.getElementById("git-revision") as HTMLAnchorElement;
if (!gitRevision) throw new Error("Could not find element with id 'git-revision'");
gitRevision.href = `https://github.com/ubiquity/pay.ubq.fi/commit/${GIT_REVISION}`;
gitRevision.textContent = GIT_REVISION;
}

export { gitHubLoginButton };
6 changes: 3 additions & 3 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
></path></svg
><span
><span class="full">Ubiquity DAO | </span><span class="mid">DevPool<input type="checkbox" id="view-toggle" disabled /></span></span></div></label
><div id="filters" class="filters-container"></div
><div id="authentication"></div></div>
><div id="filters" class="filters-container"></div><div id="authentication"></div
></div>
<div id="bottom-bar" class="toolbar"
><div id="filters-bottom" class="filters-container"></div><a href="https://dao.ubq.fi/devpool-flow" target="_blank"><button>FAQ</button></a></div
><span class="mid"><a href="#" id="git-revision"></a></span><div id="filters-bottom" class="filters-container"></div><a href="https://dao.ubq.fi/devpool-flow" target="_blank"><button>FAQ</button></a></div
>
<script type="module" src="dist/src/home/home.js"></script>
</body>
Expand Down
47 changes: 31 additions & 16 deletions static/style/inverted-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -716,23 +716,38 @@
height: 48px;
background-color: #7f7f7f;
}
}

#view-toggle:checked::after {
content: "Proposals";
}
#view-toggle::after {
content: "Directory";
letter-spacing: 1.5px;
text-rendering: geometricprecision;
text-transform: uppercase;
font-size: 16px;
}
#view-toggle:checked::after {
content: "Proposals";
}
#view-toggle::after {
content: "Directory";
letter-spacing: 1.5px;
text-rendering: geometricprecision;
text-transform: uppercase;
font-size: 16px;
}

#view-toggle {
appearance: none;
}
#view-toggle {
appearance: none;
}

label[for="view-toggle"] {
margin-left: 8px;
}

label[for="view-toggle"] {
margin-left: 8px;
#git-revision {
text-align: center;
text-transform: uppercase;
letter-spacing: 2px;
text-rendering: geometricPrecision;
vertical-align: middle;
opacity: 0.25;
font-size: 12px;
color: #000000;
}

#git-revision:hover {
opacity: 1;
}
}
47 changes: 31 additions & 16 deletions static/style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -716,23 +716,38 @@
height: 48px;
background-color: #808080;
}
}

#view-toggle:checked::after {
content: "Proposals";
}
#view-toggle::after {
content: "Directory";
letter-spacing: 1.5px;
text-rendering: geometricprecision;
text-transform: uppercase;
font-size: 16px;
}
#view-toggle:checked::after {
content: "Proposals";
}
#view-toggle::after {
content: "Directory";
letter-spacing: 1.5px;
text-rendering: geometricprecision;
text-transform: uppercase;
font-size: 16px;
}

#view-toggle {
appearance: none;
}
#view-toggle {
appearance: none;
}

label[for="view-toggle"] {
margin-left: 8px;
}

label[for="view-toggle"] {
margin-left: 8px;
#git-revision {
text-align: center;
text-transform: uppercase;
letter-spacing: 2px;
text-rendering: geometricPrecision;
vertical-align: middle;
opacity: 0.25;
font-size: 12px;
color: #fff;
}

#git-revision:hover {
opacity: 1;
}
}

0 comments on commit d613501

Please sign in to comment.