workflow-file-actions.fixture.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import React from "react";
  2. import { createRoot } from "react-dom/client";
  3. import { WorkflowArtifactSidePane } from "@/app-shell/WorkflowArtifactSidePane.js";
  4. import { PlatformProvider } from "@/hooks/usePlatform.js";
  5. import { ZCodeIntlProvider } from "@/i18n/IntlProvider.js";
  6. import { saveBrowserFile } from "../../../../../web/src/platform/saveBrowserFile.js";
  7. import type { IPlatformService } from "@zcode/shared";
  8. import "@/styles.css";
  9. const params = new URLSearchParams(location.search);
  10. const locale = params.get("locale") === "en-US" ? "en-US" : "zh-CN";
  11. document.documentElement.className =
  12. params.get("theme") === "dark" ? "theme-zai-dark dark" : "theme-zai-light";
  13. const platform = { canOpenLocalFiles: false, saveFile: saveBrowserFile } as IPlatformService;
  14. createRoot(document.getElementById("root")!).render(
  15. <ZCodeIntlProvider initialLocale={locale}>
  16. <PlatformProvider platform={platform}>
  17. <WorkflowArtifactSidePane
  18. tab={{
  19. id: "workflow-artifact:review",
  20. type: "workflow-artifact",
  21. workspaceKey: "/workspace",
  22. workspacePath: "/workspace",
  23. parentSessionId: "review-parent",
  24. runId: "review-run",
  25. artifactId: "review-file",
  26. }}
  27. onRevealFileInTree={(path) => {
  28. document.body.dataset.revealed = path;
  29. }}
  30. />
  31. </PlatformProvider>
  32. </ZCodeIntlProvider>,
  33. );