Skip to content

Commit

Permalink
Merge pull request #1044 from Eastern-Research-Group/develop
Browse files Browse the repository at this point in the history
Update staging
  • Loading branch information
cschwinderg authored Dec 6, 2024
2 parents ace8f4d + 8649377 commit c9cc245
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ function AdvancedSearch() {
css={buttonStyles}
disabled={searchLoading}
onClick={(_ev) => {
mapView?.popup?.close();
if (mapView?.popup?.close) mapView.popup.close();
executeFilter();
}}
>
Expand Down
43 changes: 40 additions & 3 deletions app/client/src/components/pages/WaterbodyReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ import { getExtensionFromPath, titleCaseWithExceptions } from 'utils/utils';
// styles
import { colors } from 'styles/index';
// errors
import { waterbodyReportError } from 'config/errorMessages';
import {
status303dShortError,
waterbodyReportError,
} from 'config/errorMessages';

const containerStyles = css`
${splitLayoutContainerStyles};
Expand Down Expand Up @@ -268,6 +271,7 @@ function WaterbodyReport() {
data: [],
});
setReportingCycleFetch({ status: 'failure', year: '' });
setReportStatusFetch({ status: 'failure', value: '' });
setWaterbodyStatus({ status: 'failure', data: [] });
setWaterbodyUses({ status: 'failure', data: [] });
setWaterbodySources({ status: 'failure', data: [] });
Expand All @@ -283,9 +287,9 @@ function WaterbodyReport() {
status: 'no-data',
data: { condition: '', planForRestoration: '', listed303d: '' },
});
setReportingCycleFetch({
setReportStatusFetch({
status: 'success',
year: '',
value: '',
});
setWaterbodyUses({
status: 'success',
Expand Down Expand Up @@ -451,6 +455,10 @@ function WaterbodyReport() {
status: 'fetching',
year: '',
});
const [reportStatusFetch, setReportStatusFetch] = useState({
status: 'fetching',
value: '',
});
const [organizationName, setOrganizationName] = useState({
status: 'fetching',
name: '',
Expand Down Expand Up @@ -527,6 +535,10 @@ function WaterbodyReport() {
return;
}

setReportStatusFetch({
status: 'success',
value: firstItem.reportStatusCode,
});
setReportingCycleFetch({
status: 'success',
year: firstItem.reportingCycleText,
Expand Down Expand Up @@ -981,6 +993,31 @@ function WaterbodyReport() {
)}
</div>

<div css={inlineBoxSectionStyles}>
<strong>
<GlossaryTerm term="303(d) listed impaired waters (Category 5)">
303(d) List Status
</GlossaryTerm>
:
</strong>
&nbsp;&nbsp;
{reportStatusFetch.status === 'fetching' && <LoadingSpinner />}
{reportStatusFetch.status === 'failure' && (
<div css={modifiedErrorBoxStyles}>
<p>{status303dShortError}</p>
</div>
)}
{reportStatusFetch.status === 'success' && (
<p>
{configFiles.data.reportStatusMapping.hasOwnProperty(
reportStatusFetch.value,
)
? configFiles.data.reportStatusMapping[reportStatusFetch.value]
: reportStatusFetch.value}{' '}
</p>
)}
</div>

<div css={inlineBoxSectionStyles}>
<h4>Other Years Reported:</h4>
{(allReportingCycles.status === 'fetching' ||
Expand Down
6 changes: 3 additions & 3 deletions app/client/src/components/shared/LocationMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ function LocationMap({ layout = 'narrow', windowHeight, children }: Props) {

const boundariesLayer = new GraphicsLayer({
id: 'boundariesLayer',
title: 'Boundaries',
title: 'Selected Watershed',
listMode: 'show',
});
setLayer('boundariesLayer', boundariesLayer);
Expand Down Expand Up @@ -1363,7 +1363,7 @@ function LocationMap({ layout = 'narrow', windowHeight, children }: Props) {
feature.attributes
) {
const stateCode = feature.attributes.STATE_FIPS;
const countyCode = feature.attributes.FIPS.substring(2, 5);
const countyCode = feature.attributes.COUNTY_FIPS;
visible = true;
setFIPS({
stateCode: stateCode,
Expand Down Expand Up @@ -1731,7 +1731,7 @@ function LocationMap({ layout = 'narrow', windowHeight, children }: Props) {
`${configFiles.data.services.dwmaps.GetPWSWMHUC12FIPS}` +
`${hucResponse.features[0].attributes.huc12}/` +
`${graphic.attributes.STATE_FIPS}/` +
`${graphic.attributes.CNTY_FIPS}`;
`${graphic.attributes.COUNTY_FIPS}`;

promises.push(fetchCheck(drinkingWaterUrl));
});
Expand Down
3 changes: 2 additions & 1 deletion app/client/src/components/shared/ViewOnMapButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function ViewOnMapButton({
}: Props) {
const { waterbodyPoints, waterbodyLines, waterbodyAreas } = useLayers();

const { setSelectedGraphic } = useMapHighlightState();
const { setSelectedGraphic, setViewOnMapClickCount } = useMapHighlightState();

function viewClick(featureParam) {
// update context with the new selected graphic
Expand All @@ -47,6 +47,7 @@ function ViewOnMapButton({
? 'Waterbody'
: fieldName;

setViewOnMapClickCount((prevCount) => prevCount + 1);
setSelectedGraphic(featureParam);
}

Expand Down
2 changes: 1 addition & 1 deletion app/client/src/components/shared/WaterbodyInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ function WaterbodyInfo({
<p>
<strong>County:</strong>
<br />
{attributes.CNTY_FIPS} - {attributes.NAME}
{attributes.COUNTY_FIPS} - {attributes.NAME}
</p>
);
};
Expand Down
7 changes: 6 additions & 1 deletion app/client/src/contexts/MapHighlight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ type State = {
selectedGraphic: ExtendedGraphic | null;
setHighlightedGraphic: Dispatch<SetStateAction<ExtendedGraphic | null>>;
setSelectedGraphic: Dispatch<SetStateAction<ExtendedGraphic | null>>;
viewOnMapClickCount: number;
setViewOnMapClickCount: Dispatch<SetStateAction<number>>;
};

const StateContext = createContext<State | undefined>(undefined);
Expand All @@ -19,14 +21,17 @@ export function MapHighlightProvider({ children }: Readonly<Props>) {
const [selectedGraphic, setSelectedGraphic] = useState<__esri.Graphic | null>(
null,
);
const [viewOnMapClickCount, setViewOnMapClickCount] = useState(0);
const state: State = useMemo(() => {
return {
highlightedGraphic,
setHighlightedGraphic,
selectedGraphic,
setSelectedGraphic,
viewOnMapClickCount,
setViewOnMapClickCount,
};
}, [highlightedGraphic, selectedGraphic]);
}, [highlightedGraphic, selectedGraphic, viewOnMapClickCount]);

return (
<StateContext.Provider value={state}>{children}</StateContext.Provider>
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export interface CongressionalDistrictAttributes {
}

export interface CountyAttributes {
CNTY_FIPS: string;
COUNTY_FIPS: string;
STATE_NAME: string;
}

Expand Down
11 changes: 6 additions & 5 deletions app/client/src/utils/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ function useWaterbodyOnMap(
// parameter is true, this will also attempt to highlight waterbodies on
// other layers that have the same organization id and assessment unit id.
function useWaterbodyHighlight(findOthers: boolean = true) {
const { highlightedGraphic, selectedGraphic } = useMapHighlightState();
const { highlightedGraphic, selectedGraphic, viewOnMapClickCount } =
useMapHighlightState();
const { mapView, huc12, highlightOptions, pointsData, linesData, areasData } =
useContext(LocationSearchContext);

Expand Down Expand Up @@ -478,7 +479,7 @@ function useWaterbodyHighlight(findOthers: boolean = true) {
configFiles.data,
);
});
}, [configFiles, mapView, navigate, selectedGraphic]);
}, [configFiles, mapView, navigate, selectedGraphic, viewOnMapClickCount]);

// Initializes a handles object for more efficient handling of highlight handlers
const [handles, setHandles] = useState<Handles | null>(null);
Expand Down Expand Up @@ -1222,7 +1223,7 @@ function useSharedLayers({
legendEnabled: false,
renderer: new SimpleRenderer({
symbol: new SimpleFillSymbol({
style: 'none',
color: [255, 255, 255, 0],
outline: {
style: 'solid',
color: '#FF00C5',
Expand Down Expand Up @@ -1259,7 +1260,7 @@ function useSharedLayers({
}

function getCountyLayer() {
const countyLayerOutFields = ['CNTY_FIPS', 'FIPS', 'NAME', 'STATE_NAME'];
const countyLayerOutFields = ['COUNTY_FIPS', 'FIPS', 'NAME', 'STATE_NAME'];
const countyLayer = new FeatureLayer({
id: 'countyLayer',
url: configFiles.data.services.counties,
Expand All @@ -1270,7 +1271,7 @@ function useSharedLayers({
outFields: countyLayerOutFields,
renderer: new SimpleRenderer({
symbol: new SimpleFillSymbol({
style: 'none',
color: [255, 255, 255, 0],
outline: {
color: [251, 164, 93, 255],
width: 0.75,
Expand Down
6 changes: 3 additions & 3 deletions app/client/src/utils/mapFunctions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,8 @@ export function getPopupTitle(attributes: PopupAttributes | null) {
}

// county
else if ('CNTY_FIPS' in attributes) {
title = `${attributes.STATE_NAME} County ${attributes.CNTY_FIPS}`;
else if ('COUNTY_FIPS' in attributes) {
title = `${attributes.STATE_NAME} County ${attributes.COUNTY_FIPS}`;
}

// congressional district
Expand Down Expand Up @@ -844,7 +844,7 @@ export function getPopupContent({
}

// county
else if ('CNTY_FIPS' in attributes) {
else if ('COUNTY_FIPS' in attributes) {
type = 'County';
}

Expand Down
6 changes: 3 additions & 3 deletions app/cypress/e2e/add-data-widget.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('Add & Save Data Widget', () => {
});

// Run tests against "ArcGIS Online"
runSearchTests('USA Counties (Generalized)');
runSearchTests('Covid-19 kommunalt data');
});

it('Test URL feature', () => {
Expand Down Expand Up @@ -335,7 +335,7 @@ describe('Add & Save Data Widget', () => {
force: true,
});
// toggle off a layer
cy.findByText('Boundaries').click({ force: true });
cy.findByText('Selected Watershed').click({ force: true });
});

cy.get(adwId).within(() => {
Expand All @@ -344,7 +344,7 @@ describe('Add & Save Data Widget', () => {
cy.findByRole('switch', {
name: 'Toggle Congressional Districts',
}).should('have.attr', 'aria-checked', 'true');
cy.findByRole('switch', { name: 'Toggle Boundaries' }).should(
cy.findByRole('switch', { name: 'Toggle Selected Watershed' }).should(
'have.attr',
'aria-checked',
'false',
Expand Down
2 changes: 1 addition & 1 deletion app/cypress/e2e/data.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('Data page', () => {
scrollTest(
'Watershed Assessment, Tracking & Environmental Results System (WATERS)',
);
scrollTest('Watershed Index Online (WSIO)');
scrollTest('Restoration and Protection Screening (RPS)');
scrollTest('Wild and Scenic Rivers');

// loop through and verify the "Top of Page" buttons all scroll to
Expand Down
10 changes: 5 additions & 5 deletions app/server/app/public/data/community/extreme-weather.json
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@
"intro": "<strong>Read more about</strong> how waters, communities, and assets are vulnerable to various extreme events, and how people are learning to adapt and build resiliency.",
"sections": [
{
"description": "Read more about how to adapt, mitigate, and build resiliency to extreme events and climate change",
"description": "Read more about how to adapt, mitigate, and build resiliency to extreme events",
"items": [
{
"label": "Office of Water Climate Adaptation Implementation Plan",
Expand Down Expand Up @@ -929,7 +929,7 @@
]
},
{
"description": "Read more about how waters, infrastructure, and communities are potentially vulnerable to extreme events and climate change",
"description": "Read more about how waters, infrastructure, and communities are potentially vulnerable to extreme events",
"items": [
{
"label": "Water quality and quantity",
Expand All @@ -939,15 +939,15 @@
"link": "https://www.epa.gov/arc-x/climate-impacts-water-quality#:~:text=Harmful%20Algal%20Blooms,-Develop%20models%20to&text=In%20many%20areas%2C%20increased%20water,due%20to%20extreme%20storm%20events"
},
{
"label": "Water Quality & Climate Change Research",
"label": "Water Quality & Climate Research",
"link": "https://www.epa.gov/climate-research/ecosystems-water-quality-climate-change-research#WaterQuality"
},
{
"label": "Wildfires and Water Quality Research",
"link": "https://www.epa.gov/water-research/wildfires-and-water-quality-research"
},
{
"label": "Understanding Climate Change Impacts on Water Resources",
"label": "Understanding Climate Impacts on Water Resources",
"link": "https://www.epa.gov/watershedacademy/understanding-climate-change-impacts-water-resources-module"
}
]
Expand Down Expand Up @@ -977,7 +977,7 @@
"link": "https://www.epa.gov/climateimpacts/climate-equity#:~:text=Some%20communities%20experience%20disproportionate%20impacts,affected%20most%20by%20climate%20change"
},
{
"label": "Water-Related Illnesses and Climate Change",
"label": "Water-Related Illnesses and Climate",
"link": "https://www.epa.gov/climateimpacts/climate-change-and-health-socially-vulnerable-people#water"
}
]
Expand Down
Loading

0 comments on commit c9cc245

Please sign in to comment.