Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): 兼容低版本 chrome 浏览器,兼容 360 极速浏览器 #1333

Merged
merged 4 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/tiny-ears-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@scow/portal-web": patch
"@scow/mis-web": patch
"@scow/ai": patch
---

兼容低版本 chrome 浏览器,兼容 360 极速浏览器
59 changes: 31 additions & 28 deletions apps/ai/src/app/clientLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

"use client";

import { legacyLogicalPropertiesTransformer, StyleProvider } from "@ant-design/cssinjs";
import { GlobalStyle } from "@scow/lib-web/build/layouts/globalStyle";
import { usePathname } from "next/navigation";
import { ErrorBoundary } from "src/components/ErrorBoundary";
Expand Down Expand Up @@ -48,34 +49,36 @@ export function ClientLayout(props: {
?? primaryColor?.defaultColor ?? uiConfig.defaultPrimaryColor;

return (
<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>
)
}
<StyleProvider hashPriority="high" transformers={[legacyLogicalPropertiesTransformer]}>
<StyledComponentsRegistry>
<AntdStyleRegistry>
<body>
{
useConfig.isLoading ?
<Loading />
: (
<DarkModeProvider initial={props.initialDark}>
<AntdConfigProvider color={color}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外AI的AntdConfigProvider目前是重新抄的,看看能不能用libs/web里公用的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

由于ai需要使用"use client";等原因,暂时不好改成使用libs/web中公用的代码

<GlobalStyle />
<TopProgressBar />
<ErrorBoundary Component={RootErrorContent} pathname={pathname ?? ""}>
<UiConfigContext.Provider
value={{
hostname,
uiConfig,
}}
>
{props.children}
</UiConfigContext.Provider>
</ErrorBoundary>
</AntdConfigProvider>
</DarkModeProvider>
)
}

</body>
</AntdStyleRegistry>
</StyledComponentsRegistry>
</body>
</AntdStyleRegistry>
</StyledComponentsRegistry>
</StyleProvider>
);
}
33 changes: 18 additions & 15 deletions apps/mis-web/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import "nprogress/nprogress.css";
import "antd/dist/reset.css";

import { legacyLogicalPropertiesTransformer, StyleProvider } from "@ant-design/cssinjs";
import { failEvent } from "@ddadaal/next-typed-api-routes-runtime/lib/client";
import { ClusterConfigSchema } from "@scow/config/build/cluster";
import { UiExtensionStore } from "@scow/lib-web/build/extensions/UiExtensionStore";
Expand Down Expand Up @@ -186,21 +187,23 @@ function MyApp({ Component, pageProps, extra }: Props) {
}}
>
<StoreProvider stores={[userStore, clusterInfoStore, uiExtensionStore]}>
<DarkModeProvider initial={extra.darkModeCookieValue}>
<AntdConfigProvider color={primaryColor} locale={extra.initialLanguage}>
<FloatButtons languageId={extra.initialLanguage} />
<GlobalStyle />
<FailEventHandler />
<TopProgressBar />
<BaseLayout
footerText={footerText}
versionTag={publicConfig.VERSION_TAG}
initialLanguage={extra.initialLanguage}
>
<Component {...pageProps} />
</BaseLayout>
</AntdConfigProvider>
</DarkModeProvider>
<StyleProvider hashPriority="high" transformers={[legacyLogicalPropertiesTransformer]}>
<DarkModeProvider initial={extra.darkModeCookieValue}>
<AntdConfigProvider color={primaryColor} locale={extra.initialLanguage}>
tongchong marked this conversation as resolved.
Show resolved Hide resolved
<FloatButtons languageId={extra.initialLanguage} />
<GlobalStyle />
<FailEventHandler />
<TopProgressBar />
<BaseLayout
footerText={footerText}
versionTag={publicConfig.VERSION_TAG}
initialLanguage={extra.initialLanguage}
>
<Component {...pageProps} />
</BaseLayout>
</AntdConfigProvider>
</DarkModeProvider>
</StyleProvider>
</StoreProvider>
</Provider>
</>
Expand Down
33 changes: 18 additions & 15 deletions apps/portal-web/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import "nprogress/nprogress.css";
import "antd/dist/reset.css";

import { legacyLogicalPropertiesTransformer, StyleProvider } from "@ant-design/cssinjs";
import { failEvent } from "@ddadaal/next-typed-api-routes-runtime/lib/client";
import { ClusterConfigSchema } from "@scow/config/build/cluster";
import { UiExtensionStore } from "@scow/lib-web/build/extensions/UiExtensionStore";
Expand Down Expand Up @@ -207,21 +208,23 @@ function MyApp({ Component, pageProps, extra }: Props) {
<StoreProvider
stores={[userStore, clusterInfoStore, loginNodeStore, uiExtensionStore]}
>
<DarkModeProvider initial={extra.darkModeCookieValue}>
<AntdConfigProvider color={primaryColor} locale={ extra.initialLanguage}>
<FloatButtons languageId={ extra.initialLanguage } />
<GlobalStyle />
<FailEventHandler />
<TopProgressBar />
<BaseLayout
footerText={footerText}
versionTag={publicConfig.VERSION_TAG}
initialLanguage={extra.initialLanguage}
>
<Component {...pageProps} />
</BaseLayout>
</AntdConfigProvider>
</DarkModeProvider>
<StyleProvider hashPriority="high" transformers={[legacyLogicalPropertiesTransformer]}>
<DarkModeProvider initial={extra.darkModeCookieValue}>
<AntdConfigProvider color={primaryColor} locale={ extra.initialLanguage}>
<FloatButtons languageId={ extra.initialLanguage } />
<GlobalStyle />
<FailEventHandler />
<TopProgressBar />
<BaseLayout
footerText={footerText}
versionTag={publicConfig.VERSION_TAG}
initialLanguage={extra.initialLanguage}
>
<Component {...pageProps} />
</BaseLayout>
</AntdConfigProvider>
</DarkModeProvider>
</StyleProvider>
</StoreProvider>
</Provider>
</>
Expand Down
Loading