mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 23:48:47 +00:00
Org user page (#2941)
* init org user * optimized code style * freezed item * update select-ediotr style * optimized code style * add state
This commit is contained in:
43
frontend/src/components/select-editor/user-status-editor.js
Normal file
43
frontend/src/components/select-editor/user-status-editor.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { gettext } from '../../utils/constants';
|
||||
import SelectEditor from './select-editor';
|
||||
|
||||
const propTypes = {
|
||||
isTextMode: PropTypes.bool.isRequired,
|
||||
isEditIconShow: PropTypes.bool.isRequired,
|
||||
statusArray: PropTypes.array.isRequired,
|
||||
currentStatus: PropTypes.string.isRequired,
|
||||
onStatusChanged: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
class UserStatusEditor extends React.Component {
|
||||
|
||||
translateStatus = (userStatus) => {
|
||||
if (userStatus === 'active') {
|
||||
return gettext('Active');
|
||||
}
|
||||
|
||||
if (userStatus === 'inactive') {
|
||||
return gettext('Inactive');
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<SelectEditor
|
||||
isTextMode={this.props.isTextMode}
|
||||
isEditIconShow={this.props.isEditIconShow}
|
||||
options={this.props.statusArray}
|
||||
currentOption={this.props.currentStatus}
|
||||
onOptionChanged={this.props.onStatusChanged}
|
||||
translateOption={this.translateStatus}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
UserStatusEditor.propTypes = propTypes;
|
||||
|
||||
export default UserStatusEditor;
|
Reference in New Issue
Block a user