Skip to content

Commit

Permalink
Revert "add re-select task button in rapid iframe (#2490)"
Browse files Browse the repository at this point in the history
This reverts commit 6195f8c.
  • Loading branch information
jake-low committed Nov 15, 2024
1 parent 9397a2c commit 688cea7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
5 changes: 0 additions & 5 deletions src/components/Widgets/TaskMapWidget/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,4 @@ export default defineMessages({
id: "Widgets.TaskMapWidget.rapidFailed",
defaultMessage: "Widget Failed! Geometries Null!",
},

reselectTask: {
id: "Widgets.TaskMapWidget.reselectTask",
defaultMessage: "Re-Select Task",
},
})
19 changes: 1 addition & 18 deletions src/components/Widgets/TaskMapWidget/RapidEditor/RapidEditor.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect, useRef } from 'react';
import React, { useState, useEffect } from 'react';
import { useDispatch } from 'react-redux';
import _get from 'lodash/get';

Expand All @@ -10,8 +10,6 @@ import WithSearch from '../../../HOCs/WithSearch/WithSearch';
import useHash from '../../../../hooks/UseHash';
import { SET_RAPIDEDITOR } from '../../../../services/RapidEditor/RapidEditor';
import BusySpinner from '../../../BusySpinner/BusySpinner';
import { FormattedMessage } from 'react-intl';
import messages from './../Messages';

/**
* Generate the initial URL hash for the Rapid editor.
Expand Down Expand Up @@ -44,7 +42,6 @@ const RapidEditor = ({ token, task, mapBounds, comment }) => {
const dispatch = useDispatch();
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState(null);
const iframeRef = useRef(null); // Create a ref for the iframe
let initialHash = generateStartingHash({ task, mapBounds, comment });
let [, setHash] = useHash();

Expand All @@ -66,21 +63,8 @@ const RapidEditor = ({ token, task, mapBounds, comment }) => {
initialHash += `&token=${token}`;
}

const handleResetHash = () => {
if (iframeRef.current) {
iframeRef.current.contentWindow.location.hash = initialHash;
}
};

return (
<div style={{ position: 'relative', width: '100%', height: '100%' }}>
<button
onClick={handleResetHash}
className="mr-ml-auto mr-button mr-button--small mr-px-2"
style={{ position: 'absolute', right: '0px', top: '-40px' }}
>
<FormattedMessage {...messages.reselectTask} />
</button>
{isLoading && (
<div style={{ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', zIndex: 1000 }}>
<BusySpinner xlarge />
Expand All @@ -90,7 +74,6 @@ const RapidEditor = ({ token, task, mapBounds, comment }) => {
<div>Error: {error.message}</div>
)}
<iframe
ref={iframeRef}
id="rapid-container-root"
style={{ width: '100%', height: '100%' }}
src={`/static/rapid-editor.html${initialHash}`}
Expand Down

0 comments on commit 688cea7

Please sign in to comment.