diff --git a/package.json b/package.json
index 8cfab5c6..e921f236 100644
--- a/package.json
+++ b/package.json
@@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
+ "dotenv": "^6.0.0",
"glamor": "^2.20.40",
"react": "^15.6.1",
"react-animated-number": "^0.4.3",
diff --git a/src/components/Content/Calendar/Calendar.js b/src/components/Content/Calendar/Calendar.js
index 7be2329d..86e8a7f3 100644
--- a/src/components/Content/Calendar/Calendar.js
+++ b/src/components/Content/Calendar/Calendar.js
@@ -1,11 +1,7 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import moment from 'moment';
-import {
- getTasks,
- getPursuances,
- showTaskDetails,
-} from '../../../actions';
+import { getTasks, getPursuances, showTaskDetails } from '../../../actions';
import BigCalendar from 'react-big-calendar';
import 'react-big-calendar/lib/css/react-big-calendar.css';
import './Calendar.css';
@@ -14,7 +10,6 @@ import '../Content.css';
BigCalendar.momentLocalizer(moment);
class Calendar extends Component {
-
componentDidMount() {
const {
getPursuances,
@@ -25,9 +20,11 @@ class Calendar extends Component {
} = this.props;
// Fetch this pursuance's tasks if we haven't already
- if (Object.keys(tasks.taskMap)
- .filter(gid => gid.startsWith(currentPursuanceId + '_'))
- .length === 0) {
+ if (
+ Object.keys(tasks.taskMap).filter(gid =>
+ gid.startsWith(currentPursuanceId + '_')
+ ).length === 0
+ ) {
getTasks(currentPursuanceId);
}
if (Object.keys(pursuances).length === 0) {
@@ -36,18 +33,24 @@ class Calendar extends Component {
}
getEvents = () => {
- const { currentPursuanceId, user, tasks: { taskMap } } = this.props;
+ const {
+ currentPursuanceId,
+ user,
+ tasks: { taskMap }
+ } = this.props;
return Object.keys(taskMap)
- .filter((gid) => {
+ .filter(gid => {
const t = taskMap[gid];
- return t &&
+ return (
+ t &&
t.due_date &&
t.status !== 'Done' &&
t.assigned_to === user.username &&
(t.pursuance_id === currentPursuanceId ||
- t.assigned_to_pursuance_id === currentPursuanceId)
+ t.assigned_to_pursuance_id === currentPursuanceId)
+ );
})
- .map((gid) => {
+ .map(gid => {
const t = taskMap[gid];
return {
id: t.gid,
@@ -55,14 +58,14 @@ class Calendar extends Component {
start: new Date(t.due_date),
end: new Date(t.due_date),
desc: t.deliverables,
- allDay: true,
- }
- })
- }
+ allDay: true
+ };
+ });
+ };
- onSelectEvent = (event) => {
- this.props.showTaskDetails({taskGid: event.id});
- }
+ onSelectEvent = event => {
+ this.props.showTaskDetails({ taskGid: event.id });
+ };
render() {
const { pursuances, currentPursuanceId } = this.props;
@@ -74,9 +77,8 @@ class Calendar extends Component {
Calendar:
- {
- pursuances[currentPursuanceId] && pursuances[currentPursuanceId].name
- }
+ {pursuances[currentPursuanceId] &&
+ pursuances[currentPursuanceId].name}
@@ -95,9 +97,17 @@ class Calendar extends Component {
}
}
-export default connect(({ pursuances, currentPursuanceId, tasks, rightPanel, user }) =>
- ({ pursuances, currentPursuanceId, tasks, rightPanel, user }), {
+export default connect(
+ ({ pursuances, currentPursuanceId, tasks, rightPanel, user }) => ({
+ pursuances,
+ currentPursuanceId,
+ tasks,
+ rightPanel,
+ user
+ }),
+ {
getTasks,
getPursuances,
- showTaskDetails,
-})(Calendar);
+ showTaskDetails
+ }
+)(Calendar);
diff --git a/src/components/Content/RightPanel/TaskDetails/TaskDetails.css b/src/components/Content/RightPanel/TaskDetails/TaskDetails.css
index d4413c8a..7f56bce1 100644
--- a/src/components/Content/RightPanel/TaskDetails/TaskDetails.css
+++ b/src/components/Content/RightPanel/TaskDetails/TaskDetails.css
@@ -75,6 +75,12 @@
min-height: 64px;
}
+.task-deliverables-header {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+}
+
.task-deliverables-ctn a {
color: #50b3fe;
}
@@ -86,7 +92,7 @@
.subtasks-list {
list-style: none;
- padding-left: 0
+ padding-left: 0;
}
.subtask-item {
@@ -106,3 +112,23 @@
width: 100%;
font-size: 36px;
}
+
+.input {
+ color: black;
+}
+
+.editSubmit {
+ border-radius: 1px;
+ font-size: 17px;
+ font-weight: 400;
+ margin: 15px auto;
+ border-radius: 10px;
+ color: #fff;
+ background-color: #288bd6;
+ padding-top: 0;
+ margin: 0;
+}
+
+button {
+ margin: 0;
+}
diff --git a/src/components/Content/RightPanel/TaskDetails/TaskDetails.js b/src/components/Content/RightPanel/TaskDetails/TaskDetails.js
index 0a5d117d..463478da 100644
--- a/src/components/Content/RightPanel/TaskDetails/TaskDetails.js
+++ b/src/components/Content/RightPanel/TaskDetails/TaskDetails.js
@@ -1,32 +1,86 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
-import { getPursuancesByIds, getTasks, patchTask } from '../../../../actions';
+import { getPursuancesByIds, getTasks } from '../../../../actions';
import ReactMarkdown from 'react-markdown';
import FaEllipsisV from 'react-icons/lib/fa/ellipsis-v';
import FaCircleO from 'react-icons/lib/fa/circle-o';
import TaskStatus from '../../TaskStatus/TaskStatus';
import TaskAssigner from '../../TaskHierarchy/Task/TaskAssigner/TaskAssigner';
import TaskDueDate from '../../TaskDueDate/TaskDueDate';
+import { updateFormField, patchTask } from '../../../../actions';
import './TaskDetails.css';
class TaskDetails extends Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ editMode: false,
+ taskDescription: '',
+ refresh: false
+ };
+ this.taskDescription = '';
+ }
+
+ editTaskDescription = e => {
+ this.taskDescription = e.target.value;
+ };
+
+ editModeToggle = () => {
+ this.setState({
+ editMode: !this.state.editMode
+ });
+ console.log(this.state.editMode);
+ };
+
+ closeOnEsc = e => {
+ if (this.state.editMode === true && e.keyCode === 27) {
+ this.editModeToggle();
+ }
+ };
+
+ onSubmit = () => {
+ if (this.state.editMode) {
+ const patchedTaskDescription = {
+ gid: this.props.rightPanel.taskGid,
+ deliverables: this.taskDescription
+ };
+ patchTask(patchedTaskDescription);
+ this.setState({
+ editMode: false
+ });
+ window.location.reload();
+ }
+ };
+
+ refresh = () => {
+ this.setState({
+ refresh: !this.state.refresh
+ });
+ };
+
+ componentDidMount() {
+ document.addEventListener('keydown', this.closeOnEsc, false);
+ document.addEventListener('keydown', this.refresh, false);
+ }
componentWillMount() {
- const {
- currentPursuanceId,
- tasks,
- getTasks,
- rightPanel
- } = this.props;
+ console.log(this.props);
+
+ const { currentPursuanceId, tasks, getTasks, rightPanel } = this.props;
+
+ if (tasks.taskMap[rightPanel.taskGid]) {
+ this.setState({
+ taskDescription: tasks.taskMap[rightPanel.taskGid].deliverables
+ });
+ }
if (rightPanel.taskGid && !tasks.taskMap[rightPanel.taskGid]) {
const thisTasksPursuanceId = rightPanel.taskGid.split(/_/)[0];
getTasks(thisTasksPursuanceId);
- // If this task was assigned to this pursuance from another
- // pursuance, grab the current pursuance's tasks, too
if (thisTasksPursuanceId !== currentPursuanceId.toString()) {
getTasks(currentPursuanceId);
}
@@ -43,9 +97,7 @@ class TaskDetails extends Component {
const task = tasks.taskMap[taskGid];
if (!task) {
- return (
-
- )
+ return
;
}
const assignedPursuanceId = task.assigned_to_pursuance_id;
@@ -64,19 +116,25 @@ class TaskDetails extends Component {
}
return (
- (assignedPursuanceId && pursuances[assignedPursuanceId] && pursuances[assignedPursuanceId].suggestionName)
- ||
- (task.assigned_to && '@' + task.assigned_to)
- )
- }
+ (assignedPursuanceId &&
+ pursuances[assignedPursuanceId] &&
+ pursuances[assignedPursuanceId].suggestionName) ||
+ (task.assigned_to && '@' + task.assigned_to)
+ );
+ };
render() {
- const { pursuances, tasks, rightPanel: { taskGid } } = this.props;
+ const {
+ pursuances,
+ tasks,
+ rightPanel: { taskGid }
+ } = this.props;
const task = tasks.taskMap[taskGid];
if (!task) {
- return
Ain't nobody got task fo' that.
+ return
Ain't nobody got task fo that.
;
}
const subtaskGids = task.subtask_gids;
+ const { editMode } = this.state;
return (
@@ -115,31 +173,82 @@ class TaskDetails extends Component {
- Created in {pursuances[task.pursuance_id] && {pursuances[task.pursuance_id].name} }
+ Created in{' '}
+ {pursuances[task.pursuance_id] && (
+ {pursuances[task.pursuance_id].name}
+ )}
+
-
Description / Deliverables
-
- {
- if (props.href.startsWith('/')) {
- return {props.children} ;
- }
- // If link to external site, open in new tab
- return {props.children} ;
- }}} />
-
+
+
+ Descriptions / Deliverables
+
+
+ {
+ e.preventDefault();
+ this.editModeToggle();
+ this.onSubmit();
+ this.refresh();
+ }}
+ >
+ {editMode ? 'Save' : 'Edit'}
+
+
+
+ {editMode && (
+
+
+
+ )}
+
+ {editMode ? console.log('EM') : console.log('NOT EM')}
+
+ {!editMode && (
+
+ {
+ if (props.href.startsWith('/')) {
+ return {props.children} ;
+ }
+ return (
+
+ {props.children}
+
+ );
+ }
+ }}
+ />
+
+ )}
+
-
Subtasks
+
+ Subtasks
+
- {subtaskGids.map((gid, i)=> {
- return
- {tasks.taskMap[gid].title}
-
+ {subtaskGids.map((gid, i) => {
+ return (
+
+
+ {tasks.taskMap[gid].title}
+
+ );
})}
@@ -147,8 +256,17 @@ class TaskDetails extends Component {
);
- };
+ }
}
-export default withRouter(connect(({currentPursuanceId, pursuances, tasks, rightPanel}) => ({currentPursuanceId, pursuances, tasks, rightPanel}),
- { getPursuancesByIds, getTasks, patchTask })(TaskDetails));
+export default withRouter(
+ connect(
+ ({ currentPursuanceId, pursuances, tasks, rightPanel }) => ({
+ currentPursuanceId,
+ pursuances,
+ tasks,
+ rightPanel
+ }),
+ { getPursuancesByIds, getTasks, patchTask }
+ )(TaskDetails)
+);
diff --git a/src/components/Content/TaskManager/TaskForm/AssignerInput/AssignerInput.js b/src/components/Content/TaskManager/TaskForm/AssignerInput/AssignerInput.js
index 4e91aa53..61867d0b 100644
--- a/src/components/Content/TaskManager/TaskForm/AssignerInput/AssignerInput.js
+++ b/src/components/Content/TaskManager/TaskForm/AssignerInput/AssignerInput.js
@@ -14,8 +14,7 @@ import {
patchTask
} from '../../../../../actions';
-const AssignerInput = (props) => {
-
+const AssignerInput = props => {
const {
updateFormField,
formId,
@@ -43,29 +42,33 @@ const AssignerInput = (props) => {
// to another pursuance
const onlyShowUsers = () => !isFromCurrentPursuance && editMode;
- const onChange = (e) => {
+ const onChange = e => {
const { value, name } = e.target;
- const suggestions = onlyShowUsers() ? users : Object.assign({}, pursuances, users);
+ const suggestions = onlyShowUsers()
+ ? users
+ : Object.assign({}, pursuances, users);
if (suggestions[assignedTo]) {
- delete suggestions[assignedTo]
+ delete suggestions[assignedTo];
}
delete suggestions[currentPursuanceId];
updateFormField(formId, name, value);
startSuggestions(value, filterSuggestion, suggestions, formId);
- }
+ };
- const onFocus = (e) => {
+ const onFocus = e => {
const { value, name } = e.target;
updateFormField(formId, name, value);
- const suggestions = onlyShowUsers() ? users : Object.assign({}, pursuances, users);
+ const suggestions = onlyShowUsers()
+ ? users
+ : Object.assign({}, pursuances, users);
if (suggestions[assignedTo]) {
- delete suggestions[assignedTo]
+ delete suggestions[assignedTo];
}
delete suggestions[currentPursuanceId];
startSuggestions(e.target.value, filterSuggestion, suggestions, formId);
- }
+ };
- const onKeyDown = (e) => {
+ const onKeyDown = e => {
if (e.key === 'Escape') {
onBlur();
return;
@@ -85,14 +88,14 @@ const AssignerInput = (props) => {
patchedTask.assigned_to_pursuance_id = suggestion.id;
patchedTask.assigned_to = null;
} else if (isFromCurrentPursuance) {
- // Assigning to a user in the current pursuance
- patchedTask.assigned_to_pursuance_id = null;
- patchedTask.assigned_to = suggestionName;
+ // Assigning to a user in the current pursuance
+ patchedTask.assigned_to_pursuance_id = null;
+ patchedTask.assigned_to = suggestionName;
} else {
- // Assigning this outsourced-to-us task to a member of the
- // current pursuance
- patchedTask.assigned_to = suggestionName;
- }
+ // Assigning this outsourced-to-us task to a member of the
+ // current pursuance
+ patchedTask.assigned_to = suggestionName;
+ }
patchTask(patchedTask);
hideEditAssignee();
} else {
@@ -110,7 +113,7 @@ const AssignerInput = (props) => {
e.preventDefault();
downSuggestion();
}
- }
+ };
const onBlur = () => {
stopSuggestions();
@@ -118,18 +121,18 @@ const AssignerInput = (props) => {
hideEditAssignee();
updateFormField(formId, 'assigned_to', '');
}
- }
+ };
const clearAssignee = () => {
const patchedTask = {
gid: formId,
assigned_to: null
- }
+ };
if (placeholder && placeholder[0] === '(') {
patchedTask.assigned_to_pursuance_id = null;
}
patchTask(patchedTask);
- }
+ };
let assigned_to = taskForm[formId] ? taskForm[formId].assigned_to : '';
let autoFocus;
@@ -155,22 +158,30 @@ const AssignerInput = (props) => {
onKeyDown={onKeyDown}
autoFocus={autoFocus}
/>
- { editMode &&
+ {editMode && (
-
+
- }
+ )}
- )
-}
+ );
+};
-export default connect(({ pursuances, currentPursuanceId, users, autoComplete, taskForm }) =>
- ({ pursuances, currentPursuanceId, users, autoComplete, taskForm}), {
- updateFormField,
- startSuggestions,
- stopSuggestions,
- upSuggestion,
- downSuggestion,
- addSuggestion,
- patchTask
-})(AssignerInput);
+export default connect(
+ ({ pursuances, currentPursuanceId, users, autoComplete, taskForm }) => ({
+ pursuances,
+ currentPursuanceId,
+ users,
+ autoComplete,
+ taskForm
+ }),
+ {
+ updateFormField,
+ startSuggestions,
+ stopSuggestions,
+ upSuggestion,
+ downSuggestion,
+ addSuggestion,
+ patchTask
+ }
+)(AssignerInput);