Skip to content

refactor(app): split panels/mod.rs (4.6k), extract the giant data-mapping matches, dedupe the property-panel family (ADR-0001 D2+D6) #165

Description

@hkngln

The panels subsystem concentrates three distinct problems (measured):

  • crates/signex-app/src/panels/mod.rs4,583 lines, 32 fns, of which two are pure data tables trapped in code: paper_dimensions (~935 lines) and label (~753 lines) are giant value-mapping match statements; plus a ~358-line Display impl and 13 view_* panel functions.
  • Parallel property-panel family with copy-paste scaffolding: panels/element_properties.rs (2,020), panels/properties_parameters.rs (1,912), panels/footprint_editor_properties/mod.rs (1,112, + pad_form 982 + subforms 979), panels/symbol_editor_properties.rs (821).
  • ADR-0001 D6's Tier-2 (library/shared/widgets/) is still empty while these panels re-implement the same row/label/field scaffolding privately.

Recipe

  1. Data out of code. paper_dimensions and the label mega-match become const/static lookup tables (arrays of structs, or a small phf-style match-free helper) in a dedicated panels/data.rs — semantics identical, pinned by a test that iterates every variant and compares old vs new output (write the test against the CURRENT fn first, then swap).
  2. One file per panel. Each view_* panel fn in panels/mod.rs moves to its own module (panels/components.rs, panels/sch_library.rs, …); panels/mod.rs becomes the index + shared kinds.
  3. Tier-2 widget extraction (D6, rule of three satisfied). The row/label/field/section scaffolding repeated across the four property panels is extracted once into shared stateless view helpers (panels/widgets.rs or library/shared/widgets/ per D6's tier decision) — parameters in, Element out, zero state. Only extract what ≥2 panels actually share today; no speculative API.
  4. footprint_editor_properties/ internal split stays within its folder (pad_form/subforms are already close to the cap — trim toward ≤800 with the shared widgets from step 3).

Ordering

Independent of #161#164; can start immediately. Coordinate with #164 only on shared small helpers.

Acceptance criteria

  • No file under panels/ exceeds ~800 lines; paper_dimensions/label data covered by an exhaustive equivalence test.
  • Property panels render identically (regression + manual smoke); shared scaffolding exists in exactly one place.
  • No stateful widgets introduced (ADR-0001 A1 — reusable pieces are stateless view fns; state stays in the slice Model).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: appsignex-app shell — menus, dock, panels, chrome, tabstier: p1Required for v2.0 — professional users expect ittype: refactorInternal restructuring, no behavior changeui/uxInteraction, visual design, or UX-parity concern — cuts across areas

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions