Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions apps/web/src/components/SidebarStageBackdrop.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,16 @@ describe("named artwork defaults", () => {
).toEqual(DEV_BACKDROP);
});
});

describe("the header renders what the picker chose", () => {
it("resolves a named scene with no help from the build channel", () => {
// Regression: the sidebar header called the stage-label resolver directly,
// so a picked scene never reached the renderer on a release build.
expect(resolveSidebarArtwork({ selection: "night", stageLabel: "", custom: [] })).toEqual(
NIGHTLY_BACKDROP,
);
expect(resolveSidebarArtwork({ selection: "day", stageLabel: "", custom: [] })).toEqual(
DEV_BACKDROP,
);
});
});
8 changes: 5 additions & 3 deletions apps/web/src/components/sidebar/SidebarChrome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import { cn } from "../../lib/utils";
import { useEnvironments } from "../../state/environments";
import {
resolveEnvironmentIdentificationPillLabel,
resolveSidebarStageBackdropVariant,
resolveSidebarStageFocusRingOffsetClass,
SidebarStageBackdrop,
useEnvironmentStageLabel,
useSidebarStageBackdropVariant,
} from "../SidebarStageBackdrop";
import { Badge } from "../ui/badge";
import {
Expand All @@ -43,8 +43,10 @@ export const SidebarChromeHeader = memo(function SidebarChromeHeader({
}) {
const stageLabel = useEnvironmentStageLabel();
const environmentIdentificationMode = useEnvironmentIdentificationMode();
const backdropVariant = resolveSidebarStageBackdropVariant(
stageLabel,
// The hook, not the stage-label resolver: this is the header that actually
// draws the artwork, and reading the build channel here meant a chosen scene
// never appeared on a release build.
const backdropVariant = useSidebarStageBackdropVariant(
environmentIdentificationMode === "artwork",
);
const pillLabel =
Expand Down
Loading