Skip to content

Commit

Permalink
Revert "feat: ai加上国际化的Provider" (#1387)
Browse files Browse the repository at this point in the history
Reverts #1385
  • Loading branch information
OYX-1 authored Aug 6, 2024
1 parent 7ee40a1 commit 1492188
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 51 deletions.
5 changes: 0 additions & 5 deletions .changeset/strange-lemons-notice.md

This file was deleted.

76 changes: 30 additions & 46 deletions apps/ai/src/app/clientLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import { usePathname } from "next/navigation";
import { ErrorBoundary } from "src/components/ErrorBoundary";
import { Loading } from "src/components/Loading";
import { TopProgressBar } from "src/components/TopProgressBar";
import { Provider } from "src/i18n";
import en from "src/i18n/en";
import zh_cn from "src/i18n/zh_cn";
import { AntdConfigProvider } from "src/layouts/AntdConfigProvider";
import { DarkModeCookie, DarkModeProvider } from "src/layouts/darkMode";
import { RootErrorContent } from "src/layouts/error/RootErrorContent";
Expand All @@ -31,11 +28,6 @@ import { trpc } from "src/utils/trpc";

import { UiConfigContext } from "./uiContext";

const languagesMap = {
"zh_cn": zh_cn,
"en": en,
};

export function ClientLayout(props: {
children: React.ReactNode,
initialDark?: DarkModeCookie,
Expand All @@ -57,44 +49,36 @@ export function ClientLayout(props: {
?? primaryColor?.defaultColor ?? uiConfig.defaultPrimaryColor;

return (
<Provider initialLanguage={{
// ai还未开发国际化,先直接写zh_cn
id: "zh_cn",
definitions: languagesMap.zh_cn,
}}
>
<StyleProvider hashPriority="high" transformers={[legacyLogicalPropertiesTransformer]}>
<StyledComponentsRegistry>
<AntdStyleRegistry>
<body>
{
useConfig.isLoading ?
<Loading />
: (
<DarkModeProvider initial={props.initialDark}>
<AntdConfigProvider color={color}>
<GlobalStyle />
<TopProgressBar />
<ErrorBoundary Component={RootErrorContent} pathname={pathname ?? ""}>
<UiConfigContext.Provider
value={{
hostname,
uiConfig,
}}
>
{props.children}
</UiConfigContext.Provider>
</ErrorBoundary>
</AntdConfigProvider>
</DarkModeProvider>
)
}

</body>
</AntdStyleRegistry>
</StyledComponentsRegistry>
</StyleProvider>
</Provider>
<StyleProvider hashPriority="high" transformers={[legacyLogicalPropertiesTransformer]}>
<StyledComponentsRegistry>
<AntdStyleRegistry>
<body>
{
useConfig.isLoading ?
<Loading />
: (
<DarkModeProvider initial={props.initialDark}>
<AntdConfigProvider color={color}>
<GlobalStyle />
<TopProgressBar />
<ErrorBoundary Component={RootErrorContent} pathname={pathname ?? ""}>
<UiConfigContext.Provider
value={{
hostname,
uiConfig,
}}
>
{props.children}
</UiConfigContext.Provider>
</ErrorBoundary>
</AntdConfigProvider>
</DarkModeProvider>
)
}

</body>
</AntdStyleRegistry>
</StyledComponentsRegistry>
</StyleProvider>
);
}

0 comments on commit 1492188

Please sign in to comment.