mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-16 09:24:00 +00:00
parent
4cfe970089
commit
7fa6631a13
5 changed files with 18 additions and 5 deletions
1
ui/.gitignore
vendored
1
ui/.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
|
src/version.ts
|
||||||
dist
|
dist
|
||||||
.fusebox
|
.fusebox
|
||||||
_site
|
_site
|
||||||
|
|
|
@ -11,6 +11,7 @@ const transformInferno = require('ts-transform-inferno').default;
|
||||||
const transformClasscat = require('ts-transform-classcat').default;
|
const transformClasscat = require('ts-transform-classcat').default;
|
||||||
let fuse, app;
|
let fuse, app;
|
||||||
let isProduction = false;
|
let isProduction = false;
|
||||||
|
var setVersion = require('./set_version.js').setVersion;
|
||||||
|
|
||||||
Sparky.task('config', _ => {
|
Sparky.task('config', _ => {
|
||||||
fuse = new FuseBox({
|
fuse = new FuseBox({
|
||||||
|
@ -41,15 +42,16 @@ Sparky.task('config', _ => {
|
||||||
});
|
});
|
||||||
app = fuse.bundle('app').instructions('>index.tsx');
|
app = fuse.bundle('app').instructions('>index.tsx');
|
||||||
});
|
});
|
||||||
|
Sparky.task('version', _ => setVersion());
|
||||||
Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'));
|
Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'));
|
||||||
Sparky.task('env', _ => (isProduction = true));
|
Sparky.task('env', _ => (isProduction = true));
|
||||||
Sparky.task('copy-assets', () => Sparky.src('assets/*.svg').dest('dist/'));
|
Sparky.task('copy-assets', () => Sparky.src('assets/*.svg').dest('dist/'));
|
||||||
Sparky.task('dev', ['clean', 'config', 'copy-assets'], _ => {
|
Sparky.task('dev', ['clean', 'config', 'copy-assets', 'version'], _ => {
|
||||||
fuse.dev();
|
fuse.dev();
|
||||||
app.hmr().watch();
|
app.hmr().watch();
|
||||||
return fuse.run();
|
return fuse.run();
|
||||||
});
|
});
|
||||||
Sparky.task('prod', ['clean', 'env', 'config', 'copy-assets'], _ => {
|
Sparky.task('prod', ['clean', 'env', 'config', 'copy-assets', 'version'], _ => {
|
||||||
// fuse.dev({ reload: true }); // remove after demo
|
// fuse.dev({ reload: true }); // remove after demo
|
||||||
return fuse.run();
|
return fuse.run();
|
||||||
});
|
});
|
||||||
|
|
9
ui/set_version.js
Normal file
9
ui/set_version.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
exports.setVersion = function() {
|
||||||
|
let revision = require('child_process')
|
||||||
|
.execSync('git describe --tags --long')
|
||||||
|
.toString().trim();
|
||||||
|
let line = `export let version: string = "${revision}";`;
|
||||||
|
fs.writeFileSync("./src/version.ts", line);
|
||||||
|
}
|
|
@ -17,11 +17,11 @@ export class MomentTime extends Component<MomentTimeProps, any> {
|
||||||
render() {
|
render() {
|
||||||
if (this.props.data.updated) {
|
if (this.props.data.updated) {
|
||||||
return (
|
return (
|
||||||
<span className="font-italics">modified {moment.utc(this.props.data.updated).fromNow()}</span>
|
<span title={this.props.data.updated} className="font-italics">modified {moment.utc(this.props.data.updated).fromNow()}</span>
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<span>{moment.utc(this.props.data.published).fromNow()}</span>
|
<span title={this.props.data.published}>{moment.utc(this.props.data.published).fromNow()}</span>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { Component, linkEvent } from 'inferno';
|
||||||
import { Link } from 'inferno-router';
|
import { Link } from 'inferno-router';
|
||||||
import { repoUrl } from '../utils';
|
import { repoUrl } from '../utils';
|
||||||
import { UserService } from '../services';
|
import { UserService } from '../services';
|
||||||
|
import { version } from '../version';
|
||||||
|
|
||||||
interface NavbarState {
|
interface NavbarState {
|
||||||
isLoggedIn: boolean;
|
isLoggedIn: boolean;
|
||||||
|
@ -40,7 +41,7 @@ export class Navbar extends Component<any, NavbarState> {
|
||||||
navbar() {
|
navbar() {
|
||||||
return (
|
return (
|
||||||
<nav class="navbar navbar-expand-sm navbar-light bg-light p-0 px-3 shadow">
|
<nav class="navbar navbar-expand-sm navbar-light bg-light p-0 px-3 shadow">
|
||||||
<a class="navbar-brand" href="#">
|
<a title={version} class="navbar-brand" href="#">
|
||||||
<svg class="icon mr-2"><use xlinkHref="#icon-mouse"></use></svg>
|
<svg class="icon mr-2"><use xlinkHref="#icon-mouse"></use></svg>
|
||||||
Lemmy
|
Lemmy
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in a new issue