Overview

Within XB, the top bar should display page-specific context, such as the title and publishing status, as shown in the screenshot. This issue focuses on exposing, displaying, and styling the relevant top bar information.

Top Bar Context Information In XB

Proposed resolution

This MR will get the publish status and page title from selectPageData selector from pageDataSlice and the hard-coded title and status on the selector to get the values should be removed after #3501847: Send entity keys to the editor from the mount controller is in. Once the information is rendered, styling will be added to align with the design specifications.

https://www.drupal.org/i/3501847

User interface changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kunalkursija created an issue. See original summary.

kunalkursija’s picture

Issue summary: View changes
kunalkursija’s picture

Category: Feature request » Task
shyam_bhatt’s picture

Assigned: Unassigned » shyam_bhatt
Category: Task » Plan
shyam_bhatt’s picture

Category: Plan » Task
longwave’s picture

The preview endpoint could probably return additional data to achieve this.

wim leers’s picture

I think it's not the experience_builder.api.preview route that should provide that info, but experience_builder.experience_builder itself? 🤔

Because:

  • experience_builder.experience_builder is requested once, and the information should be retrieved then
  • experience_builder.experience_builder is requested N times (once per component placement/props change), and it is completely unaware of the underlying content entity being edited

But perhaps @longwave sees a reason for using experience_builder.api.preview that I'm missing? 🤔

longwave’s picture

If the user changes the page title inside XB, should it update immediately (ie. on preview)?

lauriii’s picture

The page title should update automatically as it's being changed.

longwave’s picture

I guess another question is what should be displayed here: just the entity title/label? Or the HTML <title> tag from <head>?

lauriii’s picture

That's a good question. I think it should be just the entity title/label since that's what we would be using for referring to the page else where.

shyam_bhatt’s picture

Assigned: shyam_bhatt » Unassigned
parthbcharya’s picture

Assigned: Unassigned » parthbcharya
anjali rathod’s picture

I will be working on the API part of this issue and then my colleague parthbcharya will take over the FE work. I’m unclear about which API to use for my current task in experience_builder. Should I leverage an existing API route, extend one of the current routes, or consider creating a new API from scratch?

I’d appreciate some guidance to understand the best approach for this scenario.

longwave’s picture

Given the discussion in #7-11 I still think the preview endpoint is the best place to add this to the API; if the title is edited then the preview will update and reflect the change.

I suggest adding the title to the JSON response in XBPreviewRenderer::renderResponse(); it looks like we might be able to capture the title in prepare().

anjali rathod’s picture

anjali rathod’s picture

Status: Active » Needs review

Need review for the API related changes made by me, so that @parthbcharya can then continue working with these changes for React code part.

longwave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

While I agree we want to refactor this in the near future in #3494348: Support additional top-level data in returns from ApiPreviewController I think this is OK for now, but it would be good to add at least two assertions to ApiPreviewControllerTest to prove that the entity title and status are returned.

If #3494348: Support additional top-level data in returns from ApiPreviewController lands first then this will need refactoring to match the changes there.

lauriii’s picture

Merged #3494348: Support additional top-level data in returns from ApiPreviewController.

@anjali rathod Could you reimplement the API to utilize the new API? 🙏

larowlan made their first commit to this issue’s fork.

larowlan’s picture

Issue tags: -Needs tests

I've pushed a rebase on top of 0.x making use of the new functionality from MR 420 and added a test.
This is ready for the FE implementation now.
I would suggest this goes in its own slice and makes use of onQueryStarted in the preview API to pluck out the values and dispatch the reducer to update the slice

parthbcharya’s picture

balintbrews’s picture

Let's create a UI component (or set of UI components) and present them in Storybook. We'll need to display the currently focused global region in #3497648: Focus mode for global regions. Whichever issue gets to implementing a UI component earlier, let's anticipate each others' needs with the component design. 😉

wim leers’s picture

Thanks for explaining the rationale, @anjali rathod — I was thinking about not making this too narrow, and I've now clarified that in the MR comments.

I think that between my response and @balintbrews' at #24, you have all you need here to proceed? 😊

parthbcharya’s picture

Status: Needs work » Needs review
longwave’s picture

This appears to be duplicating what is being done in core in #3484600: Show entity information on the Top Bar

lauriii’s picture

What's being done in #3484600: Show entity information on the Top Bar is for the top bar when visiting the site frontend / current edit form. What we're supposed to be doing here is doing the same but within XB. These need to be sync but it shouldn't be duplicated effort.

lauriii’s picture

mglaman’s picture

Assigned: parthbcharya » mglaman

Going to help push this through over the finish line

mglaman’s picture

Assigned: mglaman » Unassigned

🫡 ready for reviews

mglaman credited hooroomoo.

mglaman’s picture

Status: Needs review » Reviewed & tested by the community

MR approved! here's my attempt at issue credits, other maintainers fix as needed!

mglaman’s picture

Status: Reviewed & tested by the community » Fixed

Woo! We're unblocked to build the in-editor page navigation.

wim leers’s picture

Wow, the merged MR looks nothing like what I reviewed a month ago: no more server-side changes!

hooroomoo’s picture

Issue summary: View changes

Updated issue summary to remove "fetching from API" from the proposed solution, since the solution changed to use the selectPageData selector instead.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.