1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-11 17:42:48 +00:00

statistics tab for discord chat

This commit is contained in:
2018-04-10 21:51:45 -05:00
parent 27a42f1b99
commit 5fa0f1ac2e
22 changed files with 281 additions and 34 deletions

View File

@@ -1,9 +1,8 @@
import React from 'react';
import { NavLink } from 'react-router-dom';
import jwt_decode from 'jwt-decode';
import { StorageService } from '../../services';
import './Navbar.scss';
import { storage } from '../../storage';
let oauthUrl: string;
@@ -31,25 +30,24 @@ export class Navbar extends React.Component<Props, State> {
}
componentDidMount() {
const token = storage.getJWT();
const token = StorageService.getJWT();
if (token) {
const claims: any = jwt_decode(token!);
console.log(claims);
const email = claims['email'];
this.setState({ token, email });
}
}
private logout = () => {
localStorage.clear();
StorageService.clear();
window.location.href = '/';
};
render() {
return (
<div className="Navbar">
<div className="Navbar__header">Go Discord Bot</div>
<div className="Navbar__header">Cash</div>
<NavLink exact to="/" className="Navbar__item" activeClassName="Navbar__item--active">
Home
</NavLink>
@@ -62,6 +60,9 @@ export class Navbar extends React.Component<Props, State> {
<NavLink to="/clips" className="Navbar__item" activeClassName="Navbar__item--active">
Clips
</NavLink>
<NavLink to="/stats" className="Navbar__item" activeClassName="Navbar__item--active">
Stats
</NavLink>
{!this.state.token ? (
<a href={oauthUrl} className="Navbar__item">

View File

@@ -51,8 +51,8 @@ export class SoundList extends React.Component<Props, State> {
const { soundList, type } = this.props;
return (
<div className="Card">
<div className="Card__header" style={{ display: 'flex' }}>
<div className="card">
<div className="card__header" style={{ display: 'flex' }}>
<div>
<span>{type}</span>
<i className="fa fa fa-volume-up" aria-hidden="true" />