mirror of
https://github.com/mgerb/go-discord-bot
synced 2026-01-14 10:42:48 +00:00
add upload history to stats UI
This commit is contained in:
11
client/app/pages/admin/admin.tsx
Normal file
11
client/app/pages/admin/admin.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
|
||||
interface IProps {}
|
||||
|
||||
interface IState {}
|
||||
|
||||
export class Admin extends React.Component<IProps, IState> {
|
||||
render() {
|
||||
return <div className="content">TODO:</div>;
|
||||
}
|
||||
}
|
||||
1
client/app/pages/admin/index.ts
Normal file
1
client/app/pages/admin/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './admin';
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './admin';
|
||||
export * from './clips/clips';
|
||||
export * from './downloader/downloader';
|
||||
export * from './not-found/not-found';
|
||||
|
||||
@@ -1,30 +1,45 @@
|
||||
import { chain, map } from 'lodash';
|
||||
import { inject, observer } from 'mobx-react';
|
||||
import React, { Component } from 'react';
|
||||
import { HorizontalBar } from 'react-chartjs-2';
|
||||
import { chain, map } from 'lodash';
|
||||
import { axios } from '../../services';
|
||||
import { UploadHistory } from '../../components';
|
||||
import { ISound } from '../../model';
|
||||
import { axios, SoundService } from '../../services';
|
||||
import { AppStore } from '../../stores';
|
||||
import './stats.scss';
|
||||
|
||||
interface IProps {
|
||||
appStore: AppStore;
|
||||
}
|
||||
|
||||
interface IState {
|
||||
data: {
|
||||
username: string;
|
||||
count: number;
|
||||
}[];
|
||||
sounds: ISound[];
|
||||
}
|
||||
|
||||
/**
|
||||
* a page to show discord chat statistics
|
||||
* currently keeps track of number messages that contain external links
|
||||
*/
|
||||
export class Stats extends Component<any, IState> {
|
||||
@inject('appStore')
|
||||
@observer
|
||||
export class Stats extends Component<IProps, IState> {
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
this.state = {
|
||||
data: [],
|
||||
sounds: [],
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getdata();
|
||||
SoundService.getSounds().then(sounds => {
|
||||
this.setState({ sounds });
|
||||
});
|
||||
}
|
||||
|
||||
async getdata() {
|
||||
@@ -59,12 +74,15 @@ export class Stats extends Component<any, IState> {
|
||||
},
|
||||
};
|
||||
|
||||
const { claims } = this.props.appStore;
|
||||
|
||||
return (
|
||||
<div className="content">
|
||||
<div className="card" style={{ maxWidth: '1000px' }}>
|
||||
<div className="card">
|
||||
<div className="card__header">Posts containing links</div>
|
||||
<HorizontalBar data={data} />
|
||||
</div>
|
||||
{claims && <UploadHistory sounds={this.state.sounds} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user