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

186719430 station selection list #22

Merged
merged 11 commits into from
Jan 26, 2024
6 changes: 1 addition & 5 deletions src/components/App.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
.body {
width: 360px;
}

.App {
padding: 12px;
box-sizing: border-box;
box-sizing: content-box;
display: flex;
flex-direction: column;
align-items: center;
Expand Down
9 changes: 6 additions & 3 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,12 +29,16 @@ 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});
}, []);

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

const handleOpenInfo = () => {
setState(draft => {
Expand Down
93 changes: 81 additions & 12 deletions src/components/location-picker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,96 @@
.location-header {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
flex-wrap: nowrap;
height: 16px;
margin: 9px 12px 0 0;

.location-title {
font-weight: 600;
}

.selected-weather-station {
padding: 2px 2px 2px 8px;
background-color: $teal-light-25;
color: $teal-dark;
font-size: 10px;
font-weight: 500;
.station-distance {
font-style: italic;
.weather-station-wrapper {
display: flex;
flex-direction: column;
align-items: flex-end;
position: relative;
right: 40px;
max-width: 311px;

.selected-weather-station {
padding: 2px 2px 2px 8px;
background-color: $teal-light-25;
color: $teal-dark;
font-size: 10px;
font-weight: 500;
display: flex;
flex-direction: row;
align-items: center;
max-width: 245px;

.station-distance {
font-style: italic;
margin-right: 4px;
}

.station-name {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
max-width: 175px;
}
svg {
height: 12px;
width: 12px;
margin-left: 6px;
}
}
.location-edit-icon {
height: 12px;
width: 12px;

.station-selection-list {
height: 86px;
padding: 8px 13px;
box-shadow: 0 5px 8px 0 rgba(0, 0, 0, 0.5);
background-color: #fff;
list-style-type: none;
margin-top: 0;
visibility: hidden;
max-width: 311px;

&.show {
visibility: visible;
z-index: 5;
}

.station-selection {
font-family: "Montserrat", sans-serif;
font-size: 10px;
font-weight: 500;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 2px 0;
gap: 4px;

.station-name {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
color: #000;
max-width: 160px;
}
.station-distance {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
color: $teal-dark-75;
min-width: 120px;
}
&.selected-station {
background-color: $teal-medium;
}
}
}
}
}
Expand Down
Loading
Loading