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

Display selected datasets on the map #668

Merged
merged 7 commits into from
Oct 2, 2023

Conversation

danielfdsilva
Copy link
Collaborator

Done so far:

  • Displays selected datasets on the map
  • Dataset order support
  • Dataset opacity support

Compare is not possible yet.

@netlify
Copy link

netlify bot commented Sep 22, 2023

Deploy Preview for veda-ui ready!

Name Link
🔨 Latest commit c055024
🔍 Latest deploy log https://app.netlify.com/sites/veda-ui/deploys/651a9ba5a37c590008dde191
😎 Deploy Preview https://deploy-preview-668--veda-ui.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@danielfdsilva danielfdsilva changed the base branch from main to feature/exploration September 22, 2023 13:20
Copy link
Contributor

@nerik nerik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works 🙌

I guess my main comments are around resolveConfigFunctions, and also layer order:

  1. the stacking order on the map is the opposite of the one in the timeline. As in, 'up' in the list should translate to 'on top' in the map, at least that's how I've always seen that kind of stuff work.
  2. this is due to the sorting algorithm in styles.tsx, hence 100% my legacy, but I think we should either:
  • follow the natural order of generators in their array, and not explicitly declare order in the raster-timeseries signature (in that case the sorting logic should use the generators indices, not the id)
  • keep explicitly declaring order, but in that case use that numerical order directly in styles.tsx, rather than the string id. Also, in that case, no need to declare and use the order prop in raster-timeseries, but put it in the BaseGeneratorParams type and let styles.tsx handle this

This can be merged without addressing 2. which I can do myself later.

Comment on lines +125 to +140
type Fn = (...args: any[]) => any;

type ObjResMap<T> = {
[K in keyof T]: Res<T[K]>;
};

type Res<T> = T extends Fn
? T extends DatasetDatumFn<DatasetDatumReturnType>
? DatasetDatumReturnType
: never
: T extends any[]
? Res<T[number]>[]
: T extends object
? ObjResMap<T>
: T;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to types.d.ts ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These types are only ever used for the resolveConfigFunctions function declaration and are not needed elsewhere so I think they can live with the declaration. However feel free to move them if you like

app/scripts/components/common/map/utils.ts Outdated Show resolved Hide resolved
bag: DatasetDatumFnResolverBag
): Res<T[number]>[];
/* eslint-disable-next-line no-redeclare */
export function resolveConfigFunctions(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I'm struggling to understand what this does. resolveConfigFunctions can call itself if datum is iterable, that I get. but then in other situations, it calls datum as a function? How is that related to the call in index.tsx line 220? What does bag mean exactly?

Sorry, might just be a case of Friday afternoon.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This basically resolves the functions in the dataset config and is needed to support this behavior.
The docs show some examples and explain the behavior. If it is not clear, we should improve the docs.

This was used in the past for the customization of the compare map message. Although it is a neat little power user functionality, not sure it is used (known/needed) a lot.

@danielfdsilva
Copy link
Collaborator Author

@nerik I think that 2.1 (layer's own index order) is what makes most sense.

@danielfdsilva
Copy link
Collaborator Author

@nerik Did some cleanup to and moved the map code to a separate component.
The compare now can be enabled through the mock controls and shows the correct datasets with a date set 1 month from the main date.
If you want to address the layer order issue before merging, feel free to continue to work on this branch.

@nerik
Copy link
Contributor

nerik commented Oct 2, 2023

@danielfdsilva Merged this for now. I'd like your eyes on this at some point if you have time.

@nerik nerik merged commit 0a33ddb into feature/exploration Oct 2, 2023
7 checks passed
@nerik nerik deleted the feature/datasets-on-map branch October 2, 2023 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants