mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-29 04:01:24 +00:00
44 lines
1.0 KiB
JavaScript
44 lines
1.0 KiB
JavaScript
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;
|