Skip to content

Commit

Permalink
style: injectIntl replaced by useIntl on taxonomy pages and components
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisChV committed Oct 31, 2023
1 parent a21fac2 commit 61864d3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
11 changes: 5 additions & 6 deletions src/taxonomy/TaxonomyListPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import {
DataTable,
Spinner,
} from '@edx/paragon';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { StudioFooter } from '@edx/frontend-component-footer';
import { useIntl } from '@edx/frontend-platform/i18n';
import Header from '../header';
import SubHeader from '../generic/sub-header/SubHeader';
import messages from './messages';
import TaxonomyCard from './taxonomy-card/TaxonomyCard';
import { useTaxonomyListDataResponse, useIsTaxonomyListDataLoaded } from './api/hooks/selectors';

const TaxonomyListPage = ({ intl }) => {
const TaxonomyListPage = () => {
const intl = useIntl();
const useTaxonomyListData = () => {
const taxonomyListData = useTaxonomyListDataResponse();
const isLoaded = useIsTaxonomyListDataLoaded();
Expand Down Expand Up @@ -97,8 +98,6 @@ const TaxonomyListPage = ({ intl }) => {
);
};

TaxonomyListPage.propTypes = {
intl: intlShape.isRequired,
};
TaxonomyListPage.propTypes = {};

export default injectIntl(TaxonomyListPage);
export default TaxonomyListPage;
7 changes: 3 additions & 4 deletions src/taxonomy/modals/ExportModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import {
ModalDialog,
} from '@edx/paragon';
import PropTypes from 'prop-types';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { useIntl } from '@edx/frontend-platform/i18n';
import messages from '../messages';
import { callExportTaxonomy } from '../api/hooks/selectors';

const ExportModal = ({
taxonomyId,
isOpen,
onClose,
intl,
}) => {
const intl = useIntl();
const [outputFormat, setOutputFormat] = useState('csv');

const onClickExport = () => {
Expand Down Expand Up @@ -80,7 +80,6 @@ ExportModal.propTypes = {
taxonomyId: PropTypes.number.isRequired,
isOpen: PropTypes.bool.isRequired,
onClose: PropTypes.func.isRequired,
intl: intlShape.isRequired,
};

export default injectIntl(ExportModal);
export default ExportModal;
9 changes: 5 additions & 4 deletions src/taxonomy/taxonomy-card/TaxonomyCardMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import {
} from '@edx/paragon';
import { MoreVert } from '@edx/paragon/icons';
import PropTypes from 'prop-types';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { useIntl } from '@edx/frontend-platform/i18n';
import messages from '../messages';

const TaxonomyCardMenu = ({
id, name, onClickMenuItem, intl,
id, name, onClickMenuItem,
}) => {
const intl = useIntl();
const [menuIsOpen, setMenuIsOpen] = useState(false);
const [menuTarget, setMenuTarget] = useState(null);

Expand All @@ -39,6 +40,7 @@ const TaxonomyCardMenu = ({
onClose={() => setMenuIsOpen(false)}
>
<Menu data-testid={`taxonomy-card-menu-${id}`}>
{/* Add more menu items here */}
<MenuItem className="taxonomy-menu-item" onClick={() => onClickItem('export')}>
{intl.formatMessage(messages.taxonomyCardExportMenu)}
</MenuItem>
Expand All @@ -52,7 +54,6 @@ TaxonomyCardMenu.propTypes = {
id: PropTypes.number.isRequired,
name: PropTypes.string.isRequired,
onClickMenuItem: PropTypes.func.isRequired,
intl: intlShape.isRequired,
};

export default injectIntl(TaxonomyCardMenu);
export default TaxonomyCardMenu;

0 comments on commit 61864d3

Please sign in to comment.