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

feat: Navigate to node from search results #3650

Merged
merged 6 commits into from
Sep 12, 2024
Merged

Conversation

DafyddLlyr
Copy link
Contributor

@DafyddLlyr DafyddLlyr commented Sep 10, 2024

What does this PR do?

Test flow on Pizza - https://3650.planx.pizza/testing/flow-navigation-search

Prior art - #3460

Screen.Recording.2024-09-11.at.16.25.57.mov

To Do (this PR)

Next step...

  • Portal "wrapper" UI for cards

@DafyddLlyr DafyddLlyr changed the title wip: Pickup work from old branch feat(wip): Navigate to node from search results Sep 10, 2024
@DafyddLlyr DafyddLlyr force-pushed the dp/search-get-url-for-node branch from ee223e2 to 53441f6 Compare September 10, 2024 12:05
Copy link

github-actions bot commented Sep 10, 2024

Removed vultr server and associated DNS entries

@DafyddLlyr DafyddLlyr force-pushed the dp/search-get-url-for-node branch 2 times, most recently from f936cc0 to 842bd00 Compare September 10, 2024 17:07
@DafyddLlyr DafyddLlyr force-pushed the dp/search-get-url-for-node branch from 842bd00 to d47fe2a Compare September 11, 2024 13:27
@DafyddLlyr DafyddLlyr changed the title feat(wip): Navigate to node from search results feat: Navigate to node from search results Sep 11, 2024
@DafyddLlyr DafyddLlyr requested a review from a team September 11, 2024 15:52
@DafyddLlyr DafyddLlyr marked this pull request as ready for review September 11, 2024 15:52
Comment on lines +512 to +515
const nodePath =
node.type === ComponentType.Answer
? `nodes/${grandparent.id}/nodes/${parent.id}/edit`
: `nodes/${parent.id}/nodes/${node.id}/edit`;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is the only variance that controls the path used for the modal - please let me know if there's something I've missed here!

Copy link
Member

Choose a reason for hiding this comment

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

This seems right to me here! Only edge case I possibly considered here were "Filters" - but these links work as expected testing on pizza 🙌

Plus very cool fun bonus - Search now makes visible the (wild!) fact that Filter's have a default data field flag assigned to them via the component's handleSubmit and later relied on in upcomingCardIds():
Screenshot from 2024-09-11 21-35-30

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ha! Good catch and a fun little easter egg... 🙃

Copy link
Member

@jessicamcinchak jessicamcinchak left a comment

Choose a reason for hiding this comment

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

Very good work - can already think of so many other places I want to use getURLForNode (publish changelogs, validation checks, etc!!) 🎉

Comment on lines +512 to +515
const nodePath =
node.type === ComponentType.Answer
? `nodes/${grandparent.id}/nodes/${parent.id}/edit`
: `nodes/${parent.id}/nodes/${node.id}/edit`;
Copy link
Member

Choose a reason for hiding this comment

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

This seems right to me here! Only edge case I possibly considered here were "Filters" - but these links work as expected testing on pizza 🙌

Plus very cool fun bonus - Search now makes visible the (wild!) fact that Filter's have a default data field flag assigned to them via the component's handleSubmit and later relied on in upcomingCardIds():
Screenshot from 2024-09-11 21-35-30

const url = getURLForNode("reservoirDogsAnswer");
expect(url).toEqual(
"/testTeam/testFlow,tarantinoPortal,moviesPortal/nodes/tarantinoPortal/nodes/tarantinoMovieQuestion/edit",
);
Copy link
Member

Choose a reason for hiding this comment

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

💪

@DafyddLlyr
Copy link
Contributor Author

Very good work - can already think of so many other places I want to use getURLForNode (publish changelogs, validation checks, etc!!) 🎉

Just a heads up that there's two minor limitations to this as it's currently written -

  • We need an orderedFlow to get URLs - which is slightly expensive to generate so I'm just doing this once when search is opened for the first time. We can for sure change this approach though.
  • This is currently Editor only (not yet exposable via window.api) for the same reason as above

Both on my to do list to take a look at!

@DafyddLlyr DafyddLlyr merged commit 66ef50d into main Sep 12, 2024
12 checks passed
DafyddLlyr added a commit to theopensystemslab/planx-core that referenced this pull request Sep 12, 2024
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