@tokcalc/mcp-server 0.1.3 → 0.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -406
- package/dist/http.js +23504 -0
- package/dist/index.js +21290 -0
- package/package.json +36 -92
- package/.zscripts/build.sh +0 -175
- package/.zscripts/database-runtime-build.sh +0 -33
- package/.zscripts/dev.pid +0 -1
- package/.zscripts/dev.sh +0 -154
- package/.zscripts/mini-services-build.sh +0 -78
- package/.zscripts/mini-services-install.sh +0 -65
- package/.zscripts/mini-services-start.sh +0 -123
- package/.zscripts/python-runtime-build.sh +0 -120
- package/.zscripts/start.sh +0 -145
- package/CAPACITY_STUDY.md +0 -283
- package/CODE_OF_CONDUCT.md +0 -55
- package/CONTRIBUTING.md +0 -177
- package/Caddyfile +0 -23
- package/LICENSE +0 -204
- package/bun.lock +0 -1965
- package/components.json +0 -21
- package/db/custom.db +0 -0
- package/download/README.md +0 -1
- package/download/tokcalc-dark-calculator.png +0 -0
- package/download/tokcalc-dark-default.png +0 -0
- package/download/tokcalc-demo.webm +0 -0
- package/download/tokcalc-github-link.png +0 -0
- package/download/tokcalc-hydration-fixed.png +0 -0
- package/download/tokcalc-issue-resolved.png +0 -0
- package/download/tokcalc-light-mode.png +0 -0
- package/download/tokcalc-light-reference.png +0 -0
- package/download/tokcalc-long-context-qwen.png +0 -0
- package/download/tokcalc-long-context.png +0 -0
- package/download/tokcalc-og-image-preview.png +0 -0
- package/download/tokcalc-phase2-3.png +0 -0
- package/download/tokcalc-plain-english.png +0 -0
- package/download/tokcalc-preview.png +0 -0
- package/download/tokcalc-share-bvb.png +0 -0
- package/download/tokcalc-share-feature.png +0 -0
- package/download/tokcalc-tab-build-vs-buy.png +0 -0
- package/download/tokcalc-tab-calculator.png +0 -0
- package/download/tokcalc-tab-reference.png +0 -0
- package/eslint.config.mjs +0 -50
- package/examples/websocket/frontend.tsx +0 -196
- package/examples/websocket/server.ts +0 -138
- package/mini-services/.gitkeep +0 -0
- package/mini-services/mcp-server/README.md +0 -86
- package/mini-services/mcp-server/bun.lock +0 -202
- package/mini-services/mcp-server/index.ts +0 -504
- package/mini-services/mcp-server/package.json +0 -40
- package/next.config.ts +0 -12
- package/postcss.config.mjs +0 -5
- package/prisma/schema.prisma +0 -32
- package/public/google6f58ca6be85fa903.html +0 -1
- package/public/logo.svg +0 -29
- package/public/manifest.json +0 -51
- package/public/og-icon-256.png +0 -0
- package/public/og.png +0 -0
- package/public/robots.txt +0 -25
- package/public/sitemap.xml +0 -23
- package/public/tokcalc-demo.gif +0 -0
- package/scripts/og-template.html +0 -120
- package/scripts/render-og.mjs +0 -43
- package/server.json +0 -21
- package/src/app/api/pricing/aws/route.ts +0 -186
- package/src/app/api/pricing/azure/route.ts +0 -168
- package/src/app/api/pricing/gcp/route.ts +0 -230
- package/src/app/api/pricing/vast-ai/route.ts +0 -164
- package/src/app/api/route.ts +0 -5
- package/src/app/compare/h100-vs-h200/layout.tsx +0 -30
- package/src/app/compare/h100-vs-h200/page.tsx +0 -328
- package/src/app/globals.css +0 -122
- package/src/app/layout.tsx +0 -276
- package/src/app/page.tsx +0 -2670
- package/src/components/azure-live-pricing.tsx +0 -185
- package/src/components/benchmark-import.tsx +0 -340
- package/src/components/confidence-badge.tsx +0 -116
- package/src/components/live-pricing-comparison.tsx +0 -241
- package/src/components/theme-provider.tsx +0 -11
- package/src/components/theme-toggle.tsx +0 -55
- package/src/components/ui/accordion.tsx +0 -66
- package/src/components/ui/alert-dialog.tsx +0 -157
- package/src/components/ui/alert.tsx +0 -66
- package/src/components/ui/aspect-ratio.tsx +0 -11
- package/src/components/ui/avatar.tsx +0 -53
- package/src/components/ui/badge.tsx +0 -46
- package/src/components/ui/breadcrumb.tsx +0 -109
- package/src/components/ui/button.tsx +0 -59
- package/src/components/ui/calendar.tsx +0 -213
- package/src/components/ui/card.tsx +0 -92
- package/src/components/ui/carousel.tsx +0 -241
- package/src/components/ui/chart.tsx +0 -353
- package/src/components/ui/checkbox.tsx +0 -32
- package/src/components/ui/collapsible.tsx +0 -33
- package/src/components/ui/command.tsx +0 -184
- package/src/components/ui/context-menu.tsx +0 -252
- package/src/components/ui/dialog.tsx +0 -143
- package/src/components/ui/drawer.tsx +0 -135
- package/src/components/ui/dropdown-menu.tsx +0 -257
- package/src/components/ui/form.tsx +0 -167
- package/src/components/ui/hover-card.tsx +0 -44
- package/src/components/ui/input-otp.tsx +0 -77
- package/src/components/ui/input.tsx +0 -21
- package/src/components/ui/label.tsx +0 -24
- package/src/components/ui/menubar.tsx +0 -276
- package/src/components/ui/navigation-menu.tsx +0 -168
- package/src/components/ui/pagination.tsx +0 -127
- package/src/components/ui/popover.tsx +0 -48
- package/src/components/ui/progress.tsx +0 -31
- package/src/components/ui/radio-group.tsx +0 -45
- package/src/components/ui/resizable.tsx +0 -56
- package/src/components/ui/scroll-area.tsx +0 -58
- package/src/components/ui/select.tsx +0 -185
- package/src/components/ui/separator.tsx +0 -28
- package/src/components/ui/sheet.tsx +0 -139
- package/src/components/ui/sidebar.tsx +0 -726
- package/src/components/ui/skeleton.tsx +0 -13
- package/src/components/ui/slider.tsx +0 -63
- package/src/components/ui/sonner.tsx +0 -25
- package/src/components/ui/switch.tsx +0 -31
- package/src/components/ui/table.tsx +0 -116
- package/src/components/ui/tabs.tsx +0 -66
- package/src/components/ui/textarea.tsx +0 -18
- package/src/components/ui/toast.tsx +0 -129
- package/src/components/ui/toaster.tsx +0 -35
- package/src/components/ui/toggle-group.tsx +0 -73
- package/src/components/ui/toggle.tsx +0 -47
- package/src/components/ui/tooltip.tsx +0 -61
- package/src/components/vast-ai-live-pricing.tsx +0 -176
- package/src/hooks/use-mobile.ts +0 -19
- package/src/hooks/use-toast.ts +0 -194
- package/src/lib/benchmark-parser-sglang.ts +0 -150
- package/src/lib/benchmark-parser-tokcalc.ts +0 -247
- package/src/lib/benchmark-parser-trtllm.ts +0 -152
- package/src/lib/benchmark-parser-vllm.ts +0 -198
- package/src/lib/benchmark-schema.ts +0 -263
- package/src/lib/db.ts +0 -13
- package/src/lib/engine-presets.ts +0 -183
- package/src/lib/price-schema.ts +0 -141
- package/src/lib/token-calc.ts +0 -808
- package/src/lib/track.ts +0 -31
- package/src/lib/url-state.ts +0 -256
- package/src/lib/utils.ts +0 -6
- package/tailwind.config.ts +0 -64
- package/tests/database-runtime-build.sh +0 -75
- package/tests/python-runtime-build.sh +0 -64
- package/tests/python-runtime-container.sh +0 -31
- package/tool-results/bash_1789888171144_2c5381860539.txt +0 -161
- package/tool-results/bash_1789888175925_49c53ba3c61b.txt +0 -191
- package/tool-results/bash_1789888181202_49c53ba3c61b.txt +0 -191
- package/tool-results/bash_1789888195219_4a86a5c91411.txt +0 -200
- package/tool-results/bash_1789888203128_6cca13c71b47.txt +0 -199
- package/tool-results/bash_1789929256963_2a52aff0d0a8.txt +0 -160
- package/tool-results/read_1789888151021_69f58eec6a5b.txt +0 -653
- package/tool-results/read_1789888153837_1d3a8bfc2a94.txt +0 -653
- package/tool-results/read_1789888163087_ccc406d47505.txt +0 -122
- package/tool-results/read_1789888167347_67d1d7c9830a.txt +0 -122
- package/tool-results/read_1789929252529_d90e8f383a25.txt +0 -285
- package/tsconfig.json +0 -42
- package/upload/Pasted Content_1789887800864.txt +0 -652
- package/upload/Pasted Content_1789887909561.txt +0 -652
- package/upload/Pasted Content_1789887918428.txt +0 -652
- package/upload/Pasted Content_1789887959420.txt +0 -652
- package/upload/Pasted Content_1789888020485.txt +0 -652
- package/upload/Pasted Content_1789888058079.txt +0 -652
- package/upload/Pasted Content_1789888885033.txt +0 -686
- package/upload/Pasted Content_1789928912741.txt +0 -285
- package/upload/Pasted Content_1789928938402.txt +0 -285
- package/upload/Pasted Content_1789929160389.txt +0 -285
- package/upload/Pasted Content_1789929176660.txt +0 -285
- package/upload/issue_vision.json +0 -28
- package/upload/pasted_image_1789883175209.png +0 -0
- package/upload/pasted_image_1789899056690.png +0 -0
- package/upload/pasted_image_1789900371483.png +0 -0
- package/upload/pasted_image_1789900472823.png +0 -0
- package/upload/pasted_image_1789900490374.png +0 -0
- package/upload/pasted_image_1789900585552.png +0 -0
- package/upload/pasted_image_1789900606519.png +0 -0
- package/upload/pasted_image_1789901598705.png +0 -0
- package/upload/pasted_image_1789901613545.png +0 -0
- package/upload/pasted_image_1789978382674.png +0 -0
- package/upload/pasted_image_1789978392749.png +0 -0
- package/upload/pasted_image_1789978474879.png +0 -0
- package/upload/pasted_image_1789978523652.png +0 -0
- package/upload/pasted_image_1789984219089.png +0 -0
- package/upload/pasted_image_1789984491896.png +0 -0
- package/upload/pasted_image_1789985017950.png +0 -0
- package/upload/pasted_image_1789985036765.png +0 -0
- package/upload/pasted_image_1789985049848.png +0 -0
- package/upload/pasted_image_1790002427833.png +0 -0
- package/upload/pasted_image_1790002659944.png +0 -0
- package/upload/pasted_image_1790037038476.png +0 -0
- package/upload/screenshot_analysis.json +0 -28
- package/upload/vision_output.json +0 -28
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import {
|
|
5
|
-
Card,
|
|
6
|
-
CardContent,
|
|
7
|
-
CardDescription,
|
|
8
|
-
CardHeader,
|
|
9
|
-
CardTitle,
|
|
10
|
-
} from "@/components/ui/card";
|
|
11
|
-
import { Button } from "@/components/ui/button";
|
|
12
|
-
import { Badge } from "@/components/ui/badge";
|
|
13
|
-
import { RefreshCw, Zap, TrendingDown, Cloud } from "lucide-react";
|
|
14
|
-
import { track } from "@/lib/track";
|
|
15
|
-
|
|
16
|
-
interface UnifiedPrice {
|
|
17
|
-
gpu: string;
|
|
18
|
-
pricePerGpuHour: number;
|
|
19
|
-
provider: string;
|
|
20
|
-
region: string;
|
|
21
|
-
retrievedAt: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface ProviderResponse {
|
|
25
|
-
source: string;
|
|
26
|
-
cached: boolean;
|
|
27
|
-
retrievedAt?: string;
|
|
28
|
-
count?: number;
|
|
29
|
-
prices?: Array<{ gpu: string; pricePerGpuHour?: number; price?: number; region?: string; retrievedAt?: string }>;
|
|
30
|
-
error?: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function LivePricingComparison() {
|
|
34
|
-
const [prices, setPrices] = useState<UnifiedPrice[]>([]);
|
|
35
|
-
const [loading, setLoading] = useState(false);
|
|
36
|
-
const [lastUpdated, setLastUpdated] = useState<string | null>(null);
|
|
37
|
-
const [errors, setErrors] = useState<string[]>([]);
|
|
38
|
-
|
|
39
|
-
const fetchAll = async () => {
|
|
40
|
-
setLoading(true);
|
|
41
|
-
setErrors([]);
|
|
42
|
-
const allPrices: UnifiedPrice[] = [];
|
|
43
|
-
const newErrors: string[] = [];
|
|
44
|
-
let latestTimestamp: string | null = null;
|
|
45
|
-
|
|
46
|
-
// Fetch all providers in parallel
|
|
47
|
-
const providers = [
|
|
48
|
-
{ url: "/api/pricing/azure", name: "Azure" },
|
|
49
|
-
{ url: "/api/pricing/vast-ai", name: "Vast.ai" },
|
|
50
|
-
{ url: "/api/pricing/aws", name: "AWS" },
|
|
51
|
-
{ url: "/api/pricing/gcp", name: "GCP" },
|
|
52
|
-
];
|
|
53
|
-
|
|
54
|
-
const results = await Promise.allSettled(
|
|
55
|
-
providers.map(async (p) => {
|
|
56
|
-
const res = await fetch(p.url);
|
|
57
|
-
if (!res.ok) {
|
|
58
|
-
const errData = await res.json().catch(() => ({}));
|
|
59
|
-
throw new Error(errData.error || `HTTP ${res.status}`);
|
|
60
|
-
}
|
|
61
|
-
return { provider: p.name, data: (await res.json()) as ProviderResponse };
|
|
62
|
-
}),
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
for (const result of results) {
|
|
66
|
-
if (result.status === "fulfilled") {
|
|
67
|
-
const { provider, data } = result.value;
|
|
68
|
-
const providerPrices = data.prices || [];
|
|
69
|
-
|
|
70
|
-
for (const p of providerPrices) {
|
|
71
|
-
const pricePerGpuHour = p.pricePerGpuHour ?? p.price ?? 0;
|
|
72
|
-
if (pricePerGpuHour > 0) {
|
|
73
|
-
allPrices.push({
|
|
74
|
-
gpu: p.gpu,
|
|
75
|
-
pricePerGpuHour,
|
|
76
|
-
provider,
|
|
77
|
-
region: p.region || "—",
|
|
78
|
-
retrievedAt: p.retrievedAt || data.retrievedAt || new Date().toISOString(),
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (data.retrievedAt && (!latestTimestamp || new Date(data.retrievedAt) > new Date(latestTimestamp))) {
|
|
84
|
-
latestTimestamp = data.retrievedAt;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
track("fetched_live_pricing", { provider, count: providerPrices.length });
|
|
88
|
-
} else if (result.status === "rejected") {
|
|
89
|
-
const providerName = providers[results.indexOf(result)].name;
|
|
90
|
-
newErrors.push(`${providerName}: ${result.reason?.message || "fetch failed"}`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
setPrices(allPrices);
|
|
95
|
-
setLastUpdated(latestTimestamp);
|
|
96
|
-
setErrors(newErrors);
|
|
97
|
-
setLoading(false);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
useEffect(() => {
|
|
101
|
-
fetchAll();
|
|
102
|
-
}, []);
|
|
103
|
-
|
|
104
|
-
// Deduplicate: keep cheapest per GPU per provider
|
|
105
|
-
const cheapestPerGpu = (() => {
|
|
106
|
-
const seen = new Map<string, UnifiedPrice>();
|
|
107
|
-
for (const p of prices) {
|
|
108
|
-
const key = `${p.gpu}-${p.provider}`;
|
|
109
|
-
if (!seen.has(key) || seen.get(key)!.pricePerGpuHour > p.pricePerGpuHour) {
|
|
110
|
-
seen.set(key, p);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Group by GPU, sort providers by price
|
|
115
|
-
const byGpu = new Map<string, UnifiedPrice[]>();
|
|
116
|
-
for (const p of Array.from(seen.values())) {
|
|
117
|
-
if (!byGpu.has(p.gpu)) byGpu.set(p.gpu, []);
|
|
118
|
-
byGpu.get(p.gpu)!.push(p);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// Sort each GPU's providers by price
|
|
122
|
-
for (const arr of byGpu.values()) {
|
|
123
|
-
arr.sort((a, b) => a.pricePerGpuHour - b.pricePerGpuHour);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Sort GPUs by their cheapest provider
|
|
127
|
-
return Array.from(byGpu.entries())
|
|
128
|
-
.map(([gpu, providers]) => ({ gpu, providers }))
|
|
129
|
-
.sort((a, b) => a.providers[0].pricePerGpuHour - b.providers[0].pricePerGpuHour);
|
|
130
|
-
})();
|
|
131
|
-
|
|
132
|
-
const asOfLabel = (() => {
|
|
133
|
-
if (!lastUpdated) return null;
|
|
134
|
-
const ageMs = Date.now() - new Date(lastUpdated).getTime();
|
|
135
|
-
if (ageMs < 60000) return "just now";
|
|
136
|
-
if (ageMs < 3600000) return `${Math.floor(ageMs / 60000)}m ago`;
|
|
137
|
-
return `${Math.floor(ageMs / 3600000)}h ago`;
|
|
138
|
-
})();
|
|
139
|
-
|
|
140
|
-
const providerColors: Record<string, string> = {
|
|
141
|
-
Azure: "text-blue-500",
|
|
142
|
-
"Vast.ai": "text-amber-500",
|
|
143
|
-
AWS: "text-orange-500",
|
|
144
|
-
GCP: "text-red-500",
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
return (
|
|
148
|
-
<Card className="border-emerald-500/30 shadow-sm">
|
|
149
|
-
<CardHeader className="pb-3">
|
|
150
|
-
<div className="flex items-center justify-between">
|
|
151
|
-
<div>
|
|
152
|
-
<CardTitle className="text-sm flex items-center gap-2">
|
|
153
|
-
<Cloud className="size-4 text-emerald-500" />
|
|
154
|
-
Live GPU price comparison — all providers
|
|
155
|
-
<Badge variant="outline" className="text-[9px] gap-1 ml-1">
|
|
156
|
-
<span className="size-1.5 rounded-full bg-emerald-500 animate-pulse" />
|
|
157
|
-
LIVE
|
|
158
|
-
</Badge>
|
|
159
|
-
</CardTitle>
|
|
160
|
-
<CardDescription className="text-xs mt-1">
|
|
161
|
-
Cheapest available GPU price across Azure, AWS, GCP, and Vast.ai marketplace.
|
|
162
|
-
{asOfLabel && ` Last updated ${asOfLabel}.`}
|
|
163
|
-
</CardDescription>
|
|
164
|
-
</div>
|
|
165
|
-
<Button
|
|
166
|
-
variant="ghost"
|
|
167
|
-
size="sm"
|
|
168
|
-
onClick={fetchAll}
|
|
169
|
-
disabled={loading}
|
|
170
|
-
className="gap-1.5 h-8"
|
|
171
|
-
>
|
|
172
|
-
<RefreshCw className={`size-3.5 ${loading ? "animate-spin" : ""}`} />
|
|
173
|
-
<span className="text-xs">Refresh</span>
|
|
174
|
-
</Button>
|
|
175
|
-
</div>
|
|
176
|
-
</CardHeader>
|
|
177
|
-
<CardContent>
|
|
178
|
-
{loading && prices.length === 0 && (
|
|
179
|
-
<div className="flex items-center justify-center py-8 text-xs text-muted-foreground">
|
|
180
|
-
<RefreshCw className="size-4 animate-spin mr-2" />
|
|
181
|
-
Fetching live prices from Azure, Vast.ai, AWS, and GCP...
|
|
182
|
-
</div>
|
|
183
|
-
)}
|
|
184
|
-
|
|
185
|
-
{errors.length > 0 && (
|
|
186
|
-
<div className="mb-3 p-2 rounded-md border border-amber-500/30 bg-amber-500/5 text-[10px] text-amber-600 dark:text-amber-400">
|
|
187
|
-
⚠ {errors.join(" · ")}
|
|
188
|
-
</div>
|
|
189
|
-
)}
|
|
190
|
-
|
|
191
|
-
{cheapestPerGpu.length > 0 && (
|
|
192
|
-
<div className="overflow-x-auto">
|
|
193
|
-
<table className="w-full text-xs">
|
|
194
|
-
<thead className="bg-muted/40 text-[10px] uppercase">
|
|
195
|
-
<tr>
|
|
196
|
-
<th className="text-left px-3 py-1.5">GPU</th>
|
|
197
|
-
<th className="text-right px-3 py-1.5">Cheapest $/GPU-hr</th>
|
|
198
|
-
<th className="text-left px-3 py-1.5">Provider</th>
|
|
199
|
-
<th className="text-left px-3 py-1.5">All providers</th>
|
|
200
|
-
</tr>
|
|
201
|
-
</thead>
|
|
202
|
-
<tbody>
|
|
203
|
-
{cheapestPerGpu.map(({ gpu, providers }) => {
|
|
204
|
-
const cheapest = providers[0];
|
|
205
|
-
return (
|
|
206
|
-
<tr key={gpu} className="border-t border-border/40 hover:bg-muted/20">
|
|
207
|
-
<td className="px-3 py-1.5 font-medium">{gpu}</td>
|
|
208
|
-
<td className="px-3 py-1.5 text-right font-mono text-emerald-500 font-semibold">
|
|
209
|
-
${cheapest.pricePerGpuHour}/hr
|
|
210
|
-
</td>
|
|
211
|
-
<td className="px-3 py-1.5">
|
|
212
|
-
<span className={providerColors[cheapest.provider] || "text-muted-foreground"}>
|
|
213
|
-
{cheapest.provider}
|
|
214
|
-
</span>
|
|
215
|
-
<span className="text-muted-foreground text-[10px] ml-1">{cheapest.region}</span>
|
|
216
|
-
</td>
|
|
217
|
-
<td className="px-3 py-1.5 text-[10px] text-muted-foreground">
|
|
218
|
-
{providers.map((p, i) => (
|
|
219
|
-
<span key={i}>
|
|
220
|
-
{i > 0 && " · "}
|
|
221
|
-
<span className={providerColors[p.provider] || "text-muted-foreground"}>
|
|
222
|
-
{p.provider} ${p.pricePerGpuHour}
|
|
223
|
-
</span>
|
|
224
|
-
</span>
|
|
225
|
-
))}
|
|
226
|
-
</td>
|
|
227
|
-
</tr>
|
|
228
|
-
);
|
|
229
|
-
})}
|
|
230
|
-
</tbody>
|
|
231
|
-
</table>
|
|
232
|
-
<p className="text-[10px] text-muted-foreground mt-2 leading-relaxed">
|
|
233
|
-
On-demand prices (spot/reserved excluded). Vast.ai shows spot-market prices which change rapidly.
|
|
234
|
-
GCP requires <code>GCP_API_KEY</code> env var on Vercel. AWS uses public bulk pricing files (no auth).
|
|
235
|
-
</p>
|
|
236
|
-
</div>
|
|
237
|
-
)}
|
|
238
|
-
</CardContent>
|
|
239
|
-
</Card>
|
|
240
|
-
);
|
|
241
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
|
4
|
-
import type { ComponentProps } from "react";
|
|
5
|
-
|
|
6
|
-
export function ThemeProvider({
|
|
7
|
-
children,
|
|
8
|
-
...props
|
|
9
|
-
}: ComponentProps<typeof NextThemesProvider>) {
|
|
10
|
-
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
|
|
11
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { Moon, Sun } from "lucide-react";
|
|
4
|
-
import { useTheme } from "next-themes";
|
|
5
|
-
import { useEffect, useState } from "react";
|
|
6
|
-
import { Button } from "@/components/ui/button";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Theme toggle button.
|
|
10
|
-
*
|
|
11
|
-
* Renders a STABLE button (same aria-label, same icon) on server + first client
|
|
12
|
-
* render. Only AFTER `useEffect` runs (post-hydration) do we swap in the actual
|
|
13
|
-
* sun/moon icon. This avoids hydration mismatches caused by `resolvedTheme`
|
|
14
|
-
* being undefined on the server but defined on the client.
|
|
15
|
-
*
|
|
16
|
-
* Refs: https://github.com/pacocoursey/next-themes#avoid-hydration-mismatches
|
|
17
|
-
*/
|
|
18
|
-
export function ThemeToggle() {
|
|
19
|
-
const { resolvedTheme, setTheme } = useTheme();
|
|
20
|
-
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
21
|
-
const [mounted, setMounted] = useState(false);
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
25
|
-
setMounted(true);
|
|
26
|
-
}, []);
|
|
27
|
-
|
|
28
|
-
const isDark = resolvedTheme === "dark";
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<Button
|
|
32
|
-
variant="ghost"
|
|
33
|
-
size="icon"
|
|
34
|
-
onClick={() => setTheme(isDark ? "light" : "dark")}
|
|
35
|
-
// STABLE label — never depends on theme. This is the hydration-safe choice.
|
|
36
|
-
aria-label="Toggle theme"
|
|
37
|
-
className="size-8 rounded-md"
|
|
38
|
-
// suppressHydrationWarning is the recommended escape hatch for theme toggles
|
|
39
|
-
// that swap attributes post-mount.
|
|
40
|
-
suppressHydrationWarning
|
|
41
|
-
>
|
|
42
|
-
{mounted ? (
|
|
43
|
-
isDark ? (
|
|
44
|
-
<Sun className="size-4" />
|
|
45
|
-
) : (
|
|
46
|
-
<Moon className="size-4" />
|
|
47
|
-
)
|
|
48
|
-
) : (
|
|
49
|
-
// Stable placeholder used during SSR + first client render.
|
|
50
|
-
// Must match exactly between server and client to avoid hydration warnings.
|
|
51
|
-
<Sun className="size-4" />
|
|
52
|
-
)}
|
|
53
|
-
</Button>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
|
5
|
-
import { ChevronDownIcon } from "lucide-react"
|
|
6
|
-
|
|
7
|
-
import { cn } from "@/lib/utils"
|
|
8
|
-
|
|
9
|
-
function Accordion({
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof AccordionPrimitive.Root>) {
|
|
12
|
-
return <AccordionPrimitive.Root data-slot="accordion" {...props} />
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function AccordionItem({
|
|
16
|
-
className,
|
|
17
|
-
...props
|
|
18
|
-
}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
|
19
|
-
return (
|
|
20
|
-
<AccordionPrimitive.Item
|
|
21
|
-
data-slot="accordion-item"
|
|
22
|
-
className={cn("border-b last:border-b-0", className)}
|
|
23
|
-
{...props}
|
|
24
|
-
/>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function AccordionTrigger({
|
|
29
|
-
className,
|
|
30
|
-
children,
|
|
31
|
-
...props
|
|
32
|
-
}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
|
|
33
|
-
return (
|
|
34
|
-
<AccordionPrimitive.Header className="flex">
|
|
35
|
-
<AccordionPrimitive.Trigger
|
|
36
|
-
data-slot="accordion-trigger"
|
|
37
|
-
className={cn(
|
|
38
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
39
|
-
className
|
|
40
|
-
)}
|
|
41
|
-
{...props}
|
|
42
|
-
>
|
|
43
|
-
{children}
|
|
44
|
-
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
|
|
45
|
-
</AccordionPrimitive.Trigger>
|
|
46
|
-
</AccordionPrimitive.Header>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function AccordionContent({
|
|
51
|
-
className,
|
|
52
|
-
children,
|
|
53
|
-
...props
|
|
54
|
-
}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
|
|
55
|
-
return (
|
|
56
|
-
<AccordionPrimitive.Content
|
|
57
|
-
data-slot="accordion-content"
|
|
58
|
-
className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
|
|
59
|
-
{...props}
|
|
60
|
-
>
|
|
61
|
-
<div className={cn("pt-0 pb-4", className)}>{children}</div>
|
|
62
|
-
</AccordionPrimitive.Content>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
|
|
5
|
-
|
|
6
|
-
import { cn } from "@/lib/utils"
|
|
7
|
-
import { buttonVariants } from "@/components/ui/button"
|
|
8
|
-
|
|
9
|
-
function AlertDialog({
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
|
|
12
|
-
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function AlertDialogTrigger({
|
|
16
|
-
...props
|
|
17
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
|
|
18
|
-
return (
|
|
19
|
-
<AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function AlertDialogPortal({
|
|
24
|
-
...props
|
|
25
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
|
|
26
|
-
return (
|
|
27
|
-
<AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function AlertDialogOverlay({
|
|
32
|
-
className,
|
|
33
|
-
...props
|
|
34
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
|
|
35
|
-
return (
|
|
36
|
-
<AlertDialogPrimitive.Overlay
|
|
37
|
-
data-slot="alert-dialog-overlay"
|
|
38
|
-
className={cn(
|
|
39
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
40
|
-
className
|
|
41
|
-
)}
|
|
42
|
-
{...props}
|
|
43
|
-
/>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function AlertDialogContent({
|
|
48
|
-
className,
|
|
49
|
-
...props
|
|
50
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
|
|
51
|
-
return (
|
|
52
|
-
<AlertDialogPortal>
|
|
53
|
-
<AlertDialogOverlay />
|
|
54
|
-
<AlertDialogPrimitive.Content
|
|
55
|
-
data-slot="alert-dialog-content"
|
|
56
|
-
className={cn(
|
|
57
|
-
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
58
|
-
className
|
|
59
|
-
)}
|
|
60
|
-
{...props}
|
|
61
|
-
/>
|
|
62
|
-
</AlertDialogPortal>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function AlertDialogHeader({
|
|
67
|
-
className,
|
|
68
|
-
...props
|
|
69
|
-
}: React.ComponentProps<"div">) {
|
|
70
|
-
return (
|
|
71
|
-
<div
|
|
72
|
-
data-slot="alert-dialog-header"
|
|
73
|
-
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
74
|
-
{...props}
|
|
75
|
-
/>
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function AlertDialogFooter({
|
|
80
|
-
className,
|
|
81
|
-
...props
|
|
82
|
-
}: React.ComponentProps<"div">) {
|
|
83
|
-
return (
|
|
84
|
-
<div
|
|
85
|
-
data-slot="alert-dialog-footer"
|
|
86
|
-
className={cn(
|
|
87
|
-
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
88
|
-
className
|
|
89
|
-
)}
|
|
90
|
-
{...props}
|
|
91
|
-
/>
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function AlertDialogTitle({
|
|
96
|
-
className,
|
|
97
|
-
...props
|
|
98
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
|
|
99
|
-
return (
|
|
100
|
-
<AlertDialogPrimitive.Title
|
|
101
|
-
data-slot="alert-dialog-title"
|
|
102
|
-
className={cn("text-lg font-semibold", className)}
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function AlertDialogDescription({
|
|
109
|
-
className,
|
|
110
|
-
...props
|
|
111
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
|
|
112
|
-
return (
|
|
113
|
-
<AlertDialogPrimitive.Description
|
|
114
|
-
data-slot="alert-dialog-description"
|
|
115
|
-
className={cn("text-muted-foreground text-sm", className)}
|
|
116
|
-
{...props}
|
|
117
|
-
/>
|
|
118
|
-
)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function AlertDialogAction({
|
|
122
|
-
className,
|
|
123
|
-
...props
|
|
124
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
|
|
125
|
-
return (
|
|
126
|
-
<AlertDialogPrimitive.Action
|
|
127
|
-
className={cn(buttonVariants(), className)}
|
|
128
|
-
{...props}
|
|
129
|
-
/>
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function AlertDialogCancel({
|
|
134
|
-
className,
|
|
135
|
-
...props
|
|
136
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
|
|
137
|
-
return (
|
|
138
|
-
<AlertDialogPrimitive.Cancel
|
|
139
|
-
className={cn(buttonVariants({ variant: "outline" }), className)}
|
|
140
|
-
{...props}
|
|
141
|
-
/>
|
|
142
|
-
)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export {
|
|
146
|
-
AlertDialog,
|
|
147
|
-
AlertDialogPortal,
|
|
148
|
-
AlertDialogOverlay,
|
|
149
|
-
AlertDialogTrigger,
|
|
150
|
-
AlertDialogContent,
|
|
151
|
-
AlertDialogHeader,
|
|
152
|
-
AlertDialogFooter,
|
|
153
|
-
AlertDialogTitle,
|
|
154
|
-
AlertDialogDescription,
|
|
155
|
-
AlertDialogAction,
|
|
156
|
-
AlertDialogCancel,
|
|
157
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
-
|
|
4
|
-
import { cn } from "@/lib/utils"
|
|
5
|
-
|
|
6
|
-
const alertVariants = cva(
|
|
7
|
-
"relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
8
|
-
{
|
|
9
|
-
variants: {
|
|
10
|
-
variant: {
|
|
11
|
-
default: "bg-card text-card-foreground",
|
|
12
|
-
destructive:
|
|
13
|
-
"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
defaultVariants: {
|
|
17
|
-
variant: "default",
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
function Alert({
|
|
23
|
-
className,
|
|
24
|
-
variant,
|
|
25
|
-
...props
|
|
26
|
-
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
|
|
27
|
-
return (
|
|
28
|
-
<div
|
|
29
|
-
data-slot="alert"
|
|
30
|
-
role="alert"
|
|
31
|
-
className={cn(alertVariants({ variant }), className)}
|
|
32
|
-
{...props}
|
|
33
|
-
/>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
38
|
-
return (
|
|
39
|
-
<div
|
|
40
|
-
data-slot="alert-title"
|
|
41
|
-
className={cn(
|
|
42
|
-
"col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
|
|
43
|
-
className
|
|
44
|
-
)}
|
|
45
|
-
{...props}
|
|
46
|
-
/>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function AlertDescription({
|
|
51
|
-
className,
|
|
52
|
-
...props
|
|
53
|
-
}: React.ComponentProps<"div">) {
|
|
54
|
-
return (
|
|
55
|
-
<div
|
|
56
|
-
data-slot="alert-description"
|
|
57
|
-
className={cn(
|
|
58
|
-
"text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
|
|
59
|
-
className
|
|
60
|
-
)}
|
|
61
|
-
{...props}
|
|
62
|
-
/>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { Alert, AlertTitle, AlertDescription }
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
|
|
4
|
-
|
|
5
|
-
function AspectRatio({
|
|
6
|
-
...props
|
|
7
|
-
}: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {
|
|
8
|
-
return <AspectRatioPrimitive.Root data-slot="aspect-ratio" {...props} />
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { AspectRatio }
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as AvatarPrimitive from "@radix-ui/react-avatar"
|
|
5
|
-
|
|
6
|
-
import { cn } from "@/lib/utils"
|
|
7
|
-
|
|
8
|
-
function Avatar({
|
|
9
|
-
className,
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof AvatarPrimitive.Root>) {
|
|
12
|
-
return (
|
|
13
|
-
<AvatarPrimitive.Root
|
|
14
|
-
data-slot="avatar"
|
|
15
|
-
className={cn(
|
|
16
|
-
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
|
|
17
|
-
className
|
|
18
|
-
)}
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
21
|
-
)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function AvatarImage({
|
|
25
|
-
className,
|
|
26
|
-
...props
|
|
27
|
-
}: React.ComponentProps<typeof AvatarPrimitive.Image>) {
|
|
28
|
-
return (
|
|
29
|
-
<AvatarPrimitive.Image
|
|
30
|
-
data-slot="avatar-image"
|
|
31
|
-
className={cn("aspect-square size-full", className)}
|
|
32
|
-
{...props}
|
|
33
|
-
/>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function AvatarFallback({
|
|
38
|
-
className,
|
|
39
|
-
...props
|
|
40
|
-
}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
|
|
41
|
-
return (
|
|
42
|
-
<AvatarPrimitive.Fallback
|
|
43
|
-
data-slot="avatar-fallback"
|
|
44
|
-
className={cn(
|
|
45
|
-
"bg-muted flex size-full items-center justify-center rounded-full",
|
|
46
|
-
className
|
|
47
|
-
)}
|
|
48
|
-
{...props}
|
|
49
|
-
/>
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { Avatar, AvatarImage, AvatarFallback }
|