Skip to content

Commit

Permalink
GHG -> main (#679)
Browse files Browse the repository at this point in the history
## This PR, merged to `ghg`

### Features

- Analysis define
  - New step-by-step layout and various UI tweaks
  - Added sticky footer, moved submit and cancel buttons there
  - Added an AoI preset for North America
- Datasets are not filtered from `/collections` metadata (spatial,
temporal extent)
  - Dates are now set by default to 2018 - 2022
  - Replaced date presets with "2018 - 2022" and "last 10 years"
  - Date selection not possible anymore before 01-01-1980
- Prevent users from selecting datasets when time range selected would
mean fetching too many STAC items
- Analysis results page: set a hardcoded limit on the number of items
that can be requested as a failsafe mechanism for ☝️

### Bugfixes

- Removed logs in production
(US-GHG-Center/veda-config-ghg#152)
- Temporary fix of critical error encoutered during demos
(#680)
- Remove Shadow Scroll as a preventative method for
(#691)
- Check only day level equity to validate dates
(#676)
- Remove unneded attributes
(#694)
- BlockMap initial position error
(#687)

### Copy changes
- [Updated define
copy](f1e7171)
- [Disclaimer on results
page](54cf01e)


--- 

## Other PRs, merged to `main`

### Added in veda UI but made configurable (so not affecting
veda-config):
- #673
- #665
- #664

### Bugfixes
- #672
- #670 /
#666
- #662
- #691
- #650
- #676
- #694
- #687
  • Loading branch information
hanbyul-here authored Oct 12, 2023
2 parents 77f3946 + 1c6cee6 commit a52e077
Show file tree
Hide file tree
Showing 33 changed files with 867 additions and 637 deletions.
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 {
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 @@ -120,24 +119,28 @@ export default function AoiSelector({
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 @@ export default function AoiSelector({
World
</DropMenuItemButton>
</li>
<li>
<DropMenuItemButton
onClick={() => onRegionPresetClick('north-america')}
>
North America
</DropMenuItemButton>
</li>
</DropMenu>
</Dropdown>
</Toolbar>
Expand All @@ -194,6 +204,6 @@ export default function AoiSelector({
/>
</MapContainer>
</FoldBody>
</Fold>
</FoldWGuideLine>
);
}
29 changes: 0 additions & 29 deletions app/scripts/components/analysis/define/constants.ts

This file was deleted.

Loading

0 comments on commit a52e077

Please sign in to comment.