Skip to content

FAC-WEB refactor: improve frontend logic structure and code quality #98

Description

@ayacoders

Context

There are parts of the frontend codebase where the logic and implementation structure are harder to follow, more coupled than necessary, or written in a way that makes maintenance riskier over time.

This issue is intended to focus on the quality of the code itself: how logic is organized, how responsibilities are split, and how maintainable the implementation is.

Purpose

  • Refactor poorly structured frontend logic
  • Improve separation of concerns across hooks, screens, and components
  • Reduce overly coupled or overloaded implementation patterns
  • Clean up code that is difficult to read, reason about, or safely extend
  • Standardize implementation quality across the frontend codebase

Focus Areas

Based on an initial scan, the cleanup should focus primarily on logic and code structure rather than visual polish:

  • Large screen/container components that mix orchestration, transformation logic, and presentation responsibility
  • Components or hooks carrying too many responsibilities in one file
  • Repeated or duplicated implementation patterns that should be extracted or standardized
  • Inconsistent state handling and data flow patterns that make behavior harder to reason about
  • Naming, file structure, and composition choices that reduce readability and maintainability
  • Low-value complexity, avoidable branching, and code paths that can be simplified without changing intended behavior

Example Areas To Review

  • features/faculty-analytics/components/scoped-analytics-dashboard-screen.tsx
  • features/questionnaires/components/builder/questionnaire-builder-shell.tsx
  • Route pages that duplicate orchestration or page-shell logic
  • Feature areas where domain logic, view logic, and rendering are mixed too tightly

Scope

  • Refactor frontend logic into clearer and more maintainable structures
  • Improve ownership boundaries between route files, feature hooks, and reusable UI components
  • Extract reusable logic where duplication or overload exists
  • Simplify complex component logic and reduce unnecessary coupling
  • Improve readability, naming, and file organization where needed
  • Preserve behavior while improving implementation quality

Out of Scope

  • No backend changes
  • No API contract changes
  • No UI-only styling or responsive cleanup as the main goal
  • No new product features
  • No intentional behavior changes unless a small corrective refactor is required

Acceptance Criteria

  • Targeted areas have clearer responsibility boundaries and improved maintainability
  • Overloaded components/hooks are split or simplified where practical
  • Repeated logic patterns are reduced through better abstractions or composition
  • Code in scope is easier to read, reason about, and extend safely
  • Existing user-visible behavior remains functionally equivalent unless a small corrective change is explicitly necessary
  • bun run lint and bun run typecheck pass after the refactor work

Notes

This ticket is for frontend logic, implementation quality, and code structure cleanup. It is not primarily a UI polish task.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions