From 5fa0f1ac2e4c8c643e6e1233bc1ff8889a2bf9ce Mon Sep 17 00:00:00 2001 From: Mitchell Date: Tue, 10 Apr 2018 21:51:45 -0500 Subject: [PATCH] statistics tab for discord chat --- client/app/app.tsx | 2 + client/app/components/Navbar/Navbar.tsx | 13 ++-- client/app/components/SoundList/SoundList.tsx | 4 +- client/app/pages/Clips/Clips.tsx | 2 +- client/app/pages/Downloader/Downloader.tsx | 2 +- client/app/pages/Home/Home.scss | 3 - client/app/pages/Home/Home.tsx | 6 +- client/app/pages/Pubg/Pubg.tsx | 2 +- client/app/pages/Soundboard/Soundboard.tsx | 7 +- client/app/pages/oauth/oauth.tsx | 5 +- client/app/pages/stats/stats.scss | 3 + client/app/pages/stats/stats.tsx | 70 ++++++++++++++++++ client/app/scss/style.scss | 8 +- client/app/services/axios.service.ts | 19 +++++ client/app/services/index.ts | 2 + .../storage.service.ts} | 7 +- client/package-lock.json | 60 +++++++++++++++ client/package.json | 4 + server/logger/{logger.go => model.go} | 0 server/logger/operations.go | 73 +++++++++++++++++++ server/webserver/handlers/logger.go | 20 +++-- server/webserver/server.go | 3 +- 22 files changed, 281 insertions(+), 34 deletions(-) create mode 100644 client/app/pages/stats/stats.scss create mode 100644 client/app/pages/stats/stats.tsx create mode 100644 client/app/services/axios.service.ts create mode 100644 client/app/services/index.ts rename client/app/{storage.ts => services/storage.service.ts} (66%) rename server/logger/{logger.go => model.go} (100%) create mode 100644 server/logger/operations.go diff --git a/client/app/app.tsx b/client/app/app.tsx index 24c74a6..d044ac4 100644 --- a/client/app/app.tsx +++ b/client/app/app.tsx @@ -9,6 +9,7 @@ import { NotFound } from './pages/NotFound/NotFound'; import { Downloader } from './pages/Downloader/Downloader'; import { Clips } from './pages/Clips'; import { Oauth } from './pages/oauth/oauth'; +import { Stats } from './pages/stats/stats'; import 'babel-polyfill'; const App: any = (): any => { @@ -21,6 +22,7 @@ const App: any = (): any => { + diff --git a/client/app/components/Navbar/Navbar.tsx b/client/app/components/Navbar/Navbar.tsx index ab629fd..0aa6d70 100644 --- a/client/app/components/Navbar/Navbar.tsx +++ b/client/app/components/Navbar/Navbar.tsx @@ -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 { } 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 (
-
Go Discord Bot
+
Cash
Home @@ -62,6 +60,9 @@ export class Navbar extends React.Component { Clips + + Stats + {!this.state.token ? ( diff --git a/client/app/components/SoundList/SoundList.tsx b/client/app/components/SoundList/SoundList.tsx index 37ce7db..ea9a922 100644 --- a/client/app/components/SoundList/SoundList.tsx +++ b/client/app/components/SoundList/SoundList.tsx @@ -51,8 +51,8 @@ export class SoundList extends React.Component { const { soundList, type } = this.props; return ( -
-
+
+
{type}