Skip to content

chore(frontend): remove dead code, consolidate patterns, update README#155

Open
Copilot wants to merge 2 commits intomainfrom
copilot/cleanup-unused-frontend-code
Open

chore(frontend): remove dead code, consolidate patterns, update README#155
Copilot wants to merge 2 commits intomainfrom
copilot/cleanup-unused-frontend-code

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

The frontend had accumulated unused files, duplicate inline patterns, and an outdated README that no longer reflected the actual structure.

Dead code removed

7 files deleted — none were reachable from any active import path:

File Reason
types/fileUpload.ts Empty placeholder
types/maplibre/bounds.ts computeBoundsFromGeoJSON never called
types/maplibre/priorityStyle.ts priorityFillColorExpression never used
features/farm/CoordinateFileUpload.tsx Barrel-exported but never imported
features/farm/YieldFileUpload.tsx Same
services/fileUploadService.ts Only consumers were the two deleted components
pages/PrescriptionsPage.tsx Route was permanently commented out

features/farm/index.ts and AppRoutes.tsx cleaned up accordingly.

Duplicate patterns consolidated

Page gradient background — a 3-line ternary repeated across 6 files extracted into src/utils/theme.ts:

// before (repeated inline in LoginPage, SignupPage, HomePage, ProfilePage, LandingPage, FieldTable)
const gradientBg =
  theme.palette.mode === "dark"
    ? `linear-gradient(180deg, #0a0a0a 0%, ${theme.palette.background.default} 100%)`
    : `linear-gradient(180deg, #f0f0f5 0%, ${theme.palette.background.default} 100%)`;

// after
import { getPageGradientBg } from "../utils/theme";
background: getPageGradientBg(theme)

Error normalizationProfilePage had a private normalizeErrors doing the same job as normalizeSignupErrors in utils/errors.ts with slightly different join logic. The general version is now exported from utils/errors.ts and ProfilePage imports it from there.

README rewritten

Previous README described an outdated structure (referenced App.tsx, ProtectedRoute in components/, React Router v6). Replaced with accurate documentation covering the current stack, full annotated directory tree, route table, auth flow, conventions, and testing instructions.

- Remove dead code: fileUpload.ts (empty), maplibre/bounds.ts,
  maplibre/priorityStyle.ts, YieldFileUpload.tsx,
  CoordinateFileUpload.tsx, fileUploadService.ts, PrescriptionsPage.tsx
- Remove commented-out PrescriptionsPage import and route in AppRoutes
- Consolidate normalizeErrors into utils/errors.ts; remove duplicate
  from ProfilePage
- Extract page gradient background into utils/theme.ts; update all 6
  usages in pages and FieldTable
- Rewrite README.md to accurately reflect current structure and conventions

Agent-Logs-Url: https://github.com/JosephPBaruch/CharAI/sessions/2018982f-9e14-412a-a709-60990d351466

Co-authored-by: JosephPBaruch <132173774+JosephPBaruch@users.noreply.github.com>
Copilot AI changed the title [WIP] Cleanup unused frontend code and reorganize file structure chore(frontend): remove dead code, consolidate patterns, update README Apr 16, 2026
Copilot AI requested a review from JosephPBaruch April 16, 2026 01:42
@JosephPBaruch JosephPBaruch marked this pull request as ready for review April 16, 2026 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cleanup unused frontend code and reorganize file structure

2 participants