1
0
mirror of https://github.com/hyperspacedev/hyperspace synced 2025-02-03 18:57:38 +01:00

Add 404 redirect, essentially

This commit is contained in:
Marquis Kurt 2019-04-21 16:14:03 -04:00
parent 55cc89a386
commit 8536dedf2c
2 changed files with 43 additions and 14 deletions

View File

@ -3,7 +3,7 @@ import {MuiThemeProvider, CssBaseline, withStyles } from '@material-ui/core';
import { setHyperspaceTheme, darkMode } from './utilities/themes';
import AppLayout from './components/AppLayout';
import {styles} from './App.styles';
import {Route} from 'react-router-dom';
import {Route, Switch} from 'react-router-dom';
import AboutPage from './pages/About';
import Settings from './pages/Settings';
import { getUserDefaultBool, getUserDefaultTheme } from './utilities/settings';
@ -18,6 +18,7 @@ import Composer from './pages/Compose';
import WelcomePage from './pages/Welcome';
import MessagesPage from './pages/Messages';
import RecommendationsPage from './pages/Recommendations';
import Missingno from './pages/Missingno';
import {withSnackbar} from 'notistack';
import {PrivateRoute} from './interfaces/overrides';
import { userLoggedIn } from './utilities/accounts';
@ -49,19 +50,22 @@ class App extends Component<any, any> {
<Route path="/welcome" component={WelcomePage}/>
<div>
{ userLoggedIn()? <AppLayout/>: null}
<PrivateRoute exact path="/" component={HomePage}/>
<PrivateRoute path="/home" component={HomePage}/>
<PrivateRoute path="/local" component={LocalPage}/>
<PrivateRoute path="/public" component={PublicPage}/>
<PrivateRoute path="/messages" component={MessagesPage}/>
<PrivateRoute path="/notifications" component={NotificationsPage}/>
<PrivateRoute path="/profile/:profileId" component={ProfilePage}/>
<PrivateRoute path="/conversation/:conversationId" component={Conversation}/>
<PrivateRoute path="/search" component={SearchPage}/>
<PrivateRoute path="/settings" component={Settings}/>
<PrivateRoute path="/about" component={AboutPage}/>
<PrivateRoute path="/compose" component={Composer}/>
<PrivateRoute path="/recommended" component={RecommendationsPage}/>
<Switch>
<PrivateRoute exact path="/" component={HomePage}/>
<PrivateRoute path="/home" component={HomePage}/>
<PrivateRoute path="/local" component={LocalPage}/>
<PrivateRoute path="/public" component={PublicPage}/>
<PrivateRoute path="/messages" component={MessagesPage}/>
<PrivateRoute path="/notifications" component={NotificationsPage}/>
<PrivateRoute path="/profile/:profileId" component={ProfilePage}/>
<PrivateRoute path="/conversation/:conversationId" component={Conversation}/>
<PrivateRoute path="/search" component={SearchPage}/>
<PrivateRoute path="/settings" component={Settings}/>
<PrivateRoute path="/about" component={AboutPage}/>
<PrivateRoute path="/compose" component={Composer}/>
<PrivateRoute path="/recommended" component={RecommendationsPage}/>
<PrivateRoute component={Missingno}/>
</Switch>
</div>
</MuiThemeProvider>

25
src/pages/Missingno.tsx Normal file
View File

@ -0,0 +1,25 @@
import React, {Component} from 'react';
import {withStyles, Typography} from '@material-ui/core';
import {styles} from './PageLayout.styles';
import {LinkableButton} from '../interfaces/overrides';
class Missingno extends Component<any, any> {
render() {
const {classes} = this.props;
return (
<div className={classes.pageLayoutConstraints}>
<div>
<Typography variant="h4" component="h1"><b>Uh oh!</b></Typography>
<Typography variant="h6" component="p">The part of Hyperspace you're looking for isn't here.</Typography>
<br/>
<LinkableButton to="/home" color="primary" variant="contained">
Go back to home timeline
</LinkableButton>
</div>
</div>
)
}
}
export default withStyles(styles)(Missingno);