-
Notifications
You must be signed in to change notification settings - Fork 319
Expand file tree
/
Copy pathofflineLicenseCard.tsx
More file actions
71 lines (67 loc) · 3.1 KB
/
Copy pathofflineLicenseCard.tsx
File metadata and controls
71 lines (67 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import type { OfflineLicenseMetadata } from "@sourcebot/shared";
import { Badge } from "@/components/ui/badge";
import { SettingsCard } from "../components/settingsCard";
import { DownloadServicePingHistoryButton } from "./downloadServicePingHistoryButton";
interface OfflineLicenseCardProps {
license: OfflineLicenseMetadata;
isExpired: boolean;
}
export function OfflineLicenseCard({ license, isExpired }: OfflineLicenseCardProps) {
const expiryDate = new Date(license.expiryDate);
const truncatedId = license.id.length > 12
? `${license.id.slice(0, 8)}…`
: license.id;
return (
<SettingsCard>
<div className="flex flex-col gap-4">
<div className="flex items-center justify-between gap-6">
<div className="flex flex-col gap-1">
<div className="flex items-center gap-2">
<p className="font-medium">Enterprise plan</p>
{isExpired && (
<Badge variant="outline" className="border-destructive/30 text-destructive">
Expired
</Badge>
)}
</div>
<div className="flex items-center gap-2 text-xs text-muted-foreground mt-0.5">
<code className="font-mono">{truncatedId}</code>
</div>
</div>
<div className="flex items-center gap-12">
{license.seats !== undefined && (
<div className="flex flex-col items-end">
<p className="text-xs text-muted-foreground">Billed seats</p>
<p className="text-sm">{license.seats}</p>
</div>
)}
<div className="flex flex-col items-end">
<p className="text-xs text-muted-foreground">
{isExpired ? "Expired on" : "Expires on"}
</p>
<p className="text-sm">{formatDate(expiryDate)}</p>
</div>
</div>
</div>
<div className="flex items-center justify-between gap-6 border-t border-border pt-4">
<p className="text-xs text-muted-foreground">
Your instance doesn't report usage automatically. Usage data must be
manually sent to{" "}
<a href="mailto:ar@sourcebot.dev" className="text-primary hover:underline">
ar@sourcebot.dev
</a>
.
</p>
<DownloadServicePingHistoryButton />
</div>
</div>
</SettingsCard>
);
}
function formatDate(date: Date): string {
return date.toLocaleDateString('en-US', {
month: 'short',
day: 'numeric',
year: 'numeric',
});
}