refactor(web): remove unnecessary "use client" from 6 pure-render components
BenchResourceCard, MobileProjectCard, MobileCapacityCard, DynamicFieldRenderer, BudgetStatusBar, and TimelineHeader use no hooks, event handlers, or browser APIs — they can be server components, reducing client bundle size. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
"use client";
|
||||
|
||||
interface MobileCapacityCardProps {
|
||||
totalResources: number;
|
||||
activeResources: number;
|
||||
@@ -16,8 +14,7 @@ export function MobileCapacityCard({
|
||||
const pct = Math.min(100, Math.max(0, avgUtilizationPct));
|
||||
const circumference = 2 * Math.PI * 34; // radius = 34
|
||||
const dashOffset = circumference * (1 - pct / 100);
|
||||
const color =
|
||||
pct >= 90 ? "#d97706" : pct >= 70 ? "#059669" : "#6b7280";
|
||||
const color = pct >= 90 ? "#d97706" : pct >= 70 ? "#059669" : "#6b7280";
|
||||
|
||||
return (
|
||||
<div className="rounded-2xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 p-5">
|
||||
@@ -27,7 +24,15 @@ export function MobileCapacityCard({
|
||||
<div className="flex items-center gap-5">
|
||||
{/* CSS-only donut */}
|
||||
<svg width="80" height="80" viewBox="0 0 80 80" className="shrink-0">
|
||||
<circle cx="40" cy="40" r="34" fill="none" stroke="#e5e7eb" strokeWidth="8" className="dark:stroke-gray-700" />
|
||||
<circle
|
||||
cx="40"
|
||||
cy="40"
|
||||
r="34"
|
||||
fill="none"
|
||||
stroke="#e5e7eb"
|
||||
strokeWidth="8"
|
||||
className="dark:stroke-gray-700"
|
||||
/>
|
||||
<circle
|
||||
cx="40"
|
||||
cy="40"
|
||||
@@ -40,7 +45,15 @@ export function MobileCapacityCard({
|
||||
strokeLinecap="round"
|
||||
transform="rotate(-90 40 40)"
|
||||
/>
|
||||
<text x="40" y="40" textAnchor="middle" dominantBaseline="middle" fontSize="15" fontWeight="700" fill={color}>
|
||||
<text
|
||||
x="40"
|
||||
y="40"
|
||||
textAnchor="middle"
|
||||
dominantBaseline="middle"
|
||||
fontSize="15"
|
||||
fontWeight="700"
|
||||
fill={color}
|
||||
>
|
||||
{Math.round(pct)}%
|
||||
</text>
|
||||
</svg>
|
||||
@@ -54,7 +67,9 @@ export function MobileCapacityCard({
|
||||
{overbookedCount > 0 && (
|
||||
<div className="flex items-center justify-between text-sm">
|
||||
<span className="text-amber-600 dark:text-amber-400">Overbooked</span>
|
||||
<span className="font-semibold text-amber-600 dark:text-amber-400">{overbookedCount}</span>
|
||||
<span className="font-semibold text-amber-600 dark:text-amber-400">
|
||||
{overbookedCount}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user