Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add information text to pop-up. (PT-186025103) #7

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ function App() {
const res = await createTableFromSelections(selectedOptions);
if (res !== "success") {
setStatusMessage("Fetch Error. Please retry.");
setStatusGraphic(<Error/>)
setStatusGraphic(<Error/>);
} else {
setStatusMessage("Fetched data.");
setStatusGraphic(<Checkmark/>);
}
}
};

const handleGetData = async () => {
const numberOfRows = getNumberOfItems(selectedOptions);
Expand All @@ -75,7 +75,7 @@ function App() {
if (getDataAnyway) {
await getData();
}
}
};

return (
<div className={css.pluginContent}>
Expand Down
14 changes: 7 additions & 7 deletions src/components/information.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

.popUpContent {
position: absolute;
left: 12px;
right: 12px;
width: 310px;
left: calc(50% - 155px);
top: 35px;
z-index: 3;

Expand All @@ -17,6 +17,11 @@

max-height: 1000px;
border-width: 1px;
.popUpBody {
background-color: white;
padding: 12px;
font-size: 13px;
}
}

.popUpFooter {
Expand All @@ -35,9 +40,4 @@
left: 0;
right: 0;
bottom: 0;
}

.popUpBody {
background-color: white;
padding: 12px;
}
18 changes: 17 additions & 1 deletion src/components/information.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,23 @@
<div className={css.popUp}>
<div className={css.popUpContent}>
<div className={css.popUpBody}>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ipsum velit, pellentesque eget turpis.
<p>
<span style={{fontWeight: "bold"}}>Source:</span> This data comes from the National Agricultural Statistics Service (NASS) supplied

Check warning on line 17 in src/components/information.tsx

View workflow job for this annotation

GitHub Actions / Build and Run Jest Tests

This line has a length of 143. Maximum allowed is 120

Check warning on line 17 in src/components/information.tsx

View workflow job for this annotation

GitHub Actions / Build and Run Jest Tests

This line has a length of 143. Maximum allowed is 120

Check warning on line 17 in src/components/information.tsx

View workflow job for this annotation

GitHub Actions / S3 Deploy

This line has a length of 143. Maximum allowed is 120

Check warning on line 17 in src/components/information.tsx

View workflow job for this annotation

GitHub Actions / S3 Deploy

This line has a length of 143. Maximum allowed is 120
by the U.S. Department of Agriculture. The NASS conducts hundreds of surveys every year, curates
and makes public the data collected, and prepares reports covering virtually every aspect of U.S.
agriculture. The data collected includes production and supplies of food, farm labor and wages,
and changes in the demographics of U.S. producers.
</p>
<p><a href="https://www.nass.usda.gov/About_NASS/index.php" target="_blank" rel="noopener noreferrer">Learn more about the NASS</a></p>
<p><a href="https://quickstats.nass.usda.gov/" target="_blank" rel="noopener noreferrer">Access the full NASS dataset</a></p>
<p><a href="https://www.nass.usda.gov/Publications/index.php" target="_blank" rel="noopener noreferrer">Read reports published by NASS</a></p>
<p>
<span style={{fontWeight: "bold"}}>Acknowledgements:</span> Brought to you by the DataPBL project, a collaboration between

Check warning on line 27 in src/components/information.tsx

View workflow job for this annotation

GitHub Actions / Build and Run Jest Tests

This line has a length of 134. Maximum allowed is 120

Check warning on line 27 in src/components/information.tsx

View workflow job for this annotation

GitHub Actions / Build and Run Jest Tests

This line has a length of 134. Maximum allowed is 120

Check warning on line 27 in src/components/information.tsx

View workflow job for this annotation

GitHub Actions / S3 Deploy

This line has a length of 134. Maximum allowed is 120

Check warning on line 27 in src/components/information.tsx

View workflow job for this annotation

GitHub Actions / S3 Deploy

This line has a length of 134. Maximum allowed is 120
Concord Consortium, EL Education, and the University of Colorado. This material is supported
by the National Science Foundation under Grant No. DRL-2200887. Any opinions, findings, and
conclusions or recommendations expressed in this material are those of the authors and
do not necessarily reflect the views of the NSF.
</p>
</div>
<div className={css.popUpFooter}>
<div className={css.controlRow}>
Expand Down
12 changes: 10 additions & 2 deletions src/components/warning.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import WarningIcon from "../assets/warning.svg";

Check warning on line 2 in src/components/warning.tsx

View workflow job for this annotation

GitHub Actions / Build and Run Jest Tests

'WarningIcon' is defined but never used

Check warning on line 2 in src/components/warning.tsx

View workflow job for this annotation

GitHub Actions / Build and Run Jest Tests

'WarningIcon' is defined but never used

Check warning on line 2 in src/components/warning.tsx

View workflow job for this annotation

GitHub Actions / S3 Deploy

'WarningIcon' is defined but never used

Check warning on line 2 in src/components/warning.tsx

View workflow job for this annotation

GitHub Actions / S3 Deploy

'WarningIcon' is defined but never used
import css from "./warning.scss";

interface IProps {
Expand All @@ -21,8 +21,16 @@
</div>
<div className={css.popUpFooter}>
<div className={css.controlRow}>
<span><button className={css.button} onClick={() => handleCloseWarning(false)}>Change Attribute Selection</button></span>
<span><button className={css.button} onClick={() => handleCloseWarning(true)}>Get Data Anyway</button></span>
<span>
<button className={css.button} onClick={() => handleCloseWarning(false)}>
Change Attribute Selection
</button>
</span>
<span>
<button className={css.button} onClick={() => handleCloseWarning(true)}>
Get Data Anyway
</button>
</span>
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
(queryParams?.statisticcat_desc as ICropCategory)[cropCategory] :
statisticcat_desc;

const locationHeader = geographicLevel === "REGION : MULTI-STATE" ? "region_desc" : geographicLevel === "County" ? "county_name" : "state_name";

Check warning on line 67 in src/scripts/api.ts

View workflow job for this annotation

GitHub Actions / Build and Run Jest Tests

This line has a length of 146. Maximum allowed is 120

Check warning on line 67 in src/scripts/api.ts

View workflow job for this annotation

GitHub Actions / S3 Deploy

This line has a length of 146. Maximum allowed is 120

const baseReq = `${baseURL}` +
`&sect_desc=${encodeURIComponent(sect_desc)}` +
Expand Down Expand Up @@ -113,7 +113,7 @@
}
}
return allAttrs;
}
};

export const getNumberOfItems = (selectedOptions: IStateOptions) => {
let {states, years} = selectedOptions;
Expand All @@ -126,10 +126,10 @@
} else {
return states.length * years.length;
}
}
};

export const createTableFromSelections = async (selectedOptions: IStateOptions) => {
const {geographicLevel, states, cropUnits, years, ...subOptions} = selectedOptions;
const {geographicLevel} = selectedOptions;
try {
const allAttrs = getAllAttrs(selectedOptions);
const requests = getAllRequests(selectedOptions);
Expand Down
Loading