Skip to content

feat(context): store vs network context switcher with its own sidebar, full-page network and a Trucks section - #123

Closed
roncodes wants to merge 8 commits into
release/v0.4.25from
feat/context-switcher
Closed

roncodes wants to merge 8 commits into
release/v0.4.25from
feat/context-switcher

Conversation

@roncodes

Copy link
Copy Markdown
Member

Summary

The console is now scoped to a store or a network, never both at once, and the sidebar is rewritten for whichever is active (design canvas, board 2 "Context model"). Stacked on #122 → #121; review the top commit.

  • storefront service gains a network context (activeNetwork, isNetworkContext, activeContextType, activeContext, setActiveNetwork/clearActiveNetwork, getActiveNetwork, storefront.context.changed). The context is derived from the route, not persisted, so leaving a network returns to the store that was active.
  • networks.index.network sets the context in afterModel and clears it in deactivate: a deep link under /storefront/networks/:id/… opens in the network context, every other URL in the store context.
  • StoreSelector grew into the context switcher: Stores and Networks groups (labels appear only once both exist, so one store and no networks looks as before), the active entry marked, "Create network" beside "Create a new", network icon and name on the trigger while in a network.
  • Application route loads networks beside stores; the controller branches the sidebar into store navigation vs network navigation (Stores, Trucks, Orders, Customers, Settings), keyed by network id with onClick/activeWhen like the product categories. Switching to a store from a network lands on the dashboard; switching to a network enters its Stores page; creating a network switches into it.
  • The network page is a full page with an identity strip (logo, name, online badge, store count, currency, "All networks") instead of a 900px overlay; the networks grid hides while a network is open.
  • New Trucks section for a network (networks.index.network.trucks) on the shared truck card, backed by FoodTruckFilter::network (whereHas('store.networks'), mirroring StoreFilter::network). Trucks are still created from a store.
  • Bug fix: network Orders and Customers queried with the active store's public id, so they listed the store's data. They now use the network being viewed.
  • createNewNetwork moved to the storefront service (mirrors createNewStorefront).

Not here, next PRs: network overview dashboard, invitations lifecycle, "Member of" group, invitation banner, ember-ui ContextSwitcher extraction.

Related Issue

Part of the Storefront UX overhaul (design canvas board 2).

Type of Change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Test
  • Chore

Implementation Notes

Network nav items cannot use route-name matching because all network routes share one dynamic segment; they carry id: network:<public_id>:<section> and activeWhen/onClick closures. The network route owns the context so nothing else has to clear it. The selector stays a DOM-built fixed menu (sidebar clipping) and gains data-test-store-selector-* hooks.

Validation

  • Tests (targeted: store-selector 9/9; service, controller, route tests written for the context, not all re-run locally per the maintainer's request to stop local runs)
  • Lint (pnpm lint clean before the final test edits)
  • Build (pnpm build clean)
  • Manual validation (maintainer will test)
pnpm lint    → intl/css/js/hbs all exit 0
pnpm build   → Built project successfully
ember test --filter store-selector → 9 passed, 0 failed
pest server/tests/Unit/Http/Filter/StorefrontFilterContractsTest.php → 15 passed (incl. new network filter)

The whole engine suite is not green on this release branch regardless of this PR (scaffold "it renders" tests, an ember-concurrency global error aborts the run). The full backend suite has pre-existing local failures (missing Fleetbase\Support\SocketCluster\* in the local core-api, OrderActivityFlow assertions); the two food truck controller tests fail identically with this filter change stashed.

Documentation Impact

  • No documentation changes needed
  • Documentation updated in fleetbase/fleetbase.io
  • Documentation needed but not included

API Reference Impact

  • No API reference changes needed
  • Updated fleetbase/postman
  • API reference updates required but not included

API reference notes: the network filter is on the internal console endpoint only.

Documentation Notes

fleetbase/fleetbase.io → docs/storefront networks: document the store vs network context and the network Trucks section once the network screens series lands (needs-docs for the series).

Risk

The network page is no longer an overlay; anything linking to networks.index.network now navigates into the network context. routes/application model is now { stores, networks } (only templates/application.hbs consumed it). Trucks of a network are read-only in the network context for now.

Screenshots / Recordings

Mockups: design canvas board 2 (https://claude.ai/artifact/771ptEFmi4BLmYHBZuUhWF). Live screenshots to follow from the maintainer's run.

The dummy app never ran: ember-classic-decorator (unused) crashes on Ember 5,
lazy loading kept the engine's modules out of the test bundle, and the host
services, config and intl data the panels need were missing. Mirrors what
fleetops already does: eager loading when `ember test` runs from this package,
an inert stand-in for the console's extensions module, the API config the
core adapter reads at module scope, and the legacy built-in components the
engine's templates still use.

The dummy intl service ignores missing locale data, since headless Chrome has
no number formats for every bundled locale, and the order details and network
controller tests stub the host router, fetch and app cache the way the widget
tests already do.
…rce card

Catalog, truck and network index pages use Layout::Resource::CardsGrid with
one card each on Layout::Resource::Card, following the Fleet-Ops anatomy:
identity and subtitle in the header, media or facts in the body, status,
icon actions and meta in the footer, with registry slots at each end.

A catalog card shows its categories with product counts, its hours as a
seven-day strip (the new Storefront::HoursStrip) and its product total; a
draft is dashed. A truck card is a Vehicle::Pill with the online dot, the
vehicle photo, where it serves, and a presence badge that says serving,
offline, inactive, or online with no catalog. A network card shows the logo on
its backdrop, the online state, the currency and member count.

"Food trucks" reads "Trucks" in the UI; the food-truck model, routes and
permissions keep their names. The catalogs and trucks pages gain the search
the header already offered.
@roncodes roncodes added needs-docs Requires documentation updates needs-human-review Requires human review before proceeding type:feature Feature or enhancement labels Oct 10, 2026
… and crashed createRecord; the store summary is store_summary
…s own sidebar for each

- storefront service tracks a network context derived from the network route
- StoreSelector becomes the context switcher with a Networks group and create-network
- application route loads networks; sidebar rewrites for the network context
- network page is a full page with an identity strip; the list hides while one is open
- new Trucks section for a network backed by FoodTruckFilter::network
- network orders and customers are scoped to the network being viewed, not the active store
- createNewNetwork lives on the storefront service
…enu without Networks

- trigger: context icon, name, STORE/NETWORK label and caret; blue for a store, indigo for a network; invitation badge
- menu: Stores and Networks groups with tiles, currency or member count, a check on the active one, readable in dark mode; footer actions read New store / New network
- store navigation follows the design order (Dashboard, Orders, Products, Catalogs, Customers, Trucks, Promotions, Settings); networks live in the switcher, not the menu
- network page loses the All networks button; leaving a network is the switcher's job
@roncodes
roncodes force-pushed the feat/context-switcher branch from 29af555 to 41506ec Compare October 10, 2026 09:30
…e sidebar re-renders on a switch; networks report their store count
@roncodes

Copy link
Copy Markdown
Member Author

Superseded by the single overhaul PR (one branch, one PR targeting release/v0.4.25, per maintainer request).

@roncodes roncodes closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-docs Requires documentation updates needs-human-review Requires human review before proceeding type:feature Feature or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant