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

Port the Catalog View in the E&A dataset selector modal #989

Merged
merged 16 commits into from
Jun 7, 2024

Conversation

dzole0311
Copy link
Collaborator

@dzole0311 dzole0311 commented Jun 3, 2024

Related Ticket: 973

Description of Changes

Ported the CatalogView to the E&A modal.

  1. Created a configurable Catalog Card, that either can be selected (E&A Modal) or can navigate to a link (Data Catalog)
  2. Re-factored the Data Catalog component to a reusable Catalog Content component (used in Data Catalog and E&A Modal)
  3. Few other tweaks and changes + addressed Fausto's design-related comment below

Notes & Questions About Changes

{Add additonal notes and outstanding questions here related to changes in this pull request}

Validation / Testing

  1. Validate that the Catalog works with navigation in the Data Catalog view (counters are correct, filters work, navigation works)
  2. Validate that the Catalog is shown in the Dataset Selector modal in E&A and works as expected (is selectable, can add datasets, counters are correct, filters work)

Copy link

netlify bot commented Jun 3, 2024

Deploy Preview for veda-ui ready!

Name Link
🔨 Latest commit 95b21bb
🔍 Latest deploy log https://app.netlify.com/sites/veda-ui/deploys/666198f63435ec0008c62f1e
😎 Deploy Preview https://deploy-preview-989--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.

@dzole0311 dzole0311 marked this pull request as draft June 3, 2024 09:14
@dzole0311 dzole0311 requested review from hanbyul-here, sandrahoang686 and faustoperez and removed request for hanbyul-here and sandrahoang686 June 3, 2024 10:32
Copy link

@faustoperez faustoperez left a comment

Choose a reason for hiding this comment

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

Great job Gjore! Two comments only:

  • I think it is safe to have the filters collapsed by default so they don't take a lot of space.
  • Make the whole filter box label clickable to open/close and not just the chevron

Thanks!

@dzole0311 dzole0311 changed the title [DRAFT] Port the Catalog View in the E&A dataset selector modal Port the Catalog View in the E&A dataset selector modal Jun 3, 2024
@dzole0311 dzole0311 marked this pull request as ready for review June 3, 2024 14:56
@hanbyul-here
Copy link
Collaborator

hanbyul-here commented Jun 4, 2024

🤔 I am not sure I am complicating the matter or not - but I am unsure if we need URLs to be manipulated when users interact through modal. Especially dinvr the query parameters are not getting reset when the datasets are seleted.

In a scenario like below

  1. A user selected some datasets through selecting specific taxonomies
  2. The user navigates datasets, finds the cool thing, so shares the url
  3. Another user opens the shared url, then opens the modal to add more datasets

In Step 3, that user will see the taxonomies that were not chosen by the user.

The current behavior makes sense in a way that the same component does the same URL manipulation. On the other hand, I think mixing up URL parameters from two components (data catalog modal and e&a components) for one page (new E&A) creates an edge case like the above. I also see much of the need for URL sharing while selecting the datasets for the E&A page. What do you think? Am I missing anything?


It is awesome that the URL manipulation logic is captured in the hook: https://github.com/NASA-IMPACT/veda-ui/pull/989/files#diff-469d42d5232f537ff54ffb1ea3ee80fe574196d55379cf93c482bb6171cee567R52 Maybe we can use the hook only for Data Catalog page?

action: CatalogActions,
value: any,
taxonomies: any,
setSearch: (value: string) => void,
Copy link
Collaborator

@hanbyul-here hanbyul-here Jun 5, 2024

Choose a reason for hiding this comment

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

I realize that we would need more of this type of utility function - which takes either setState or setAtomas a setter function - like the one that we use for reconciling STAC metadata here: https://github.com/NASA-IMPACT/veda-ui/pull/988/files#diff-b0d6bd8ff29016fd81054f35bfcc97dd5b50077310a81f6043a99240cb43a4eaR167

