Fix role selection defaults and phone input typing
This commit is contained in:
parent
a69d37a672
commit
2400f34c80
2 changed files with 9 additions and 9 deletions
|
|
@ -224,7 +224,7 @@ export function AdminUsersManager({ initialUsers, initialInvites, roleOptions, d
|
||||||
const teamUsers = useMemo(() => users.filter((user) => user.role !== "machine"), [users])
|
const teamUsers = useMemo(() => users.filter((user) => user.role !== "machine"), [users])
|
||||||
const machineUsers = 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 [teamSearch, setTeamSearch] = useState("")
|
||||||
const [teamRoleFilter, setTeamRoleFilter] = useState<"all" | RoleOption>("all")
|
const [teamRoleFilter, setTeamRoleFilter] = useState<"all" | RoleOption>("all")
|
||||||
const [machineSearch, setMachineSearch] = useState("")
|
const [machineSearch, setMachineSearch] = useState("")
|
||||||
|
|
@ -755,7 +755,7 @@ async function handleDeleteUser() {
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="all">Todos os papéis</SelectItem>
|
<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}>
|
<SelectItem key={`team-filter-${option}`} value={option}>
|
||||||
{formatRole(option)}
|
{formatRole(option)}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
|
|
@ -1228,7 +1228,7 @@ async function handleDeleteUser() {
|
||||||
<SelectValue placeholder="Selecione" />
|
<SelectValue placeholder="Selecione" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{selectableRoles.filter((option) => option !== "machine").map((option) => (
|
{selectableRoles.map((option) => (
|
||||||
<SelectItem key={`create-role-${option}`} value={option}>
|
<SelectItem key={`create-role-${option}`} value={option}>
|
||||||
{formatRole(option)}
|
{formatRole(option)}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
|
|
|
||||||
|
|
@ -104,13 +104,13 @@ const SPECIAL_FORMATS: Record<string, { maxDigits: number; formatLocal: (digits:
|
||||||
CA: { maxDigits: 10, formatLocal: formatUsPhone },
|
CA: { maxDigits: 10, formatLocal: formatUsPhone },
|
||||||
}
|
}
|
||||||
|
|
||||||
const COUNTRY_OPTIONS: CountryOption[] = COUNTRY_DIAL_CODES.map((entry: CountryDialCode) => {
|
const COUNTRY_OPTIONS: CountryOption[] = COUNTRY_DIAL_CODES.map(({ code, name, dialCode }: CountryDialCode) => {
|
||||||
const special = SPECIAL_FORMATS[entry.code]
|
const special = SPECIAL_FORMATS[code]
|
||||||
return {
|
return {
|
||||||
code: entry.code,
|
code,
|
||||||
label: regionDisplayNames?.of(entry.code) ?? entry.name ?? entry.code,
|
label: regionDisplayNames?.of(code) ?? name ?? code,
|
||||||
dialCode: entry.dialCode,
|
dialCode,
|
||||||
flag: flagEmojiFor(entry.code),
|
flag: flagEmojiFor(code),
|
||||||
maxDigits: special?.maxDigits ?? 15,
|
maxDigits: special?.maxDigits ?? 15,
|
||||||
formatLocal: special?.formatLocal ?? formatGenericPhone,
|
formatLocal: special?.formatLocal ?? formatGenericPhone,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue