diff --git a/app/assets/javascripts/components/activity/activity_table.jsx b/app/assets/javascripts/components/activity/activity_table.jsx deleted file mode 100644 index f91f1e6edc..0000000000 --- a/app/assets/javascripts/components/activity/activity_table.jsx +++ /dev/null @@ -1,123 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { useSelector } from 'react-redux'; -import { flatten, zip } from 'lodash-es'; -import { formatDateWithTime } from '../../utils/date_utils'; -import ActivityTableRow from './activity_table_row.jsx'; -import Loading from '../common/loading.jsx'; - -const ActivityTable = ({ onSort, activity, headers, loading, noActivityMessage }) => { - const openKey = useSelector(state => state.ui.openKey); - - const sortItems = (e) => { - onSort(e.currentTarget.getAttribute('data-sort-key')); - }; - - const _renderActivites = () => { - return activity.map((revision) => { - const roundedRevisionScore = Math.round(revision.revision_score) || 'unknown'; - const revisionDateTime = formatDateWithTime(revision.datetime); - const talkPageLink = `${revision.base_url}/wiki/User_talk:${revision.username}`; - const isOpen = openKey === `drawer_${revision.key}`; - - return ( - - ); - }); - }; - - const _renderDrawers = () => { - return activity.map((revision) => { - const courses = revision.courses.map((course) => { - return ( -
  • - {course.title} -
  • - ); - }); - - return ( - - - - - - - - - -
    - -
    {I18n.t('recent_activity.active_courses')}
    -
      - {courses} -
    -
    -
    - - - ); - }); - }; - - const _renderHeaders = () => { - return headers.map((header) => { - return ( - - {header.title} - - - ); - }); - }; - - if (loading) { - return ; - } - - const renderedActivity = _renderActivites(); - const drawers = _renderDrawers(); - const ths = _renderHeaders(); - - let elements = flatten(zip(renderedActivity, drawers)); - if (!elements.length) { - elements = {noActivityMessage}; - } - - return ( - - - - {ths} - - - - {elements} - -
    -
    - ); -}; - -ActivityTable.propTypes = { - loading: PropTypes.bool, - activity: PropTypes.array, - headers: PropTypes.array, - noActivityMessage: PropTypes.string, - toggleDrawer: PropTypes.func -}; - -export default (ActivityTable); diff --git a/app/assets/javascripts/components/activity/activity_table_row.jsx b/app/assets/javascripts/components/activity/activity_table_row.jsx deleted file mode 100644 index 5ac6155d2e..0000000000 --- a/app/assets/javascripts/components/activity/activity_table_row.jsx +++ /dev/null @@ -1,83 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import DiffViewer from '../revisions/diff_viewer.jsx'; -import { toggleUI } from '../../actions'; -import { useDispatch } from 'react-redux'; - -const ActivityTableRow = ({ isOpen, diffUrl, revisionDateTime, - revisionScore, reportUrl, revision, rowId, articleUrl, title, talkPageLink, - author }) => { - const dispatch = useDispatch(); - - const openDrawer = () => { - return dispatch(toggleUI(`drawer_${rowId}`)); - }; - - let revDateElement; - let col2; - const className = isOpen ? 'open' : 'closed'; - - if (diffUrl) { - revDateElement = ( - {revisionDateTime} - ); - } - - if (revisionScore) { - col2 = ( - - {revisionScore} - - ); - } - - if (reportUrl) { - col2 = ( - - {I18n.t('recent_activity.report')} - - ); - } - - let diffViewer; - if (revision && revision.api_url) { - diffViewer = ; - } - - return ( - - - {title} - - {col2} - - {author} - - - {revDateElement} - - - {diffViewer} - - - ); -}; - -ActivityTableRow.propTypes = { - rowId: PropTypes.number, - diffUrl: PropTypes.string, - revisionDateTime: PropTypes.string, - reportUrl: PropTypes.string, - revisionScore: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.number - ]), - articleUrl: PropTypes.string, - talkPageLink: PropTypes.string, - author: PropTypes.string, - title: PropTypes.string, - revision: PropTypes.object, - isOpen: PropTypes.bool, -}; - -export default ActivityTableRow;