Something went wrong. Try again.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950import { create } from "zustand";
export interface XrpcLogEntry { id: string; timestamp: number; method: string; endpoint: string; status: "pending" | "success" | "error"; requestSummary?: string; responseSummary?: string; durationMs?: number;}
interface DevModeState { enabled: boolean; xrpcLog: XrpcLogEntry[]; toggle: () => void; logCall: (entry: Omit<XrpcLogEntry, "id" | "timestamp">) => string; updateCall: (id: string, update: Partial<XrpcLogEntry>) => void; clearLog: () => void;}
let nextId = 0;
export const useDevModeStore = create<DevModeState>((set, get) => ({ enabled: false, xrpcLog: [],
toggle: () => set((s) => ({ enabled: !s.enabled })),
logCall: (entry) => { const id = `xrpc-${++nextId}`; set((s) => ({ xrpcLog: [{ ...entry, id, timestamp: Date.now() }, ...s.xrpcLog].slice( 0, 50, ), })); return id; },
updateCall: (id, update) => { set((s) => ({ xrpcLog: s.xrpcLog.map((e) => (e.id === id ? { ...e, ...update } : e)), })); },
clearLog: () => set({ xrpcLog: [] }),}));