Skip to content

Commit f0cc66c

Browse files
committed
show date distance for timestamp in case list
1 parent b1068a2 commit f0cc66c

File tree

1 file changed

+17
-8
lines changed
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/_components

1 file changed

+17
-8
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/_components/case-list.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { format } from "date-fns";
3+
import { formatDate, formatDistanceToNow } from "date-fns";
44
import { XIcon } from "lucide-react";
55
import Link from "next/link";
66
import { useState } from "react";
@@ -15,6 +15,7 @@ import {
1515
TableHeader,
1616
TableRow,
1717
} from "@/components/ui/table";
18+
import { ToolTipLabel } from "@/components/ui/tooltip";
1819
import type { SupportTicketListItem } from "../types/tickets";
1920
import {
2021
getTicketStatusBadgeVariant,
@@ -133,7 +134,7 @@ export function SupportsCaseList({
133134
linkBox
134135
className="hover:bg-accent/50 cursor-pointer"
135136
>
136-
<TableCell className="py-6">
137+
<TableCell className="py-5">
137138
<Link
138139
className="text-foreground font-medium text-sm before:absolute before:inset-0"
139140
href={`/team/${team.slug}/~/support/cases/${ticket.id}`}
@@ -142,15 +143,23 @@ export function SupportsCaseList({
142143
</Link>
143144
</TableCell>
144145
<TableCell>
145-
<Badge
146-
variant={getTicketStatusBadgeVariant(ticket.status)}
147-
className="text-sm"
148-
>
146+
<Badge variant={getTicketStatusBadgeVariant(ticket.status)}>
149147
{getTicketStatusLabel(ticket.status)}
150148
</Badge>
151149
</TableCell>
152-
<TableCell className="text-muted-foreground text-sm">
153-
{format(new Date(ticket.updatedAt), "MMM d, yyyy")}
150+
<TableCell>
151+
<ToolTipLabel
152+
label={formatDate(
153+
new Date(ticket.updatedAt),
154+
"MMM d, yyyy 'at' hh:mm a",
155+
)}
156+
>
157+
<div className="text-sm flex items-center gap-2 z-10 relative">
158+
{formatDistanceToNow(new Date(ticket.updatedAt), {
159+
addSuffix: true,
160+
})}
161+
</div>
162+
</ToolTipLabel>
154163
</TableCell>
155164
</TableRow>
156165
))}

0 commit comments

Comments
 (0)