wip Pup 1.0.0
This commit is contained in:
commit
cdc15f019d
48 changed files with 1100 additions and 0 deletions
61
imports/ui/layouts/App/App.js
Normal file
61
imports/ui/layouts/App/App.js
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
|
||||
import { Grid } from 'react-bootstrap';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { createContainer } from 'meteor/react-meteor-data';
|
||||
import { Roles } from 'meteor/alanning:roles';
|
||||
import Navigation from '../../components/Navigation/Navigation';
|
||||
import Authenticated from '../../components/Authenticated/Authenticated';
|
||||
import Public from '../../components/Public/Public';
|
||||
import Index from '../../pages/Index/Index';
|
||||
import Documents from '../../pages/Documents/Documents';
|
||||
import NewDocument from '../../pages/NewDocument/NewDocument';
|
||||
import ViewDocument from '../../pages/ViewDocument/ViewDocument';
|
||||
import EditDocument from '../../pages/EditDocument/EditDocument';
|
||||
import Signup from '../../pages/Signup/Signup';
|
||||
import Login from '../../pages/Login/Login';
|
||||
import RecoverPassword from '../../pages/RecoverPassword/RecoverPassword';
|
||||
import ResetPassword from '../../pages/ResetPassword/ResetPassword';
|
||||
import NotFound from '../../pages/NotFound/NotFound';
|
||||
|
||||
const App = props => (
|
||||
<Router>
|
||||
{!props.loading ? <div className="App">
|
||||
<Navigation {...props} />
|
||||
<Grid>
|
||||
<Switch>
|
||||
<Route exact name="index" path="/" component={Index} />
|
||||
<Authenticated exact path="/documents" component={Documents} {...props} />
|
||||
<Authenticated exact path="/documents/new" component={NewDocument} {...props} />
|
||||
<Authenticated exact path="/documents/:_id" component={ViewDocument} {...props} />
|
||||
<Authenticated exact path="/documents/:_id/edit" component={EditDocument} {...props} />
|
||||
<Public path="/signup" component={Signup} {...props} />
|
||||
<Public path="/login" component={Login} {...props} />
|
||||
<Route name="recover-password" path="/recover-password" component={RecoverPassword} />
|
||||
<Route name="reset-password" path="/reset-password/:token" component={ResetPassword} />
|
||||
<Route component={NotFound} />
|
||||
</Switch>
|
||||
</Grid>
|
||||
</div> : ''}
|
||||
</Router>
|
||||
);
|
||||
|
||||
App.propTypes = {
|
||||
loading: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
export default createContainer(() => {
|
||||
const loggingIn = Meteor.loggingIn();
|
||||
const user = Meteor.user();
|
||||
const userId = Meteor.userId();
|
||||
const loading = !Roles.subscription.ready();
|
||||
|
||||
return {
|
||||
loading,
|
||||
loggingIn,
|
||||
authenticated: !loggingIn && !!userId,
|
||||
name: user && user.profile ? `${user.profile.name.first} ${user.profile.name.last}` : '',
|
||||
roles: !loading && Roles.getRolesForUser(userId),
|
||||
};
|
||||
}, App);
|
||||
Loading…
Add table
Add a link
Reference in a new issue