Add hash to send feedback email (#1551)

- detected bug with zoom/lat/lng values and created ticket 1550
- get realtime has from mapRef
- pass hash to AreaDetail as prop
- update tests and snapshots
This commit is contained in:
Vim 2022-04-12 14:49:57 -04:00 committed by GitHub
parent ce6f7974fb
commit 1ce124069d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 19 deletions

View file

@ -21,6 +21,7 @@ import mailIcon from '/node_modules/uswds/dist/img/usa-icons/mail_outline.svg';
interface IAreaDetailProps { interface IAreaDetailProps {
properties: constants.J40Properties, properties: constants.J40Properties,
hash: string[],
} }
/** /**
@ -40,7 +41,7 @@ export interface indicatorInfo {
threshold?: number, threshold?: number,
} }
const AreaDetail = ({properties}:IAreaDetailProps) => { const AreaDetail = ({properties, hash}:IAreaDetailProps) => {
const intl = useIntl(); const intl = useIntl();
// console.log the properties of the census that is selected: // console.log the properties of the census that is selected:
@ -55,7 +56,10 @@ const AreaDetail = ({properties}:IAreaDetailProps) => {
const isCommunityFocus = score >= constants.SCORE_BOUNDARY_THRESHOLD; const isCommunityFocus = score >= constants.SCORE_BOUNDARY_THRESHOLD;
const feedbackEmailSubject = `Census tract ID ${blockGroup}, ${countyName}, ${stateName}`; const feedbackEmailSubject = hash ? `
Census tract ID ${blockGroup}, ${countyName}, ${stateName}, ( z/lat/lon: #${hash.join('/')} )
` : `Census tract ID ${blockGroup}, ${countyName}, ${stateName}`;
const feedbackEmailBody = intl.formatMessage(EXPLORE_COPY.SEND_FEEDBACK.EMAIL_BODY); const feedbackEmailBody = intl.formatMessage(EXPLORE_COPY.SEND_FEEDBACK.EMAIL_BODY);
/** /**

View file

@ -22,7 +22,7 @@ exports[`rendering of the AreaDetail checks if indicators for ISLAND AREAS are p
County: County:
</span> </span>
<span> <span>
N/A Brooklyn
</span> </span>
</li> </li>
<li> <li>
@ -30,7 +30,7 @@ exports[`rendering of the AreaDetail checks if indicators for ISLAND AREAS are p
Territory: Territory:
</span> </span>
<span> <span>
N/A New York
</span> </span>
</li> </li>
<li> <li>
@ -60,7 +60,9 @@ exports[`rendering of the AreaDetail checks if indicators for ISLAND AREAS are p
</div> </div>
<a <a
href=" href="
mailto:Screeningtool-Support@omb.eop.gov?subject=Census tract ID 98729374234, N/A, N/A&body=Please provide feedback about this census tract, including about the datasets, the data categories provided for this census tract, the communities who live in this census tract, and anything else relevant that CEQ should know about this census tract. mailto:Screeningtool-Support@omb.eop.gov?subject=
Census tract ID 98729374234, Brooklyn, New York, ( z/lat/lon: #11.54/36.0762/-84.4494 )
&body=Please provide feedback about this census tract, including about the datasets, the data categories provided for this census tract, the communities who live in this census tract, and anything else relevant that CEQ should know about this census tract.
" "
rel="noreferrer" rel="noreferrer"
@ -384,7 +386,7 @@ exports[`rendering of the AreaDetail checks if indicators for NATION is present
County: County:
</span> </span>
<span> <span>
N/A Brooklyn
</span> </span>
</li> </li>
<li> <li>
@ -392,7 +394,7 @@ exports[`rendering of the AreaDetail checks if indicators for NATION is present
State: State:
</span> </span>
<span> <span>
N/A New York
</span> </span>
</li> </li>
<li> <li>
@ -422,7 +424,9 @@ exports[`rendering of the AreaDetail checks if indicators for NATION is present
</div> </div>
<a <a
href=" href="
mailto:Screeningtool-Support@omb.eop.gov?subject=Census tract ID 98729374234, N/A, N/A&body=Please provide feedback about this census tract, including about the datasets, the data categories provided for this census tract, the communities who live in this census tract, and anything else relevant that CEQ should know about this census tract. mailto:Screeningtool-Support@omb.eop.gov?subject=
Census tract ID 98729374234, Brooklyn, New York, ( z/lat/lon: #11.54/36.0762/-84.4494 )
&body=Please provide feedback about this census tract, including about the datasets, the data categories provided for this census tract, the communities who live in this census tract, and anything else relevant that CEQ should know about this census tract.
" "
rel="noreferrer" rel="noreferrer"
@ -2121,7 +2125,7 @@ exports[`rendering of the AreaDetail checks if indicators for PUERTO RICO are pr
County: County:
</span> </span>
<span> <span>
N/A Brooklyn
</span> </span>
</li> </li>
<li> <li>
@ -2129,7 +2133,7 @@ exports[`rendering of the AreaDetail checks if indicators for PUERTO RICO are pr
Territory: Territory:
</span> </span>
<span> <span>
N/A New York
</span> </span>
</li> </li>
<li> <li>
@ -2159,7 +2163,9 @@ exports[`rendering of the AreaDetail checks if indicators for PUERTO RICO are pr
</div> </div>
<a <a
href=" href="
mailto:Screeningtool-Support@omb.eop.gov?subject=Census tract ID 98729374234, N/A, N/A&body=Please provide feedback about this census tract, including about the datasets, the data categories provided for this census tract, the communities who live in this census tract, and anything else relevant that CEQ should know about this census tract. mailto:Screeningtool-Support@omb.eop.gov?subject=
Census tract ID 98729374234, Brooklyn, New York, ( z/lat/lon: #11.54/36.0762/-84.4494 )
&body=Please provide feedback about this census tract, including about the datasets, the data categories provided for this census tract, the communities who live in this census tract, and anything else relevant that CEQ should know about this census tract.
" "
rel="noreferrer" rel="noreferrer"

View file

@ -15,17 +15,19 @@ describe('rendering of the AreaDetail', () => {
[constants.SCORE_PROPERTY_HIGH]: .95, [constants.SCORE_PROPERTY_HIGH]: .95,
[constants.GEOID_PROPERTY]: 98729374234, [constants.GEOID_PROPERTY]: 98729374234,
[constants.TOTAL_POPULATION]: 3435435, [constants.TOTAL_POPULATION]: 3435435,
[constants.STATE_NAME]: 'New York',
[constants.COUNTY_NAME]: 'Brooklyn',
[constants.POVERTY_BELOW_200_PERCENTILE]: .19, [constants.POVERTY_BELOW_200_PERCENTILE]: .19,
[constants.SIDE_PANEL_STATE]: constants.SIDE_PANEL_STATE_VALUES.NATION, [constants.SIDE_PANEL_STATE]: constants.SIDE_PANEL_STATE_VALUES.NATION,
[constants.COUNT_OF_CATEGORIES_DISADV]: 5, [constants.COUNT_OF_CATEGORIES_DISADV]: 5,
[constants.TOTAL_NUMBER_OF_DISADVANTAGE_INDICATORS]: 3, [constants.TOTAL_NUMBER_OF_DISADVANTAGE_INDICATORS]: 3,
}; };
const hash = ['11.54', '36.0762', '-84.4494'];
it('checks if indicators for NATION is present', () => { it('checks if indicators for NATION is present', () => {
const {asFragment} = render( const {asFragment} = render(
<LocalizedComponent> <LocalizedComponent>
<AreaDetail properties={properties}/> <AreaDetail properties={properties} hash={hash}/>
</LocalizedComponent>, </LocalizedComponent>,
); );
expect(asFragment()).toMatchSnapshot(); expect(asFragment()).toMatchSnapshot();
@ -39,7 +41,7 @@ describe('rendering of the AreaDetail', () => {
const {asFragment} = render( const {asFragment} = render(
<LocalizedComponent> <LocalizedComponent>
<AreaDetail properties={propertiesPR}/> <AreaDetail properties={propertiesPR} hash={hash}/>
</LocalizedComponent>, </LocalizedComponent>,
); );
expect(asFragment()).toMatchSnapshot(); expect(asFragment()).toMatchSnapshot();
@ -57,7 +59,7 @@ describe('rendering of the AreaDetail', () => {
const {asFragment} = render( const {asFragment} = render(
<LocalizedComponent> <LocalizedComponent>
<AreaDetail properties={propertiesIA}/> <AreaDetail properties={propertiesIA} hash={hash}/>
</LocalizedComponent>, </LocalizedComponent>,
); );
expect(asFragment()).toMatchSnapshot(); expect(asFragment()).toMatchSnapshot();

View file

@ -102,7 +102,10 @@ export const featureURLForTilesetName = (tilesetName: string): string => {
const J40Map = ({location}: IJ40Interface) => { const J40Map = ({location}: IJ40Interface) => {
/** /**
* Initializes the zoom, and the map's center point (lat, lng) via the URL hash #{z}/{lat}/{long} * Initializes the zoom, and the map's center point (lat, lng) via the URL hash #{z}/{lat}/{long}
* where: * where
* @TODO: These values do not update when zooming in/out. Could explain a number of cypress bugs
* reference to ticket #1550
*
* z = zoom * z = zoom
* lat = map center's latitude * lat = map center's latitude
* long = map center's longitude * long = map center's longitude
@ -132,6 +135,7 @@ const J40Map = ({location}: IJ40Interface) => {
const selectedFeatureId = (selectedFeature && selectedFeature.id) || ''; const selectedFeatureId = (selectedFeature && selectedFeature.id) || '';
const filter = useMemo(() => ['in', constants.GEOID_PROPERTY, selectedFeatureId], [selectedFeature]); const filter = useMemo(() => ['in', constants.GEOID_PROPERTY, selectedFeatureId], [selectedFeature]);
const zoomLatLngHash = mapRef.current?.getMap()._hash._getCurrentHash();
/** /**
* This function will return the bounding box of the current map. Comment in when needed. * This function will return the bounding box of the current map. Comment in when needed.
* { * {
@ -444,7 +448,7 @@ const J40Map = ({location}: IJ40Interface) => {
onClose={setDetailViewData} onClose={setDetailViewData}
captureScroll={true} captureScroll={true}
> >
<AreaDetail properties={detailViewData.properties} /> <AreaDetail properties={detailViewData.properties} hash={zoomLatLngHash}/>
</Popup> </Popup>
)} )}
@ -477,6 +481,7 @@ const J40Map = ({location}: IJ40Interface) => {
className={styles.mapInfoPanel} className={styles.mapInfoPanel}
featureProperties={detailViewData?.properties} featureProperties={detailViewData?.properties}
selectedFeatureId={selectedFeature?.id} selectedFeatureId={selectedFeature?.id}
hash={zoomLatLngHash}
/> />
</Grid> </Grid>
</> </>

View file

@ -6,13 +6,14 @@ interface IMapInfoPanelProps {
className: string, className: string,
featureProperties: { [key:string]: string | number } | undefined, featureProperties: { [key:string]: string | number } | undefined,
selectedFeatureId: string | number | undefined selectedFeatureId: string | number | undefined
hash: string[],
} }
const MapInfoPanel = ({className, featureProperties, selectedFeatureId}:IMapInfoPanelProps) => { const MapInfoPanel = ({className, featureProperties, selectedFeatureId, hash}:IMapInfoPanelProps) => {
return ( return (
<div className={className} > <div className={className} >
{(featureProperties && selectedFeatureId ) ? {(featureProperties && selectedFeatureId ) ?
<AreaDetail properties={featureProperties} /> : <AreaDetail properties={featureProperties} hash={hash}/> :
<SidePanelInfo /> <SidePanelInfo />
} }
</div> </div>