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

Exploration page (E&A merge) #598

Merged
merged 249 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
249 commits
Select commit Hold shift + click to select a range
4f01df9
Add experiment with timeline
danielfdsilva May 30, 2023
d5f1e48
Style dataset list items and timeline heads
danielfdsilva Jul 17, 2023
15b6aaa
Add datepickers
danielfdsilva Jul 19, 2023
32e87b5
Add custom date axis
danielfdsilva Jul 20, 2023
1e6ae69
Add right space to timeline
danielfdsilva Jul 31, 2023
4739561
Add scale factors
danielfdsilva Aug 2, 2023
aa277dc
Create exploration page with timeline
danielfdsilva Aug 2, 2023
7d8c093
Fix timeline rescale glitch
danielfdsilva Aug 2, 2023
f4b93db
Handle dataset loading and error
danielfdsilva Aug 3, 2023
bbcc349
Improve extent calculation
danielfdsilva Aug 4, 2023
64d0c61
Fix scale calculation and dragging select
danielfdsilva Aug 4, 2023
9c465f2
Add empty state when there's no loaded datasets
danielfdsilva Aug 4, 2023
b404050
Set initial dates upon dataset selection
danielfdsilva Aug 7, 2023
8ff19b3
Add analysis chart
danielfdsilva Aug 11, 2023
420f3d1
Add metrics and expand controls
danielfdsilva Aug 11, 2023
8335cdf
Add dataset options menu
danielfdsilva Aug 11, 2023
7fb12d7
Add floating-ui library
danielfdsilva Aug 21, 2023
eebf5e6
Add dataset hover interaction based on mouse position
danielfdsilva Aug 21, 2023
05d259f
Add dataset analysis types and mock data
danielfdsilva Aug 21, 2023
b7c0a90
Highlight interaction data point on chart
danielfdsilva Aug 21, 2023
d42ba98
Add a popover to the analysis chart with hovered information
danielfdsilva Aug 21, 2023
4dd03ff
Add retry button to error messages
danielfdsilva Aug 30, 2023
0e5dce8
Implement preliminary dataset selector modal
danielfdsilva Aug 30, 2023
5ba5508
Remove sandbox from timeline
danielfdsilva Aug 30, 2023
57975e4
Lint files
danielfdsilva Aug 30, 2023
9ab1a86
Fix button disabled styles
danielfdsilva Sep 4, 2023
9307c7d
Add support for different legend types
danielfdsilva Aug 31, 2023
7dc1fcf
Move code around according to review
danielfdsilva Sep 4, 2023
8e1041e
Set up basic map
nerik Sep 4, 2023
57b9017
Implement preliminary dataset selector modal (#639)
danielfdsilva Sep 4, 2023
394e50e
Add layer legends to timeline (#642)
danielfdsilva Sep 4, 2023
3372282
Reorganize exploration files (#644)
danielfdsilva Sep 4, 2023
ec5f90d
Add STAC metadata integration
danielfdsilva Sep 4, 2023
38b08aa
Rename errors to better match react query
danielfdsilva Sep 4, 2023
61db488
Set up compare map
nerik Sep 5, 2023
4612278
Use styles generator
nerik Sep 5, 2023
98a68e9
Added GeocoderControl as an control example
nerik Sep 5, 2023
d6c35c4
Merged fature/exploration
nerik Sep 5, 2023
77bfa2d
Fixed CSS error
nerik Sep 5, 2023
f976b26
Add type narrowing and discriminants
danielfdsilva Sep 6, 2023
8d5c880
Implement dataset metadata refetching
danielfdsilva Sep 6, 2023
cf3d972
Properly sync compare map
nerik Sep 6, 2023
3af6b14
Simplified style handling
nerik Sep 6, 2023
b91e47a
Adressed various CR comments
nerik Sep 6, 2023
21ec633
Replace dummy Comapre component with hook
nerik Sep 6, 2023
9aef99e
Split into multiple components
nerik Sep 6, 2023
bb77814
Fixed resizing issue
nerik Sep 6, 2023
89b69ca
Fixed filenames case
nerik Sep 6, 2023
46be4fc
unique ids for maps
nerik Sep 6, 2023
51185d0
Fixed issue with printing 0
nerik Sep 7, 2023
d041705
Fix map position and conditionally show mock controls
danielfdsilva Sep 7, 2023
4d341ed
Improve timeline dataset types
danielfdsilva Sep 7, 2023
f41cf04
Fixed keyboard shortcut
nerik Sep 7, 2023
9de327e
Fix css for compare map
danielfdsilva Sep 7, 2023
95213dd
Only instanciate map compare when compare map is (un)mounted
nerik Sep 8, 2023
2bdfc83
Fix last domain date not being included
danielfdsilva Sep 8, 2023
947066b
Feature/exploration map (#646)
nerik Sep 11, 2023
1ee5379
Add basic controls wrappers
nerik Sep 11, 2023
9130bc9
Show controls on both compare maps
nerik Sep 11, 2023
d2ec945
Added coords and a generic hook to render a custom control
nerik Sep 11, 2023
957ad79
Fix last domain date not being included (#650)
danielfdsilva Sep 11, 2023
f1f0204
Added map options
nerik Sep 12, 2023
cfe26f7
Lump dataset blocks together when zooming out
danielfdsilva Sep 8, 2023
3177feb
Fixed linting error
nerik Sep 14, 2023
962e440
Sync basemaps
nerik Sep 14, 2023
f027c94
Disable pitch and rotation
nerik Sep 14, 2023
29f79cc
Integrates STAC metadata request (#645)
danielfdsilva Sep 14, 2023
e1cbdd5
Merge branch 'feature/exploration' into feature/exploration-map-controls
nerik Sep 14, 2023
70d0782
reuse raster timeseries
nerik Sep 14, 2023
aa1d0c4
Removed idSuffix
nerik Sep 18, 2023
9f1f6c4
Handle visibility in a generic way
nerik Sep 18, 2023
7a1b27b
Improve dataset track stacked look
danielfdsilva Sep 18, 2023
1e18cce
Add current to map context and hook
nerik Sep 18, 2023
8322abf
Ensure labels and boundaries are applied to both maps
danielfdsilva Sep 18, 2023
560fdd7
Exploration map controls (#651)
nerik Sep 18, 2023
6711901
Load sprite from styles wrapper
nerik Sep 18, 2023
c489680
Use map directly from hook
nerik Sep 18, 2023
482fb9d
Rebased pparent branch
nerik Sep 18, 2023
12b1a9c
Fixed linting error
nerik Sep 18, 2023
e34c350
Lump dataset blocks (#649)
nerik Sep 19, 2023
b18c3f6
Fixed type
nerik Sep 21, 2023
4910c17
Access context through hooks
nerik Sep 21, 2023
52e1349
Raster timeseries (#655)
nerik Sep 21, 2023
9949537
Add layerOrder to raster timeseries layer
danielfdsilva Sep 22, 2023
ac17b50
Add opacity support to raster timeseries layer
danielfdsilva Sep 22, 2023
3be9f44
Improve dataset settings hook typings
danielfdsilva Sep 22, 2023
9a1c07c
Render selected datasets on map
danielfdsilva Sep 22, 2023
8fb81af
Clean up files and render compare layers
danielfdsilva Sep 23, 2023
9185f00
Fix pointer events on new map controls
nerik Sep 25, 2023
e23f228
Merge branch 'main' of github.com:NASA-IMPACT/veda-ui into feature/ex…
nerik Sep 25, 2023
0cc3745
Reverse layer order
nerik Oct 2, 2023
c055024
Handle generator order at styles level
nerik Oct 2, 2023
0a33ddb
Display selected datasets on the map (#668)
nerik Oct 2, 2023
2d8b371
Fix pointer events on new map controls (#674)
nerik Oct 2, 2023
530acb1
Basic AoIs using URL hash
nerik Oct 4, 2023
9bca0b4
Show URL polygons in the map on mount
nerik Oct 6, 2023
27b9162
Moved aoi atoms to own file
nerik Oct 10, 2023
88e0ef2
Simplify url decoding
nerik Oct 10, 2023
24dc07a
Centralize map cursor management
nerik Oct 10, 2023
46c8d16
Fixed mapbox-gl-draw cursors
nerik Oct 11, 2023
c7c3ace
Disable delete button when not applicable
nerik Oct 11, 2023
582d24c
Revert "Centralize map cursor management"
nerik Oct 11, 2023
2c3544c
Do not start drawing
nerik Oct 11, 2023
2b89c94
Use query params rather than hash
nerik Oct 11, 2023
7e42de9
Basic AoIs (#690)
nerik Oct 12, 2023
b0a33fe
Move controls to the right
nerik Oct 17, 2023
c2ac66e
Updated icons
nerik Oct 17, 2023
6a6f688
Fix colors
nerik Oct 17, 2023
aa951ed
Set control group to horizontal layout
nerik Oct 17, 2023
57c5e7e
Removed Navigation control
nerik Oct 17, 2023
465739e
Set up trigger button and modal
nerik Oct 17, 2023
496301b
Use custom AoI
nerik Oct 17, 2023
47f9405
Feature/exploration map controls polish (#702)
nerik Oct 17, 2023
8161928
Add analysis data request
danielfdsilva Sep 8, 2023
c3be001
include aoi in stats query key
danielfdsilva Oct 11, 2023
15a2dba
Use map aoi to run analysis
danielfdsilva Oct 11, 2023
4f6d556
Add preliminary map message
danielfdsilva Oct 11, 2023
bc3d5f2
Handle analysis metrics on a dataset basis
danielfdsilva Oct 12, 2023
d13a827
Move taxonomy filters above text search
danielfdsilva Oct 16, 2023
d6cdb72
Add onLinkClick to ElementInteractive
danielfdsilva Oct 16, 2023
3171d81
Convert EmptyHub to styled component
danielfdsilva Oct 16, 2023
e651212
Implement analysis dataset selector modal
danielfdsilva Oct 16, 2023
c85e642
Fix analysis cancellation not stopping requests
danielfdsilva Oct 16, 2023
23a31e7
Update analysis controller
danielfdsilva Oct 17, 2023
d86ff7e
Update modal style
danielfdsilva Oct 17, 2023
1617956
Fix ts errors
danielfdsilva Oct 17, 2023
d3d37bd
Properly locate handler to trigger custom AoI modal
nerik Oct 19, 2023
ce2f577
Custom AoI upload (#703)
nerik Oct 19, 2023
3b7cae4
Implement analysis message and convert to control
danielfdsilva Oct 19, 2023
c46bf5d
Merge branch 'feature/exploration' into feature/analysis-requests
danielfdsilva Oct 19, 2023
ff15c00
Add analysis data request with AOIs (#699)
danielfdsilva Oct 20, 2023
0459625
Implement controls for dataset compare
danielfdsilva Oct 17, 2023
6721546
Fixed an error that caused the compare map to not be displayed properly
nerik Oct 18, 2023
bd3440c
Dataset exploration comparison (#704)
danielfdsilva Oct 23, 2023
18806be
Relocate file
nerik Oct 19, 2023
50c23da
Added reset button
nerik Oct 20, 2023
2769527
Fixed lint error
nerik Oct 20, 2023
d8a7b49
Trying to access mb draw instamce
nerik Oct 20, 2023
26a98b6
Actually delete all polygons
nerik Oct 20, 2023
e82a5fe
Clean up mbdraw/aoi atom sync
danielfdsilva Oct 25, 2023
733f10c
Update AOI button styles
danielfdsilva Oct 23, 2023
5ff51d3
Reset AoIs (#707)
danielfdsilva Oct 25, 2023
9738d47
Use a wrapper for map controls
danielfdsilva Oct 24, 2023
1c5bf02
Fix critical error on /exploration (#709)
danielfdsilva Oct 25, 2023
791d12b
Store selected exploration datasets on url
danielfdsilva Oct 23, 2023
52a1252
Store selected exploration datasets on url (#708)
danielfdsilva Oct 26, 2023
b5bab98
Store exploration dates on url
danielfdsilva Oct 26, 2023
949a61b
Exclude datasets and layers that should not be explored and analysed
danielfdsilva Oct 27, 2023
4aa735a
Add unit to analysis chart y axis
danielfdsilva Oct 30, 2023
a89b14a
Add unit to analysis chart y axis (#716)
danielfdsilva Oct 31, 2023
67f6aaf
Store exploration dates on url
danielfdsilva Oct 31, 2023
6e7f624
Display error message when the analysis items is over max
danielfdsilva Oct 31, 2023
144a6f8
Update data points limit message
danielfdsilva Oct 31, 2023
fe5ef40
Display error message when the analysis items is over max (#719)
danielfdsilva Nov 2, 2023
3f6ce6e
Fix url update cadence
danielfdsilva Oct 31, 2023
881fb48
Ensure that parsed values from location are stable
danielfdsilva Nov 2, 2023
1d8da96
Set newest dataset date as the default selected date
danielfdsilva Nov 3, 2023
b87b1bb
Remove letter from main timeline playhead
danielfdsilva Nov 3, 2023
da3b8b7
Update date range playhead behavior
danielfdsilva Nov 3, 2023
3df87ae
Add antimeridian fix to ensure polygons are inside normal coord range
danielfdsilva Nov 6, 2023
6b6372a
Do not set an interval when date domain changes
danielfdsilva Nov 6, 2023
d4aef36
Address review feedback
danielfdsilva Nov 6, 2023
d0997fc
Limit map bounds to limit draw extent
danielfdsilva Nov 6, 2023
53eb29c
Set analysis expanded by default
danielfdsilva Nov 7, 2023
a085a89
Give B playhead some buffer from A
danielfdsilva Nov 7, 2023
36038d8
Remove expand button when not in "analysis mode"
danielfdsilva Nov 7, 2023
b15530b
Simplify atoms related to url storage
danielfdsilva Nov 8, 2023
ee1b7af
Store uploaded features in aoi atom
danielfdsilva Nov 8, 2023
e53f82d
Zoom to feature on upload
danielfdsilva Nov 8, 2023
e843e7a
Ensure that a analysis help message is present when needed
danielfdsilva Nov 8, 2023
0e5978d
Fix error caused by updating url too frequently (#726)
danielfdsilva Nov 9, 2023
64e90f2
Merge remote-tracking branch 'origin/feature/exploration' into featur…
danielfdsilva Nov 9, 2023
4f0f3a6
Organize analysis messages conditionals
danielfdsilva Nov 9, 2023
d2e0e9c
Improvements to the analysis (#733)
danielfdsilva Nov 9, 2023
268e089
Improve test messages
danielfdsilva Nov 9, 2023
2c3f46d
Ensure polygons are inside -180/180 range before making stac request …
danielfdsilva Nov 9, 2023
895aafc
Add draft implementation of react tour to exploration
danielfdsilva Nov 9, 2023
e31d205
Apply suggestions from code review
danielfdsilva Nov 8, 2023
49081e5
Add tour for analysis step
danielfdsilva Nov 9, 2023
cd20ed2
Apply suggestions from code review
danielfdsilva Nov 10, 2023
a7d15b4
Guided tour of exploration page
danielfdsilva Nov 10, 2023
4ccf313
Merge main into feature/exploration
danielfdsilva Nov 10, 2023
7b09da6
Fix error with shadow scrollbar
danielfdsilva Nov 10, 2023
ce45256
Disable dataset modal keyboard close on first selection
danielfdsilva Nov 10, 2023
db7a467
Add tour step for compare
danielfdsilva Nov 15, 2023
dccf06e
Connect data catalog to exploration
danielfdsilva Nov 15, 2023
e21789d
Add text search highlight to dataset selector modal
danielfdsilva Nov 15, 2023
fc8a0a7
Remove analysis from menu
danielfdsilva Nov 15, 2023
68d327b
Add info icon to dataset card
danielfdsilva Nov 15, 2023
c8aff07
Merge branch '730-multi-stac' into feature/feedback
danielfdsilva Nov 15, 2023
f4845cc
Implement custom endpoint in A&E page
danielfdsilva Nov 15, 2023
93b3d06
Ensure that range is within domain when updated
danielfdsilva Nov 15, 2023
817d596
Add support for vector datasets on exploration page
danielfdsilva Nov 15, 2023
916f344
Fix bug where exploration state would persist after exiting
danielfdsilva Nov 15, 2023
bc5f4af
Add analysis paths back
danielfdsilva Nov 15, 2023
b34e3b4
Improvements to analysis page from the feedback (#751)
danielfdsilva Nov 17, 2023
56111aa
Add zarr support to exploration page
danielfdsilva Nov 17, 2023
727da0c
Fix race condition when getting data from cache
danielfdsilva Nov 17, 2023
7b0eeac
Add dataset tile urls modal to E&A page
danielfdsilva Nov 17, 2023
95e3e1f
Add error for non supported analysis on datasets
danielfdsilva Nov 17, 2023
d484c62
Fix bug with initial date value on date atom
danielfdsilva Nov 17, 2023
b3f57b7
Add exploration feature flag FEATURE_NEW_EXPLORATION
danielfdsilva Nov 17, 2023
8ca1aab
Enable exploration path
danielfdsilva Nov 17, 2023
cb5e40e
Apply textual suggestions from code review
danielfdsilva Nov 21, 2023
389fe3d
Add support for dataset default projection
danielfdsilva Nov 21, 2023
06e4768
Handle malformed api summaries field
danielfdsilva Nov 21, 2023
e6321d4
Improve analysis errors
danielfdsilva Nov 21, 2023
6e91e9e
Fix root unmount error on themed control
danielfdsilva Nov 22, 2023
e719b14
Fix url params race condition
danielfdsilva Nov 22, 2023
83268e0
Address review
danielfdsilva Nov 22, 2023
33a0b5e
Fix analysis not running when new dataset is added
danielfdsilva Nov 23, 2023
2707768
Exploration features and improvements
danielfdsilva Nov 27, 2023
393dfb6
Change compare date icon
danielfdsilva Nov 27, 2023
1905baa
Add label to add layer button
danielfdsilva Nov 27, 2023
09fea03
Add button tooltips
danielfdsilva Nov 27, 2023
f9ac052
Add navigation controls to map
danielfdsilva Nov 27, 2023
d017cd2
Change dataset selection indicator on selector modal
danielfdsilva Nov 27, 2023
ce9c6b0
Use single jotai location atom for url operations
danielfdsilva Nov 27, 2023
fcd0092
Implements custom controls for aoi draw tool
danielfdsilva Nov 27, 2023
21b6b18
Implement timeline zoom controls
danielfdsilva Nov 27, 2023
52a7b6b
Rename datasets to data layers
danielfdsilva Nov 28, 2023
895107d
Fix lint errors
danielfdsilva Nov 28, 2023
bcfee1b
Make timeline zoom controls always visible
danielfdsilva Nov 28, 2023
0e237ef
Add missing tooltips
danielfdsilva Nov 28, 2023
60c2118
Fix timeline zoom scaling
danielfdsilva Nov 28, 2023
368d13b
Change dataset subtitle
danielfdsilva Nov 28, 2023
e2ffcc5
Use log scale for timeline zoom controls
danielfdsilva Nov 29, 2023
89d2347
Fix feature getting deselected after drawing
danielfdsilva Nov 29, 2023
59fa631
Fix aoi flickering
danielfdsilva Nov 30, 2023
c3b3044
Disable compare when analysing and vice versa
danielfdsilva Nov 30, 2023
ab4578b
Exploration improvements from feedback. (#767)
danielfdsilva Dec 4, 2023
3f51dab
Merge branch 'main' into feature/exploration
danielfdsilva Dec 4, 2023
93b9eac
Remove dataset mocks
danielfdsilva Dec 4, 2023
14e3ea1
Throw error when domain is invalid
danielfdsilva Dec 4, 2023
c86ccea
Update analysis messages
danielfdsilva Dec 4, 2023
ad60c98
Address review
danielfdsilva Dec 5, 2023
c35908b
Fix text position
danielfdsilva Dec 5, 2023
3f82cbf
Update analysis messages (#772)
danielfdsilva Dec 5, 2023
e3b12d1
Focus tour on two features
j08lue Dec 4, 2023
8d09b8e
Change texts to be less imperative
j08lue Dec 4, 2023
cabed1f
Remove analysis specific tour
danielfdsilva Dec 5, 2023
0b4da04
Add images to analysis tour
danielfdsilva Dec 6, 2023
8e7c36c
Merge remote-tracking branch 'origin/main' into feature/exploration
danielfdsilva Dec 6, 2023
b09bfe6
Simplify feature tour (#771)
danielfdsilva Dec 6, 2023
7f6f5fc
Fix popover being displayed after exiting analysis
danielfdsilva Dec 6, 2023
7944416
Handle aoi drawing before datasets load
danielfdsilva Dec 6, 2023
e7e62e9
Replace dataset with data layers
danielfdsilva Dec 6, 2023
4fbc97c
Add check for dataset id
danielfdsilva Dec 7, 2023
eb37147
Add env flag check function
danielfdsilva Dec 11, 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
1 change: 0 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ [email protected]

API_RASTER_ENDPOINT='https://staging-raster.delta-backend.com'
API_STAC_ENDPOINT='https://staging-stac.delta-backend.com'
API_XARRAY_ENDPOINT='https://dev-titiler-xarray.delta-backend.com/tilejson.json'

# If the app is being served in from a subfolder, the domain url must be set.
# For example, if the app is served from /mysite:
Expand Down
Binary file added app/graphics/content/tour-analysis.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/graphics/content/tour-comparison.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 24 additions & 6 deletions app/scripts/components/analysis/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { endOfDay, startOfDay, format } from 'date-fns';
import { Feature, FeatureCollection, MultiPolygon, Polygon } from 'geojson';
import { userTzDate2utcString } from '$utils/date';
import { fixAntimeridian } from '$utils/antimeridian';

/**
* Creates the appropriate filter object to send to STAC.
Expand All @@ -16,6 +17,8 @@ export function getFilterPayload(
aoi: FeatureCollection<Polygon>,
collections: string[]
) {
const aoiMultiPolygon = fixAoiFcForStacSearch(aoi);

const filterPayload = {
op: 'and',
args: [
Expand All @@ -31,11 +34,9 @@ export function getFilterPayload(
}
]
},
// Stac search spatial intersect needs to be done on a single feature.
// Using a Multipolygon
{
op: 's_intersects',
args: [{ property: 'geometry' }, combineFeatureCollection(aoi).geometry]
args: [{ property: 'geometry' }, aoiMultiPolygon.geometry]
},
{
op: 'in',
Expand All @@ -50,9 +51,9 @@ export function getFilterPayload(
* Converts a MultiPolygon to a Feature Collection of polygons.
*
* @param feature MultiPolygon feature
*
*
* @see combineFeatureCollection() for opposite
*
*
* @returns Feature Collection of Polygons
*/
export function multiPolygonToPolygons(feature: Feature<MultiPolygon>) {
Expand All @@ -75,7 +76,7 @@ export function multiPolygonToPolygons(feature: Feature<MultiPolygon>) {
* Converts a Feature Collection of polygons into a MultiPolygon
*
* @param featureCollection Feature Collection of Polygons
*
*
* @see multiPolygonToPolygons() for opposite
*
* @returns MultiPolygon Feature
Expand All @@ -95,6 +96,23 @@ export function combineFeatureCollection(
};
}

/**
* Fixes the AOI feature collection for a STAC search by converting all polygons
* to a single multipolygon and ensuring that every polygon is inside the
* -180/180 range.
* @param aoi The AOI feature collection
* @returns AOI as a multipolygon with every polygon inside the -180/180 range
*/
export function fixAoiFcForStacSearch(aoi: FeatureCollection<Polygon>) {
// Stac search spatial intersect needs to be done on a single feature.
// Using a Multipolygon
const singleMultiPolygon = combineFeatureCollection(aoi);
// And every polygon must be inside the -180/180 range.
// See: https://github.com/NASA-IMPACT/veda-ui/issues/732
const aoiMultiPolygon = fixAntimeridian(singleMultiPolygon);
return aoiMultiPolygon;
}

export function getDateRangeFormatted(startDate, endDate) {
const dFormat = 'yyyy-MM-dd';
const startDateFormatted = format(startDate, dFormat);
Expand Down
28 changes: 14 additions & 14 deletions app/scripts/components/common/browse-controls/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ function BrowseControls(props: BrowseControlsProps) {

return (
<BrowseControlsWrapper {...rest}>
<TaxonomyWrapper>
{taxonomiesOptions.map(({ name, values }) => (
<DropdownOptions
key={name}
prefix={name}
items={[optionAll].concat(values)}
currentId={taxonomies?.[name] ?? 'all'}
onChange={(v) => {
onAction(Actions.TAXONOMY, { key: name, value: v });
}}
size={isLargeUp ? 'large' : 'medium'}
/>
))}
</TaxonomyWrapper>
<SearchWrapper>
<SearchField
size={isLargeUp ? 'large' : 'medium'}
Expand Down Expand Up @@ -142,20 +156,6 @@ function BrowseControls(props: BrowseControlsProps) {
</DropMenu>
</DropdownScrollable>
</SearchWrapper>
<TaxonomyWrapper>
{taxonomiesOptions.map(({ name, values }) => (
<DropdownOptions
key={name}
prefix={name}
items={[optionAll].concat(values)}
currentId={taxonomies?.[name] ?? 'all'}
onChange={(v) => {
onAction(Actions.TAXONOMY, { key: name, value: v });
}}
size={isLargeUp ? 'large' : 'medium'}
/>
))}
</TaxonomyWrapper>
</BrowseControlsWrapper>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import useQsStateCreator from 'qs-state-hook';
import { set, omit } from 'lodash';

export enum Actions {
CLEAR = 'clear',
SEARCH = 'search',
SORT_FIELD = 'sfield',
SORT_DIR = 'sdir',
TAXONOMY = 'taxonomy'
}

export type BrowserControlsAction = (what: Actions, value: any) => void;
export type BrowserControlsAction = (what: Actions, value?: any) => void;

export interface FilterOption {
id: string;
Expand Down Expand Up @@ -85,6 +86,10 @@ export function useBrowserControls({ sortOptions }: BrowseControlsHookParams) {
const onAction = useCallback<BrowserControlsAction>(
(what, value) => {
switch (what) {
case Actions.CLEAR:
setSearch('');
setTaxonomies({});
break;
case Actions.SEARCH:
setSearch(value);
break;
Expand Down
8 changes: 5 additions & 3 deletions app/scripts/components/common/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ interface CardComponentProps {
parentTo?: string;
footerContent?: ReactNode;
onCardClickCapture?: MouseEventHandler;
onLinkClick?: MouseEventHandler;
}

function CardComponent(props: CardComponentProps) {
Expand All @@ -349,13 +350,14 @@ function CardComponent(props: CardComponentProps) {
parentName,
parentTo,
footerContent,
onCardClickCapture
onCardClickCapture,
onLinkClick
} = props;

const isExternalLink = linkTo.match(/^https?:\/\//);
const linkProps = isExternalLink
? { href: linkTo }
: { as: Link, to: linkTo };
? { href: linkTo, onClick: onLinkClick }
: { as: Link, to: linkTo, onClick: onLinkClick };

return (
<ElementInteractive
Expand Down
26 changes: 14 additions & 12 deletions app/scripts/components/common/empty-hub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@ import { themeVal } from '@devseed-ui/theme-provider';

import { variableGlsp } from '$styles/variable-utils';

const EmptyHubWrapper = styled.div`
function EmptyHub(props: { children: ReactNode }) {
const theme = useTheme();

const { children, ...rest } = props;

return (
<div {...rest}>
<CollecticonPage size='xxlarge' color={theme.color!['base-400']} />
{children}
</div>
);
}

export default styled(EmptyHub)`
max-width: 100%;
grid-column: 1/-1;
display: flex;
Expand All @@ -16,14 +29,3 @@ const EmptyHubWrapper = styled.div`
border: 1px dashed ${themeVal('color.base-300')};
gap: ${variableGlsp(1)};
`;

export default function EmptyHub(props: { children: ReactNode }) {
const theme = useTheme();

return (
<EmptyHubWrapper>
<CollecticonPage size='xxlarge' color={theme.color!['base-400']} />
{props.children}
</EmptyHubWrapper>
);
}
21 changes: 21 additions & 0 deletions app/scripts/components/common/icons/calendar-minus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import { createCollecticon } from '@devseed-ui/collecticons';
import styled from 'styled-components';

export const CollecticonCalendarMinus = styled(
createCollecticon((props: any) => (
<svg {...props}>
<title>{props.title || 'Calendar with minus icon'}</title>
<path
d='M11.5 0H10V3H9V1H5V0H3.5V3H2.5V1H1C0.447715 1 0 1.44772 0 2V12C0 12.5523 0.447716 13 1 13H5.34141C5.12031 12.3744 5 11.7013 5 11H2V5H12C13 5 13.3926 5.36838 14 5.71974V2C14 1.44772 13.5523 1 13 1H11.5V0Z'
/>
<path
fillRule='evenodd'
clipRule='evenodd'
d='M16 11C16 13.7614 13.7614 16 11 16C8.23858 16 6 13.7614 6 11C6 8.23858 8.23858 6 11 6C13.7614 6 16 8.23858 16 11ZM8.5 11.625V10.375H13.5V11.625H8.5Z'
/>
</svg>
))
)`
/* icons must be styled-components */
`;
21 changes: 21 additions & 0 deletions app/scripts/components/common/icons/calendar-plus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import { createCollecticon } from '@devseed-ui/collecticons';
import styled from 'styled-components';

export const CollecticonCalendarPlus = styled(
createCollecticon((props: any) => (
<svg {...props}>
<title>{props.title || 'Calendar with plus icon'}</title>
<path
d='M11.5 0H10V3H9V1H5V0H3.5V3H2.5V1H1C0.447715 1 0 1.44772 0 2V12C0 12.5523 0.447716 13 1 13H5.34141C5.12031 12.3744 5 11.7013 5 11H2V5H12C13 5 13.3926 5.36838 14 5.71974V2C14 1.44772 13.5523 1 13 1H11.5V0Z'
/>
<path
fillRule='evenodd'
clipRule='evenodd'
d='M16 11C16 13.7614 13.7614 16 11 16C8.23858 16 6 13.7614 6 11C6 8.23858 8.23858 6 11 6C13.7614 6 16 8.23858 16 11ZM10.375 8.5V10.375H8.5V11.625H10.375V13.5H11.625V11.625H13.5V10.375H11.625V8.5H10.375Z'
/>
</svg>
))
)`
/* icons must be styled-components */
`;
19 changes: 19 additions & 0 deletions app/scripts/components/common/icons/magnifier-minus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { createCollecticon } from '@devseed-ui/collecticons';
import styled from 'styled-components';

export const CollecticonMagnifierMinus = styled(
createCollecticon((props: any) => (
<svg {...props}>
<title>{props.title || 'Magnifier with minus icon'}</title>
<path d='M9.5 5.5V7.5L3.5 7.5V5.5H9.5Z' />
<path
fillRule='evenodd'
clipRule='evenodd'
d='M12.033 9.912L15.708 13.587C16.097 13.976 16.097 14.612 15.708 15.001L15.001 15.708C14.612 16.097 13.976 16.097 13.587 15.708L9.912 12.033C8.92 12.646 7.751 13 6.5 13C2.91 13 0 10.09 0 6.5C0 2.91 2.91 0 6.5 0C10.09 0 13 2.91 13 6.5C13 7.751 12.646 8.92 12.033 9.912ZM3.318 9.682C2.468 8.832 2 7.702 2 6.5C2 5.298 2.468 4.168 3.318 3.318C4.168 2.468 5.298 2 6.5 2C7.702 2 8.832 2.468 9.682 3.318C10.532 4.168 11 5.298 11 6.5C11 7.702 10.532 8.832 9.682 9.682C8.832 10.532 7.702 11 6.5 11C5.298 11 4.168 10.532 3.318 9.682Z'
/>
</svg>
))
)`
/* icons must be styled-components */
`;
21 changes: 21 additions & 0 deletions app/scripts/components/common/icons/magnifier-plus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import { createCollecticon } from '@devseed-ui/collecticons';
import styled from 'styled-components';

export const CollecticonMagnifierPlus = styled(
createCollecticon((props: any) => (
<svg {...props}>
<title>{props.title || 'Magnifier with plus icon'}</title>
<path
d='M7.5 7.5H9.5V5.5H7.5V3.5H5.5V5.5H3.5V7.5H5.5V9.5H7.5V7.5Z'
/>
<path
fillRule='evenodd'
clipRule='evenodd'
d='M15.708 13.587L12.033 9.912C12.646 8.92 13 7.751 13 6.5C13 2.91 10.09 0 6.5 0C2.91 0 0 2.91 0 6.5C0 10.09 2.91 13 6.5 13C7.751 13 8.92 12.646 9.912 12.033L13.587 15.708C13.976 16.097 14.612 16.097 15.001 15.708L15.708 15.001C16.097 14.612 16.097 13.976 15.708 13.587ZM2 6.5C2 7.702 2.468 8.832 3.318 9.682C4.168 10.532 5.298 11 6.5 11C7.702 11 8.832 10.532 9.682 9.682C10.532 8.832 11 7.702 11 6.5C11 5.298 10.532 4.168 9.682 3.318C8.832 2.468 7.702 2 6.5 2C5.298 2 4.168 2.468 3.318 3.318C2.468 4.168 2 5.298 2 6.5Z'
/>
</svg>
))
)`
/* icons must be styled-components */
`;
2 changes: 1 addition & 1 deletion app/scripts/components/common/loading-skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const pulse = keyframes`
}
`;

const pulsingAnimation = css`
export const pulsingAnimation = css`
animation: ${pulse} 0.8s ease 0s infinite alternate;
`;

Expand Down
68 changes: 68 additions & 0 deletions app/scripts/components/common/map/controls/aoi/atoms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { atom } from 'jotai';
import { Feature, Polygon } from 'geojson';
import { AoIFeature } from '../../types';
import { decodeAois, encodeAois } from '$utils/polygon-url';
import { atomWithUrlValueStability } from '$utils/params-location-atom/atom-with-url-value-stability';

// This is the atom acting as a single source of truth for the AOIs.
export const aoisSerialized = atomWithUrlValueStability<string>({
initialValue: new URLSearchParams(window.location.search).get('aois') ?? '',
urlParam: 'aois',
hydrate: (v) => v ?? '',
dehydrate: (v) => v,
});

// Getter atom to get AoiS as GeoJSON features from the hash.
export const aoisFeaturesAtom = atom<AoIFeature[]>((get) => {
const hash = get(aoisSerialized);
if (!hash) return [];
return decodeAois(hash);
});

// Setter atom to update AOIs geometries, writing directly to the hash atom.
export const aoisUpdateGeometryAtom = atom(
null,
(get, set, updates: Feature<Polygon>[]) => {
let newFeatures = [...get(aoisFeaturesAtom)];
updates.forEach(({ id, geometry }) => {
const existingFeature = newFeatures.find((feature) => feature.id === id);
if (existingFeature) {
existingFeature.geometry = geometry;
} else {
const newFeature: AoIFeature = {
type: 'Feature',
id: id as string,
geometry,
selected: true,
properties: {}
};
newFeatures = [...newFeatures, newFeature];
}
});
set(aoisSerialized, encodeAois(newFeatures));
}
);

// Setter atom to update AOIs selected state, writing directly to the hash atom.
export const aoisSetSelectedAtom = atom(null, (get, set, ids: string[]) => {
const features = get(aoisFeaturesAtom);
const newFeatures = features.map((feature) => {
return { ...feature, selected: ids.includes(feature.id as string) };
});
set(aoisSerialized, encodeAois(newFeatures));
});

// Setter atom to delete AOIs, writing directly to the hash atom.
export const aoisDeleteAtom = atom(null, (get, set, ids: string[]) => {
const features = get(aoisFeaturesAtom);
const newFeatures = features.filter(
(feature) => !ids.includes(feature.id as string)
);
set(aoisSerialized, encodeAois(newFeatures));
});

export const aoiDeleteAllAtom = atom(null, (get, set) => {
set(aoisSerialized, encodeAois([]));
});

export const isDrawingAtom = atom(false);
Loading
Loading