forked from openedx/frontend-app-authoring
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
161 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// @ts-check | ||
|
||
/** | ||
/** | ||
* @typedef {Object} TaxonomyData | ||
* @property {number} id | ||
* @property {string} name | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export { default as TaxonomyListPage } from './TaxonomyListPage'; | ||
export { TaxonomyDetailPage } from './taxonomy-detail'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import React from 'react'; | ||
import { | ||
Container, | ||
} from '@edx/paragon'; | ||
import Proptypes from 'prop-types'; | ||
|
||
import PermissionDeniedAlert from '../../generic/PermissionDeniedAlert'; | ||
import Loading from '../../generic/Loading'; | ||
import Header from '../../header'; | ||
import SubHeader from '../../generic/sub-header/SubHeader'; | ||
import { useTaxonomyDetailDataResponse, useTaxonomyDetailDataStatus } from '../api/hooks/selectors'; | ||
|
||
|
||
const TaxonomyDetailTemp = ({ taxonomyId }) => { | ||
const useTaxonomyDetailData = () => { | ||
const { isError, isFetched } = useTaxonomyDetailDataStatus(taxonomyId); | ||
const taxonomy = useTaxonomyDetailDataResponse(taxonomyId); | ||
return { isError, isFetched, taxonomy }; | ||
}; | ||
|
||
const { isError, isFetched, taxonomy } = useTaxonomyDetailData(taxonomyId); | ||
|
||
if (isError) { | ||
return ( | ||
<PermissionDeniedAlert /> | ||
); | ||
} | ||
|
||
if (!isFetched) { | ||
return ( | ||
<Loading /> | ||
); | ||
} | ||
|
||
if (taxonomy) { | ||
return ( | ||
<> | ||
<div className="pt-4.5 pr-4.5 pl-4.5 pb-2 bg-light-100 box-shadow-down-2"> | ||
<Container size="xl"> | ||
<SubHeader | ||
title={taxonomy.name} | ||
hideBorder | ||
/> | ||
</Container> | ||
</div> | ||
<div className="bg-light-400 mt-1"> | ||
<Container size="xl"> | ||
{ | ||
taxonomy ? ( | ||
<div> | ||
<pre>{JSON.stringify(taxonomy, null, 2)}</pre> | ||
</div> | ||
) : (<>Taxonomy not found</>) | ||
} | ||
</Container> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
return undefined; | ||
}; | ||
|
||
const TaxonomyDetailPage = ({ taxonomyId }) => ( | ||
<> | ||
<style> | ||
{` | ||
body { | ||
background-color: #E9E6E4; /* light-400 */ | ||
} | ||
`} | ||
</style> | ||
<Header isHiddenMainMenu /> | ||
<TaxonomyDetailTemp taxonomyId={taxonomyId} /> | ||
</> | ||
); | ||
|
||
TaxonomyDetailPage.propTypes = { | ||
taxonomyId: Proptypes.number, | ||
}; | ||
|
||
TaxonomyDetailPage.defaultProps = { | ||
taxonomyId: undefined, | ||
}; | ||
|
||
TaxonomyDetailTemp.propTypes = TaxonomyDetailPage.propTypes; | ||
TaxonomyDetailTemp.defaultProps = TaxonomyDetailPage.defaultProps; | ||
|
||
export default TaxonomyDetailPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export { default as TaxonomyDetailPage } from './TaxonomyDetailPage'; |