import { useEffect, useState, type ReactNode } from "react";
import { Link, useSearchParams } from "react-router-dom";
import ViewTabs from "../components/ViewTabs";
import SessionsView from "../views/SessionsView";
import { api, type UserRecord, type UserRole } from "../api/client";
import { formatDateTime } from "../utils/date";
import { useSortable } from "../hooks/useSortable";
import SortableTh from "../components/SortableTh";
import { downloadCsv } from "../utils/csv";
import { ErrorNotice } from "../components/Notice";
import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
import Avatar from "../components/Avatar";
const ROLES: UserRole[] = ["viewer", "operator", "admin"];
/** People and Signed in now: who has an account and what they may do, and who is signed in at this moment. Switched by `?view=sessions`. */
const userTabs = (view: "people" | "sessions") => (
);
export default function Users() {
const [params] = useSearchParams();
if (params.get("view") === "sessions") {
return (
<>
Roles are set from sign-in groups, so they can't be changed here: change a person's group in the identity provider, and their role follows at their next sign-in.{" "}
Sign-in settings