{"size": 1136, "ext": "js", "max_stars_repo_path": "src/components/tableColumns/usersColumns.js", "max_stars_repo_name": "AJAkimana/ivugurura-ui", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/tableColumns/usersColumns.js", "max_issues_repo_name": "AJAkimana/ivugurura-ui", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/tableColumns/usersColumns.js", "max_forks_repo_name": "AJAkimana/ivugurura-ui", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.6956521739, "max_line_length": 76, "alphanum_fraction": 0.5519366197}
import moment from 'moment';
import { Button, ButtonGroup } from 'react-bootstrap';
import { getRole } from '../../utils/constants';

export const usersColumns = (user = {}, setActions) => [
	{
		label: 'Names(First/Last name)',
		content: (item) => (user.id === item.id ? item.names + 'You' : item.names)
	},
	{ path: 'username', label: 'User name' },
	{ path: 'email', label: 'Email' },
	{ label: 'User role', content: (item) => getRole(item.role) },
	{
		label: 'Registed',
		content: (item) => moment(item.createdAt).format('MMMM Do YYYY')
	},
	{
		label: 'Is Active',
		content: (item) => (item.isActive ? 'Yes' : 'No')
	},
	{
		label: 'Actions',
		content: (item) =>
			item.id !== user.id && Number(user.role) < 3 ? (
				<ButtonGroup size='sm'>
					<Button
						size='sm'
						variant='success'
						onClick={() => setActions('edit', item)}
					>
						<i className='fa fa-pencil'></i>
					</Button>
					<Button
						size='sm'
						variant='danger'
						onClick={() => setActions('del', item)}
					>
						<i className='fa fa-trash'></i>
					</Button>
				</ButtonGroup>
			) : (
				<strong>YOU</strong>
			)
	}
];
