Cars: arrange the garage, and choose what a car's page shows

Three things you can now set up rather than live with.

The garage takes a drag: cards reorder as you drag across them and the
arrangement saves on drop — or on dragend, since a card released in the
gap between cards never produces a drop and would otherwise revert on
the next load. It is a per-user list of car ids on the profile, so it
covers cars shared with you and never reorders anybody else's garage;
the API returns /api/cars in that order, so a client only sends the new
one back. Pointer-only: touch browsers don't fire the native drag
events, and this is not worth a dependency.

A car's page is now configurable from the gear in its header: which tabs
it shows, and which of the 14 Information rows. Both belong to the car,
so everyone it is shared with sees the same page — Fuel off on an EV
stays off for all of them — and setting them needs write access. Stored
as the hidden sets, so anything added in a later release is on by
default. PUT /api/cars/{id}/view is its own endpoint precisely so an
ordinary save of the car form, which sends every other field, can never
reveal something that was deliberately switched off. Information itself
can't be hidden: a page with no tabs left would be a dead end.

The connected-service cards fold away, remembered per device, so a
provider that reports eight sections can be trimmed to the two worth
watching. A failed section keeps a short badge in its collapsed header
and puts the provider's own message — a few hundred characters of JSON,
which used to stretch the page sideways — inside the body with
everything else.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
tajniak81
2026-08-17 20:29:23 +02:00
co-authored by Claude Opus 5
parent e373497958
commit 049da69c83
18 changed files with 840 additions and 46 deletions
+14
View File
@@ -66,6 +66,15 @@ type Car struct {
Provider string `json:"provider,omitempty"`
ProviderVehicleID string `json:"providerVehicleId,omitempty"`
// HiddenTabs and HiddenFields are what this car's page does not show: tabs
// (["fuel"] on an EV) and Information fields (["differentialOil"] on a car
// without one). Properties of the car, so everyone it is shared with sees the
// same page. The hidden sets, not the visible ones, so anything added in a
// later release is on by default. Set through the view endpoint only, never by
// an ordinary car edit, so saving the form cannot silently reveal them again.
HiddenTabs []string `json:"hiddenTabs"`
HiddenFields []string `json:"hiddenFields"`
// Owner is the user id that owns this car. Access is the requesting user's
// permission on it — "owner", "write", or "read" — computed by the API at
// read time and never persisted (omitempty; not part of the write payload).
@@ -340,6 +349,11 @@ type User struct {
Organization string `json:"organization"`
OrganizationName string `json:"organizationName,omitempty"`
// CarOrder is the garage arrangement: car ids in the order this user dragged
// them into. The car list is already returned in this order, so a client only
// needs it to send an updated arrangement back.
CarOrder []string `json:"carOrder"`
// Non-empty while an account-deletion request is pending its cooldown.
DeletionRequestedAt *time.Time `json:"deletionRequestedAt,omitempty"`