feat: show the build commit as a faint corner mark
Declares ARG NEXT_PUBLIC_APP_COMMIT, supplied by Ship, and renders it as a nearly transparent, click-through stamp. Renders nothing when unset. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9ccfcd1714
commit
dd6e90bed3
3 changed files with 39 additions and 0 deletions
|
|
@ -53,6 +53,11 @@ COPY . .
|
|||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# The commit being built, supplied by Ship. Declared late so the layers above
|
||||
# stay cached; it is empty for builds that do not pass it.
|
||||
ARG NEXT_PUBLIC_APP_COMMIT
|
||||
ENV NEXT_PUBLIC_APP_COMMIT=${NEXT_PUBLIC_APP_COMMIT}
|
||||
|
||||
# Build the standalone server. This produces `.next/standalone/` which
|
||||
# already contains the trimmed `node_modules` needed at runtime plus a
|
||||
# ready-to-run `server.js`.
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import "leaflet.markercluster/dist/MarkerCluster.Default.css";
|
|||
import { AuthProvider } from "@/hooks/use-auth";
|
||||
import { ThemeProvider } from "@/hooks/use-theme";
|
||||
import { PwaRegister } from "@/components/pwa-register";
|
||||
import { BuildStamp } from "@/components/build-stamp";
|
||||
|
||||
// Every deployment uses named PocketBase sessions.
|
||||
export const dynamic = "force-dynamic";
|
||||
|
|
@ -102,6 +103,7 @@ export default function RootLayout({
|
|||
<AuthProvider mode="users">
|
||||
<PwaRegister />
|
||||
{children}
|
||||
<BuildStamp />
|
||||
</AuthProvider>
|
||||
</ThemeProvider>
|
||||
</body>
|
||||
|
|
|
|||
32
src/components/build-stamp.tsx
Normal file
32
src/components/build-stamp.tsx
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* The commit this build came from, as a faint mark in the corner.
|
||||
*
|
||||
* `NEXT_PUBLIC_APP_COMMIT` is set by Ship (the Forgejo Desktop app) when it
|
||||
* builds the image. A build made any other way has no value, so nothing is
|
||||
* rendered. It never takes a click and is nearly transparent.
|
||||
*/
|
||||
export function BuildStamp() {
|
||||
const commit = process.env.NEXT_PUBLIC_APP_COMMIT;
|
||||
if (!commit) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
aria-hidden="true"
|
||||
title={`Build ${commit}`}
|
||||
style={{
|
||||
position: "fixed",
|
||||
right: 6,
|
||||
bottom: "calc(env(safe-area-inset-bottom, 0px) + 3px)",
|
||||
zIndex: 2147483647,
|
||||
fontSize: 9,
|
||||
lineHeight: 1,
|
||||
fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
|
||||
opacity: 0.3,
|
||||
pointerEvents: "none",
|
||||
userSelect: "none",
|
||||
}}
|
||||
>
|
||||
{commit}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
Reference in a new issue