refactor(characters): drive shared UI from active character

This commit is contained in:
2026-07-17 19:33:59 +08:00
parent 8bb1e21886
commit 7bd5defa5e
42 changed files with 335 additions and 118 deletions
@@ -4,8 +4,6 @@ import type { Dispatch, ReactNode } from "react";
import { createActorContext, shallowEqual } from "@xstate/react";
import type { SnapshotFrom } from "xstate";
import { DEFAULT_CHARACTER_ID } from "@/data/constants/character";
import { privateRoomMachine } from "./private-room-machine";
import type {
PrivateRoomEvent,
@@ -34,12 +32,12 @@ const PrivateRoomActorContext = createActorContext(privateRoomMachine);
export interface PrivateRoomProviderProps {
children: ReactNode;
characterId?: string;
characterId: string;
}
export function PrivateRoomProvider({
children,
characterId = DEFAULT_CHARACTER_ID,
characterId,
}: PrivateRoomProviderProps) {
return (
<PrivateRoomActorContext.Provider options={{ input: { characterId } }}>