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: bare bones taxonomy detail page [FC-0036] #655

Conversation

rpenido
Copy link
Contributor

@rpenido rpenido commented Oct 24, 2023

Description

Add the first version of the Taxonomy Detail page to show taxonomy metadata and its tag list.

Supporting Information

image

Testing instructions

  • Go to the taxonomy list page (http://localhost:2001/taxonomy-list)
  • Click in any place of the taxonomy card to go to the taxonomy detail page
  • Verify if the tag list is displayed and the taxonomy info is showed in the right card
  • Use the Actions menu to export the taxonomy (taxonomy modal implemented here)

If you don't have any taxonomies registered, you could use the taxonomy-sample-data script.


Private-ref: FAL-3529

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

openedx-webhooks commented Oct 24, 2023

Thanks for the pull request, @rpenido! 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.

@rpenido rpenido force-pushed the rpenido/fal-3529-bare-bones-taxonomy-detail-page branch 5 times, most recently from 965385f to 3d45969 Compare October 25, 2023 13:02
@rpenido rpenido force-pushed the rpenido/fal-3529-bare-bones-taxonomy-detail-page branch 3 times, most recently from 5d927a9 to 87808bb Compare October 25, 2023 19:18
@rpenido rpenido force-pushed the rpenido/fal-3529-bare-bones-taxonomy-detail-page branch 2 times, most recently from d408b52 to a12f262 Compare October 31, 2023 18:45
@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Nov 6, 2023
@e0d
Copy link

e0d commented Nov 6, 2023

@rpenido I've invited you to the openedx-triage team which will allow tests to run automatically for your submissions, can you please accept the invitation.

@mphilbrick211 mphilbrick211 removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Nov 9, 2023
@rpenido rpenido force-pushed the rpenido/fal-3529-bare-bones-taxonomy-detail-page branch from 9ae8dc1 to c6b68bf Compare November 11, 2023 13:10
@rpenido rpenido force-pushed the rpenido/fal-3529-bare-bones-taxonomy-detail-page branch from 568ee3e to 56dbdd2 Compare November 11, 2023 15:07
@bradenmacdonald
Copy link
Contributor

@rpenido Can you please rebase this and mark it as non-draft, if it's ready? We should also get the 👍🏻 here from your reviewer(s), then schedule the Core Contributor / Maintainer review.

@bradenmacdonald
Copy link
Contributor

@rpenido Also, please put [FC-0036] into the PR title.

@rpenido rpenido changed the title feat: bare bones taxonomy detail page feat: bare bones taxonomy detail page [FC-0036] Nov 15, 2023
Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

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

👍

  • I tested this on my devstack
  • I read through the code
  • I checked for accessibility issues by navigating using the keyboard only
  • Includes documentation
  • User-facing strings are extracted for translation

@pomegranited
Copy link
Contributor

@bradenmacdonald Standing in while @rpenido is away: I've merged latest main and addressed the comments from open-craft#5 (review)
I left my 👍 so I think this is ready for upstream review? I don't have permission to remove the "Draft" label.

@rpenido rpenido marked this pull request as ready for review November 16, 2023 01:18
@rpenido
Copy link
Contributor Author

rpenido commented Nov 16, 2023

I don't have permission to remove the "Draft" label.

Done @pomegranited ! Thank you for your cover here! 😃

Copy link
Contributor

@xitij2000 xitij2000 left a comment

Choose a reason for hiding this comment

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

A few nits.

Comment on lines 22 to 25
queryFn: () => getAuthenticatedHttpClient().get(getTagListApiUrl(taxonomyId, pageIndex))
.then((response) => response.data)
.then(camelCaseObject),
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Just realised you can use async/await here:

Suggested change
queryFn: () => getAuthenticatedHttpClient().get(getTagListApiUrl(taxonomyId, pageIndex))
.then((response) => response.data)
.then(camelCaseObject),
});
queryFn: async () => {
const { data } = await getAuthenticatedHttpClient().get(getTagListApiUrl(taxonomyId, pageIndex));
return camelCaseObject(data);
}
});

Copy link
Contributor

@pomegranited pomegranited Nov 20, 2023

Choose a reason for hiding this comment

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

Addressed with 0e19e99

@@ -0,0 +1 @@
export { default as TagListTable } from './TagListTable'; // eslint-disable-line import/prefer-default-export
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a small nit. Adding it this way means any other entries you add won't need this comment.

Suggested change
export { default as TagListTable } from './TagListTable'; // eslint-disable-line import/prefer-default-export
/* eslint-disable import/prefer-default-export */
export { default as TagListTable } from './TagListTable';

Copy link
Contributor

Choose a reason for hiding this comment

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

Addressed with 0e19e99

