diff --git a/.circleci/config.yml b/.circleci/config.yml
index 40caefd886..268ceb57c3 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -424,7 +424,7 @@ parameters:
type: string
dev_git_branch: # change to feature branch to test deployment
description: "Name of github branch that will deploy to dev"
- default: "lr/ttahub-1521/display-regions-in-AR-header"
+ default: "mb/TTAHUB-3007/no-disallowed-urls"
type: string
sandbox_git_branch: # change to feature branch to test deployment
default: "al-ttahub-add-fei-root-cause-to-review"
diff --git a/frontend/package.json b/frontend/package.json
index 435b09e172..bc4e507bfd 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -12,7 +12,7 @@
"@silevis/reactgrid": "3.1",
"@react-hook/resize-observer": "^1.2.6",
"@trussworks/react-uswds": "4.1.1",
- "@ttahub/common": "^2.1.3",
+ "@ttahub/common": "^2.1.5",
"@use-it/interval": "^1.0.0",
"async": "^3.2.3",
"browserslist": "^4.16.5",
diff --git a/frontend/src/components/GoalForm/ResourceRepeater.js b/frontend/src/components/GoalForm/ResourceRepeater.js
index f90c56a3a0..fc5756728f 100644
--- a/frontend/src/components/GoalForm/ResourceRepeater.js
+++ b/frontend/src/components/GoalForm/ResourceRepeater.js
@@ -1,4 +1,5 @@
import React from 'react';
+import { isValidResourceUrl } from '@ttahub/common';
import PropTypes from 'prop-types';
import { v4 as uuidv4 } from 'uuid';
import {
@@ -11,7 +12,6 @@ import QuestionTooltip from './QuestionTooltip';
import URLInput from '../URLInput';
import colors from '../../colors';
import './ResourceRepeater.scss';
-import { OBJECTIVE_LINK_ERROR } from './constants';
export default function ResourceRepeater({
resources,
@@ -19,10 +19,12 @@ export default function ResourceRepeater({
error,
validateResources,
toolTipText,
- validateOnRemove,
isLoading,
}) {
const addResource = () => {
+ if ((error.props.children) || resources.some((r) => !r.value)) {
+ return;
+ }
const newResources = [...resources, { key: uuidv4(), value: '' }];
setResources(newResources);
};
@@ -31,20 +33,12 @@ export default function ResourceRepeater({
const newResources = [...resources];
newResources.splice(i, 1);
setResources(newResources);
-
- // This is an attempt to handle on remove validation for resources.
- // the AR and RTR use two different approaches to validation.
- // This works around it by allowing the parent component to pass in a validation function.
- if (validateOnRemove) {
- validateOnRemove(newResources);
- } else {
- validateResources();
- }
+ validateResources();
};
const updateResource = (value, i) => {
const newResources = [...resources];
- const toUpdate = { ...newResources[i], value };
+ const toUpdate = { ...newResources[i], value: value.trim() };
newResources.splice(i, 1, toUpdate);
setResources(newResources);
};
@@ -64,10 +58,10 @@ export default function ResourceRepeater({
Enter one resource per field. To enter more resources, select “Add new resource”
- {error.props.children ? OBJECTIVE_LINK_ERROR : null}
+ {error.props.children ? error : null}
{ resources.map((r, i) => (
-
+