Loading files
05241c15dThis file is pinned to the selected release. Download the original to open it in your design tool.
"use client";
import { useState } from "react";
import {
MOCK_KEYS,
MOCK_STATES,
activeMockKey,
setMockKey,
useMockKey,
} from "@/lib/mockStates";
/**
* Dev-only UX picker. Renders only when `?mock` is in the URL, so it never ships to a real session.
* Lists every mockable home state and swaps between them in place (updates the `?mock=` param, no
* reload). Collapsible so it stays out of the way while eyeballing a given screen.
*/
export function MockSwitcher() {
const mockKey = useMockKey();
const [open, setOpen] = useState(true);
// absent param → mocking off → don't render at all
if (mockKey == null) return null;
const active = activeMockKey(mockKey);
return (
<div className="pointer-events-auto fixed right-3 top-1/2 z-50 flex max-h-[80vh] w-44 -translate-y-1/2 flex-col rounded-lg border border-cab-600/70 bg-cab-900/85 font-pixel backdrop-blur-md">
<button
onClick={() => setOpen((v) => !v)}
className="flex items-center justify-between border-b border-cab-600/60 px-3 py-2 text-[9px] text-neon-magenta neon-text-soft"
>
<span>MOCK UX</span>
<span className="text-cab-500">{open ? "▾" : "▸"}</span>
</button>
{open && (
<div className="flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-1.5">
{MOCK_KEYS.map((key) => {
const on = key === active;
return (
<button
key={key}
onClick={() => setMockKey(key)}
className={`rounded px-2 py-1.5 text-left text-[8px] leading-tight transition-colors ${
on
? "bg-neon-cyan/15 text-neon-cyan neon-text-soft"
: "text-cab-500 hover:bg-cab-700/60 hover:text-neon-cyan/80"
}`}
>
{MOCK_STATES[key].title}
</button>
);
})}
</div>
)}
</div>
);
}