From 3a30303631d584b10bd3476ff2e0cd87dc9b7c19 Mon Sep 17 00:00:00 2001 From: CollinBeczak Date: Fri, 15 Nov 2024 16:45:46 -0600 Subject: [PATCH] remove completingtask conditions --- .../HOCs/WithTaskBundle/WithTaskBundle.jsx | 15 ++++--------- .../ReviewTaskControls/ReviewTaskControls.jsx | 1 - .../ReviewTaskPane/ReviewTaskPane.jsx | 2 +- .../ActiveTaskControls/ActiveTaskControls.jsx | 2 -- src/components/TaskPane/TaskMap/TaskMap.jsx | 20 ++++++++---------- src/components/TaskPane/TaskPane.jsx | 21 ++----------------- 6 files changed, 16 insertions(+), 45 deletions(-) diff --git a/src/components/HOCs/WithTaskBundle/WithTaskBundle.jsx b/src/components/HOCs/WithTaskBundle/WithTaskBundle.jsx index d920103c0..bf140f132 100644 --- a/src/components/HOCs/WithTaskBundle/WithTaskBundle.jsx +++ b/src/components/HOCs/WithTaskBundle/WithTaskBundle.jsx @@ -22,14 +22,13 @@ import { export function WithTaskBundle(WrappedComponent) { return class extends Component { state = { - loading: false, - bundleEditsDisabled: false, initialBundle: null, taskBundle: null, - completingTask: null, + bundleEditsDisabled: false, selectedTasks: [], resetSelectedTasks: null, - errorMessage: null + errorMessage: null, + loading: false, } async componentDidMount() { @@ -43,7 +42,7 @@ export function WithTaskBundle(WrappedComponent) { async componentDidUpdate(prevProps) { const { task } = this.props if (_get(task, 'id') !== _get(prevProps, 'task.id')) { - this.setState({ selectedTasks: [], taskBundle: null, initialBundle: null, loading: false, completingTask: null }) + this.setState({ selectedTasks: [], taskBundle: null, initialBundle: null, loading: false }) if (_isFinite(_get(task, 'bundleId'))) { await this.fetchBundle(task.bundleId) } @@ -180,10 +179,6 @@ export function WithTaskBundle(WrappedComponent) { this.resetSelectedTasks() } - setCompletingTask = task => { - this.setState({ selectedTasks: [], completingTask: task }) - } - updateTaskBundle = async () => { const { taskBundle, initialBundle } = this.state if (taskBundle || initialBundle) { @@ -207,8 +202,6 @@ export function WithTaskBundle(WrappedComponent) { taskBundle={this.state.taskBundle} initialBundle={this.state.initialBundle} taskBundleLoading={this.state.loading} - setCompletingTask={this.setCompletingTask} - completingTask={this.props.completingTask} createTaskBundle={this.createTaskBundle} updateTaskBundle={this.updateTaskBundle} resetTaskBundle={this.resetTaskBundle} diff --git a/src/components/ReviewTaskControls/ReviewTaskControls.jsx b/src/components/ReviewTaskControls/ReviewTaskControls.jsx index 482b9e1a9..f643382ef 100644 --- a/src/components/ReviewTaskControls/ReviewTaskControls.jsx +++ b/src/components/ReviewTaskControls/ReviewTaskControls.jsx @@ -50,7 +50,6 @@ export class ReviewTaskControls extends Component { if(this.state.tags) { this.props.saveTaskTags(this.props.task, this.state.tags) } - this.props.setCompletingTask(this.props.task.id) const history = _cloneDeep(this.props.history) _merge(_get(history, 'location.state', {}), alternateCriteria) diff --git a/src/components/ReviewTaskPane/ReviewTaskPane.jsx b/src/components/ReviewTaskPane/ReviewTaskPane.jsx index 31dc3eebb..46e69f0d8 100644 --- a/src/components/ReviewTaskPane/ReviewTaskPane.jsx +++ b/src/components/ReviewTaskPane/ReviewTaskPane.jsx @@ -168,7 +168,7 @@ export class ReviewTaskPane extends Component { /> - + { useMapEvents({ moveend: () => { - if (props.task.id !== props.completingTask) { - const bounds = map.getBounds() - const zoom = map.getZoom() - props.setTaskMapBounds(props.task.id, bounds, zoom, false) - if (props.setWorkspaceContext) { - props.setWorkspaceContext({ - taskMapTask: props.task, - taskMapBounds: bounds, - taskMapZoom: zoom - }) - } + const bounds = map.getBounds() + const zoom = map.getZoom() + props.setTaskMapBounds(props.task.id, bounds, zoom, false) + if (props.setWorkspaceContext) { + props.setWorkspaceContext({ + taskMapTask: props.task, + taskMapBounds: bounds, + taskMapZoom: zoom + }) } }, }) diff --git a/src/components/TaskPane/TaskPane.jsx b/src/components/TaskPane/TaskPane.jsx index 53dd3f2b1..4f9d8a832 100644 --- a/src/components/TaskPane/TaskPane.jsx +++ b/src/components/TaskPane/TaskPane.jsx @@ -127,16 +127,7 @@ export class TaskPane extends Component { needsReview, requestedNextTask, osmComment, tagEdits, taskBundle) => { this.props.completeTask(task, challengeId, taskStatus, comment, tags, taskLoadBy, userId, needsReview, requestedNextTask, osmComment, tagEdits, - this.state.completionResponses, taskBundle).then(() => { - this.clearCompletingTask() - }) - } - - clearCompletingTask = () => { - // Clear on next tick to give our animation transition a chance to clean up. - setTimeout(() => { - this.props.setCompletingTask(null) - }, 0) + this.state.completionResponses, taskBundle) } setCompletionResponse = (propertyName, value) => { @@ -387,23 +378,15 @@ export class TaskPane extends Component { } completeTask={this.completeTask} - completingTask={this.props.completingTask} setCompletionResponse={this.setCompletionResponse} setNeedsResponses={this.setNeedsResponses} completionResponses={completionResponses} needsResponses={this.state.needsResponses} templateRevision={isCompletionStatus(this.props.task.status)} /> - {this.props.completingTask && this.props.completingTask === this.props.task.id && -
- -
- }
- +