diff --git a/mobile/src/config.js b/mobile/src/config.js index 979d475..3cfb69a 100644 --- a/mobile/src/config.js +++ b/mobile/src/config.js @@ -15,8 +15,8 @@ export const config = { homeRegionDelta: 0.005, geocodeDelayMilliseconds: 500, - defaultUser: "john@lyon-smith.org", - // defaultUser: "", + //defaultUser: "john@lyon-smith.org", + defaultUser: "", // This region is downtown Toronto initialRegion: { @@ -27,12 +27,12 @@ export const config = { }, // This region is Bainbridge Island - initialRegion: { - latitude: 47.629536, - longitude: -122.524162, - latitudeDelta: 0.0922, - longitudeDelta: 0.0421, - }, + // initialRegion: { + // latitude: 47.629536, + // longitude: -122.524162, + // latitudeDelta: 0.0922, + // longitudeDelta: 0.0421, + // }, // alwaysShowWorkItemInAR: true, } diff --git a/website/src/App.js b/website/src/App.js index 1f8c9f7..f51976e 100644 --- a/website/src/App.js +++ b/website/src/App.js @@ -13,7 +13,6 @@ import { Home } from "./Home" import { Profile } from "./Profile" import { Users } from "./Users" import { Teams } from "./Teams" -import { System } from "./System" import { Header, Column, Footer } from "ui" import { BrowserRouter, Route, Switch } from "react-router-dom" import { sizeInfo } from "ui/style" @@ -84,12 +83,6 @@ export class App extends Component { /> - diff --git a/website/src/Home/Home.js b/website/src/Home/Home.js index f1faf6f..f67fac9 100644 --- a/website/src/Home/Home.js +++ b/website/src/Home/Home.js @@ -1,47 +1,217 @@ import React, { Component, Fragment } from "react" import PropTypes from "prop-types" -import { Row, Column, PanelButton } from "ui" -import { sizeInfo } from "ui/style" +import { Box, Image, Column, Row, Button, Link } from "ui" +import { MessageModal, WaitModal, YesNoMessageModal } from "../Modal" +import { sizeInfo, colorInfo } from "ui/style" +import headerLogo from "images/logo.png" +import autobind from "autobind-decorator" +import { api } from "../API" export class Home extends Component { static propTypes = { - history: PropTypes.object, + changeTitle: PropTypes.func.isRequired, + } + + constructor(props) { + super(props) + this.state = { + messageModal: null, + waitModal: null, + yesNoModal: null, + } + } + + @autobind + handleDeleteActivities() { + this.setState({ + yesNoModal: { + question: + "Are you sure you want to delete all activities in the system?", + onDismiss: this.handleDeleteActivitiesDismiss, + }, + }) + } + + @autobind + handleDeleteActivitiesDismiss(yes) { + if (yes) { + this.setState({ waitModal: { message: "Deleting All Activities..." } }) + api + .deleteAllActivities() + .then(() => { + this.setState({ + waitModal: null, + messageModal: { + icon: "thumb", + message: "All logged activities have been deleted", + }, + }) + }) + .catch((error) => { + this.setState({ + waitModal: null, + messageModal: { + icon: "hand", + message: "Unable to request delete activities.", + detail: error.message, + }, + }) + }) + } + + this.setState({ + yesNoModal: null, + }) + } + + @autobind + handleDeleteWorkItems() { + this.setState({ + yesNoModal: { + question: + "Are you sure you want to delete all work items & activities in the system?", + onDismiss: this.handleDeleteWorkItemsDismiss, + }, + }) + } + + @autobind + handleDeleteWorkItemsDismiss(yes) { + if (yes) { + this.setState({ + waitModal: { message: "Deleting All Work Items & Activities..." }, + }) + api + .deleteAllWorkItems() + .then(() => { + this.setState({ + waitModal: null, + messageModal: { + icon: "thumb", + message: "All work items and logged activities have been deleted", + }, + }) + }) + .catch((error) => { + this.setState({ + waitModal: null, + messageModal: { + icon: "hand", + message: "Unable to delete work items and activities.", + detail: error.message, + }, + }) + }) + } + + this.setState({ + yesNoModal: null, + }) + } + + @autobind + handleMessageModalDismiss() { + this.setState({ messageModal: null }) } render() { + const { messageModal, yesNoModal, waitModal } = this.state + return ( - - this.props.history.push("/admin/users")} - /> - - - - this.props.history.push("/admin/teams")} - /> - - - - this.props.history.push("/admin/system")} - /> + + + + + + + + + + + + + + + + + + + +