import { useEffect, useState } from "react"; import Sidebar from "@/components/SettingsSidebar"; import { isMobile } from "react-device-detect"; import * as Skeleton from "react-loading-skeleton"; import "react-loading-skeleton/dist/skeleton.css"; import { UserPlus } from "@phosphor-icons/react"; import Admin from "@/models/admin"; import UserRow from "./UserRow"; import useUser from "@/hooks/useUser"; import NewUserModal from "./NewUserModal"; import { useModal } from "@/hooks/useModal"; import ModalWrapper from "@/components/ModalWrapper"; import CTAButton from "@/components/lib/CTAButton"; export default function AdminUsers() { const { isOpen, openModal, closeModal } = useModal(); return (

Users

These are all the accounts which have an account on this instance. Removing an account will instantly remove their access to this instance.

Add user
); } function UsersContainer() { const { user: currUser } = useUser(); const [loading, setLoading] = useState(true); const [users, setUsers] = useState([]); useEffect(() => { async function fetchUsers() { const _users = await Admin.users(); setUsers(_users); setLoading(false); } fetchUsers(); }, []); if (loading) { return ( ); } return ( {users.map((user) => ( ))}
Username Role Date Added {" "}
); } const ROLE_HINT = { default: [ "Can only send chats with workspaces they are added to by admin or managers.", "Cannot modify any settings at all.", ], manager: [ "Can view, create, and delete any workspaces and modify workspace-specific settings.", "Can create, update and invite new users to the instance.", "Cannot modify LLM, vectorDB, embedding, or other connections.", ], admin: [ "Highest user level privilege.", "Can see and do everything across the system.", ], }; export function RoleHintDisplay({ role }) { return (

Permissions

); } export function MessageLimitInput({ enabled, limit, updateState, role }) { if (role === "admin") return null; return (

Limit messages per day

Restrict this user to a number of successful queries or chats within a 24 hour window.

{enabled && (
e.target.blur()} onChange={(e) => { updateState({ enabled: true, limit: Number(e?.target?.value || 0), }); }} value={limit} min={1} className="border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5" />
)}
); }