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

Show related items #4381

Merged
merged 17 commits into from
Dec 18, 2024
Merged

Show related items #4381

merged 17 commits into from
Dec 18, 2024

Conversation

wesleybl
Copy link
Member

@wesleybl wesleybl commented Feb 8, 2023

I need help with the layout:

related items

Can someone help me?

fixes #3740

@netlify
Copy link

netlify bot commented Feb 8, 2023

Deploy Preview for volto canceled.

Name Link
🔨 Latest commit c586247
🔍 Latest deploy log https://app.netlify.com/sites/volto/deploys/645bb15fc8e0030008ee4f99

@ksuess
Copy link
Member

ksuess commented Feb 8, 2023

I would say

  • rewrite Tags.jsx to Segment.Group instead of Container,
  • include Tags.jsx and Related.jsx in a new MetaData.jsx with a Semantic UI Container.

But this would mean a breaking change, I guess.

@wesleybl
Copy link
Member Author

wesleybl commented Feb 9, 2023

@ksuess I don't think it would be a good idea to do a breaking change for this. Someone who customized the Tags might not like it.

I tried to follow the HTML structure of the Semantic UI lists described here:

https://semantic-ui.com/elements/list.html

Of the React components, I used only the Container to wrap everything.

More suggestions?

@tiberiuichim
Copy link
Contributor

@sneridagh @tisto any insight on a visual for this?

@tisto
Copy link
Member

tisto commented Feb 9, 2023

@tiberiuichim I can ask our designer to come up with something. Though, that might take a few days...

@ichim-david
Copy link
Member

@wesleybl The related functionality is still not present in Volto to the point that it was added as a tutorial block from World Plone Day https://github.com/collective/volto-relateditems-block
I wonder at this point if something will be agreed for core...

@wesleybl
Copy link
Member Author

wesleybl commented Jul 23, 2024

@ichim-david I think related content shouldn't be in blocks. They should appear without explicit user action, as occurs in classic Plone. I will try to update this PR.

Copy link

netlify bot commented Jul 30, 2024

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit 521f16a
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/67635006334dd600088a7a70

@wesleybl
Copy link
Member Author

@ichim-david I have updated this PR. Can you please take a look?

@wesleybl wesleybl requested a review from ichim-david July 31, 2024 12:24
Copy link
Member

@ichim-david ichim-david left a comment

Choose a reason for hiding this comment

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

@wesleybl see my review suggestions