Comment on lines 47 to 59
const renderModals = () => (
// eslint-disable-next-line react/jsx-no-useless-fragment
<>
{isExportModalOpen && (
<ExportModal
isOpen={isExportModalOpen}
onClose={() => setIsExportModalOpen(false)}
taxonomyId={taxonomy.id}
taxonomyName={taxonomy.name}
/>
)}
</>
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const renderModals = () => (
// eslint-disable-next-line react/jsx-no-useless-fragment
<>
{isExportModalOpen && (
<ExportModal
isOpen={isExportModalOpen}
onClose={() => setIsExportModalOpen(false)}
taxonomyId={taxonomy.id}
taxonomyName={taxonomy.name}
/>
)}
</>
);
const renderModals = () => isExportModalOpen && (
<ExportModal
isOpen={isExportModalOpen}
onClose={() => setIsExportModalOpen(false)}
taxonomyId={taxonomy.id}
taxonomyName={taxonomy.name}
/>
);

Copy link
Contributor

Choose a reason for hiding this comment

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

Addressed with 0e19e99

Comment on lines 25 to 31
const useTaxonomyDetailData = () => {
const { isError, isFetched } = useTaxonomyDetailDataStatus(taxonomyId);
const taxonomy = useTaxonomyDetailDataResponse(taxonomyId);
return { isError, isFetched, taxonomy };
};

const { isError, isFetched, taxonomy } = useTaxonomyDetailData(taxonomyId);
Copy link
Contributor

Choose a reason for hiding this comment

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

This internal hook doesn't seem to be reused so I'm not sure why it's needed.

Suggested change
const useTaxonomyDetailData = () => {
const { isError, isFetched } = useTaxonomyDetailDataStatus(taxonomyId);
const taxonomy = useTaxonomyDetailDataResponse(taxonomyId);
return { isError, isFetched, taxonomy };
};
const { isError, isFetched, taxonomy } = useTaxonomyDetailData(taxonomyId);
const { isError, isFetched } = useTaxonomyDetailDataStatus(taxonomyId);
const taxonomy = useTaxonomyDetailDataResponse(taxonomyId);

Copy link
Contributor

Choose a reason for hiding this comment

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

Addressed with 0e19e99

Comment on lines 20 to 31
const useTagListData = () => {
const { isError, isFetched, isLoading } = useTagListDataStatus(taxonomyId, options);
const tagList = useTagListDataResponse(taxonomyId, options);
return {
isError,
isFetched,
isLoading,
tagList,
};
};

const { tagList, isLoading } = useTagListData();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const useTagListData = () => {
const { isError, isFetched, isLoading } = useTagListDataStatus(taxonomyId, options);
const tagList = useTagListDataResponse(taxonomyId, options);
return {
isError,
isFetched,
isLoading,
tagList,
};
};
const { tagList, isLoading } = useTagListData();
const { isLoading } = useTagListDataStatus(taxonomyId, options);
const tagList = useTagListDataResponse(taxonomyId, options);

Copy link
Contributor

Choose a reason for hiding this comment

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

Addressed with 0e19e99

@bradenmacdonald
Copy link
Contributor

@pomegranited Would you be able to address those nits? ^

I also noticed a minor bug with this PR. If I click the "three dots" button, the menu opens - good. But if I click it again while the menu is open, instead of just closing the menu, it also takes me to the taxonomy detail page.

Screenshot 2023-11-17 at 12 25 05 PM

@bradenmacdonald
Copy link
Contributor

Also: I think we should fix the URLs here. The taxonomy list should be at /taxonomies/ and an individual taxonomy should be at e.g. taxonomy/4/, not taxonomy-list/4/. It doesn't make sense to have "list" in the URL for a single taxonomy.

Avoids clicking through to the card when using the menu button to hide
a card's menu.
* /taxonomy-list is now /taxonomies, and there's a temporary redirect
* /taxonomy-list/:id: is now /taxonomy/:id:
@pomegranited
Copy link
Contributor

@xitij2000 I've addressed your nits with 0e19e99.

@bradenmacdonald I fixed that menu bug with 3f0dbaa, and changed the URLs with a15e3a4.

Let me know if there's anything else we should fix before this can be merged?

Copy link
Contributor

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

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

Approved, but it seems a rebase is needed.

@bradenmacdonald
Copy link
Contributor

I can rebase now.

@arbrandes arbrandes merged commit 02cdccc into openedx:master Nov 20, 2023
5 checks passed
@openedx-webhooks
Copy link

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

@rpenido rpenido deleted the rpenido/fal-3529-bare-bones-taxonomy-detail-page branch November 21, 2023 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

[Tagging] "Bare Bones" Taxonomy Detail Page
9 participants