-
Notifications
You must be signed in to change notification settings - Fork 6
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
Conversation
✅ Deploy Preview for veda-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this 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:
- 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.
- 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.
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; | ||
|
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
bag: DatasetDatumFnResolverBag | ||
): Res<T[number]>[]; | ||
/* eslint-disable-next-line no-redeclare */ | ||
export function resolveConfigFunctions( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@nerik I think that 2.1 (layer's own index order) is what makes most sense. |
@nerik Did some cleanup to and moved the map code to a separate component. |
@danielfdsilva Merged this for now. I'd like your eyes on this at some point if you have time. |
Done so far:
Compare is not possible yet.