const RelatedItems = ({ relatedItems, intl }) =>
relatedItems && relatedItems.length > 0 ? (
<Container>
<h4 className="ui header">{intl.formatMessage(messages.relatedItems)}</h4>
Copy link
Member

Choose a reason for hiding this comment

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

The a11y tests will complain that you have a jump from h1 to h4 as it doesn't follow the normal heading ranges from h1-h4.
I suggest an h2 styled to look like the h4

Copy link
Member Author

@wesleybl wesleybl Jul 31, 2024

Choose a reason for hiding this comment

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

Done. I also changed the HTML to look more like volto-relateditems-block. Now the Related Items will look like this:

download (5)

I didn't include the CSS because it didn't make a difference.

Copy link
Member

Choose a reason for hiding this comment

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

Done. I also changed the HTML to look more like volto-relateditems-block. Now the Related Items will look like this:

download (5)

I didn't include the CSS because it didn't make a difference.

@wesleybl if this is the final render update the screenshot from the ticket description with this or the latest render.

packages/volto/src/config/index.js Outdated Show resolved Hide resolved
@ichim-david
Copy link
Member

@wesleybl don't have time to spend on open-source anymore for today, I already do so for too long :) :( but I plan on checking this tomorrow.

@wesleybl wesleybl force-pushed the related_items branch 2 times, most recently from 305497e to 732213d Compare August 6, 2024 13:14
@ichim-david
Copy link
Member

@erral @pnicolli @davisagli @ksuess We need to decide on how we want to display the related items in Volto.
@wesleybl has worked on adding the display of the related items as seen in the ticket description.
There are several questions that need answering such as:

  1. Are we ok with adding the component after the tags directly in the View template or should we add it through Slots?
  2. Are we ok with this minimal styles or do we need something more?
  3. This work adds the ability to see the related items in Volto core but during World Plone Day this functionality was added as a block in collective https://github.com/collective/volto-relateditems-block. Do we want to have it as a component added in the template or as a block?
  4. What kind of options do we want for this work, do we want to show it in View.jsx or would there be a need to insert it based on certain conditions?
  5. Should we have this feature disabled or enabled by default? If we opt for the minimal style and as a non-breaking feature we could go for the opt-in solution where you enable and further style it as needed if you want it.

Unless we all chip in on this pull request, if we have any feedback I don't know how we should treat this work because I don't know what is your expectations for the related items viewing especially given that we haven't added it to core until now.

@ichim-david ichim-david requested a review from avoinea August 6, 2024 14:00
@wesleybl
Copy link
Member Author

wesleybl commented Aug 8, 2024

@ichim-david when I made this PR, slots didn't exist in Volto. But I think it makes sense now for Related Items to be in slots. I think it would be interesting for them to be in the belowContent slot. But for that, Tags would have to be in that slot too, above the related items. See:

<SlotRenderer name="belowContent" content={this.props.content} />
{config.settings.showTags &&
this.props.content.subjects &&
this.props.content.subjects.length > 0 && (
<Tags tags={this.props.content.subjects} />
)}

One detail is that Volto doesn't register anything in the slot. But I don't think there would be a problem registering it, right?

Can I make the change?

@ichim-david
Copy link
Member

@ichim-david when I made this PR, slots didn't exist in Volto. But I think it makes sense now for Related Items to be in slots. I think it would be interesting for them to be in the belowContent slot. But for that, Tags would have to be in that slot too, above the related items. See:

<SlotRenderer name="belowContent" content={this.props.content} />
{config.settings.showTags &&
this.props.content.subjects &&
this.props.content.subjects.length > 0 && (
<Tags tags={this.props.content.subjects} />
)}

One detail is that Volto doesn't register anything in the slot. But I don't think there would be a problem registering it, right?

Can I make the change?

@wesleybl I am more in favor of having this functionality as a registration in the below content slot rather than adding more things directly to the template especially since you can even condition the slot addition.
However I don't know what is the sentiment of this pull request and despite my effort to @ people as you have seen so far we have gotten no replies. I think it also has todo with the time of the year, people are either busy preparing for holidays or are on holidays as we speak.

Unless we get feedback from the other I don't know in what direction to point you as I don't know what the other core members think about related items.

As such I would wait for more feedback before any more development as to not have to make too many changes on and on and on.

@davisagli
Copy link
Member

@wesleybl @ichim-david I like the idea of using slots for this, because then it's pretty easy for an add-on to replace the component if it wants to do something different (maybe even different components for different content types). In that case we might not need the showRelatedItems setting (because it's possible to override the slot with an empty component)

@erral
Copy link
Member

erral commented Aug 11, 2024

Yes, I also like the idea of having it in the said slot. If I am not wrong, in Classic UI there is a viewlet to render the related items which is rendered in a viewlet manager. And slots are similar to viewlet manager, si it makes total sense.

I also agree with the point that @davisagli raises regarding the need of the showRelatedItems setting.

Regarding changing the Tags component and adding it to a Slot, it makes total sense, but I think that's out of the scope of this PR.

@wesleybl
Copy link
Member Author

You can do this for Volto 18. If you want to backport this to Volto 16 or 17, it should be false by default there.

Done to Volto 18

@fredvd
Copy link
Member

fredvd commented Sep 21, 2024

I only found this issue this week. Yes, putting the related items in the slot is the most flexible and others a good default experience.

Please consider setups where you do want authors to control the related items in a block the site could be set up to hide th default slot and add a block for the related items. Both are possible this way.

@davisagli
Copy link
Member

@ichim-david Could you update your review please?

@plone/volto-team Can we merge this for Volto 18?

@ichim-david ichim-david self-requested a review September 21, 2024 16:20
@ichim-david
Copy link
Member

ichim-david commented Sep 21, 2024

@davisagli I haven't tested the latest changes but everything that is added came out of our comments on what we think it's best. I trust your judgement on how it works with the slot implementation. At this moment I am getting ready for the trip to Ferrara so I am accepting on principle and not due to further testing.

EDIT:
I am +1 on adding to volto 18 with worst case scenario disabled by default if there is objections from @plone/volto-team to have it enabled by default

@davisagli
Copy link
Member

We discussed in the Volto Team meeting. We missed merging this for Volto 18 so we want to merge it with the setting off by default. We can consider turning it on by default in the future in Volto 19.

@wesleybl
Copy link
Member Author

We discussed in the Volto Team meeting. We missed merging this for Volto 18 so we want to merge it with the setting off by default. We can consider turning it on by default in the future in Volto 19.

@davisagli I changed the default to false.

@davisagli davisagli merged commit 928afbd into main Dec 18, 2024
72 of 73 checks passed
@davisagli davisagli deleted the related_items branch December 18, 2024 22:52
@davisagli
Copy link
Member

@wesleybl Obrigado!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

related items don't show by default
9 participants