mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: Add user menu on users table (#1222)
This commit is contained in:
@@ -2,6 +2,7 @@ import React from "react"
|
||||
import { UserResponse } from "../../api/types"
|
||||
import { EmptyState } from "../EmptyState/EmptyState"
|
||||
import { Column, Table } from "../Table/Table"
|
||||
import { TableRowMenu } from "../TableRowMenu/TableRowMenu"
|
||||
import { UserCell } from "../UserCell/UserCell"
|
||||
|
||||
const Language = {
|
||||
@@ -9,6 +10,7 @@ const Language = {
|
||||
usersTitle: "All users",
|
||||
emptyMessage: "No users found",
|
||||
usernameLabel: "User",
|
||||
suspendMenuItem: "Suspend",
|
||||
}
|
||||
|
||||
const emptyState = <EmptyState message={Language.emptyMessage} />
|
||||
@@ -28,5 +30,25 @@ export interface UsersTableProps {
|
||||
}
|
||||
|
||||
export const UsersTable: React.FC<UsersTableProps> = ({ users }) => {
|
||||
return <Table columns={columns} data={users} title={Language.usersTitle} emptyState={emptyState} />
|
||||
return (
|
||||
<Table
|
||||
columns={columns}
|
||||
data={users}
|
||||
title={Language.usersTitle}
|
||||
emptyState={emptyState}
|
||||
rowMenu={(user) => (
|
||||
<TableRowMenu
|
||||
data={user}
|
||||
menuItems={[
|
||||
{
|
||||
label: Language.suspendMenuItem,
|
||||
onClick: () => {
|
||||
// TO-DO: Add suspend action here
|
||||
},
|
||||
},
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user