Skip to content

Commit eb2a508

Browse files
committed
feat(services): add subscription badge to services data table and create service-badges utility #105 (comment)
1 parent d6997c2 commit eb2a508

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

app/(authenticated)/services/services-data-table.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from "@/components/ui/tooltip";
1313
import { DataTable } from "@/components/data-table";
1414
import { formatDate } from "@/lib/format";
15-
import { statusBadgeClass } from "@/lib/service-status";
15+
import { statusBadgeClass, subscriptionBadgeClass } from "@/lib/service-badges";
1616

1717
import { setServiceStatus } from "@/app/(authenticated)/services/actions";
1818
import type { ServiceView } from "@/app/(authenticated)/services/queries";
@@ -61,6 +61,20 @@ export function ServicesDataTable({
6161
</span>
6262
),
6363
},
64+
{
65+
accessorKey: "requiresSubscription",
66+
header: "Subscription",
67+
cell: ({ row }) => (
68+
<span
69+
className={
70+
"inline-flex rounded-full px-2 py-0.5 text-xs capitalize " +
71+
subscriptionBadgeClass(row.original.requiresSubscription)
72+
}
73+
>
74+
{row.original.requiresSubscription ? "Required" : "Not required"}
75+
</span>
76+
),
77+
},
6478
{
6579
id: "startDate",
6680
header: "Start Date",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ export function statusBadgeClass(status: ServiceStatus) {
1212
return "bg-muted text-muted-foreground";
1313
}
1414
}
15+
16+
export function subscriptionBadgeClass(requiresSubscription: boolean) {
17+
return requiresSubscription
18+
? "bg-blue-700/80 text-white"
19+
: "bg-secondary/80 text-secondary-foreground";
20+
}

0 commit comments

Comments
 (0)