@refinedev/antd 5.3.8 → 5.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinedev/antd",
3
- "version": "5.3.8",
3
+ "version": "5.3.10",
4
4
  "description": "refine is a React-based framework for building internal tools, rapidly. It ships with Ant Design System, an enterprise-level UI toolkit.",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@refinedev/cli": "^2.1.0",
27
- "@refinedev/ui-tests": "^1.3.0",
28
- "@refinedev/core": "^4.5.4",
27
+ "@refinedev/ui-tests": "^1.3.2",
28
+ "@refinedev/core": "^4.5.6",
29
29
  "@esbuild-plugins/node-resolve": "^0.1.4",
30
30
  "@testing-library/jest-dom": "^5.16.4",
31
31
  "@testing-library/react": "^13.1.1",
@@ -1,87 +1,10 @@
1
- import * as React from "react";
2
- import { Row, Col, Typography, Space, Button } from "antd";
3
- import { ReadOutlined, FolderOutlined, TeamOutlined } from "@ant-design/icons";
4
-
5
- const styles: { [key: string]: React.CSSProperties } = {
6
- root: {
7
- height: "100vh",
8
- backgroundImage:
9
- "url('https://refine.ams3.cdn.digitaloceanspaces.com/login-background/background.png')",
10
- backgroundSize: "cover",
11
- backgroundColor: "#331049",
12
- },
13
- title: {
14
- color: "white",
15
- fontWeight: 800,
16
- fontSize: "64px",
17
- marginBottom: "8px",
18
- },
19
- p1: {
20
- color: "white",
21
- marginBottom: 0,
22
- fontSize: "20px",
23
- fontWeight: "bold",
24
- },
25
- p2: {
26
- color: "white",
27
- fontSize: "20px",
28
- },
29
- code: {
30
- backgroundColor: "white",
31
- color: "#331049",
32
- },
33
- };
34
-
35
- const { Title } = Typography;
1
+ import React from "react";
2
+ import { WelcomePage as WelcomePageFromCore } from "@refinedev/core";
36
3
 
37
4
  /**
38
5
  * It is a page that welcomes you after the configuration is completed.
6
+ * @deprecated `WelcomePage` is deprecated. Use `WelcomePage` from `@refinedev/core` instead.
39
7
  */
40
8
  export const WelcomePage: React.FC = () => {
41
- return (
42
- <Row align="middle" justify="center" style={styles.root}>
43
- <Col style={{ textAlign: "center" }}>
44
- <img
45
- style={{ marginBottom: "48px" }}
46
- src="https://refine.ams3.cdn.digitaloceanspaces.com/logo/refine.svg"
47
- alt="Refine Logo"
48
- />
49
- <Title style={styles.title}>Welcome on board</Title>
50
- <p style={styles.p1}>Your configuration is completed.</p>
51
- <Space
52
- size="large"
53
- wrap
54
- style={{ marginTop: "70px", justifyContent: "center" }}
55
- >
56
- <a
57
- href="https://refine.dev"
58
- target="_blank"
59
- rel="noreferrer"
60
- >
61
- <Button size="large" icon={<ReadOutlined />}>
62
- Documentation
63
- </Button>
64
- </a>
65
- <a
66
- href="https://refine.dev/examples"
67
- target="_blank"
68
- rel="noreferrer"
69
- >
70
- <Button size="large" icon={<FolderOutlined />}>
71
- Examples
72
- </Button>
73
- </a>
74
- <a
75
- href="https://discord.gg/refine"
76
- target="_blank"
77
- rel="noreferrer"
78
- >
79
- <Button size="large" icon={<TeamOutlined />}>
80
- Community
81
- </Button>
82
- </a>
83
- </Space>
84
- </Col>
85
- </Row>
86
- );
9
+ return <WelcomePageFromCore />;
87
10
  };
@@ -22,6 +22,7 @@ import {
22
22
  useRouterType,
23
23
  useActiveAuthProvider,
24
24
  pickNotDeprecated,
25
+ useWarnAboutChange,
25
26
  } from "@refinedev/core";
26
27
 
27
28
  import { drawerButtonStyles } from "./styles";
@@ -43,6 +44,7 @@ export const ThemedSider: React.FC<RefineThemedLayoutSiderProps> = ({
43
44
  const isExistAuthentication = useIsExistAuthentication();
44
45
  const routerType = useRouterType();
45
46
  const NewLink = useLink();
47
+ const { warnWhen, setWarnWhen } = useWarnAboutChange();
46
48
  const { Link: LegacyLink } = useRouterContext();
47
49
  const Link = routerType === "legacy" ? LegacyLink : NewLink;
48
50
  const TitleFromContext = useTitle();
@@ -123,10 +125,28 @@ export const ThemedSider: React.FC<RefineThemedLayoutSiderProps> = ({
123
125
  });
124
126
  };
125
127
 
128
+ const handleLogout = () => {
129
+ if (warnWhen) {
130
+ const confirm = window.confirm(
131
+ translate(
132
+ "warnWhenUnsavedChanges",
133
+ "Are you sure you want to leave? You have unsaved changes.",
134
+ ),
135
+ );
136
+
137
+ if (confirm) {
138
+ setWarnWhen(false);
139
+ mutateLogout();
140
+ }
141
+ } else {
142
+ mutateLogout();
143
+ }
144
+ };
145
+
126
146
  const logout = isExistAuthentication && (
127
147
  <Menu.Item
128
148
  key="logout"
129
- onClick={() => mutateLogout()}
149
+ onClick={() => handleLogout()}
130
150
  icon={<LogoutOutlined />}
131
151
  >
132
152
  {translate("buttons.logout", "Logout")}