Skip to content

Latest commit

 

History

History
112 lines (85 loc) · 4.89 KB

File metadata and controls

112 lines (85 loc) · 4.89 KB

Unused Code Analysis

Date: 2025-09-16
Status: Analysis Complete - 21 unused files identified

Summary

Comprehensive search through the codebase identified 21 components, hooks, and utility modules that are not being imported or used anywhere in the application. These files are safe candidates for removal to reduce codebase bloat.

Definitely Unused Components (Safe to Remove)

React Components

Social & Notifications

  • src/components/social/FriendMessagePopup.tsx - Social popup dialog component for friends and messages
  • src/components/notifications/notification-demo.tsx - Demo component for notifications (development/testing)

Game Components

  • src/app/(checkers)/_components/game/TimeControlPanel.tsx - Game time control configuration panel
  • src/app/(checkers)/_components/game/WaitingRoom.tsx - Game waiting room component
  • src/app/(checkers)/_components/game/OrientedBoard.tsx - Board component with orientation handling
  • src/app/(checkers)/_components/game/SpectatorIndicator.tsx - UI indicator for spectators
  • src/app/(checkers)/_components/game/InviteStatusIndicator.tsx - Game invite status indicator
  • src/app/(checkers)/_components/game/InviteStatusPanel.tsx - Panel showing invite status details

Game Action Components

  • src/app/(checkers)/_components/game/MustCaptureArrow.tsx - Arrow indicator for mandatory captures
  • src/app/(checkers)/_components/game/MustCaptureToast.tsx - Toast notification for mandatory captures
  • src/app/(checkers)/_components/game/MustCaptureTooltip.tsx - Tooltip for mandatory capture rules

Hooks & Custom Logic

Game State Hooks

  • src/hooks/useOfflineSync.ts - Hook for offline synchronization
  • src/hooks/useGameStorage.ts - Hook for game data storage management
  • src/hooks/useTabTitleBadge.ts - Hook for updating browser tab title with badges
  • src/hooks/useSingleTabEnforcement.ts - Hook for enforcing single tab usage

Utility Modules

Game Logic Utilities

  • src/lib/conflict-resolution.ts - Conflict resolution utilities for multiplayer
  • src/lib/game/multiplayer-sync.ts - Multiplayer synchronization utilities
  • src/lib/game/guest-session.ts - Guest session management utilities
  • src/lib/game/checkers-notation.ts - Chess/checkers notation utilities
  • src/lib/game/move-evaluation.ts - Move evaluation and scoring utilities

External Integrations

  • src/lib/s3.ts - AWS S3 integration utilities

UI Components (Shadcn/ui)

  • src/components/ui/resizable-panels.tsx - Shadcn/ui resizable panels component
  • src/components/ui/collapsible.tsx - Shadcn/ui collapsible component

Analysis Notes

Components That Are Actually Used

These components appeared potentially unused but are actually imported:

  • MessageCenter - Used by FriendMessagePopup
  • ChatSettingsPopup - Used by FloatingChat components
  • GameAnalysis - Used in multiple places
  • All tRPC routers - All registered in the main router
  • All type files - All have multiple imports
  • Page/Layout components - Used by Next.js App Router automatically

Important Exclusions

  1. Next.js Page Components: All page.tsx, layout.tsx, and loading.tsx files in src/app/ are automatically used by Next.js App Router
  2. Test Files: All *.test.tsx and *.test.ts files are intentionally separate and don't need imports
  3. Development Components: Some components like notification-demo.tsx are development/testing utilities

Categorization by Feature

Incomplete Features (Consider removing if not planned)

  • Spectator Mode: SpectatorIndicator.tsx
  • Offline Functionality: useOfflineSync.ts, conflict-resolution.ts
  • Advanced Game Controls: TimeControlPanel.tsx, OrientedBoard.tsx
  • Guest Sessions: guest-session.ts
  • AWS Integration: s3.ts
  • Mandatory Capture UI: MustCapture*.tsx components
  • Multi-tab Management: useSingleTabEnforcement.ts, useTabTitleBadge.ts

Development/Testing Utilities

  • notification-demo.tsx
  • FriendMessagePopup.tsx (orphaned social component)

Unused UI Library Components

  • resizable-panels.tsx
  • collapsible.tsx

Recommendations

Immediate Safe Removals

These have no dependencies and can be removed immediately:

  • FriendMessagePopup.tsx (completely orphaned)
  • notification-demo.tsx (development component)
  • resizable-panels.tsx and collapsible.tsx (unused UI components)
  • s3.ts (unused AWS integration)

Feature-Specific Decisions Needed

Consider the roadmap for these features before removing:

  • Spectator mode components
  • Offline sync functionality
  • Advanced game controls
  • Guest session support
  • Mandatory capture UI enhancements

Total Count

21 unused files identified across components, hooks, utilities, and UI library additions.


This analysis was generated by searching for import patterns and actual usage throughout the codebase. All identified files have no active imports or references in the application code.