feat(changelog): changelog inside application
This commit is contained in:
26
src/app/changelog-page.js
Normal file
26
src/app/changelog-page.js
Normal 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>
|
||||
);
|
||||
}
|
||||
}
|
@ -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'});
|
||||
});
|
Reference in New Issue
Block a user