Commit e36256df authored by jrc632's avatar jrc632
Browse files

Updated from master, added apply chip

parent 395ce44c
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -56,15 +56,11 @@ export default function App() {
  const [footprintData, setFootprintData] = React.useState([]);

  const showHideSort = () => {
    console.log(showSidePanel + " -> ")
    console.log("Show/Hide");
    setShowSidePanel(!showSidePanel);
    setSidePanelVisStyle(showSidePanel ? css.shown : css.hidden);
    console.log(" -> " + showSidePanel);
  }

  const handlePanelLayout = (event) => {
    console.log("Expand/Collapse");
    setExpandResults(expandResults => !expandResults);
    setResultsExpandStyle(expandResults ? css.expanded : css.stacked);
  }
@@ -79,7 +75,7 @@ export default function App() {

  const handleFootprintClick = () => {
    setFootprintData(getFeatures);
    console.log(footprintData);
    //console.log(footprintData);
  };

  return (
+57 −30
Original line number Diff line number Diff line
@@ -21,8 +21,11 @@ import InputLabel from '@mui/material/InputLabel';
import FormControl from '@mui/material/FormControl';
import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward';
import ArrowUpwardIcon from '@mui/icons-material/ArrowUpward';
// No. of Footprints, pagination
import Slider from '@mui/material/Slider';
import Pagination from '@mui/material/Pagination';
import Chip from '@mui/material/Chip';
import FlagIcon from '@mui/icons-material/Flag';

import { getMaxNumberPages, setCurrentPage, getCurrentPage, getNumberMatched, setLimit } from "../../js/ApiJsonCollection";

@@ -74,6 +77,13 @@ let css = {
    color: "#343a40",
    fontSize: 18,
    fontWeight: 600
  },
  chipHidden: {
    visibility: "hidden"
  },
  chipShown: {
    visibility: "visible",
    textAlign: "center"
  }
};

@@ -105,14 +115,19 @@ export default function SearchAndFilterInput(props) {
  const [maxNumberFootprints, setMaxNumberFootprints] = React.useState(10);
  const [limitVal, setLimitVal] = React.useState(10);

  const handleApply = (event) => {
  const [applyChipVisStyle, setApplyChipVisStyle] = React.useState(css.chipHidden);
  const [gotoPage, setGotopage] = React.useState("Apply to go to page 2");

  const handleApply = () => {
    setTimeout(() => {
      setMaxPages(getMaxNumberPages);
      props.footprintNavClick();
    }, 1000);
    setApplyChipVisStyle(css.chipHidden);
  }

  // Clear all values
  const handleClear = (event) => {
  const handleClear = () => {
    setSortVal('');
    setSortAscCheckVal(false);
    setAreaCheckVal(false);
@@ -124,6 +139,8 @@ export default function SearchAndFilterInput(props) {
    setLimitVal(10);
    setMaxPages(getMaxNumberPages);
    setMaxNumberFootprints(getNumberMatched);

    setApplyChipVisStyle(css.chipShown);
    //// Uncomment to close details on clear
    // keywordDetails.current.open = false;
    // dateDetails.current.open = false;
@@ -174,7 +191,8 @@ export default function SearchAndFilterInput(props) {
  const handleLimitChange = (event, value) => {
    setLimitVal(value);
    setLimit(value);
    props.footprintNavClick();
    setGotopage("Apply to show " + value + " footprints");
    setApplyChipVisStyle(css.chipShown);
  }

  // resets pagination and limit when switching targets
@@ -185,16 +203,15 @@ export default function SearchAndFilterInput(props) {
      setLimit(10);
      setMaxPages(getMaxNumberPages);
      props.footprintNavClick();
    }, 1000);
    }, 2000);
  }, [props.target]);


  // Pagination
  const handlePageChange = (event, value) => {
    setCurrentPage(value);
    setTimeout(() => {
      props.footprintNavClick();
    }, 1000)
    setGotopage("Apply to go to page " + value);
    setApplyChipVisStyle(css.chipShown);
  };


@@ -359,6 +376,16 @@ export default function SearchAndFilterInput(props) {
                />
            </div>
          </div>
          <div style={applyChipVisStyle}>
            <Chip 
              id="applyChip"
              label={gotoPage}
              icon={<FlagIcon/>}
              onClick={handleApply}
              variant="outlined"
              clickable
            />
          </div>
        </div>
    </div>
  );
+7 −0
Original line number Diff line number Diff line
@@ -72,6 +72,13 @@ export default L.Control.AstroDrawControl = L.Control.Draw.extend({
    this.wktButton = L.DomUtil.get("wktButton");
    L.DomEvent.on(this.wktButton, "click", this.mapWKTString, this);

    L.DomEvent.on(
      L.DomUtil.get("applyChip"),
      "click",
      this.applyFilter,
      this
    );

    L.DomEvent.on(
      L.DomUtil.get("applyButton"),
      "click",