Fix broken links

This commit is contained in:
John Lyon-Smith
2018-05-14 13:31:46 -07:00
parent 68f976ed7f
commit 5b4798b196
4 changed files with 90 additions and 82 deletions

View File

@@ -56,7 +56,7 @@ export class App extends Component {
<ProtectedRoute exact path="/app/profile" component={Profile} />
<ProtectedRoute exact admin path="/app/home" component={Home} />
<ProtectedRoute exact admin path="/app/teams" component={Teams} />
<ProtectedRoute exact admin path="/system" component={System} />
<ProtectedRoute exact admin path="/app/system" component={System} />
<ProtectedRoute exact admin path="/app/users" component={Users} />
<DefaultRoute redirect="/app/home" />
</Switch>

View File

@@ -19,7 +19,7 @@ export class Home extends Component {
<PanelButton
icon="users"
text="Users"
onClick={() => this.props.history.push("/users")}
onClick={() => this.props.history.push("/app/users")}
/>
</Row.Item>
<Row.Item width={sizeInfo.panelButtonSpacing} />
@@ -27,7 +27,7 @@ export class Home extends Component {
<PanelButton
icon="teams"
text="Teams"
onClick={() => this.props.history.push("/teams")}
onClick={() => this.props.history.push("/app/teams")}
/>
</Row.Item>
<Row.Item width={sizeInfo.panelButtonSpacing} />
@@ -35,7 +35,7 @@ export class Home extends Component {
<PanelButton
icon="system"
text="System"
onClick={() => this.props.history.push("/system")}
onClick={() => this.props.history.push("/app/system")}
/>
</Row.Item>
<Row.Item grow />

View File

@@ -1,11 +1,16 @@
import React, { Fragment, Component } from 'react'
import { ProfileForm } from './ProfileForm'
import { api } from 'src/API'
import { WaitModal, MessageModal, ChangePasswordModal, ChangeEmailModal } from '../Modal'
import { Column, Row } from 'ui'
import { sizeInfo } from 'ui/style'
import PropTypes from 'prop-types'
import autobind from 'autobind-decorator'
import React, { Fragment, Component } from "react"
import { ProfileForm } from "./ProfileForm"
import { api } from "src/API"
import {
WaitModal,
MessageModal,
ChangePasswordModal,
ChangeEmailModal,
} from "../Modal"
import { Column, Row } from "ui"
import { sizeInfo } from "ui/style"
import PropTypes from "prop-types"
import autobind from "autobind-decorator"
export class Profile extends Component {
static propTypes = {
@@ -23,36 +28,31 @@ export class Profile extends Component {
changeEmailModal: null,
progressModal: null,
uploadPercent: 0,
user
user,
}
}
componentDidMount() {
this.props.changeTitle('Profile')
}
componentWillUnmount() {
this.props.changeTitle('')
}
@autobind
handleSaved(user) {
this.setState({ waitModal: { message: 'Updating Profile' } })
api.updateUser(user).then((updatedUser) => {
this.setState({
waitModal: null,
user: updatedUser
this.setState({ waitModal: { message: "Updating Profile" } })
api
.updateUser(user)
.then((updatedUser) => {
this.setState({
waitModal: null,
user: updatedUser,
})
})
}).catch((error) => {
this.setState({
waitModal: null,
messageModal: {
icon: 'hand',
message: 'Unable to save the profile changes.',
detail: error.message,
},
.catch((error) => {
this.setState({
waitModal: null,
messageModal: {
icon: "hand",
message: "Unable to save the profile changes.",
detail: error.message,
},
})
})
})
}
@autobind
@@ -71,20 +71,23 @@ export class Profile extends Component {
if (passwords) {
this.setState({
waitModal: { message: 'Changing Password' }
waitModal: { message: "Changing Password" },
})
api.changePassword(passwords).then(() => {
this.setState({ waitModal: false })
}).catch((error) => {
this.setState({
waitModal: false,
messageModal: {
icon: 'hand',
message: 'Unable to change password',
detail: error.message,
}
api
.changePassword(passwords)
.then(() => {
this.setState({ waitModal: false })
})
.catch((error) => {
this.setState({
waitModal: false,
messageModal: {
icon: "hand",
message: "Unable to change password",
detail: error.message,
},
})
})
})
}
}
@@ -100,30 +103,38 @@ export class Profile extends Component {
return
}
this.setState({
waitModal: { message: 'Requesting Email Change...' }
waitModal: { message: "Requesting Email Change..." },
})
api.sendConfirmEmail({ newEmail }).then(() => {
this.setState({
waitModal: null,
messageModal: {
icon: 'thumb',
message: `An email has been sent to '${newEmail}' with a link that you need to click on to finish changing your email.`
}
api
.sendConfirmEmail({ newEmail })
.then(() => {
this.setState({
waitModal: null,
messageModal: {
icon: "thumb",
message: `An email has been sent to '${newEmail}' with a link that you need to click on to finish changing your email.`,
},
})
})
}).catch((error) => {
this.setState({
waitModal: null,
messageModal: {
icon: 'hand',
message: 'Unable to request email change.',
detail: error.message
}
.catch((error) => {
this.setState({
waitModal: null,
messageModal: {
icon: "hand",
message: "Unable to request email change.",
detail: error.message,
},
})
})
})
}
render() {
const { messageModal, waitModal, changeEmailModal, changePasswordModal } = this.state
const {
messageModal,
waitModal,
changeEmailModal,
changePasswordModal,
} = this.state
return (
<Fragment>
@@ -138,7 +149,8 @@ export class Profile extends Component {
onSelectImage={this.handleSelectImage}
onChangePassword={this.handleChangePassword}
onChangeEmail={this.handleChangeEmail}
userImageUrl={this.state.userImageUrl} />
userImageUrl={this.state.userImageUrl}
/>
</Row.Item>
<Row.Item grow />
</Row>
@@ -146,23 +158,27 @@ export class Profile extends Component {
<Column.Item>
<MessageModal
open={!!messageModal}
icon={messageModal ? messageModal.icon : ''}
title={messageModal ? messageModal.title : ''}
message={messageModal ? messageModal.message : ''}
onDismiss={this.handleMessageModalDismiss} />
icon={messageModal ? messageModal.icon : ""}
title={messageModal ? messageModal.title : ""}
message={messageModal ? messageModal.message : ""}
onDismiss={this.handleMessageModalDismiss}
/>
<ChangeEmailModal
open={!!changeEmailModal}
oldEmail={changeEmailModal ? changeEmailModal.oldEmail : ''}
onDismiss={this.handleChangeEmailDismiss} />
oldEmail={changeEmailModal ? changeEmailModal.oldEmail : ""}
onDismiss={this.handleChangeEmailDismiss}
/>
<WaitModal
active={!!waitModal}
message={waitModal ? waitModal.message : ''} />
message={waitModal ? waitModal.message : ""}
/>
<ChangePasswordModal
open={!!changePasswordModal}
onDismiss={this.handleChangePasswordDismiss} />
onDismiss={this.handleChangePasswordDismiss}
/>
</Column.Item>
<Column.Item grow />
</Fragment>

View File

@@ -21,14 +21,6 @@ export class System extends Component {
}
}
componentDidMount(props) {
this.props.changeTitle("System")
}
componentWillUnmount() {
this.props.changeTitle("")
}
@autobind
handleDeleteActivities() {
this.setState({