kaoritokashiki 6 лет назад
Родитель
Сommit
3bf6947e7a
1 измененных файлов с 21 добавлено и 115 удалено
  1. 21 115
      src/client/js/components/Admin/Users/SortIcons.jsx

+ 21 - 115
src/client/js/components/Admin/Users/SortIcons.jsx

@@ -1,124 +1,30 @@
-import React, { Fragment } from 'react';
-import PropTypes from 'prop-types';
+import React from 'react';
+// import PropTypes from 'prop-types';
 import { withTranslation } from 'react-i18next';
-import { createSubscribedElement } from '../../UnstatedUtils';
-import AppContainer from '../../../services/AppContainer';
-import AdminUsersContainer from '../../../services/AdminUsersContainer';
+// import AdminUsersContainer from '../../../services/AdminUsersContainer';
+// import UserTable from './UserTable';
 
-class SortIcons extends React.Component {
+const SortIcons = (props) => {
+  const { isSelected } = props;
 
-  constructor(props) {
-    super(props);
-
-    this.state = {
-
-    };
-
-  }
-
-  /**
-   *  sorting
-   */
-  renderSortIcon(columnName) {
-    return (
-      <div className="d-flex flex-column text-center">
-        { this.generateSorting(columnName, 'asc') }
-        { this.generateSorting(columnName, 'desc') }
-      </div>
-    );
-  }
-
-  generateSorting(columnName, sorting) {
-    const { adminUsersContainer } = this.props;
-    const upOrDown = (sorting === 'asc' ? 'up' : 'down');
-    return (
-      <a
-        className={`fa ${(
-        adminUsersContainer.state.sort === columnName)
-        && (adminUsersContainer.state.sortOrder === sorting) ? `fa-chevron-${upOrDown}` : `fa-angle-${upOrDown}`}`}
-        aria-hidden="true"
-        onClick={() => adminUsersContainer.onClickSort(columnName, sorting === 'asc')}
-      >
-      </a>
-    );
-
-  }
-
-  render() {
-    const { t } = this.props;
-
-    return (
-      <Fragment>
-        <thead>
-          <tr>
-            <th width="100px">#</th>
-            <th>
-              <div className="d-flex align-items-center">
-                <div className="mr-3">
-                  {t('status')}
-                </div>
-                { this.renderSortIcon('status') }
-              </div>
-            </th>
-            <th>
-              <div className="d-flex align-items-center">
-                <div className="mr-3">
-                  <code>username</code>
-                </div>
-                { this.renderSortIcon('username') }
-              </div>
-            </th>
-            <th>
-              <div className="d-flex align-items-center">
-                <div className="mr-3">
-                  {t('Name')}
-                </div>
-                { this.renderSortIcon('name')}
-              </div>
-            </th>
-            <th>
-              <div className="d-flex align-items-center">
-                <div className="mr-3">
-                  {t('Email')}
-                </div>
-                { this.renderSortIcon('email')}
-              </div>
-            </th>
-            <th width="100px">
-              <div className="d-flex align-items-center">
-                <div className="mr-3">
-                  {t('Created')}
-                </div>
-                { this.renderSortIcon('createdAt')}
-              </div>
-            </th>
-            <th width="150px">
-              <div className="d-flex align-items-center">
-                <div className="mr-3">
-                  {t('Last_Login')}
-                </div>
-                { this.renderSortIcon('lastLoginAt')}
-              </div>
-            </th>
-            <th width="70px"></th>
-          </tr>
-        </thead>
-
-      </Fragment>
-    );
-  }
-
-}
+  return (
+    <a
+      className={`fa ${props.isSelected ? 'fa-chevron-down' : 'fa-chevron-up'}`}
+      aria-hidden="true"
+      // onClick={props.onClick}
+    />
 
+  );
+};
 
 SortIcons.propTypes = {
-  t: PropTypes.func.isRequired, // i18next
-  appContainer: PropTypes.instanceOf(AppContainer).isRequired,
-  adminUsersContainer: PropTypes.instanceOf(AdminUsersContainer).isRequired,
-};
+  // t: PropTypes.func.isRequired, // i18next
 
-const SortIconsWrapper = (props) => {
-  return createSubscribedElement(SortIcons, props, [AppContainer, AdminUsersContainer]);
+  // checked: PropTypes.bool.isRequired,
+  // onChange: PropTypes.func.isRequired,
+  // event: PropTypes.string.isRequired,
+  // children: PropTypes.object.isRequired,
 };
 
-export default withTranslation()(SortIconsWrapper);
+
+export default withTranslation()(SortIcons);