Skip to content

Commit

Permalink
MOves the weather station import to a ts file
Browse files Browse the repository at this point in the history
  • Loading branch information
eireland committed Jan 26, 2024
1 parent 1da54b4 commit 8a0ae9a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import { AttributesSelector } from "./attribute-selector";
import { AttributeFilter } from "./attribute-filter";
import { InfoModal } from "./info-modal";
import { useStateContext } from "../hooks/use-state";
import { adjustStationDataset } from "../utils/getWeatherStations";
import { adjustStationDataset, getWeatherStations } from "../utils/getWeatherStations";
import { createStationsDataset } from "../utils/codapHelpers";
import weatherStations from "../assets/data/weather-stations.json";
import InfoIcon from "../assets/images/icon-info.svg";
import { useCODAPApi } from "../hooks/use-codap-api";
import { dataTypeStore } from "../utils/noaaDataTypes";
Expand All @@ -30,13 +29,17 @@ export const App = () => {
const [statusMessage, setStatusMessage] = useState("");
const [isFetching, setIsFetching] = useState(false);
const { showModal } = state;
const weatherStations = getWeatherStations();

useEffect(() => {
initializePlugin({pluginName: kPluginName, version: kVersion, dimensions: kInitialDimensions});
adjustStationDataset(weatherStations as IWeatherStation[]); //change max data to "present"
createStationsDataset(weatherStations as IWeatherStation[]); //send weather station data to CODAP
}, []);

useEffect(() => {
adjustStationDataset(weatherStations); //change max data to "present"
createStationsDataset(weatherStations); //send weather station data to CODAP
},[weatherStations]);

const handleOpenInfo = () => {
setState(draft => {
draft.showModal = "info";
Expand Down

0 comments on commit 8a0ae9a

Please sign in to comment.