@@ -0,0 +1,37 @@
|
||||
// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
|
||||
// Actual module UI and HTTP data client; synthetic server responses only.
|
||||
|
||||
import { builtInCatalogues, createI18n, uiLabels } from "@conusai-kit/i18n"
|
||||
import { createDataClient, DataProvider } from "@conusai-kit/ui/data"
|
||||
import { UiLabelsProvider } from "@conusai-kit/ui/primitives"
|
||||
import { createRoot } from "react-dom/client"
|
||||
import { en } from "../../modules/knowledge/i18n/en.js"
|
||||
import { searchFormLabels } from "../../modules/knowledge/ui/labels.js"
|
||||
import { SearchForm } from "../../modules/knowledge/ui/search-form.js"
|
||||
import "@conusai-kit/ui/styles.css"
|
||||
import "@conusai-kit/ui/primitives.css"
|
||||
import "@conusai-kit/ui/patterns.css"
|
||||
|
||||
const scenario = new URLSearchParams(location.search).get("scenario") ?? "cited"
|
||||
const client = createDataClient({ headers: () => ({ "x-fixture-scenario": scenario }) })
|
||||
const t = (key: string, values: Record<string, string | number> = {}): string => {
|
||||
let value: unknown = en
|
||||
for (const part of key.split(".")) value = (value as Record<string, unknown>)[part]
|
||||
if (typeof value !== "string") throw new Error("missing fixture message")
|
||||
for (const [key, replacement] of Object.entries(values)) value = value.replace(`{${key}}`, String(replacement))
|
||||
return value
|
||||
}
|
||||
const root = document.getElementById("root")
|
||||
if (!root) throw new Error("missing fixture root")
|
||||
createRoot(root).render(
|
||||
<UiLabelsProvider labels={uiLabels(createI18n("en", builtInCatalogues))}>
|
||||
<DataProvider client={client}>
|
||||
<SearchForm
|
||||
slugs={{ org: "synthetic", workspace: "workspace", project: "project" }}
|
||||
collectionName="sources"
|
||||
labels={searchFormLabels(t)}
|
||||
locale="en"
|
||||
/>
|
||||
</DataProvider>
|
||||
</UiLabelsProvider>,
|
||||
)
|
||||
Reference in New Issue
Block a user