mirror of
https://github.com/fastapi/full-stack-fastapi-template.git
synced 2026-11-03 20:36:27 +00:00
8c2532a5c3
* 🔧 Add Tailwind, update dependencies and config files * ✨ Introduce new Shadcn components and remove old ones * 🔧 Update dependencies * Add new components.json file * 🔥 Remove Chakra UI files * 🔧 Add ThemeProvider component and integrate it into main * 🔥 Remove common components * Update primary color * ✨ Add new components * ✨ Add AuthLayout component * 🔧 Add utility function cn * 🔧 Refactor devtools integration and update dependencies * ✨ Add Footer and Error components * ♻️ Update Footer * 🔥 Remove utils * ♻️ Refactor error handling in useAuth * ♻️ Refactor useCustomToast * ♻️ Refactor Login component and form handling * ♻️ Refactor SignUp component and form handling * 🔧 Update dependencies * ♻️ Refactor RecoverPassword component and form handling * ♻️ Refactor ResetPassword and form handling * ♻️ Add error component to root route * ♻️ Refactor error handling in utils * ♻️ Update buttons * 🍱 Add icons and logos assets * ♻️ Refactor Sidebar component * 🎨 Format * ♻️ Refactor ThemeProvider * ♻️ Refactor Common components * 🔥 Remove old Appearance component * ✨ Add Sidebar components * ♻️ Refactor DeleteAccount components * ♻️ Refactor ChangePassword component * ♻️ Refactor UserSettings * ✨ Add TanStack table * ♻️ Update SignUp * ✨ Add Select component * 🎨 Format * ♻️ Update Footer * ✨ Add useCopyToClipboard hook * 🎨 Tweak table styles * 🎨 Tweak styling * ♻️ Refactor AddUser and AddItem components * ♻️ Update DeleteConfirmation * ✅ Update tests * ✅ Update tests * ✅ Fix tests * ✨ Add DataTable for item and admin management * ♻️ Refactor DeleteUser and DeleteItem components * ✅ Fix tests * ♻️ Refactor EditUser and EditItem components * ♻️ Refactor UserInformation component * 🎨 Format * ♻️ Refactor pending components * 🎨 Format * ✅ Update tests * ✅ Update tests * ✅ Fix test * ♻️ Minor tweaks * ♻️ Update social media links
77 lines
2.0 KiB
TypeScript
77 lines
2.0 KiB
TypeScript
import type { ColumnDef } from "@tanstack/react-table"
|
|
|
|
import type { UserPublic } from "@/client"
|
|
import { Badge } from "@/components/ui/badge"
|
|
import { cn } from "@/lib/utils"
|
|
import { UserActionsMenu } from "./UserActionsMenu"
|
|
|
|
export type UserTableData = UserPublic & {
|
|
isCurrentUser: boolean
|
|
}
|
|
|
|
export const columns: ColumnDef<UserTableData>[] = [
|
|
{
|
|
accessorKey: "full_name",
|
|
header: "Full Name",
|
|
cell: ({ row }) => {
|
|
const fullName = row.original.full_name
|
|
return (
|
|
<div className="flex items-center gap-2">
|
|
<span
|
|
className={cn("font-medium", !fullName && "text-muted-foreground")}
|
|
>
|
|
{fullName || "N/A"}
|
|
</span>
|
|
{row.original.isCurrentUser && (
|
|
<Badge variant="outline" className="text-xs">
|
|
You
|
|
</Badge>
|
|
)}
|
|
</div>
|
|
)
|
|
},
|
|
},
|
|
{
|
|
accessorKey: "email",
|
|
header: "Email",
|
|
cell: ({ row }) => (
|
|
<span className="text-muted-foreground">{row.original.email}</span>
|
|
),
|
|
},
|
|
{
|
|
accessorKey: "is_superuser",
|
|
header: "Role",
|
|
cell: ({ row }) => (
|
|
<Badge variant={row.original.is_superuser ? "default" : "secondary"}>
|
|
{row.original.is_superuser ? "Superuser" : "User"}
|
|
</Badge>
|
|
),
|
|
},
|
|
{
|
|
accessorKey: "is_active",
|
|
header: "Status",
|
|
cell: ({ row }) => (
|
|
<div className="flex items-center gap-2">
|
|
<span
|
|
className={cn(
|
|
"size-2 rounded-full",
|
|
row.original.is_active ? "bg-green-500" : "bg-gray-400",
|
|
)}
|
|
/>
|
|
<span className={row.original.is_active ? "" : "text-muted-foreground"}>
|
|
{row.original.is_active ? "Active" : "Inactive"}
|
|
</span>
|
|
</div>
|
|
),
|
|
},
|
|
{
|
|
id: "actions",
|
|
header: () => <span className="sr-only">Actions</span>,
|
|
cell: ({ row }) => (
|
|
<div className="flex justify-end">
|
|
<UserActionsMenu user={row.original} />
|
|
</div>
|
|
),
|
|
},
|
|
]
|