Fix role selection defaults and phone input typing

This commit is contained in:
Esdras Renan 2025-10-18 19:28:37 -03:00
parent a69d37a672
commit 2400f34c80
2 changed files with 9 additions and 9 deletions

View file

@ -224,7 +224,7 @@ export function AdminUsersManager({ initialUsers, initialInvites, roleOptions, d
const teamUsers = useMemo(() => users.filter((user) => user.role !== "machine"), [users])
const machineUsers = useMemo(() => users.filter((user) => user.role === "machine"), [users])
const defaultCreateRole = (selectableRoles.find((role) => role !== "machine") ?? "agent") as RoleOption
const defaultCreateRole: RoleOption = selectableRoles[0] ?? "agent"
const [teamSearch, setTeamSearch] = useState("")
const [teamRoleFilter, setTeamRoleFilter] = useState<"all" | RoleOption>("all")
const [machineSearch, setMachineSearch] = useState("")
@ -755,7 +755,7 @@ async function handleDeleteUser() {
</SelectTrigger>
<SelectContent>
<SelectItem value="all">Todos os papéis</SelectItem>
{selectableRoles.filter((option) => option !== "machine").map((option) => (
{selectableRoles.map((option) => (
<SelectItem key={`team-filter-${option}`} value={option}>
{formatRole(option)}
</SelectItem>
@ -1228,7 +1228,7 @@ async function handleDeleteUser() {
<SelectValue placeholder="Selecione" />
</SelectTrigger>
<SelectContent>
{selectableRoles.filter((option) => option !== "machine").map((option) => (
{selectableRoles.map((option) => (
<SelectItem key={`create-role-${option}`} value={option}>
{formatRole(option)}
</SelectItem>

View file

@ -104,13 +104,13 @@ const SPECIAL_FORMATS: Record<string, { maxDigits: number; formatLocal: (digits:
CA: { maxDigits: 10, formatLocal: formatUsPhone },
}
const COUNTRY_OPTIONS: CountryOption[] = COUNTRY_DIAL_CODES.map((entry: CountryDialCode) => {
const special = SPECIAL_FORMATS[entry.code]
const COUNTRY_OPTIONS: CountryOption[] = COUNTRY_DIAL_CODES.map(({ code, name, dialCode }: CountryDialCode) => {
const special = SPECIAL_FORMATS[code]
return {
code: entry.code,
label: regionDisplayNames?.of(entry.code) ?? entry.name ?? entry.code,
dialCode: entry.dialCode,
flag: flagEmojiFor(entry.code),
code,
label: regionDisplayNames?.of(code) ?? name ?? code,
dialCode,
flag: flagEmojiFor(code),
maxDigits: special?.maxDigits ?? 15,
formatLocal: special?.formatLocal ?? formatGenericPhone,
}