refactor: enhance user tables and machine ticket views
This commit is contained in:
parent
bd2f22d046
commit
28796bf105
7 changed files with 416 additions and 201 deletions
|
|
@ -5,6 +5,7 @@ import Link from "next/link"
|
|||
import { usePaginatedQuery, useQuery } from "convex/react"
|
||||
import { format, formatDistanceToNowStrict } from "date-fns"
|
||||
import { ptBR } from "date-fns/locale"
|
||||
import { IconUserOff } from "@tabler/icons-react"
|
||||
|
||||
import type { Id } from "@/convex/_generated/dataModel"
|
||||
import { api } from "@/convex/_generated/api"
|
||||
|
|
@ -24,6 +25,7 @@ import { Spinner } from "@/components/ui/spinner"
|
|||
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty"
|
||||
import { TicketStatusBadge } from "@/components/tickets/status-badge"
|
||||
import type { TicketPriority, TicketStatus } from "@/lib/schemas/ticket"
|
||||
import { EmptyIndicator } from "@/components/ui/empty-indicator"
|
||||
|
||||
type MachineTicketHistoryItem = {
|
||||
id: string
|
||||
|
|
@ -355,7 +357,6 @@ export function MachineTicketsHistoryClient({ tenantId: _tenantId, machineId }:
|
|||
{tickets.map((ticket) => {
|
||||
const priorityMeta = getPriorityMeta(ticket.priority)
|
||||
const requesterLabel = ticket.requester?.name ?? ticket.requester?.email ?? "Solicitante não informado"
|
||||
const assigneeLabel = ticket.assignee?.name ?? ticket.assignee?.email ?? "Sem responsável"
|
||||
const updatedLabel = formatRelativeTime(ticket.updatedAt)
|
||||
const updatedAbsolute = formatAbsoluteTime(ticket.updatedAt)
|
||||
return (
|
||||
|
|
@ -394,11 +395,21 @@ export function MachineTicketsHistoryClient({ tenantId: _tenantId, machineId }:
|
|||
</div>
|
||||
</TableCell>
|
||||
<TableCell className="align-top">
|
||||
<div className="flex flex-col text-sm text-neutral-700">
|
||||
<span>{assigneeLabel}</span>
|
||||
{ticket.assignee?.email ? (
|
||||
<span className="text-xs text-neutral-400">{ticket.assignee.email}</span>
|
||||
) : null}
|
||||
<div className="flex flex-col items-start text-sm text-neutral-700">
|
||||
{ticket.assignee ? (
|
||||
<>
|
||||
<span>{ticket.assignee.name ?? ticket.assignee.email ?? "—"}</span>
|
||||
{ticket.assignee.email ? (
|
||||
<span className="text-xs text-neutral-400">{ticket.assignee.email}</span>
|
||||
) : null}
|
||||
</>
|
||||
) : (
|
||||
<EmptyIndicator
|
||||
icon={IconUserOff}
|
||||
label="Sem responsável"
|
||||
className="h-7 w-7 border-neutral-200 bg-transparent text-neutral-400"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue