Skip to content

Front End Patterns

Wavemap’s front end should keep generic UI behavior, page/domain orchestration, state ownership, transport details, and localized copy in separate layers.

Use this section when adding or changing reusable components, layout composition components, queryable pages, page workflow hooks, typeahead/search surfaces, saved views, draft state, or component label maps.

For the broader feature path, start with Feature Slice Workflow. For shared route, DTO, query, saved-view, role, and permission contracts, use API Contracts.

PageUse It For
ComponentsReusable components, layout composition components, page/domain wrappers, workflow hooks, labels, and component/workflow testing posture.
StateState ownership, queryable pages, URL state, saved views, workflow draft state, and media draft boundaries.

Frontend code should separate four general work areas:

LayerOwnsAvoids
Reusable componentsInteraction mechanics, accessibility behavior, layout options, generic visible chrome, and documented props.Wavemap route constants, API calls, domain DTO mapping, page-specific translation keys.
Layout composition componentsPage section structure, responsive arrangement, repeated page chrome, and visual grouping of prepared data.Fetching data, owning URL state, making permission decisions, or becoming a generic primitive.
Page/domain wrappersProduct context, API hook usage, DTO-to-view mapping, localized labels, route state, and user-facing workflow.Reimplementing generic popover, sheet, table, upload, carousel, pagination, or input logic.
Workflow hooksMulti-step sequencing, diffing, retry posture, side effects, and UI-facing pending/error/warning state.Rendering UI directly or hiding reusable endpoint hooks behind a giant page component.

The goal is to make reusable components easy to use correctly while keeping page-specific behavior close to the route or domain that owns it.

For example, an artists collection page should let the page frame own URL query state, endpoint capabilities, selected view mode, and saved-view persistence. Layout composition components can own the page sections that arrange filters, results, tabs, sidebars, headers, and empty-state placement. Table, Pagination, gallery cards, search inputs, and popovers should receive already-normalized data, handlers, labels, and formatters. If the flow later crosses into backend route shape or saved-view schema, graduate that part into API Contracts instead of rediscovering it inside the component tree.

Workflow hooks live with Components because they keep page and layout components from becoming request choreography surfaces. They also coordinate a distinct class of application state, so State calls out how workflow draft state fits beside URL, saved-view, query-cache, and media draft state.

Keep these elsewhere: