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: display all child tags in the "bare bones" taxonomy detail page [FAL-3529] [FC-0036] #703

Merged

Conversation

bradenmacdonald
Copy link
Contributor

@bradenmacdonald bradenmacdonald commented Nov 20, 2023

Ticket: openedx/modular-learning#138

This PR has some minor improvements to the "Taxonomy Detail Page".

This is not the final UI design and all of this can/will be changed - this just makes sure that users can see all the tags in the taxonomy during our initial round of testing.

Before:

Screenshot 2023-11-17 at 3 22 16 PM

After:

Screenshot 2023-11-17 at 3 23 01 PM

Screenshot 2023-11-17 at 3 23 16 PM

Screenshot 2023-11-17 at 3 23 30 PM

Test Instructions

Note that you need to have openedx/openedx-learning#119 checked out locally or you may see duplicate results in the tag tree.

Private ref: FAL-3529

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Nov 20, 2023
@openedx-webhooks
Copy link

Thanks for the pull request, @bradenmacdonald! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

Copy link

codecov bot commented Nov 20, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (a622f8e) 88.62% compared to head (eb1ea74) 88.69%.

Files Patch % Lines
src/taxonomy/tag-list/TagListTable.jsx 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #703      +/-   ##
==========================================
+ Coverage   88.62%   88.69%   +0.06%     
==========================================
  Files         446      446              
  Lines        6851     6875      +24     
  Branches     1465     1469       +4     
==========================================
+ Hits         6072     6098      +26     
+ Misses        754      752       -2     
  Partials       25       25              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@rpenido rpenido left a comment

Choose a reason for hiding this comment

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

LGTM 👍

  • I read through the code
  • I followed the test instructions and ran the code locally
  • I checked for accessibility issues by navigating using the keyboard only
  • User-facing strings are extracted for translation

I added a nit suggestion about the Title, but to me, it is ok to leave it as it is.

Also, when we click Expand all and have a tag without children, we have an empty row drawn. This is from the DataTable, not our SubTagsExpanded component. We could try to hide this row using CSS, but I wonder if we should put time into this.
image

To meet the coverage criteria, we need to add tests to the SubTagsExpanded and the new temporary hook.

