refactor: improve user table design (#279)
This commit is contained in:
@@ -10,6 +10,7 @@ import { clientApi } from "@homarr/api/client";
|
|||||||
import { useScopedI18n } from "@homarr/translation/client";
|
import { useScopedI18n } from "@homarr/translation/client";
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
|
Avatar,
|
||||||
Button,
|
Button,
|
||||||
Flex,
|
Flex,
|
||||||
Group,
|
Group,
|
||||||
@@ -41,6 +42,15 @@ export const UserListComponent = ({
|
|||||||
{
|
{
|
||||||
accessorKey: "name",
|
accessorKey: "name",
|
||||||
header: "Name",
|
header: "Name",
|
||||||
|
grow: 100,
|
||||||
|
Cell: ({ renderedCellValue, row }) => (
|
||||||
|
<Link href={`/manage/users/${row.original.id}`}>
|
||||||
|
<Group>
|
||||||
|
<Avatar size="sm"></Avatar>
|
||||||
|
{renderedCellValue}
|
||||||
|
</Group>
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "email",
|
accessorKey: "email",
|
||||||
@@ -66,27 +76,11 @@ export const UserListComponent = ({
|
|||||||
enableRowSelection: true,
|
enableRowSelection: true,
|
||||||
enableColumnOrdering: true,
|
enableColumnOrdering: true,
|
||||||
enableGlobalFilter: false,
|
enableGlobalFilter: false,
|
||||||
enableRowActions: true,
|
enableRowActions: false,
|
||||||
enableDensityToggle: false,
|
enableDensityToggle: false,
|
||||||
enableFullScreenToggle: false,
|
enableFullScreenToggle: false,
|
||||||
|
layoutMode: "grid-no-grow",
|
||||||
getRowId: (row) => row.id,
|
getRowId: (row) => row.id,
|
||||||
renderRowActions: ({ row }) => (
|
|
||||||
<Flex gap="md">
|
|
||||||
<Tooltip label="Edit">
|
|
||||||
<ActionIcon
|
|
||||||
component={Link}
|
|
||||||
href={`/manage/users/${row.original.id}`}
|
|
||||||
>
|
|
||||||
<IconEdit size="1rem" />
|
|
||||||
</ActionIcon>
|
|
||||||
</Tooltip>
|
|
||||||
<Tooltip label="Delete">
|
|
||||||
<ActionIcon color="red">
|
|
||||||
<IconTrash size="1rem" />
|
|
||||||
</ActionIcon>
|
|
||||||
</Tooltip>
|
|
||||||
</Flex>
|
|
||||||
),
|
|
||||||
renderTopToolbarCustomActions: () => (
|
renderTopToolbarCustomActions: () => (
|
||||||
<Button component={Link} href="/manage/users/create">
|
<Button component={Link} href="/manage/users/create">
|
||||||
Create New User
|
Create New User
|
||||||
|
|||||||
Reference in New Issue
Block a user