Skip to content

Commit

Permalink
Implement analysis dataset selector modal
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfdsilva committed Oct 16, 2023
1 parent cd205d5 commit c54dbe2
Show file tree
Hide file tree
Showing 5 changed files with 336 additions and 68 deletions.
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 @@ -84,6 +85,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
9 changes: 4 additions & 5 deletions app/scripts/components/data-catalog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useMemo, useRef } from 'react';
import styled from 'styled-components';
import { DatasetData, datasets, datasetTaxonomies, getString } from 'veda';
import { DatasetData, datasetTaxonomies, getString } from 'veda';
import { Link } from 'react-router-dom';
import { glsp } from '@devseed-ui/theme-provider';
import { Subtitle } from '@devseed-ui/typography';
Expand Down Expand Up @@ -47,8 +47,7 @@ import {
TAXONOMY_TOPICS
} from '$utils/veda-data';
import { DatasetClassification } from '$components/common/dataset-classification';

const allDatasets = Object.values(datasets).map((d) => d!.data);
import { allDatasets } from '$components/exploration/data-utils';

const DatasetCount = styled(Subtitle)`
grid-column: 1 / -1;
Expand All @@ -66,9 +65,9 @@ const BrowseFoldHeader = styled(FoldHeader)`
align-items: flex-start;
`;

const sortOptions = [{ id: 'name', name: 'Name' }];
export const sortOptions = [{ id: 'name', name: 'Name' }];

const prepareDatasets = (
export const prepareDatasets = (
data: DatasetData[],
options: {
search: string;
Expand Down
Loading

0 comments on commit c54dbe2

Please sign in to comment.