Skip to content

Commit

Permalink
feat: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Oct 20, 2023
1 parent a52cc85 commit 860840b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ const App = () => {
/>
</>
)}
<Route>
No match (404)
</Route>
</Switch>
</QueryClientProvider>
</AppProvider>
Expand Down
2 changes: 1 addition & 1 deletion src/taxonomy/api/hooks/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
export const useTaxonomyListDataResponse = () => {
const response = useTaxonomyListData();
if (response.status === 'success') {
return response.data;
return response.data.data;
}
return undefined;
};
Expand Down
3 changes: 3 additions & 0 deletions src/taxonomy/taxonomy-card/TaxonomyCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
} from '@edx/paragon';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';

import classNames from 'classnames';
import messages from '../messages';
import TaxonomyCardMenu from './TaxonomyCardMenu';
Expand Down Expand Up @@ -102,6 +104,7 @@ const TaxonomyCard = ({ className, original, intl }) => {
return (
<>
<Card className={classNames('taxonomy-card', className)} data-testid={`taxonomy-card-${id}`}>
<Link className="stretched-link" to={`taxonomy-list/${id}`} aria-label="view taxonomy details" />
<Card.Header
title={name}
subtitle={getHeaderSubtitle()}
Expand Down
21 changes: 19 additions & 2 deletions src/taxonomy/taxonomy-detail/TaxonomyDetailPage.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState } from 'react';
import {
Container,
Layout,
Expand All @@ -11,6 +11,7 @@ import Header from '../../header';
import SubHeader from '../../generic/sub-header/SubHeader';
import TaxonomyDetailSideCard from './TaxonomyDetailSideCard';
import TagListTable from './TagListTable';
import ExportModal from '../modals/ExportModal';
import { useTaxonomyDetailDataResponse, useTaxonomyDetailDataStatus } from '../api/hooks/selectors';

const TaxonomyDetailContent = ({ taxonomyId }) => {
Expand All @@ -22,6 +23,8 @@ const TaxonomyDetailContent = ({ taxonomyId }) => {

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

const [isExportModalOpen, setIsExportModalOpen] = useState(false);

if (isError) {
return (
<PermissionDeniedAlert />
Expand All @@ -34,6 +37,20 @@ const TaxonomyDetailContent = ({ taxonomyId }) => {
);
}

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

if (taxonomy) {
return (
<>
Expand All @@ -59,9 +76,9 @@ const TaxonomyDetailContent = ({ taxonomyId }) => {
<Layout.Element>
<TaxonomyDetailSideCard taxonomy={taxonomy} />
</Layout.Element>

</Layout>
</div>
{renderModals()}
</>
);
}
Expand Down

0 comments on commit 860840b

Please sign in to comment.