update the api

This commit is contained in:
2026-09-10 19:25:07 +05:30
parent bfe4d3d2f2
commit d2e090214a
8 changed files with 65 additions and 70 deletions

View File

@@ -7,33 +7,44 @@ import {Icon} from '@astryxdesign/core/Icon';
import {ICONS} from '@/shared/utils/icons';
/**
* "This needs a backend resource that does not exist yet."
* "This section has nothing to show yet, and here is why."
*
* ── Why this exists instead of fixture data ──────────────────────────────
* Several screens in this console were built against a loyalty domain — LYT
* balances, reward catalogues, engagement activities, product inventory — that
* the Loyaly platform does not expose. The choice was to keep inventing
* numbers or to say so. Invented numbers are worse than a blank panel: a
* merchant cannot tell them from real ones, and the first time they act on one
* the whole product loses its credibility.
* Several screens were built against a domain the platform does not record.
* The choice was to keep inventing numbers or to say so. Invented numbers are
* worse than a blank panel: a merchant cannot tell them from real ones, and
* the first time they act on one the whole product loses its credibility.
*
* So the screen stays, its layout stays, and the panel states plainly what it
* is waiting for. When the endpoint ships, one hook replaces one component.
* ── Why there is no `endpoints` prop any more ────────────────────────────
* There was. Every panel printed "Required backend resources" and then
* `GET /api/staff — shop-floor roster, distinct from console accounts`, in a
* monospace font, on a screen a shop owner opens to run their business. That
* is an engineering backlog rendered as product copy, and it breaks the same
* rule the merchant-app spec sets for the API itself (§35): expose business
* operations, not implementation details. A merchant cannot act on a route
* name — being shown one only says the product is unfinished.
*
* Gating it on `NODE_ENV` was tried and is NOT sufficient, which is worth
* recording because it looks like it should be: the arrays were passed as
* props from each page, so the literals were still constructed and still
* shipped in the production bundle — verified by grepping `.next/static` after
* a clean build. Not rendering is not the same as not shipping. The prop is
* gone instead, and what each section needs is recorded in the page's own
* doc comment, where the people who can act on it actually work.
*
* This is NOT an error state. The platform's own vocabulary has a status for
* exactly this — 501, "the feature is off for this deployment, not an error" —
* and the treatment is deliberately calm: secondary text, no red, no alarm.
*
* `description` is merchant copy. Write it as a sentence a shop owner would
* accept: what is missing, why, and what would change it — never a route.
*/
export function FeatureUnavailable({
title,
description,
endpoints,
}: {
title: string;
description: string;
/** The API resources this section needs. Naming them turns a dead end into
* a work item somebody can pick up. */
endpoints?: string[];
}) {
return (
<Card>
@@ -46,19 +57,6 @@ export function FeatureUnavailable({
<Text size="sm" color="secondary">
{description}
</Text>
{endpoints?.length ? (
<VStack gap={1}>
<Text size="xsm" color="secondary" weight="medium">
Required backend resources
</Text>
{endpoints.map((e) => (
<Text key={e} size="xsm" color="disabled" className="font-mono">
{e}
</Text>
))}
</VStack>
) : null}
</VStack>
</Card>
);