Skip to content

Commit

Permalink
refactor: Move and rename taxonomy UI components to match 0002 ADR
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisChV committed Oct 31, 2023
1 parent 61864d3 commit b09b86a
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 55 deletions.
2 changes: 1 addition & 1 deletion src/taxonomy/TaxonomyListPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ 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 TaxonomyCard from './taxonomy-card';
import { useTaxonomyListDataResponse, useIsTaxonomyListDataLoaded } from './api/hooks/selectors';

const TaxonomyListPage = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IntlProvider, injectIntl } from '@edx/frontend-platform/i18n';
import { initializeMockApp } from '@edx/frontend-platform';
import { AppProvider } from '@edx/frontend-platform/react';
import { render, fireEvent } from '@testing-library/react';
import ExportModal from './ExportModal';
import ExportModal from '.';
import initializeStore from '../../store';
import { callExportTaxonomy } from '../api/hooks/selectors';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@edx/paragon';
import PropTypes from 'prop-types';
import { useIntl } from '@edx/frontend-platform/i18n';
import messages from '../messages';
import messages from './messages';
import { callExportTaxonomy } from '../api/hooks/selectors';

const ExportModal = ({
Expand Down
30 changes: 30 additions & 0 deletions src/taxonomy/export-modal/messages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { defineMessages } from '@edx/frontend-platform/i18n';

const messages = defineMessages({
exportModalTitle: {
id: 'course-authoring.taxonomy-list.modal.export.title',
defaultMessage: 'Select format to export',
},
exportModalBodyDescription: {
id: 'course-authoring.taxonomy-list.modal.export.body',
defaultMessage: 'Select the file format in which you would like the taxonomy to be exported:',
},
exportModalSubmitButtonLabel: {
id: 'course-authoring.taxonomy-list.modal.export.submit.label',
defaultMessage: 'Export',
},
taxonomyCSVFormat: {
id: 'course-authoring.taxonomy-list.csv-format',
defaultMessage: 'CSV file',
},
taxonomyJSONFormat: {
id: 'course-authoring.taxonomy-list.json-format',
defaultMessage: 'JSON file',
},
taxonomyModalsCancelLabel: {
id: 'course-authoring.taxonomy-list.modal.cancel',
defaultMessage: 'Cancel',
},
});

export default messages;
48 changes: 0 additions & 48 deletions src/taxonomy/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,58 +17,10 @@ const messages = defineMessages({
id: 'course-authoring.taxonomy-list.select.org.default',
defaultMessage: 'All taxonomies',
},
systemDefinedBadge: {
id: 'course-authoring.taxonomy-list.badge.system-defined.label',
defaultMessage: 'System-level',
},
assignedToOrgsLabel: {
id: 'course-authoring.taxonomy-list.orgs-count.label',
defaultMessage: 'Assigned to {orgsCount} orgs',
},
usageLoadingMessage: {
id: 'course-authoring.taxonomy-list.spinner.loading',
defaultMessage: 'Loading',
},
systemTaxonomyPopoverTitle: {
id: 'course-authoring.taxonomy-list.popover.system-defined.title',
defaultMessage: 'System taxonomy',
},
systemTaxonomyPopoverBody: {
id: 'course-authoring.taxonomy-list.popover.system-defined.body',
defaultMessage: 'This is a system-level taxonomy and is enabled by default.',
},
taxonomyCardExportMenu: {
id: 'course-authoring.taxonomy-list.menu.export.label',
defaultMessage: 'Export',
},
taxonomyMenuAlt: {
id: 'course-authoring.taxonomy-list.menu.alt',
defaultMessage: '{name} menu',
},
exportModalTitle: {
id: 'course-authoring.taxonomy-list.modal.export.title',
defaultMessage: 'Select format to export',
},
exportModalBodyDescription: {
id: 'course-authoring.taxonomy-list.modal.export.body',
defaultMessage: 'Select the file format in which you would like the taxonomy to be exported:',
},
exportModalSubmitButtonLabel: {
id: 'course-authoring.taxonomy-list.modal.export.submit.label',
defaultMessage: 'Export',
},
taxonomyCSVFormat: {
id: 'course-authoring.taxonomy-list.csv-format',
defaultMessage: 'CSV file',
},
taxonomyJSONFormat: {
id: 'course-authoring.taxonomy-list.json-format',
defaultMessage: 'JSON file',
},
taxonomyModalsCancelLabel: {
id: 'course-authoring.taxonomy-list.modal.cancel',
defaultMessage: 'Cancel',
},
});

export default messages;
2 changes: 1 addition & 1 deletion src/taxonomy/taxonomy-card/TaxonomyCard.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import PropTypes from 'prop-types';

import initializeStore from '../../store';

import TaxonomyCard from './TaxonomyCard';
import TaxonomyCard from '.';

let store;

Expand Down
2 changes: 1 addition & 1 deletion src/taxonomy/taxonomy-card/TaxonomyCardMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { MoreVert } from '@edx/paragon/icons';
import PropTypes from 'prop-types';
import { useIntl } from '@edx/frontend-platform/i18n';
import messages from '../messages';
import messages from './messages';

const TaxonomyCardMenu = ({
id, name, onClickMenuItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { useIntl } from '@edx/frontend-platform/i18n';
import messages from '../messages';
import messages from './messages';
import TaxonomyCardMenu from './TaxonomyCardMenu';
import ExportModal from '../modals/ExportModal';
import ExportModal from '../export-modal';

const orgsCountEnabled = (orgsCount) => orgsCount !== undefined && orgsCount !== 0;

Expand Down
30 changes: 30 additions & 0 deletions src/taxonomy/taxonomy-card/messages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { defineMessages } from '@edx/frontend-platform/i18n';

const messages = defineMessages({
systemTaxonomyPopoverTitle: {
id: 'course-authoring.taxonomy-list.popover.system-defined.title',
defaultMessage: 'System taxonomy',
},
systemTaxonomyPopoverBody: {
id: 'course-authoring.taxonomy-list.popover.system-defined.body',
defaultMessage: 'This is a system-level taxonomy and is enabled by default.',
},
systemDefinedBadge: {
id: 'course-authoring.taxonomy-list.badge.system-defined.label',
defaultMessage: 'System-level',
},
assignedToOrgsLabel: {
id: 'course-authoring.taxonomy-list.orgs-count.label',
defaultMessage: 'Assigned to {orgsCount} orgs',
},
taxonomyCardExportMenu: {
id: 'course-authoring.taxonomy-list.menu.export.label',
defaultMessage: 'Export',
},
taxonomyMenuAlt: {
id: 'course-authoring.taxonomy-list.menu.alt',
defaultMessage: '{name} menu',
},
});

export default messages;

0 comments on commit b09b86a

Please sign in to comment.