Skip to content

Commit

Permalink
Add props for dropdown and remove logic for hash params (#20332)
Browse files Browse the repository at this point in the history
Co-authored-by: Jim Foley <james.foley4@va.gov>
  • Loading branch information
2 people authored and craigrva committed Jan 24, 2024
1 parent e1f685a commit 1f1bd4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
3 changes: 3 additions & 0 deletions app/views/correspondence/intake.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
userId: current_user.id,
userRole: (current_user.vacols_roles.first || "").capitalize,
userCssId: current_user.css_id,
dropdownUrls: dropdown_urls,
applicationUrls: application_urls,
feedbackUrl: feedback_url,
organizations: current_user.selectable_organizations.map {|o| o.slice(:name, :url)},
featureToggles: {
correspondence_queue: FeatureToggle.enabled?(:correspondence_queue, user: current_user)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AddTasksAppealsView } from './TasksAppeals/AddTasksAppealsView';
import { connect, useSelector } from 'react-redux';
import { bindActionCreators } from 'redux';
import { setUnrelatedTasks } from '../../correspondenceReducer/correspondenceActions';
import { useHistory, useLocation } from 'react-router-dom';
import { useHistory } from 'react-router-dom';
import { ConfirmCorrespondenceView } from './ConfirmCorrespondence/ConfirmCorrespondenceView';
import { SubmitCorrespondenceModal } from './ConfirmCorrespondence/SubmitCorrespondenceModal';
import Alert from 'app/components/Alert';
Expand Down Expand Up @@ -39,10 +39,7 @@ export const CorrespondenceIntake = (props) => {
const [addTasksVisible, setAddTasksVisible] = useState(false);
const [submitCorrespondenceModalVisible, setSubmitCorrespondenceModalVisible] = useState(false);
const [errorBannerVisible, setErrorBannerVisible] = useState(false);
const { pathname, hash, key } = useLocation();
const history = useHistory();
// For hash routing - Add element id and which step it lives on here
const SECTION_MAP = { 'task-not-related-to-an-appeal': 2 };

const handleContinueStatusChange = (isEnabled) => {
setContinueEnabled(isEnabled);
Expand Down Expand Up @@ -96,23 +93,6 @@ export const CorrespondenceIntake = (props) => {
);
}, [currentStep]);

useEffect(() => {
if (hash === '') {
window.scrollTo(0, 0);
} else {
setTimeout(() => {
const id = hash.replace('#', '');

setCurrentStep(SECTION_MAP[id]);
const element = document.getElementById(id);

if (element) {
element.scrollIntoView();
}
}, 0);
}
}, [pathname, hash, key]);

return <div>
{ errorBannerVisible &&
<Alert title={CORRESPONDENCE_INTAKE_FORM_ERROR_BANNER_TITLE} type="error">
Expand Down

0 comments on commit 1f1bd4a

Please sign in to comment.