Skip to content

Refactor and Organize Knitlab Codebase #2

@areumjo

Description

@areumjo

1. Decouple State from App.tsx

Issue: App.tsx acts as a "God Component".
Solution: Introduce Context APIs for keyPalette and sheets. Refactor consuming components accordingly.

2. Extract Logic into Custom Hooks

Issue: Large components (e.g., KnitCanvas.tsx, KeyEditorModal.tsx) are too complex.
Solution: Move interaction, drawing, and editing logic into dedicated hooks (useCanvasInteraction, useCanvasDrawing, useLineDrawer).

3. Organize Project Structure

Issue: Flat structure with mixed responsibilities.
Solution: Group components by feature and move utilities (e.g., grid helpers) to services or utils.

Summary: These changes will make the codebase cleaner, more maintainable, and ready for future growth. Let us know for review or PR collaboration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions