refactor(private-zone): use canonical product name

This commit is contained in:
Codex
2026-07-23 10:53:41 +08:00
parent 4639acf232
commit 9ca56c2a04
103 changed files with 569 additions and 569 deletions
@@ -7,7 +7,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
const instances = vi.hoisted(() => ({
chat: 0,
payment: 0,
privateZoom: 0,
privateZone: 0,
}));
vi.mock("@/stores/chat/chat-context", async () => {
@@ -51,23 +51,23 @@ vi.mock("@/stores/payment/payment-context", async () => {
};
});
vi.mock("@/stores/private-zoom", async () => {
vi.mock("@/stores/private-zone", async () => {
const { createElement, useState } = await import("react");
return {
PrivateZoomProvider({
PrivateZoneProvider({
characterId,
children,
}: {
characterId: string;
children: ReactNode;
}) {
const [instanceId] = useState(() => ++instances.privateZoom);
const [instanceId] = useState(() => ++instances.privateZone);
return createElement(
"div",
{
"data-character-id": characterId,
"data-instance-id": instanceId,
"data-testid": "private-zoom-provider",
"data-testid": "private-zone-provider",
},
children,
);
@@ -85,7 +85,7 @@ vi.mock("@/stores/sync/payment-success-sync", () => ({
import { ChatRouteProviders } from "@/providers/chat-route-providers";
import { PaymentRouteProvider } from "@/providers/payment-route-provider";
import { PrivateZoomRouteProvider } from "@/providers/private-zoom-route-provider";
import { PrivateZoneRouteProvider } from "@/providers/private-zone-route-provider";
describe("character actor route providers", () => {
let container: HTMLDivElement;
@@ -94,7 +94,7 @@ describe("character actor route providers", () => {
beforeEach(() => {
instances.chat = 0;
instances.payment = 0;
instances.privateZoom = 0;
instances.privateZone = 0;
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean })
.IS_REACT_ACT_ENVIRONMENT = true;
container = document.createElement("div");
@@ -121,14 +121,14 @@ describe("character actor route providers", () => {
);
});
it("recreates the private-zoom actor when the character changes", () => {
renderPrivateZoom("elio");
const firstInstance = instanceId("private-zoom-provider");
it("recreates the private-zone actor when the character changes", () => {
renderPrivateZone("elio");
const firstInstance = instanceId("private-zone-provider");
renderPrivateZoom("maya-tan");
renderPrivateZone("maya-tan");
expect(instanceId("private-zoom-provider")).not.toBe(firstInstance);
expect(testNode("private-zoom-provider").dataset.characterId).toBe(
expect(instanceId("private-zone-provider")).not.toBe(firstInstance);
expect(testNode("private-zone-provider").dataset.characterId).toBe(
"maya-tan",
);
});
@@ -155,12 +155,12 @@ describe("character actor route providers", () => {
});
}
function renderPrivateZoom(characterId: string): void {
function renderPrivateZone(characterId: string): void {
act(() => {
root.render(
<PrivateZoomRouteProvider characterId={characterId}>
<span>private zoom</span>
</PrivateZoomRouteProvider>,
<PrivateZoneRouteProvider characterId={characterId}>
<span>private zone</span>
</PrivateZoneRouteProvider>,
);
});
}
@@ -0,0 +1,21 @@
"use client";
import type { ReactNode } from "react";
import { PrivateZoneProvider } from "@/stores/private-zone";
export interface PrivateZoneRouteProviderProps {
children: ReactNode;
characterId: string;
}
export function PrivateZoneRouteProvider({
children,
characterId,
}: PrivateZoneRouteProviderProps) {
return (
<PrivateZoneProvider key={characterId} characterId={characterId}>
{children}
</PrivateZoneProvider>
);
}
@@ -1,21 +0,0 @@
"use client";
import type { ReactNode } from "react";
import { PrivateZoomProvider } from "@/stores/private-zoom";
export interface PrivateZoomRouteProviderProps {
children: ReactNode;
characterId: string;
}
export function PrivateZoomRouteProvider({
children,
characterId,
}: PrivateZoomRouteProviderProps) {
return (
<PrivateZoomProvider key={characterId} characterId={characterId}>
{children}
</PrivateZoomProvider>
);
}
+1 -1
View File
@@ -4,7 +4,7 @@
* 根级 Client Providers 包装
*
* 这里只保留跨路由的 Character Catalog、Auth、User、消息预览和 viewport
* Provider。Chat、Payment、PrivateZoom 状态机由对应路由 layout 按需挂载。
* Provider。Chat、Payment、PrivateZone 状态机由对应路由 layout 按需挂载。
*/
import type { ReactNode } from "react";