Update global footer (#354)

This commit is contained in:
sua yoo 2022-11-15 14:15:04 -08:00 committed by GitHub
parent 6833c9d676
commit 40054d1501
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 10 deletions

View File

@ -15,7 +15,9 @@
></script> ></script>
</head> </head>
<body class="text-base"> <body class="text-base">
<browsertrix-app></browsertrix-app> <browsertrix-app
version="v<%= version %>-<%= commitHash %>"
></browsertrix-app>
<script> <script>
const isDev = "<%= environment %>" === "development"; const isDev = "<%= environment %>" === "development";
@ -24,7 +26,7 @@
if (isDev && dsn) { if (isDev && dsn) {
Sentry.init({ Sentry.init({
dsn: dsn, dsn: dsn,
release: "<%= commit_hash %>", release: "<%= gitBranch %> (<%= commitHash %>) v<%= version %>",
environment: "<%= environment %>", environment: "<%= environment %>",
debug: isDev, debug: isDev,
autoSessionTracking: false, // Turn off unsupported page/session tracking autoSessionTracking: false, // Turn off unsupported page/session tracking

View File

@ -1,6 +1,6 @@
import type { TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { render } from "lit"; import { render } from "lit";
import { state, query } from "lit/decorators.js"; import { property, state, query } from "lit/decorators.js";
import { ifDefined } from "lit/directives/if-defined.js"; import { ifDefined } from "lit/directives/if-defined.js";
import { msg, localized } from "@lit/localize"; import { msg, localized } from "@lit/localize";
import type { SlDialog } from "@shoelace-style/shoelace"; import type { SlDialog } from "@shoelace-style/shoelace";
@ -40,6 +40,9 @@ type DialogContent = {
*/ */
@localized() @localized()
export class App extends LiteElement { export class App extends LiteElement {
@property({ type: String })
version?: string;
private router: APIRouter = new APIRouter(ROUTES); private router: APIRouter = new APIRouter(ROUTES);
authService: AuthService = new AuthService(); authService: AuthService = new AuthService();
@ -320,17 +323,31 @@ export class App extends LiteElement {
renderFooter() { renderFooter() {
return html` return html`
<footer <footer
class="w-full max-w-screen-lg mx-auto p-1 md:p-3 box-border flex justify-between" class="w-full max-w-screen-lg mx-auto p-1 md:p-3 box-border flex justify-end"
> >
<div> <div>
<sl-icon-button <a
name="github" class="text-neutral-400"
href="https://github.com/webrecorder/browsertrix-cloud" href="https://github.com/webrecorder/browsertrix-cloud"
target="_blank" target="_blank"
></sl-icon-button> rel="noopener"
>
${this.version
? html`
<span class="inline-block align-middle text-mono text-xs">
${this.version}
</span>
`
: ""}
<sl-icon
name="github"
class="inline-block align-middle ml-1"
></sl-icon>
</a>
</div> </div>
<div> <div>
<btrix-locale-picker></btrix-locale-picker> <!-- TODO re-enable when translations are added -->
<!-- <btrix-locale-picker></btrix-locale-picker> -->
</div> </div>
</footer> </footer>
`; `;

View File

@ -5,6 +5,7 @@ const ESLintPlugin = require("eslint-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin"); const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin"); const CopyPlugin = require("copy-webpack-plugin");
const childProcess = require("child_process"); const childProcess = require("child_process");
const packageJSON = require("./package.json");
const isDevServer = process.env.WEBPACK_SERVE; const isDevServer = process.env.WEBPACK_SERVE;
@ -24,7 +25,7 @@ const WEBSOCKET_HOST =
? new URL(process.env.API_BASE_URL).host ? new URL(process.env.API_BASE_URL).host
: process.env.WEBSOCKET_HOST || ""; : process.env.WEBSOCKET_HOST || "";
// Get git info to use as Glitchtip release version // Get git info for release version info
const execCommand = (cmd, defValue) => { const execCommand = (cmd, defValue) => {
try { try {
@ -101,7 +102,9 @@ module.exports = {
rwp_base_url: RWP_BASE_URL, rwp_base_url: RWP_BASE_URL,
glitchtip_dsn: process.env.GLITCHTIP_DSN || "", glitchtip_dsn: process.env.GLITCHTIP_DSN || "",
environment: isDevServer ? "development" : "production", environment: isDevServer ? "development" : "production",
commit_hash: `${gitBranch} (${commitHash})`, version: packageJSON.version,
gitBranch,
commitHash,
}, },
// Need to block during local development for HMR: // Need to block during local development for HMR:
inject: isDevServer ? "head" : true, inject: isDevServer ? "head" : true,