@@ -35,6 +38,9 @@ const TaxonomyListPage = () => {

return (
<>
<Helmet>
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch!

@@ -74,6 +79,9 @@ const TaxonomyDetailPage = () => {

return (
<>
<Helmet>
<title>{getPageHeadTitle('', taxonomy.name)}</title>
Copy link
Contributor

Choose a reason for hiding this comment

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

Feel free to push back on this, but what do you think about adding the Taxonomy header to give some context?

Suggested change
<title>{getPageHeadTitle('', taxonomy.name)}</title>
<title>{getPageHeadTitle(taxonomy.name, intl.formatMessage(taxonomyMessages.headerTitle))}</title>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, done! Though I did it slightly differently. You always want the most specific information to come first in the <title> as that's what users can see most easily.

src/generic/Loading.jsx Outdated Show resolved Hide resolved
Comment on lines +24 to +30
<ul style={{ listStyleType: 'none' }}>
{subTagsData.data.results.map(tagData => (
<li key={tagData.id} style={{ paddingLeft: `${(tagData.depth - 1) * 30}px` }}>
{tagData.value} <span className="text-light-900">{tagData.childCount > 0 ? `(${tagData.childCount})` : null}</span>
</li>
))}
</ul>
Copy link
Contributor

Choose a reason for hiding this comment

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

If this date is nested, instead of using padding perhaps it can do the following:

const TagList = ({subTagData}) => (
    <ul style={{ listStyleType: 'none' }}>
      {subTagsData.data.results.map(tagData => (
        <li key={tagData.id}>
          {tagData.value} <span className="text-light-900">{tagData.childCount > 0 ? `(${tagData.childCount})` : null}</span> 
          {tagData.children && <TagList subTagData={tagData} />}
        </li>
      ))}
    </ul>
)

I don't know if the data is structured that way or can be accessed that way. It will avoid the need to use padding to denote hierarchy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think that's what we'll do eventually. We're basically going to be re-building this whole table in openedx/modular-learning#130 so I didn't bother doing anything too fancy for now. Right now we're just trying to get the basic read-only functionality out the door. The data is currently just in a single array, though the tags are in "tree order" in that array, which is why we can display them this way and why I went with the simplest option.

@bradenmacdonald
Copy link
Contributor Author

Also, when we click Expand all and have a tag without children, we have an empty row drawn. This is from the DataTable, not our SubTagsExpanded component. We could try to hide this row using CSS, but I wonder if we should put time into this.

Yeah, it's not worth spending time on for now. This is just a very temporary solution. We're going to have to build this datatable quite differently to implement tickets like openedx/modular-learning#130 and openedx/modular-learning#128 .

@@ -7,6 +7,7 @@ const getApiBaseUrl = () => getConfig().STUDIO_BASE_URL;
export const getTaxonomyListApiUrl = (org) => {
const url = new URL('api/content_tagging/v1/taxonomies/', getApiBaseUrl());
url.searchParams.append('enabled', 'true');
url.searchParams.append('page_size', '500'); // For the tagging MVP, we don't paginate the taxonomy list
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ChrisChV FYI - I included a quick fix here for the pagination issue on the taxonomy list page.

@bradenmacdonald bradenmacdonald force-pushed the braden/improve-listing-tags-bare-bones branch from c821d2d to 61de124 Compare November 21, 2023 23:38
@xitij2000
Copy link
Contributor

@bradenmacdonald Is this PR complete and ready to merge from your side?

@bradenmacdonald
Copy link
Contributor Author

@xitij2000 Yes, thanks!

@xitij2000
Copy link
Contributor

@bradenmacdonald Could you squish the commits and add a commit description?

Also includes:
- feat: set <title> on taxonomy list page and taxonomy detail page
- fix: display all taxonomies on the list page, even if > 10
- refactor: separate out loading spinner component
@bradenmacdonald bradenmacdonald force-pushed the braden/improve-listing-tags-bare-bones branch from 61de124 to eb1ea74 Compare November 22, 2023 16:40
@bradenmacdonald
Copy link
Contributor Author

@xitij2000 Sure, done. Is the "Squash and Merge" feature not enabled for this repo?

@xitij2000 xitij2000 merged commit 352ef35 into openedx:master Nov 22, 2023
5 checks passed
@openedx-webhooks
Copy link

@bradenmacdonald 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@bradenmacdonald bradenmacdonald deleted the braden/improve-listing-tags-bare-bones branch November 22, 2023 21:42
@xitij2000
Copy link
Contributor

@bradenmacdonald Is this PR complete and ready to merge from your side?

@xitij2000 Sure, done. Is the "Squash and Merge" feature not enabled for this repo?

It is, however it doesn't generate a good commit message, it merely squishes together all the messages, often adding unnecessary temporary commit messages. It's best for the original author to do this since they'll have best context on what all to include in the message.

@itsjeyd itsjeyd added the core contributor PR author is a Core Contributor (who may or may not have write access to this repo). label Nov 23, 2023
lucascalvino pushed a commit that referenced this pull request Dec 19, 2023
…#703)

Also includes:
- feat: set <title> on taxonomy list page and taxonomy detail page
- fix: display all taxonomies on the list page, even if > 10
- refactor: separate out loading spinner component
lucascalvino pushed a commit that referenced this pull request Dec 19, 2023
…#703)

Also includes:
- feat: set <title> on taxonomy list page and taxonomy detail page
- fix: display all taxonomies on the list page, even if > 10
- refactor: separate out loading spinner component
lucascalvino pushed a commit that referenced this pull request Dec 19, 2023
…#703)

Also includes:
- feat: set <title> on taxonomy list page and taxonomy detail page
- fix: display all taxonomies on the list page, even if > 10
- refactor: separate out loading spinner component
lucascalvino pushed a commit that referenced this pull request Dec 19, 2023
…#703)

Also includes:
- feat: set <title> on taxonomy list page and taxonomy detail page
- fix: display all taxonomies on the list page, even if > 10
- refactor: separate out loading spinner component
lucascalvino pushed a commit that referenced this pull request Dec 19, 2023
…#703)

Also includes:
- feat: set <title> on taxonomy list page and taxonomy detail page
- fix: display all taxonomies on the list page, even if > 10
- refactor: separate out loading spinner component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants