Add UI version to UI via docker. Fixes #263

This commit is contained in:
Dessalines 2021-04-25 15:48:33 -04:00
parent 440d0c9b77
commit c9dd60027f
5 changed files with 17 additions and 3 deletions

View file

@ -16,6 +16,10 @@ COPY generate_translations.js \
COPY lemmy-translations lemmy-translations COPY lemmy-translations lemmy-translations
COPY src src COPY src src
COPY .git .git
# Set UI version
RUN echo "export const VERSION = '$(git describe --tag)';" > "src/shared/version.ts"
RUN yarn RUN yarn
RUN yarn build:prod RUN yarn build:prod

View file

@ -3,6 +3,7 @@ import { Link } from "inferno-router";
import { i18n } from "../i18next"; import { i18n } from "../i18next";
import { repoUrl, joinLemmyUrl, docsUrl } from "../utils"; import { repoUrl, joinLemmyUrl, docsUrl } from "../utils";
import { GetSiteResponse } from "lemmy-js-client"; import { GetSiteResponse } from "lemmy-js-client";
import { VERSION } from "../version";
interface FooterProps { interface FooterProps {
site: GetSiteResponse; site: GetSiteResponse;
@ -19,7 +20,10 @@ export class Footer extends Component<FooterProps, any> {
<div className="navbar-collapse"> <div className="navbar-collapse">
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
<li class="nav-item"> <li class="nav-item">
<span class="navbar-text">{this.props.site.version}</span> <span class="nav-link">UI: {VERSION}</span>
</li>
<li class="nav-item">
<span class="nav-link">BE: {this.props.site.version}</span>
</li> </li>
<li className="nav-item"> <li className="nav-item">
<Link className="nav-link" to="/modlog"> <Link className="nav-link" to="/modlog">

View file

@ -263,7 +263,9 @@ export class Main extends Component<any, MainState> {
get documentTitle(): string { get documentTitle(): string {
return `${ return `${
this.state.siteRes.site_view this.state.siteRes.site_view
? this.state.siteRes.site_view.site.name ? this.state.siteRes.site_view.site.description
? `${this.state.siteRes.site_view.site.name} - ${this.state.siteRes.site_view.site.description}`
: this.state.siteRes.site_view.site.name
: "Lemmy" : "Lemmy"
}`; }`;
} }

View file

@ -181,7 +181,10 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
<div class="container"> <div class="container">
{this.props.site_res.site_view && ( {this.props.site_res.site_view && (
<Link <Link
title={this.props.site_res.version} title={
this.props.site_res.site_view.site.description ||
this.props.site_res.site_view.site.name
}
className="d-flex align-items-center navbar-brand mr-md-3" className="d-flex align-items-center navbar-brand mr-md-3"
to="/" to="/"
> >

1
src/shared/version.ts Normal file
View file

@ -0,0 +1 @@
export const VERSION = "unknown version";