Skip to content

Antd Upgrade #307

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

Merged
merged 14 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refactor: added global instances for message, modal and notification
  • Loading branch information
raheeliftikhar5 committed Jul 24, 2023
commit e4996df2f2d055c45814447d427fd22ecbeffdde
18 changes: 18 additions & 0 deletions client/packages/lowcoder-design/src/components/GlobalInstances.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { App } from 'antd';
import type { MessageInstance } from 'antd/es/message/interface';
import type { ModalStaticFunctions } from 'antd/es/modal/confirm';
import type { NotificationInstance } from 'antd/es/notification/interface';

let messageInstance: MessageInstance;
let notificationInstance: NotificationInstance;
let modalInstance: Omit<ModalStaticFunctions, 'warn'>;

export default () => {
const staticFunction = App.useApp();
messageInstance = staticFunction.message;
modalInstance = staticFunction.modal;
notificationInstance = staticFunction.notification;
return null;
};

export { messageInstance, notificationInstance, modalInstance };
1 change: 1 addition & 0 deletions client/packages/lowcoder-design/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from "./components/CustomModal";
export * from "./components/Drawer";
export * from "./components/Dropdown";
export * from "./components/ExternalLink";
export * from "./components/GlobalInstances";
export * from "./components/Input";
export * from "./components/Label";
export * from "./components/Menu";
Expand Down
17 changes: 13 additions & 4 deletions client/packages/lowcoder/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ConfigProvider } from "antd";
import { App, ConfigProvider } from "antd";
import {
ALL_APPLICATIONS_URL,
APP_EDITOR_URL,
Expand Down Expand Up @@ -46,6 +46,7 @@ import { isFetchUserFinished } from "redux/selectors/usersSelectors";
import { SystemWarning } from "./components/SystemWarning";
import { getBrandingConfig, getSystemConfigFetching } from "./redux/selectors/configSelectors";
import { buildMaterialPreviewURL } from "./util/materialUtils";
import GlobalInstances from 'components/GlobalInstances';

const LazyUserAuthComp = React.lazy(() => import("pages/userAuth"));
const LazyInviteLanding = React.lazy(() => import("pages/common/inviteLanding"));
Expand All @@ -54,9 +55,17 @@ const LazyComponentPlayground = React.lazy(() => import("pages/ComponentPlaygrou
const LazyDebugComp = React.lazy(() => import("./debug"));
const LazyDebugNewComp = React.lazy(() => import("./debugNew"));

const Wrapper = (props: { children: React.ReactNode }) => {
return <ConfigProvider locale={getAntdLocale(language)}>{props.children}</ConfigProvider>;
};
const Wrapper = (props: { children: React.ReactNode }) => (
<ConfigProvider
theme={{ hashed: false }}
locale={getAntdLocale(language)}
>
<App>
<GlobalInstances />
{props.children}
</App>
</ConfigProvider>
);

type AppIndexProps = {
isFetchUserFinished: boolean;
Expand Down