From fc2419be8027bef119397bc89708f893cfa7727d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Penido?= Date: Sat, 11 Nov 2023 10:46:46 -0300 Subject: [PATCH] refactor: ADR --- src/taxonomy/index.js | 2 +- src/taxonomy/tag-list/TagListTable.jsx | 7 +++---- src/taxonomy/tag-list/index.js | 1 + src/taxonomy/taxonomy-detail/TaxonomyDetailMenu.jsx | 5 ++--- src/taxonomy/taxonomy-detail/TaxonomyDetailPage.jsx | 9 +++++---- src/taxonomy/taxonomy-detail/TaxonomyDetailPage.test.jsx | 4 ++-- src/taxonomy/taxonomy-detail/index.js | 2 ++ src/taxonomy/taxonomy-detail/messages.js | 9 +++++++++ 8 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 src/taxonomy/tag-list/index.js create mode 100644 src/taxonomy/taxonomy-detail/index.js diff --git a/src/taxonomy/index.js b/src/taxonomy/index.js index 789be9255a..356c532411 100644 --- a/src/taxonomy/index.js +++ b/src/taxonomy/index.js @@ -1,3 +1,3 @@ export { default as TaxonomyListPage } from './TaxonomyListPage'; export { default as TaxonomyLayout } from './TaxonomyLayout'; -export { default as TaxonomyDetailPage } from './taxonomy-detail/TaxonomyDetailPage'; +export { TaxonomyDetailPage } from './taxonomy-detail'; diff --git a/src/taxonomy/tag-list/TagListTable.jsx b/src/taxonomy/tag-list/TagListTable.jsx index 6e8adc3dc3..a7ae3d950c 100644 --- a/src/taxonomy/tag-list/TagListTable.jsx +++ b/src/taxonomy/tag-list/TagListTable.jsx @@ -6,9 +6,8 @@ import _ from 'lodash'; import Proptypes from 'prop-types'; import { useState } from 'react'; -import messages from '../../messages'; -import taxonomyMessages from '../messages'; -import { useTagListDataResponse, useTagListDataStatus } from '../api/hooks/selectors'; +import messages from './messages'; +import { useTagListDataResponse, useTagListDataStatus } from './data/selectors'; const TagListTable = ({ taxonomyId }) => { const intl = useIntl(); @@ -48,7 +47,7 @@ const TagListTable = ({ taxonomyId }) => { initialState={options} columns={[ { - Header: intl.formatMessage(taxonomyMessages.tagListColumnValueHeader), + Header: intl.formatMessage(messages.tagListColumnValueHeader), accessor: 'value', }, ]} diff --git a/src/taxonomy/tag-list/index.js b/src/taxonomy/tag-list/index.js new file mode 100644 index 0000000000..ac0ce31b3d --- /dev/null +++ b/src/taxonomy/tag-list/index.js @@ -0,0 +1 @@ +export { default as TagListTable } from './TagListTable'; // eslint-disable-line import/prefer-default-export diff --git a/src/taxonomy/taxonomy-detail/TaxonomyDetailMenu.jsx b/src/taxonomy/taxonomy-detail/TaxonomyDetailMenu.jsx index 6fd7613e12..1f2aa839d2 100644 --- a/src/taxonomy/taxonomy-detail/TaxonomyDetailMenu.jsx +++ b/src/taxonomy/taxonomy-detail/TaxonomyDetailMenu.jsx @@ -7,7 +7,6 @@ import { import PropTypes from 'prop-types'; import messages from './messages'; -import taxonomyMessages from '../messages'; const TaxonomyDetailMenu = ({ id, name, disabled, onClickMenuItem, @@ -18,11 +17,11 @@ const TaxonomyDetailMenu = ({ onClickMenuItem('export')}> - {intl.formatMessage(taxonomyMessages.taxonomyCardExportMenu)} + {intl.formatMessage(messages.exportMenu)} ); diff --git a/src/taxonomy/taxonomy-detail/TaxonomyDetailPage.jsx b/src/taxonomy/taxonomy-detail/TaxonomyDetailPage.jsx index 23ddf046f0..6c39a0e23b 100644 --- a/src/taxonomy/taxonomy-detail/TaxonomyDetailPage.jsx +++ b/src/taxonomy/taxonomy-detail/TaxonomyDetailPage.jsx @@ -1,3 +1,4 @@ +// ts-check import React, { useState } from 'react'; import { useIntl } from '@edx/frontend-platform/i18n'; import { @@ -10,11 +11,11 @@ import { Link, useParams } from 'react-router-dom'; import ConnectionErrorAlert from '../../generic/ConnectionErrorAlert'; import Loading from '../../generic/Loading'; import SubHeader from '../../generic/sub-header/SubHeader'; -import messages from './messages'; +import taxonomyMessages from '../messages'; import TaxonomyDetailMenu from './TaxonomyDetailMenu'; import TaxonomyDetailSideCard from './TaxonomyDetailSideCard'; -import TagListTable from './TagListTable'; -import ExportModal from '../modals/ExportModal'; +import { TagListTable } from '../tag-list'; +import ExportModal from '../export-modal'; import { useTaxonomyDetailDataResponse, useTaxonomyDetailDataStatus } from './data/selectors'; const TaxonomyDetailPage = () => { @@ -89,7 +90,7 @@ const TaxonomyDetailPage = () => { ({ +jest.mock('./data/api', () => ({ useTaxonomyDetailData: jest.fn(), })); jest.mock('react-router-dom', () => ({ diff --git a/src/taxonomy/taxonomy-detail/index.js b/src/taxonomy/taxonomy-detail/index.js new file mode 100644 index 0000000000..5665033c97 --- /dev/null +++ b/src/taxonomy/taxonomy-detail/index.js @@ -0,0 +1,2 @@ +// ts-check +export { default as TaxonomyDetailPage } from './TaxonomyDetailPage'; // eslint-disable-line import/prefer-default-export diff --git a/src/taxonomy/taxonomy-detail/messages.js b/src/taxonomy/taxonomy-detail/messages.js index a1d9c15404..ec5291f6c0 100644 --- a/src/taxonomy/taxonomy-detail/messages.js +++ b/src/taxonomy/taxonomy-detail/messages.js @@ -1,3 +1,4 @@ +// ts-check import { defineMessages } from '@edx/frontend-platform/i18n'; const messages = defineMessages({ @@ -17,6 +18,14 @@ const messages = defineMessages({ id: 'course-authoring.taxonomy-detail.action.button.label', defaultMessage: 'Actions', }, + actionsButtonAlt: { + id: 'course-authoring.taxonomy-detail.action.button.alt', + defaultMessage: '{name} actions', + }, + exportMenu: { + id: 'course-authoring.taxonomy-detail.action.export', + defaultMessage: 'Export', + }, }); export default messages;