Skip to content

Refactor BaseProductApp view rendering with component registry #39

@vertefra

Description

@vertefra

Problem

BaseProductApp.tsx has a long if-else chain (lines 78-144) to determine which view to render. This is:

  • Hard to read and maintain
  • Verbose and repetitive
  • Makes adding new views tedious

Current Code

Multiple nested if statements checking currentView and returning components.

Solution

Use a view registry pattern with a configuration object that maps view types to components and their props.

Benefits

  • More maintainable and readable
  • Easier to add new views
  • Clear separation of view config and logic
  • Reduces nesting and complexity

Priority

Medium

Metadata

Metadata

Assignees

No one assigned

    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