'use client' import { formatCPF } from '@brazilian-utils/brazilian-utils' import { type ColumnDef } from '@tanstack/react-table' import { ArrowRight } from 'lucide-react' import { NavLink } from 'react-router' import { Avatar, AvatarFallback } from '@repo/ui/components/ui/avatar' import { Button } from '@repo/ui/components/ui/button' import { Spinner } from '@repo/ui/components/ui/spinner' import { initials } from '@repo/ui/lib/utils' // This type is used to define the shape of our data. // You can use a Zod schema here if you want. export type User = { id: string name: string email: string cpf?: string cnpj?: string } const formatted = new Intl.DateTimeFormat('pt-BR', { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit' }) export const columns: ColumnDef[] = [ { header: 'Colaborador', cell: ({ row }) => { const { name, email } = row.original return (
{initials(name)}
) } }, { header: 'CPF', cell: ({ row }) => { const { cpf } = row.original if (cpf) { return <>{formatCPF(cpf)} } return <> } }, { header: 'Cadastrado em', cell: ({ row }) => { const created_at = new Date(row.original.createDate) return formatted.format(created_at) } }, { header: 'Ăšltimo accesso', cell: ({ row }) => { // Post-migration: rename `lastLogin` to `last_login` if (row.original?.lastLogin) { const lastLogin = new Date(row.original.lastLogin) return formatted.format(lastLogin) } return <> } }, { header: ' ', cell: ({ row }) => { return (
) } } ]