feat(changelog): changelog inside application

This commit is contained in:
Alexey Kasyanchuk
2018-02-06 00:41:23 +03:00
parent 74def9f763
commit 9bac53f559
6 changed files with 324 additions and 12 deletions

26
src/app/changelog-page.js Normal file
View File

@ -0,0 +1,26 @@
import React from 'react';
import Page from './page';
import ReactMarkdown from 'react-markdown'
import fs from 'fs'
export default class ChangeLog extends Page {
constructor(props) {
super(props)
this.setTitle('Changelog');
let changelogPath = 'CHANGELOG.md'
if(!fs.existsSync(changelogPath))
changelogPath = 'resources/CHANGELOG.md'
this.changelog = fs.readFileSync(changelogPath)
if(!this.changelog)
throw new Error('no changelog file')
}
render() {
return (
<div className='pad0-75'>
<ReactMarkdown skipHtml={true} source={this.changelog} />
</div>
);
}
}

View File

@ -6,6 +6,7 @@ import TorrentPage from './torrent-page.js'
import DMCAPage from './dmca-page.js'
import AdminPage from './admin-page.js'
import TopPage from './top-page.js'
import ChangelogPage from './changelog-page.js'
let routers = {}
const router = (page, callback) => {
@ -81,4 +82,11 @@ router('/top', () => {
//singleton
let pie = new PagesPie;
pie.open(TopPage, {replace: 'all'});
});
router('/changelog', () => {
//singleton
let pie = new PagesPie;
console.log('changelog')
pie.open(ChangelogPage, {replace: 'all'});
});