I'd like to ask your thoughts how we should type these util functions moving forward. Should we explicitly type the setter function as either setAtom or setState? ex. I tried this method in https://github.com/NASA-IMPACT/veda-ui/pull/988/files#diff-b0d6bd8ff29016fd81054f35bfcc97dd5b50077310a81f6043a99240cb43a4eaR169 - and I am still unsure if this just added complicacy or not. But I also think any is a bit too broad. Any thoughts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think both can be verbose, even for simpler types like a setter for a string (ie. React.Dispatch<React.SetStateAction<string>>).

How about we create aliases for the setters and use that? For example: type SetState<T> = Dispatch<SetStateAction<T>> and then we can use it like this:

const [count, setCount]: [number, SetState<number>] = useState(0);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, aliases sound great. I will leave it up to you if you want to apply this change to this pr or not.

Copy link
Collaborator

@hanbyul-here hanbyul-here left a comment

Choose a reason for hiding this comment

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

Wooh, yes, all the problems I mentioned are gone! (And I was actually not aware that the modal was manipulating the urls 😓 My apologies! - but I do think the current behavior makes more sense url-wise. It is great that you kept the functionality with local state!) I left some comments, but most of them are not blockers!

  • comment for the future: this filter function is actually a great feature to have a unit test 😬

@dzole0311
Copy link
Collaborator Author

  • comment for the future: this filter function is actually a great feature to have a unit test 😬

Good point, added :)

Copy link
Collaborator

@hanbyul-here hanbyul-here left a comment

Choose a reason for hiding this comment

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

👍 Left additional comments, but nothing is a blocker. thanks for awesome work

action: CatalogActions,
value: any,
taxonomies: any,
setSearch: (value: string) => void,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, aliases sound great. I will leave it up to you if you want to apply this change to this pr or not.

Copy link

@faustoperez faustoperez left a comment

Choose a reason for hiding this comment

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

Great work! 👍

@dzole0311 dzole0311 merged commit f414f3b into main Jun 7, 2024
8 checks passed
@dzole0311 dzole0311 deleted the 973-catalog-view-in-exploration-modal branch June 7, 2024 07:52
sandrahoang686 added a commit that referenced this pull request Jun 17, 2024
## What's Changed
Bump minor version as part of release cycle

## 🎉 Features
- Port the upgraded catalog view in the E&A dataset selector modal
#989

## 🚀 Improvements
- Replace legacy Mapbox component for Scrollytelling
#992
- Add Vizdataset type #993

## 🐛 Fixes
🦗
@hanbyul-here
Copy link
Collaborator

hanbyul-here commented Jun 25, 2024

Flagging that I missed the searchTerm URL Parameters are needed to make a connection between the Data Catalog and the modal. I will work on putting this feature back.

hanbyul-here added a commit that referenced this pull request Jun 28, 2024
…nd new E&A page (#1021)

**Related Ticket:** #1016 

### Description of Changes

This PR makes Catalog View on the data-catalog page use QS-state for
query parameters, while Catalog View on the new E&A page uses Jotai. The
current Atoms related to URL management is not designed for cross-page
navigation. I drew a diagram to describe the navigation problem between
catalog page and overview page.

![Screenshot 2024-06-26 at 1 19
05 PM](https://github.com/NASA-IMPACT/veda-ui/assets/4583806/c11f216d-b3a9-4c01-b3b5-fa747d8999b1)

More context: 
We moved our query parameter management to use Jotai because of the
concerns about the mix-use of QS-State and Jotai for query parameters on
the same page. (Specifically - for the new E&A page, other parameters
are managed by Jotai). More details on this PR that initially introduced
data-catalog view to new E&A page:
#989 (comment)
In the end, we ditched the Query parameter manipulation thinking that we
don't need. (Details are in this comment:
#989 (comment))
But the bug reported #1016 made me realize that was a wrong call.


### Notes & Questions About Changes
- We need a better solution for long-term url management. 

### Validation / Testing
Navigate back and forth from data catalog to overview, from overview to
data catalog (especially through taxonomy pills on the overview page)
Navigate to the new E&A page through the 'Explore Data' button on the
overview page.


I opened a pr on ghg for testing:
US-GHG-Center/veda-config-ghg#421
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.

3 participants