import { useMemo, useState } from 'react'; import Dialog from '~/components/Dialog'; import Input from '~/components/Input'; interface AddGroupProps { groups: string[]; isDisabled?: boolean; } export default function AddGroup({ groups, isDisabled }: AddGroupProps) { const [group, setGroup] = useState(''); const isInvalid = useMemo(() => { if (!group || group.trim().length === 0) { // Empty group is invalid, but no error shown return false; } if (groups.includes(group.trim())) { return true; } }, [group, groups]); return ( Add group Add group Add this group to a list of allowed groups that can authenticate with Headscale via OIDC. {isInvalid && (

The group you entered already exists in the list of allowed groups.

)}
); }