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

Use router instead of internal component state #61

Merged
merged 10 commits into from
Sep 30, 2024
Merged

Conversation

psrpinto
Copy link
Member

@psrpinto psrpinto commented Sep 26, 2024

Previously, the BlogPostFlow component was handling transitions between screens internally, instead of relying on the URL to drive navigation.

This PR fixes that by removing this component in favor of two others, which are mapped to two different URLs:

  • NewBlogPost: /session/${ sessionId }/flow/blog-post/new
  • EditBlogPost: /session/${ sessionId }/flow/blog-post/${ postId }

This makes the app behave in more standard "CRUD" way.

Additionally, some other small changes were made:

  • Remove duplicated code for retrieving information about the current source site
  • Make it possible to navigate from the dev tools: e.g. window.trywp.navigateTo( '/start/home' )
  • Add a Toolbar component for rendering the buttons of each screen (see screen capture below), so that the "next" button is always on the top right.

Screen captures

Screenshot 2024-09-27 at 14 12 55 Screenshot 2024-09-27 at 14 13 04

@psrpinto psrpinto changed the base branch from trunk to fetch-existing-post September 26, 2024 18:01
@psrpinto psrpinto self-assigned this Sep 26, 2024
@psrpinto psrpinto marked this pull request as ready for review September 27, 2024 13:13
Copy link
Member

@ashfame ashfame left a comment

Choose a reason for hiding this comment

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

LGTM!

Base automatically changed from fetch-existing-post to trunk September 30, 2024 10:17
@psrpinto psrpinto merged commit 617d6c3 into trunk Sep 30, 2024
3 checks passed
@psrpinto psrpinto deleted the router-blog-post-flow branch September 30, 2024 10:18
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