@canmingir/link 1.2.24 → 1.2.26
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 +1 -1
- package/src/layouts/auth/modern.jsx +2 -2
- package/src/lib/Flow/core/FlowViewport.jsx +18 -8
- package/src/pages/LoginPage.jsx +3 -12
- package/src/widgets/Login/CognitoLogin.jsx +2 -2
- package/src/widgets/Login/DemoLogin.jsx +1 -1
- package/src/widgets/LoginForm/LoginForm.jsx +8 -3
package/package.json
CHANGED
|
@@ -28,7 +28,7 @@ export default function AuthModernLayout({ image }) {
|
|
|
28
28
|
<Logo
|
|
29
29
|
maxSize={140}
|
|
30
30
|
sx={{
|
|
31
|
-
mb:
|
|
31
|
+
mb: 1,
|
|
32
32
|
width: 80,
|
|
33
33
|
height: 80,
|
|
34
34
|
}}
|
|
@@ -37,7 +37,7 @@ export default function AuthModernLayout({ image }) {
|
|
|
37
37
|
<Card
|
|
38
38
|
sx={{
|
|
39
39
|
width: 1,
|
|
40
|
-
py: { xs: 6, md:
|
|
40
|
+
py: { xs: 6, md: 4 },
|
|
41
41
|
px: { xs: 4, md: 6 },
|
|
42
42
|
boxShadow: {
|
|
43
43
|
xs: (theme) =>
|
|
@@ -57,25 +57,35 @@ const FlowViewport = ({
|
|
|
57
57
|
if (!container) return;
|
|
58
58
|
|
|
59
59
|
const onWheel = (e) => {
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
|
|
62
|
+
let deltaX = e.deltaX;
|
|
63
|
+
let deltaY = e.deltaY;
|
|
64
|
+
if (e.deltaMode === 1) {
|
|
65
|
+
deltaX *= 20;
|
|
66
|
+
deltaY *= 20;
|
|
67
|
+
} else if (e.deltaMode === 2) {
|
|
68
|
+
deltaX *= 400;
|
|
69
|
+
deltaY *= 400;
|
|
70
|
+
}
|
|
71
|
+
|
|
60
72
|
const wantsZoom = e.ctrlKey || e.metaKey;
|
|
61
73
|
|
|
62
74
|
if (wantsZoom) {
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
const factor =
|
|
75
|
+
const maxDelta = 15;
|
|
76
|
+
const clamped = Math.max(-maxDelta, Math.min(maxDelta, deltaY));
|
|
77
|
+
const factor = Math.exp(-clamped * 0.007);
|
|
66
78
|
setZoom((z) => clampZoom(z * factor));
|
|
67
79
|
} else if (e.shiftKey) {
|
|
68
|
-
|
|
69
|
-
const delta = e.deltaX !== 0 ? e.deltaX : e.deltaY;
|
|
80
|
+
const delta = deltaX !== 0 ? deltaX : deltaY;
|
|
70
81
|
setOffset((prev) => ({
|
|
71
82
|
x: prev.x - delta,
|
|
72
83
|
y: prev.y,
|
|
73
84
|
}));
|
|
74
85
|
} else {
|
|
75
|
-
e.preventDefault();
|
|
76
86
|
setOffset((prev) => ({
|
|
77
|
-
x: prev.x -
|
|
78
|
-
y: prev.y -
|
|
87
|
+
x: prev.x - deltaX,
|
|
88
|
+
y: prev.y - deltaY,
|
|
79
89
|
}));
|
|
80
90
|
}
|
|
81
91
|
};
|
package/src/pages/LoginPage.jsx
CHANGED
|
@@ -30,20 +30,11 @@ function LoginPage() {
|
|
|
30
30
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
31
|
}, [navigate]);
|
|
32
32
|
|
|
33
|
-
if (credentials?.provider === "COGNITO") {
|
|
34
|
-
return <CognitoLogin />;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (credentials?.provider === "DEMO") {
|
|
38
|
-
return (
|
|
39
|
-
<Page title={`Sign in to ${name}`}>
|
|
40
|
-
<DemoLogin />
|
|
41
|
-
</Page>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
33
|
return (
|
|
46
34
|
<Page title={`Sign in to ${name}`}>
|
|
35
|
+
{credentials?.provider === "COGNITO" && <CognitoLogin />}
|
|
36
|
+
{credentials?.provider === "DEMO" && <DemoLogin />}
|
|
37
|
+
|
|
47
38
|
<LoginForm icon={template.login.icon} name={name} formColor={formColor} />
|
|
48
39
|
</Page>
|
|
49
40
|
);
|
|
@@ -18,12 +18,17 @@ const handleOAuthLogin = (
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
function LoginForm() {
|
|
21
|
-
const { name, project } = config();
|
|
21
|
+
const { name, project, credentials } = config();
|
|
22
22
|
|
|
23
23
|
const [email, setEmail] = useState("");
|
|
24
24
|
const [password, setPassword] = useState("");
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const providerCheck =
|
|
27
|
+
credentials?.provider === "COGNITO" || credentials?.provider === "DEMO";
|
|
28
|
+
|
|
29
|
+
const hasContent = !providerCheck || !!project.nucleoid;
|
|
30
|
+
|
|
31
|
+
const renderHead = hasContent ? (
|
|
27
32
|
<Stack spacing={2} sx={{ mb: 5 }}>
|
|
28
33
|
<Typography variant="h4">Sign in to {name}</Typography>
|
|
29
34
|
{project.nucleoid && (
|
|
@@ -34,7 +39,7 @@ function LoginForm() {
|
|
|
34
39
|
</Stack>
|
|
35
40
|
)}
|
|
36
41
|
</Stack>
|
|
37
|
-
);
|
|
42
|
+
) : null;
|
|
38
43
|
|
|
39
44
|
const renderForm = (
|
|
40
45
|
<>
|