import React, { useState } from 'react';
import {
Table, TableRow, TableCell, TableHead, TableBody,
} from '@mui/material';
import LoginIcon from '@mui/icons-material/Login';
import makeStyles from '@mui/styles/makeStyles';
import { useCatch, useEffectAsync } from '../reactHelper';
import { formatBoolean } from '../common/util/formatter';
import { useTranslation } from '../common/components/LocalizationProvider';
import PageLayout from '../common/components/PageLayout';
import SettingsMenu from './components/SettingsMenu';
import CollectionFab from './components/CollectionFab';
import CollectionActions from './components/CollectionActions';
import TableShimmer from '../common/components/TableShimmer';
import { useAdministrator } from '../common/util/permissions';
const useStyles = makeStyles((theme) => ({
columnAction: {
width: '1%',
paddingRight: theme.spacing(1),
},
}));
const UsersPage = () => {
const classes = useStyles();
const t = useTranslation();
const admin = useAdministrator();
const [timestamp, setTimestamp] = useState(Date.now());
const [items, setItems] = useState([]);
const [loading, setLoading] = useState(false);
const handleLogin = useCatch(async (userId) => {
const response = await fetch(`/api/session/${userId}`);
if (response.ok) {
window.location.replace('/');
} else {
throw Error(await response.text());
}
});
const loginAction = {
title: t('loginLogin'),
icon: (