mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-23 19:31:33 +00:00
parent
e120c69a52
commit
dae66517aa
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
|
||||
.fusebox
|
||||
_site
|
||||
|
|
|
@ -11,6 +11,7 @@ const transformInferno = require('ts-transform-inferno').default;
|
|||
const transformClasscat = require('ts-transform-classcat').default;
|
||||
let fuse, app;
|
||||
let isProduction = false;
|
||||
var setVersion = require('./set_version.js').setVersion;
|
||||
|
||||
Sparky.task('config', _ => {
|
||||
fuse = new FuseBox({
|
||||
|
@ -41,15 +42,16 @@ Sparky.task('config', _ => {
|
|||
});
|
||||
app = fuse.bundle('app').instructions('>index.tsx');
|
||||
});
|
||||
Sparky.task('version', _ => setVersion());
|
||||
Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'));
|
||||
Sparky.task('env', _ => (isProduction = true));
|
||||
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();
|
||||
app.hmr().watch();
|
||||
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
|
||||
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() {
|
||||
if (this.props.data.updated) {
|
||||
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 {
|
||||
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 { repoUrl } from '../utils';
|
||||
import { UserService } from '../services';
|
||||
import { version } from '../version';
|
||||
|
||||
interface NavbarState {
|
||||
isLoggedIn: boolean;
|
||||
|
@ -40,7 +41,7 @@ export class Navbar extends Component<any, NavbarState> {
|
|||
navbar() {
|
||||
return (
|
||||
<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>
|
||||
Lemmy
|
||||
</a>
|
||||
|
|
Loading…
Reference in a new issue