Skip to content

Commit

Permalink
Merge pull request #7 from concord-consortium/add-information-text
Browse files Browse the repository at this point in the history
Add information text to pop-up. (PT-186025103)
  • Loading branch information
lublagg authored Sep 25, 2023
2 parents 7ae7163 + 8a79770 commit 8105b80
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 16 deletions.
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 @@ export const Information: React.FC<IProps> = (props) => {
<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
Expand Up @@ -21,8 +21,16 @@ export const Warning: React.FC<IProps> = (props) => {
</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 @@ -113,7 +113,7 @@ export const getAllAttrs = (selectedOptions: IStateOptions) => {
}
}
return allAttrs;
}
};

export const getNumberOfItems = (selectedOptions: IStateOptions) => {
let {states, years} = selectedOptions;
Expand All @@ -126,10 +126,10 @@ export const getNumberOfItems = (selectedOptions: IStateOptions) => {
} 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

0 comments on commit 8105b80

Please sign in to comment.