diff --git a/client/app/app.tsx b/client/app/app.tsx index 657f933..7ca4ff1 100644 --- a/client/app/app.tsx +++ b/client/app/app.tsx @@ -2,7 +2,7 @@ import { Provider } from 'mobx-react'; import React from 'react'; import ReactDOM from 'react-dom'; import { BrowserRouter, Route, Switch } from 'react-router-dom'; -import { Admin, Clips, Downloader, NotFound, Oauth, Soundboard, Stats, VideoArchive } from './pages'; +import { Admin, Clips, Downloader, NotFound, Oauth, Soundboard, Stats, UploadHistory, VideoArchive } from './pages'; import './scss/index.scss'; import { rootStoreInstance } from './stores'; import { Wrapper } from './wrapper'; @@ -14,6 +14,7 @@ const App: any = (): any => { + diff --git a/client/app/components/index.ts b/client/app/components/index.ts index 82ef969..732c2bb 100644 --- a/client/app/components/index.ts +++ b/client/app/components/index.ts @@ -2,5 +2,4 @@ export * from './embedded-youtube/embedded-youtube'; export * from './header/header'; export * from './navbar/navbar'; export * from './sound-list/sound-list'; -export * from './upload-history/upload-history'; export * from './uploader/uploader'; diff --git a/client/app/components/navbar/navbar.tsx b/client/app/components/navbar/navbar.tsx index 745baeb..6871ec8 100644 --- a/client/app/components/navbar/navbar.tsx +++ b/client/app/components/navbar/navbar.tsx @@ -1,12 +1,11 @@ import React from 'react'; import { NavLink } from 'react-router-dom'; -import { IClaims, Permissions } from '../../model'; import { OauthService, StorageService } from '../../services'; +import { AppStore } from '../../stores'; import './navbar.scss'; interface Props { - claims?: IClaims; - open: boolean; + appStore: AppStore; onNavClick: () => void; } @@ -37,7 +36,7 @@ export class Navbar extends React.Component { }; renderLoginButton() { - const { claims } = this.props; + const { claims } = this.props.appStore; if (!this.state.oauthUrl) { return null; @@ -69,19 +68,17 @@ export class Navbar extends React.Component { }; render() { - const { claims, open } = this.props; - const openClass = open ? 'navbar--open' : ''; + const { claims, navbarOpen, hasModPermissions, hasAdminPermissions } = this.props.appStore; + const openClass = navbarOpen ? 'navbar--open' : ''; return (
{this.renderNavLink('Soundboard', '/', { exact: true })} + {hasModPermissions() && this.renderNavLink('Upload History', '/upload-history')} {this.renderNavLink('Video Archive', '/video-archive')} {this.renderNavLink('Youtube Downloader', '/downloader')} {this.renderNavLink('Clips', '/clips')} {this.renderNavLink('Stats', '/stats')} - {claims && - claims.permissions && - claims.permissions === Permissions.Admin && - this.renderNavLink('Admin', '/admin')} + {hasAdminPermissions() && this.renderNavLink('Admin', '/admin')} {this.renderLoginButton()} {claims && claims.email &&
{claims.email}
} diff --git a/client/app/components/sound-list/sound-list.tsx b/client/app/components/sound-list/sound-list.tsx index e1ca27d..247a282 100644 --- a/client/app/components/sound-list/sound-list.tsx +++ b/client/app/components/sound-list/sound-list.tsx @@ -5,6 +5,7 @@ import './sound-list.scss'; interface Props { soundList: SoundType[]; type: 'sounds' | 'clips'; + title: string; onPlayDiscord?: (sound: SoundType) => void; showDiscordPlay?: boolean; } @@ -47,13 +48,13 @@ export class SoundList extends React.Component { } render() { - const { showDiscordPlay, soundList, type } = this.props; + const { showDiscordPlay, soundList, title, type } = this.props; return (
- {type} + {title}