Sangeetha-Grantha

Metadata Value
Status Active
Version 1.1.0
Last Updated 2026-09-10
Author Sangeetha Grantha Team
Document Type Evidence record

KrithiEditor.tsx Refactoring Checklist


[!NOTE] Historical evidence: results, counts, commands, and observations below belong to the original work described here. The editorial update date is not a new test or corpus verification. For present behavior, use current quality checks.

Related Review: krithi-editor-code-review.md Target File: modules/frontend/sangita-admin-web/src/pages/KrithiEditor.tsx


Priority 1: Critical (Foundation)

These items block other improvements and should be done first.

1.1 Extract Tab Components

1.2 Define TypeScript Interfaces

1.3 Implement useReducer for Form State

1.4 Extract Business Logic


Priority 2: High (Stability & Robustness)

2.1 Create Custom Data Fetching Hooks

2.2 Implement Error Boundary

2.3 Standardize Error Handling

2.4 Performance Optimizations


Priority 3: Medium (Quality & Maintainability)

3.1 Accessibility Improvements

3.2 Create Reusable Form Components

3.3 Add Unit Tests

3.4 Implement Request Cancellation


Priority 4: Nice-to-Have (Polish)

4.1 Consider Form Library Integration

4.2 Implement Optimistic Updates

4.3 Add Storybook Documentation

4.4 Code Style Cleanup


File Structure After Refactoring

src/
├── pages/
│   └── KrithiEditor.tsx              # ~200 lines (orchestration only)
├── components/
│   ├── form/
│   │   ├── FormInput.tsx
│   │   ├── FormSelect.tsx
│   │   ├── FormTextarea.tsx
│   │   ├── FormCheckbox.tsx
│   │   ├── FormField.tsx
│   │   └── index.ts
│   ├── krithi-editor/
│   │   ├── MetadataTab.tsx
│   │   ├── StructureTab.tsx
│   │   ├── LyricsTab.tsx
│   │   ├── TagsTab.tsx
│   │   ├── AuditTab.tsx
│   │   ├── CanonicalFieldModal.tsx
│   │   └── index.ts
│   └── ErrorBoundary.tsx
├── hooks/
│   ├── useKrithiEditorReducer.ts
│   ├── useKrithiData.ts
│   ├── useReferenceData.ts
│   ├── useKrithiSections.ts
│   ├── useKrithiLyricVariants.ts
│   ├── useKrithiTags.ts
│   └── useKrithiAuditLogs.ts
├── utils/
│   ├── krithi-mapper.ts
│   ├── krithi-payload-builder.ts
│   ├── section-id-mapper.ts
│   └── error-handler.ts
├── types/
│   └── krithi-editor.types.ts
└── __tests__/
    ├── krithi-mapper.test.ts
    ├── krithi-payload-builder.test.ts
    └── useKrithiEditorReducer.test.ts

Progress Tracking

Priority Total Items Completed Percentage
P1 Critical 47 45 96%
P2 High 30 14 47%
P3 Medium 28 6 21%
P4 Nice-to-have 16 0 0%
Total 121 65 54%

Definition of Done

For each checklist item:

  1. Code is written and compiles without errors
  2. No TypeScript any types (where applicable)
  3. Unit tests pass (where applicable)
  4. Component renders correctly in browser
  5. No console errors or warnings
  6. Code reviewed (self or peer)

Notes


Section index · Documentation home · Feature status