mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-20 07:45:20 +00:00
♻️ 10 users/roles per page
This commit is contained in:
@@ -5,8 +5,6 @@ import { useDebounce } from "use-debounce";
|
|||||||
|
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { MultiSelectTagInput } from "./multi-select/multi-select-tag-input";
|
import { MultiSelectTagInput } from "./multi-select/multi-select-tag-input";
|
||||||
import { usePaidStatus } from "@app/hooks/usePaidStatus";
|
|
||||||
import { TierFeature, tierMatrix } from "@server/lib/billing/tierMatrix";
|
|
||||||
|
|
||||||
export type SelectedRole = { id: string; text: string };
|
export type SelectedRole = { id: string; text: string };
|
||||||
|
|
||||||
@@ -29,15 +27,13 @@ export function RolesSelector({
|
|||||||
mapRolesByName,
|
mapRolesByName,
|
||||||
buttonText
|
buttonText
|
||||||
}: RolesSelectorProps) {
|
}: RolesSelectorProps) {
|
||||||
const { isPaidUser } = usePaidStatus();
|
|
||||||
const canSelectMultipleUsers = isPaidUser(tierMatrix.fullRbac);
|
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const [roleSearchQuery, setRoleSearchQuery] = useState("");
|
const [roleSearchQuery, setRoleSearchQuery] = useState("");
|
||||||
|
|
||||||
const [debouncedValue] = useDebounce(roleSearchQuery, 150);
|
const [debouncedValue] = useDebounce(roleSearchQuery, 150);
|
||||||
|
|
||||||
const { data: roles = [] } = useQuery(
|
const { data: roles = [] } = useQuery(
|
||||||
orgQueries.roles({ orgId, perPage: 7, query: debouncedValue })
|
orgQueries.roles({ orgId, perPage: 10, query: debouncedValue })
|
||||||
);
|
);
|
||||||
|
|
||||||
// always include the selected roles in the list (if the user isn't searching)
|
// always include the selected roles in the list (if the user isn't searching)
|
||||||
@@ -78,13 +74,7 @@ export function RolesSelector({
|
|||||||
onSearch={setRoleSearchQuery}
|
onSearch={setRoleSearchQuery}
|
||||||
options={rolesShown}
|
options={rolesShown}
|
||||||
value={selectedRoles}
|
value={selectedRoles}
|
||||||
onChange={(newRoles) => {
|
onChange={onSelectRoles}
|
||||||
let roles = canSelectMultipleUsers
|
|
||||||
? [...newRoles]
|
|
||||||
: [newRoles[0]];
|
|
||||||
|
|
||||||
onSelectRoles(roles);
|
|
||||||
}}
|
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export function UsersSelector({
|
|||||||
const [debouncedValue] = useDebounce(userSearchQuery, 150);
|
const [debouncedValue] = useDebounce(userSearchQuery, 150);
|
||||||
|
|
||||||
const { data: users = [] } = useQuery(
|
const { data: users = [] } = useQuery(
|
||||||
orgQueries.users({ orgId, perPage: 7, query: debouncedValue })
|
orgQueries.users({ orgId, perPage: 10, query: debouncedValue })
|
||||||
);
|
);
|
||||||
|
|
||||||
// always include the selected users in the list (if the user isn't searching)
|
// always include the selected users in the list (if the user isn't searching)
|
||||||
|
|||||||
Reference in New Issue
Block a user