fix: bug fixes (#1000)

* sort by groups first

* add scroll area

* fix group members pagination

* move pagination to the right
This commit is contained in:
Philip Okugbe 2025-04-08 13:34:00 +01:00 committed by GitHub
parent 651e5f6153
commit 1eaba6e77f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 99 additions and 90 deletions

View file

@ -21,7 +21,7 @@ export default function Paginate({
} }
return ( return (
<Group mt="md"> <Group mt="md" justify="flex-end">
<Button <Button
variant="default" variant="default"
size="compact-sm" size="compact-sm"

View file

@ -33,7 +33,7 @@ export async function getGroupMembers(
groupId: string, groupId: string,
params?: QueryParams, params?: QueryParams,
): Promise<IPagination<IUser>> { ): Promise<IPagination<IUser>> {
const req = await api.post("/groups/members", { groupId, params }); const req = await api.post("/groups/members", { groupId, ...params });
return req.data; return req.data;
} }

View file

@ -1,4 +1,11 @@
import { Group, Table, Text, Menu, ActionIcon } from "@mantine/core"; import {
Group,
Table,
Text,
Menu,
ActionIcon,
ScrollArea,
} from "@mantine/core";
import React from "react"; import React from "react";
import { IconDots } from "@tabler/icons-react"; import { IconDots } from "@tabler/icons-react";
import { modals } from "@mantine/modals"; import { modals } from "@mantine/modals";
@ -106,6 +113,7 @@ export default function SpaceMembersList({
return ( return (
<> <>
<SearchInput onSearch={handleSearch} /> <SearchInput onSearch={handleSearch} />
<ScrollArea h={400}>
<Table.ScrollContainer minWidth={500}> <Table.ScrollContainer minWidth={500}>
<Table highlightOnHover verticalSpacing={8}> <Table highlightOnHover verticalSpacing={8}>
<Table.Thead> <Table.Thead>
@ -193,6 +201,7 @@ export default function SpaceMembersList({
</Table.Tbody> </Table.Tbody>
</Table> </Table>
</Table.ScrollContainer> </Table.ScrollContainer>
</ScrollArea>
{data?.items.length > 0 && ( {data?.items.length > 0 && (
<Paginate <Paginate

View file

@ -17,7 +17,6 @@ import Paginate from "@/components/common/paginate.tsx";
import { SearchInput } from "@/components/common/search-input.tsx"; import { SearchInput } from "@/components/common/search-input.tsx";
import NoTableResults from "@/components/common/no-table-results.tsx"; import NoTableResults from "@/components/common/no-table-results.tsx";
import { usePaginateAndSearch } from "@/hooks/use-paginate-and-search.tsx"; import { usePaginateAndSearch } from "@/hooks/use-paginate-and-search.tsx";
import InviteActionMenu from "@/features/workspace/components/members/components/invite-action-menu.tsx";
import MemberActionMenu from "@/features/workspace/components/members/components/members-action-menu.tsx"; import MemberActionMenu from "@/features/workspace/components/members/components/members-action-menu.tsx";
export default function WorkspaceMembersTable() { export default function WorkspaceMembersTable() {

View file

@ -114,6 +114,7 @@ export class SpaceMemberRepo {
]) ])
.select((eb) => this.groupRepo.withMemberCount(eb)) .select((eb) => this.groupRepo.withMemberCount(eb))
.where('spaceId', '=', spaceId) .where('spaceId', '=', spaceId)
.orderBy((eb) => eb('groups.id', 'is not', null), 'desc')
.orderBy('spaceMembers.createdAt', 'asc'); .orderBy('spaceMembers.createdAt', 'asc');
if (pagination.query) { if (pagination.query) {