From f05dc6fa6811cd2ca9f8d1e851a4302e530adb60 Mon Sep 17 00:00:00 2001 From: Joey Eamigh <55670930+JoeyEamigh@users.noreply.github.com> Date: Wed, 11 Feb 2026 05:40:39 -0500 Subject: [PATCH] final QA: code review fixes Remove dead code per project rules: - Delete unused ErrorBoundary component (never imported) - Delete unused AmbientGlow component (never imported) - Remove unused eiaPaginationSchema export - Remove unused SuperJSON re-export --- src/components/dashboard/ambient-glow.tsx | 48 ----------------- src/components/error-boundary.tsx | 65 ----------------------- src/lib/schemas/electricity.ts | 10 ---- src/lib/superjson.ts | 2 - 4 files changed, 125 deletions(-) delete mode 100644 src/components/dashboard/ambient-glow.tsx delete mode 100644 src/components/error-boundary.tsx diff --git a/src/components/dashboard/ambient-glow.tsx b/src/components/dashboard/ambient-glow.tsx deleted file mode 100644 index fb21712..0000000 --- a/src/components/dashboard/ambient-glow.tsx +++ /dev/null @@ -1,48 +0,0 @@ -'use client'; - -import { cn } from '@/lib/utils.js'; -import type { ReactNode } from 'react'; - -type StressLevel = 'low' | 'moderate' | 'high' | 'critical'; - -interface AmbientGlowProps { - stressLevel: StressLevel; - children: ReactNode; - className?: string; -} - -const GLOW_COLORS: Record = { - low: '34, 197, 94', // green - moderate: '234, 179, 8', // yellow - high: '249, 115, 22', // orange - critical: '239, 68, 68', // red -}; - -const GLOW_ANIMATION: Record = { - low: 'ambient-glow-slow', - moderate: 'ambient-glow-medium', - high: 'ambient-glow-fast', - critical: 'ambient-glow-pulse', -}; - -export function getStressLevel(utilizationPercent: number): StressLevel { - if (utilizationPercent >= 90) return 'critical'; - if (utilizationPercent >= 80) return 'high'; - if (utilizationPercent >= 65) return 'moderate'; - return 'low'; -} - -export function AmbientGlow({ stressLevel, children, className }: AmbientGlowProps) { - const rgb = GLOW_COLORS[stressLevel]; - const animationClass = GLOW_ANIMATION[stressLevel]; - - return ( -
- {children} -
- ); -} diff --git a/src/components/error-boundary.tsx b/src/components/error-boundary.tsx deleted file mode 100644 index 51eff02..0000000 --- a/src/components/error-boundary.tsx +++ /dev/null @@ -1,65 +0,0 @@ -'use client'; - -import { Component, type ErrorInfo, type ReactNode } from 'react'; - -import { Button } from '@/components/ui/button.js'; -import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '@/components/ui/card.js'; - -interface ErrorBoundaryProps { - children: ReactNode; - fallback?: ReactNode; -} - -interface ErrorBoundaryState { - hasError: boolean; - error: Error | null; -} - -export class ErrorBoundary extends Component { - constructor(props: ErrorBoundaryProps) { - super(props); - this.state = { hasError: false, error: null }; - } - - static getDerivedStateFromError(error: Error): ErrorBoundaryState { - return { hasError: true, error }; - } - - componentDidCatch(error: Error, info: ErrorInfo): void { - console.error('ErrorBoundary caught an error:', error, info.componentStack); - } - - handleRetry = () => { - this.setState({ hasError: false, error: null }); - }; - - render() { - if (this.state.hasError) { - if (this.props.fallback) { - return this.props.fallback; - } - - return ( -
- - - Something went wrong - - -

- {this.state.error?.message ?? 'An unexpected error occurred while rendering this section.'} -

-
- - - -
-
- ); - } - - return this.props.children; - } -} diff --git a/src/lib/schemas/electricity.ts b/src/lib/schemas/electricity.ts index 3a4c9e6..e0f6c61 100644 --- a/src/lib/schemas/electricity.ts +++ b/src/lib/schemas/electricity.ts @@ -108,16 +108,6 @@ export interface FuelTypeDataPoint { valueUnits: string; } -/** - * EIA API pagination metadata. - * Note: `total` comes back as a string from EIA. - */ -export const eiaPaginationSchema = z.object({ - offset: z.number(), - length: z.number(), - total: z.union([z.string(), z.number()]).transform(Number), -}); - /** * Generic EIA API response wrapper. * All EIA v2 responses share this structure. diff --git a/src/lib/superjson.ts b/src/lib/superjson.ts index abadb80..d531f84 100644 --- a/src/lib/superjson.ts +++ b/src/lib/superjson.ts @@ -7,5 +7,3 @@ export function serialize(data: T) { export function deserialize(data: ReturnType): T { return SuperJSON.deserialize(data); } - -export { SuperJSON };