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

Limit the datasets for analysis #675

Merged
merged 24 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
92f0574
Thorw errors if too many statistics are requested
hanbyul-here Sep 22, 2023
db3fd08
Merge branch 'main' of github.com:NASA-IMPACT/veda-ui into feature/li…
nerik Sep 25, 2023
441f059
Return the guessed number of items based on collection metadata
nerik Sep 25, 2023
42de6bc
Fixed types and variable names
nerik Sep 25, 2023
c0f6b72
Memoize datasets
nerik Sep 25, 2023
f1e7171
Updated analysis flow wording
nerik Sep 26, 2023
9b24cd4
Added sticky footer
nerik Sep 26, 2023
35bd7fa
Prevent users from selecting datasets with too many data points
nerik Sep 26, 2023
2af6225
Fixed number of data points estimate when isPeriodic=false using time…
nerik Sep 26, 2023
0a4a000
Changed date presets
nerik Sep 26, 2023
a67f413
Replace reset icon
nerik Sep 26, 2023
fd884ee
Added north america preset
nerik Sep 26, 2023
30ec70b
Fix getNumberOfItem logic when dataset is not periodic, add unit test
hanbyul-here Sep 26, 2023
7f5c11f
Style for 1,2,3 step
hanbyul-here Sep 26, 2023
180447b
Use fold for footer items
hanbyul-here Sep 26, 2023
d27f634
Align date selection tools, lint
hanbyul-here Sep 27, 2023
ee5a107
Select 2018-2022 date range by default
nerik Sep 27, 2023
a40244d
Hardcode min and max dates to 1980-01-01 through 2022-12-31
nerik Sep 27, 2023
f9ae022
Initialize the map with North America AoI
nerik Sep 27, 2023
5c7a87d
Correct month
j08lue Sep 27, 2023
15a3227
Revert "Correct month"
nerik Sep 27, 2023
240017f
Revert "Initialize the map with North America AoI"
nerik Sep 27, 2023
9abac3b
Some design polish
nerik Sep 27, 2023
e85073e
Feature/analysis flow (#677)
nerik Sep 27, 2023
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
50 changes: 50 additions & 0 deletions app/scripts/components/analysis/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { FeatureCollection, Polygon } from 'geojson';
import { featureCollection } from '@turf/helpers';

export type RegionPreset = 'world' | 'north-america';

export const FeatureByRegionPreset: Record<
RegionPreset,
FeatureCollection<Polygon>
> = {
world: featureCollection([
{
type: 'Feature',
id: 'world',
properties: {},
geometry: {
coordinates: [
[
[-180, -89],
[180, -89],
[180, 89],
[-180, 89],
[-180, -89]
]
],
type: 'Polygon'
}
}
]),
'north-america': featureCollection([
{
type: 'Feature',
id: 'north-america',
properties: {},
geometry: {
coordinates: [
[
[-180, 0],
[-180, 89],
[-60, 89],
[-60, 0],
[-180, 0]
]
],
type: 'Polygon'
}
}
])
};

export const MAX_QUERY_NUM = 300;
28 changes: 19 additions & 9 deletions app/scripts/components/analysis/define/aoi-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,19 @@
import { Button, ButtonGroup } from '@devseed-ui/button';
import { Dropdown, DropMenu, DropTitle } from '@devseed-ui/dropdown';
import {
CollecticonArrowLoop,
CollecticonTrashBin,
CollecticonHandPan,
CollecticonMarker,
CollecticonPencil,
CollecticonUpload2
} from '@devseed-ui/collecticons';
import { FeatureByRegionPreset, RegionPreset } from './constants';
import { FeatureByRegionPreset, RegionPreset } from '../constants';
import AoIUploadModal from './aoi-upload-modal';
import { FoldWGuideLine, FoldTitleWOAccent } from '.';
import {
Fold,
FoldHeader,
FoldHeadline,
FoldHeadActions,
FoldTitle,
FoldBody
} from '$components/common/fold';
import MapboxMap, { MapboxMapRef } from '$components/common/mapbox';
Expand Down Expand Up @@ -96,7 +95,7 @@
];
mapRef.current?.instance?.fitBounds(fcBbox, { padding: 32 });
},
[onAoiEvent]

Check warning on line 98 in app/scripts/components/analysis/define/aoi-selector.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useCallback has a missing dependency: 'mapRef'. Either include it or remove the dependency array
);

const onRegionPresetClick = useCallback(
Expand All @@ -115,29 +114,33 @@
onAoiEvent('aoi.clear');
mapRef.current?.instance?.flyTo({ zoom: 1, center: [0, 0] });
}
}, [onAoiEvent, qsFc, setFeatureCollection]);

Check warning on line 117 in app/scripts/components/analysis/define/aoi-selector.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useEffect has a missing dependency: 'mapRef'. Either include it or remove the dependency array

const [aoiModalRevealed, setAoIModalRevealed] = useState(false);

return (
<Fold>
<FoldWGuideLine number={1}>
<AoIUploadModal
setFeatureCollection={setFeatureCollection}
revealed={aoiModalRevealed}
onCloseClick={() => setAoIModalRevealed(false)}
/>
<FoldHeader>
<FoldHeadline>
<FoldTitle>Area</FoldTitle>
<FoldTitleWOAccent>Select area of interest</FoldTitleWOAccent>
<p>
Use the pencil tool to draw a shape on the map or upload your own
shapefile.
</p>
</FoldHeadline>
<AoiHeadActions>
<Toolbar>
<ToolbarIconButton
variation='primary-fill'
variation='danger-fill'
onClick={() => onAoiEvent('aoi.clear')}
disabled={!featureCollection?.features.length}
>
<CollecticonArrowLoop title='Clear map' meaningful />
<CollecticonTrashBin title='Clear map' meaningful />
</ToolbarIconButton>
<VerticalDivider variation='dark' />
<ButtonGroup variation='primary-fill'>
Expand Down Expand Up @@ -179,6 +182,13 @@
World
</DropMenuItemButton>
</li>
<li>
<DropMenuItemButton
onClick={() => onRegionPresetClick('north-america')}
>
North America
</DropMenuItemButton>
</li>
</DropMenu>
</Dropdown>
</Toolbar>
Expand All @@ -194,6 +204,6 @@
/>
</MapContainer>
</FoldBody>
</Fold>
</FoldWGuideLine>
);
}
29 changes: 0 additions & 29 deletions app/scripts/components/analysis/define/constants.ts

This file was deleted.

Loading
Loading