jac-client 0.2.8__py3-none-any.whl → 0.2.11__py3-none-any.whl
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.
- jac_client/examples/all-in-one/button.jac +4 -3
- jac_client/examples/all-in-one/components/CategoryFilter.jac +36 -24
- jac_client/examples/all-in-one/components/Header.jac +12 -8
- jac_client/examples/all-in-one/components/ProfitOverview.jac +49 -35
- jac_client/examples/all-in-one/components/Summary.jac +59 -36
- jac_client/examples/all-in-one/components/TransactionForm.jac +142 -112
- jac_client/examples/all-in-one/components/TransactionItem.jac +37 -30
- jac_client/examples/all-in-one/components/TransactionList.jac +33 -26
- jac_client/examples/all-in-one/components/button.jac +4 -3
- jac_client/examples/all-in-one/components/navigation.jac +111 -117
- jac_client/examples/all-in-one/constants/categories.jac +23 -24
- jac_client/examples/all-in-one/constants/clients.jac +7 -8
- jac_client/examples/all-in-one/context/BudgetContext.jac +9 -6
- jac_client/examples/all-in-one/hooks/useBudget.jac +18 -12
- jac_client/examples/all-in-one/hooks/useLocalStorage.jac +14 -13
- jac_client/examples/all-in-one/main.jac +542 -0
- jac_client/examples/all-in-one/pages/BudgetPlanner.jac +26 -12
- jac_client/examples/all-in-one/pages/FeaturesTest.jac +43 -12
- jac_client/examples/all-in-one/pages/LandingPage.jac +113 -90
- jac_client/examples/all-in-one/pages/budget_planner_ui.cl.jac +65 -0
- jac_client/examples/all-in-one/pages/features_test_ui.cl.jac +675 -0
- jac_client/examples/all-in-one/pages/loginPage.jac +114 -119
- jac_client/examples/all-in-one/pages/nestedDemo.jac +44 -51
- jac_client/examples/all-in-one/pages/notFound.jac +15 -21
- jac_client/examples/all-in-one/pages/signupPage.jac +113 -119
- jac_client/examples/all-in-one/utils/formatters.jac +5 -8
- jac_client/examples/asset-serving/css-with-image/main.jac +92 -0
- jac_client/examples/asset-serving/image-asset/main.jac +56 -0
- jac_client/examples/asset-serving/import-alias/main.jac +109 -0
- jac_client/examples/basic/main.jac +23 -0
- jac_client/examples/basic-auth/main.jac +363 -0
- jac_client/examples/basic-auth-with-router/main.jac +451 -0
- jac_client/examples/basic-full-stack/main.jac +362 -0
- jac_client/examples/css-styling/js-styling/main.jac +63 -0
- jac_client/examples/css-styling/material-ui/main.jac +122 -0
- jac_client/examples/css-styling/pure-css/main.jac +55 -0
- jac_client/examples/css-styling/sass-example/main.jac +55 -0
- jac_client/examples/css-styling/styled-components/main.jac +62 -0
- jac_client/examples/css-styling/tailwind-example/main.jac +74 -0
- jac_client/examples/full-stack-with-auth/main.jac +696 -0
- jac_client/examples/little-x/main.jac +681 -0
- jac_client/examples/little-x/src/submit-button.jac +15 -14
- jac_client/examples/nested-folders/nested-advance/main.jac +26 -0
- jac_client/examples/nested-folders/nested-advance/src/ButtonRoot.jac +4 -6
- jac_client/examples/nested-folders/nested-advance/src/level1/ButtonSecondL.jac +9 -13
- jac_client/examples/nested-folders/nested-advance/src/level1/Card.jac +29 -32
- jac_client/examples/nested-folders/nested-advance/src/level1/level2/ButtonThirdL.jac +12 -18
- jac_client/examples/nested-folders/nested-basic/{src/app.jac → main.jac} +7 -5
- jac_client/examples/nested-folders/nested-basic/src/button.jac +4 -3
- jac_client/examples/nested-folders/nested-basic/src/components/button.jac +4 -3
- jac_client/examples/ts-support/main.jac +35 -0
- jac_client/examples/with-router/main.jac +286 -0
- jac_client/plugin/cli.jac +491 -411
- jac_client/plugin/client.jac +25 -0
- jac_client/plugin/client_runtime.cl.jac +10 -4
- jac_client/plugin/impl/client.impl.jac +96 -55
- jac_client/plugin/impl/client_runtime.impl.jac +155 -1
- jac_client/plugin/plugin_config.jac +211 -29
- jac_client/plugin/src/__init__.jac +0 -2
- jac_client/plugin/src/compiler.jac +0 -1
- jac_client/plugin/src/config_loader.jac +1 -0
- jac_client/plugin/src/desktop_config.jac +31 -0
- jac_client/plugin/src/impl/compiler.impl.jac +49 -17
- jac_client/plugin/src/impl/config_loader.impl.jac +8 -0
- jac_client/plugin/src/impl/desktop_config.impl.jac +191 -0
- jac_client/plugin/src/impl/jac_to_js.impl.jac +5 -1
- jac_client/plugin/src/impl/package_installer.impl.jac +20 -20
- jac_client/plugin/src/impl/vite_bundler.impl.jac +191 -64
- jac_client/plugin/src/targets/desktop/sidecar/main.py +144 -0
- jac_client/plugin/src/targets/desktop_target.jac +37 -0
- jac_client/plugin/src/targets/impl/desktop_target.impl.jac +2347 -0
- jac_client/plugin/src/targets/impl/registry.impl.jac +64 -0
- jac_client/plugin/src/targets/impl/web_target.impl.jac +157 -0
- jac_client/plugin/src/targets/register.jac +21 -0
- jac_client/plugin/src/targets/registry.jac +87 -0
- jac_client/plugin/src/targets/web_target.jac +35 -0
- jac_client/plugin/src/vite_bundler.jac +6 -0
- jac_client/plugin/utils/__init__.jac +3 -0
- jac_client/plugin/utils/bun_installer.jac +16 -0
- jac_client/plugin/utils/impl/bun_installer.impl.jac +99 -0
- jac_client/templates/client.jacpack +72 -0
- jac_client/templates/fullstack.jacpack +61 -0
- jac_client/tests/conftest.py +103 -47
- jac_client/tests/fixtures/spawn_test/app.jac +49 -52
- jac_client/tests/fixtures/with-ts/app.jac +27 -27
- jac_client/tests/test_cli.py +182 -71
- jac_client/tests/test_e2e.py +232 -0
- jac_client/tests/test_helpers.py +58 -0
- jac_client/tests/test_it.py +91 -135
- jac_client/tests/test_it_desktop.py +891 -0
- {jac_client-0.2.8.dist-info → jac_client-0.2.11.dist-info}/METADATA +6 -6
- jac_client-0.2.11.dist-info/RECORD +113 -0
- {jac_client-0.2.8.dist-info → jac_client-0.2.11.dist-info}/WHEEL +1 -1
- jac_client/examples/all-in-one/app.jac +0 -573
- jac_client/examples/all-in-one/pages/BudgetPlanner.cl.jac +0 -70
- jac_client/examples/all-in-one/pages/FeaturesTest.cl.jac +0 -552
- jac_client/examples/asset-serving/css-with-image/src/app.jac +0 -88
- jac_client/examples/asset-serving/image-asset/src/app.jac +0 -55
- jac_client/examples/asset-serving/import-alias/src/app.jac +0 -111
- jac_client/examples/basic/src/app.jac +0 -21
- jac_client/examples/basic-auth/src/app.jac +0 -371
- jac_client/examples/basic-auth-with-router/src/app.jac +0 -464
- jac_client/examples/basic-full-stack/src/app.jac +0 -359
- jac_client/examples/css-styling/js-styling/src/app.jac +0 -84
- jac_client/examples/css-styling/material-ui/src/app.jac +0 -122
- jac_client/examples/css-styling/pure-css/src/app.jac +0 -64
- jac_client/examples/css-styling/sass-example/src/app.jac +0 -64
- jac_client/examples/css-styling/styled-components/src/app.jac +0 -71
- jac_client/examples/css-styling/tailwind-example/src/app.jac +0 -63
- jac_client/examples/full-stack-with-auth/src/app.jac +0 -722
- jac_client/examples/little-x/src/app.jac +0 -719
- jac_client/examples/nested-folders/nested-advance/src/app.jac +0 -35
- jac_client/examples/ts-support/src/app.jac +0 -35
- jac_client/examples/with-router/src/app.jac +0 -323
- jac_client/plugin/src/babel_processor.jac +0 -18
- jac_client/plugin/src/impl/babel_processor.impl.jac +0 -89
- jac_client-0.2.8.dist-info/RECORD +0 -97
- {jac_client-0.2.8.dist-info → jac_client-0.2.11.dist-info}/entry_points.txt +0 -0
- {jac_client-0.2.8.dist-info → jac_client-0.2.11.dist-info}/top_level.txt +0 -0
|
@@ -1,132 +1,127 @@
|
|
|
1
|
-
cl import from "@jac
|
|
2
|
-
|
|
3
|
-
useNavigate,
|
|
4
|
-
jacLogin
|
|
5
|
-
}
|
|
1
|
+
cl import from "@jac/runtime" { Link, useNavigate, jacLogin }
|
|
2
|
+
|
|
6
3
|
cl {
|
|
7
4
|
def:pub LoginPage -> any {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
navigate = useNavigate();
|
|
5
|
+
has username: str = "",
|
|
6
|
+
password: str = "",
|
|
7
|
+
error: str = "";
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
e.preventDefault();
|
|
15
|
-
error = "";
|
|
16
|
-
if not username or not password {
|
|
17
|
-
error = "Please fill in all fields";
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
success = await jacLogin(username, password);
|
|
21
|
-
if success {
|
|
22
|
-
navigate("/");
|
|
23
|
-
} else {
|
|
24
|
-
error = "Invalid credentials";
|
|
25
|
-
}
|
|
26
|
-
}
|
|
9
|
+
navigate = useNavigate();
|
|
27
10
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
11
|
+
async def handleLogin(e: any) -> None {
|
|
12
|
+
e.preventDefault();
|
|
13
|
+
error = "";
|
|
14
|
+
if not username or not password {
|
|
15
|
+
error = "Please fill in all fields";
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
success = await jacLogin(username, password);
|
|
19
|
+
if success {
|
|
20
|
+
navigate("/");
|
|
21
|
+
} else {
|
|
22
|
+
error = "Invalid credentials";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
def handleUsernameChange(e: any) -> None {
|
|
27
|
+
username = e.target.value;
|
|
28
|
+
}
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
style={{"color": "#dc2626", "fontSize": "14px", "marginBottom": "12px"}}
|
|
40
|
-
>
|
|
41
|
-
{error}
|
|
42
|
-
</div>;
|
|
43
|
-
}
|
|
30
|
+
def handlePasswordChange(e: any) -> None {
|
|
31
|
+
password = e.target.value;
|
|
32
|
+
}
|
|
44
33
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"alignItems": "center",
|
|
50
|
-
"justifyContent": "center",
|
|
51
|
-
"background": "#f5f5f5"
|
|
52
|
-
}}
|
|
53
|
-
>
|
|
54
|
-
<div
|
|
55
|
-
style={{
|
|
56
|
-
"background": "#ffffff",
|
|
57
|
-
"padding": "32px",
|
|
58
|
-
"borderRadius": "8px",
|
|
59
|
-
"width": "300px",
|
|
60
|
-
"boxShadow": "0 2px 8px rgba(0,0,0,0.1)"
|
|
61
|
-
}}
|
|
62
|
-
>
|
|
63
|
-
<h2
|
|
64
|
-
style={{"marginBottom": "24px", "textAlign": "center"}}
|
|
34
|
+
errorDisplay = None;
|
|
35
|
+
if error {
|
|
36
|
+
errorDisplay = <div
|
|
37
|
+
style={{"color": "#dc2626", "fontSize": "14px", "marginBottom": "12px"}}
|
|
65
38
|
>
|
|
66
|
-
|
|
67
|
-
</
|
|
68
|
-
|
|
69
|
-
|
|
39
|
+
{error}
|
|
40
|
+
</div>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return
|
|
44
|
+
<div
|
|
45
|
+
style={{
|
|
46
|
+
"minHeight": "calc(100vh - 56px)",
|
|
47
|
+
"display": "flex",
|
|
48
|
+
"alignItems": "center",
|
|
49
|
+
"justifyContent": "center",
|
|
50
|
+
"background": "#f5f5f5"
|
|
51
|
+
}}
|
|
70
52
|
>
|
|
71
|
-
<
|
|
72
|
-
type="text"
|
|
73
|
-
value={username}
|
|
74
|
-
onChange={handleUsernameChange}
|
|
75
|
-
placeholder="Username"
|
|
76
|
-
style={{
|
|
77
|
-
"width": "100%",
|
|
78
|
-
"padding": "10px",
|
|
79
|
-
"marginBottom": "12px",
|
|
80
|
-
"border": "1px solid #ddd",
|
|
81
|
-
"borderRadius": "4px",
|
|
82
|
-
"boxSizing": "border-box"
|
|
83
|
-
}}
|
|
84
|
-
/>
|
|
85
|
-
<input
|
|
86
|
-
type="password"
|
|
87
|
-
value={password}
|
|
88
|
-
onChange={handlePasswordChange}
|
|
89
|
-
placeholder="Password"
|
|
90
|
-
style={{
|
|
91
|
-
"width": "100%",
|
|
92
|
-
"padding": "10px",
|
|
93
|
-
"marginBottom": "12px",
|
|
94
|
-
"border": "1px solid #ddd",
|
|
95
|
-
"borderRadius": "4px",
|
|
96
|
-
"boxSizing": "border-box"
|
|
97
|
-
}}
|
|
98
|
-
/>
|
|
99
|
-
{errorDisplay}
|
|
100
|
-
<button
|
|
101
|
-
type="submit"
|
|
53
|
+
<div
|
|
102
54
|
style={{
|
|
103
|
-
"
|
|
104
|
-
"padding": "
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"borderRadius": "4px",
|
|
109
|
-
"cursor": "pointer",
|
|
110
|
-
"fontWeight": "600"
|
|
55
|
+
"background": "#ffffff",
|
|
56
|
+
"padding": "32px",
|
|
57
|
+
"borderRadius": "8px",
|
|
58
|
+
"width": "300px",
|
|
59
|
+
"boxShadow": "0 2px 8px rgba(0,0,0,0.1)"
|
|
111
60
|
}}
|
|
112
61
|
>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
62
|
+
<h2 style={{"marginBottom": "24px", "textAlign": "center"}}>
|
|
63
|
+
Login
|
|
64
|
+
</h2>
|
|
65
|
+
<form onSubmit={handleLogin}>
|
|
66
|
+
<input
|
|
67
|
+
type="text"
|
|
68
|
+
value={username}
|
|
69
|
+
onChange={handleUsernameChange}
|
|
70
|
+
placeholder="Username"
|
|
71
|
+
style={{
|
|
72
|
+
"width": "100%",
|
|
73
|
+
"padding": "10px",
|
|
74
|
+
"marginBottom": "12px",
|
|
75
|
+
"border": "1px solid #ddd",
|
|
76
|
+
"borderRadius": "4px",
|
|
77
|
+
"boxSizing": "border-box"
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
<input
|
|
81
|
+
type="password"
|
|
82
|
+
value={password}
|
|
83
|
+
onChange={handlePasswordChange}
|
|
84
|
+
placeholder="Password"
|
|
85
|
+
style={{
|
|
86
|
+
"width": "100%",
|
|
87
|
+
"padding": "10px",
|
|
88
|
+
"marginBottom": "12px",
|
|
89
|
+
"border": "1px solid #ddd",
|
|
90
|
+
"borderRadius": "4px",
|
|
91
|
+
"boxSizing": "border-box"
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
{errorDisplay}
|
|
95
|
+
<button
|
|
96
|
+
type="submit"
|
|
97
|
+
style={{
|
|
98
|
+
"width": "100%",
|
|
99
|
+
"padding": "10px",
|
|
100
|
+
"background": "#3b82f6",
|
|
101
|
+
"color": "#ffffff",
|
|
102
|
+
"border": "none",
|
|
103
|
+
"borderRadius": "4px",
|
|
104
|
+
"cursor": "pointer",
|
|
105
|
+
"fontWeight": "600"
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
Login
|
|
109
|
+
</button>
|
|
110
|
+
</form>
|
|
111
|
+
<p
|
|
112
|
+
style={{
|
|
113
|
+
"textAlign": "center",
|
|
114
|
+
"marginTop": "16px",
|
|
115
|
+
"fontSize": "14px"
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
Need an account?
|
|
119
|
+
{" "}
|
|
120
|
+
<Link to="/signup">
|
|
121
|
+
Sign up
|
|
122
|
+
</Link>
|
|
123
|
+
</p>
|
|
124
|
+
</div>
|
|
125
|
+
</div>;
|
|
126
|
+
}
|
|
132
127
|
}
|
|
@@ -1,61 +1,54 @@
|
|
|
1
1
|
# Nested folder imports (same pattern as nested-basic/)
|
|
2
|
-
cl import from ..components.
|
|
2
|
+
cl import from ..components.nestedDemo.CustomButton.tsx {
|
|
3
3
|
CustomButton
|
|
4
4
|
}
|
|
5
5
|
cl import from ..button { CustomButtonRoot }
|
|
6
|
-
cl import from "@jac
|
|
7
|
-
|
|
8
|
-
Navigate,
|
|
9
|
-
jacIsLoggedIn
|
|
10
|
-
}
|
|
11
|
-
|
|
6
|
+
cl import from "@jac/runtime" { Navigate, jacIsLoggedIn }
|
|
12
7
|
|
|
13
8
|
cl {
|
|
14
9
|
def:pub NestedImportsDemo -> any {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
# Check if user is logged in, redirect if not
|
|
11
|
+
if not jacIsLoggedIn() {
|
|
12
|
+
return
|
|
13
|
+
<Navigate to="/login" />;
|
|
14
|
+
}
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<CustomButtonRoot />
|
|
58
|
-
</div>
|
|
59
|
-
</div>;
|
|
16
|
+
return
|
|
17
|
+
<div
|
|
18
|
+
style={{
|
|
19
|
+
"padding": "2rem",
|
|
20
|
+
"fontFamily": "system-ui, -apple-system, sans-serif"
|
|
21
|
+
}}
|
|
22
|
+
>
|
|
23
|
+
<h1>
|
|
24
|
+
📁 Nested Folder Imports
|
|
25
|
+
</h1>
|
|
26
|
+
<p>
|
|
27
|
+
This page mirrors the
|
|
28
|
+
{" "}
|
|
29
|
+
<code>
|
|
30
|
+
nested-folders/nested-basic
|
|
31
|
+
</code>
|
|
32
|
+
{" "}
|
|
33
|
+
example by importing components from both
|
|
34
|
+
{" "}
|
|
35
|
+
<code>
|
|
36
|
+
components.button
|
|
37
|
+
</code>
|
|
38
|
+
{" "}
|
|
39
|
+
and
|
|
40
|
+
{" "}
|
|
41
|
+
<code>
|
|
42
|
+
button
|
|
43
|
+
</code>
|
|
44
|
+
</p>
|
|
45
|
+
<p style={{"marginTop": "0.75rem"}}>
|
|
46
|
+
Both buttons below are rendered via relative imports:
|
|
47
|
+
</p>
|
|
48
|
+
<div style={{"display": "flex", "gap": "1rem", "marginTop": "1.5rem"}}>
|
|
49
|
+
<CustomButton />
|
|
50
|
+
<CustomButtonRoot />
|
|
51
|
+
</div>
|
|
52
|
+
</div>;
|
|
60
53
|
}
|
|
61
54
|
}
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
cl import from "@jac
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
cl import from "@jac/runtime" { Link }
|
|
2
|
+
cl import "..styles/notFoundPage/NotFoundstyle.css";
|
|
4
3
|
cl {
|
|
5
4
|
def:pub NotFound -> any {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<Link to="/">
|
|
20
|
-
← Back to Home
|
|
21
|
-
</Link>
|
|
22
|
-
</div>;
|
|
23
|
-
}
|
|
5
|
+
return
|
|
6
|
+
<div className="not-found-container">
|
|
7
|
+
<h1>
|
|
8
|
+
🔍 404 - Page Not Found
|
|
9
|
+
</h1>
|
|
10
|
+
<p>
|
|
11
|
+
The page you are looking for does not exist.
|
|
12
|
+
</p>
|
|
13
|
+
<Link to="/">
|
|
14
|
+
← Back to Home
|
|
15
|
+
</Link>
|
|
16
|
+
</div>;
|
|
17
|
+
}
|
|
24
18
|
}
|
|
@@ -1,133 +1,127 @@
|
|
|
1
|
-
cl import from "@jac
|
|
2
|
-
Link,
|
|
3
|
-
useNavigate,
|
|
4
|
-
jacSignup
|
|
5
|
-
}
|
|
1
|
+
cl import from "@jac/runtime" { Link, useNavigate, jacSignup }
|
|
6
2
|
|
|
7
3
|
cl {
|
|
8
4
|
def:pub SignupPage -> any {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
navigate = useNavigate();
|
|
5
|
+
has username: str = "",
|
|
6
|
+
password: str = "",
|
|
7
|
+
error: str = "";
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
e.preventDefault();
|
|
16
|
-
error = "";
|
|
17
|
-
if not username or not password {
|
|
18
|
-
error = "Please fill in all fields";
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
result = await jacSignup(username, password);
|
|
22
|
-
if result["success"] {
|
|
23
|
-
navigate("/");
|
|
24
|
-
} else {
|
|
25
|
-
error = result["error"] if result["error"] else "Signup failed";
|
|
26
|
-
}
|
|
27
|
-
}
|
|
9
|
+
navigate = useNavigate();
|
|
28
10
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
async def handleSignup(e: any) -> None {
|
|
12
|
+
e.preventDefault();
|
|
13
|
+
error = "";
|
|
14
|
+
if not username or not password {
|
|
15
|
+
error = "Please fill in all fields";
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
result = await jacSignup(username, password);
|
|
19
|
+
if result["success"] {
|
|
20
|
+
navigate("/");
|
|
21
|
+
} else {
|
|
22
|
+
error = result["error"] if result["error"] else "Signup failed";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
32
25
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
def handleUsernameChange(e: any) -> None {
|
|
27
|
+
username = e.target.value;
|
|
28
|
+
}
|
|
36
29
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
style={{"color": "#dc2626", "fontSize": "14px", "marginBottom": "12px"}}
|
|
41
|
-
>
|
|
42
|
-
{error}
|
|
43
|
-
</div>;
|
|
44
|
-
}
|
|
30
|
+
def handlePasswordChange(e: any) -> None {
|
|
31
|
+
password = e.target.value;
|
|
32
|
+
}
|
|
45
33
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"alignItems": "center",
|
|
51
|
-
"justifyContent": "center",
|
|
52
|
-
"background": "#f5f5f5"
|
|
53
|
-
}}
|
|
54
|
-
>
|
|
55
|
-
<div
|
|
56
|
-
style={{
|
|
57
|
-
"background": "#ffffff",
|
|
58
|
-
"padding": "32px",
|
|
59
|
-
"borderRadius": "8px",
|
|
60
|
-
"width": "300px",
|
|
61
|
-
"boxShadow": "0 2px 8px rgba(0,0,0,0.1)"
|
|
62
|
-
}}
|
|
63
|
-
>
|
|
64
|
-
<h2
|
|
65
|
-
style={{"marginBottom": "24px", "textAlign": "center"}}
|
|
34
|
+
errorDisplay = None;
|
|
35
|
+
if error {
|
|
36
|
+
errorDisplay = <div
|
|
37
|
+
style={{"color": "#dc2626", "fontSize": "14px", "marginBottom": "12px"}}
|
|
66
38
|
>
|
|
67
|
-
|
|
68
|
-
</
|
|
69
|
-
|
|
70
|
-
|
|
39
|
+
{error}
|
|
40
|
+
</div>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return
|
|
44
|
+
<div
|
|
45
|
+
style={{
|
|
46
|
+
"minHeight": "calc(100vh - 56px)",
|
|
47
|
+
"display": "flex",
|
|
48
|
+
"alignItems": "center",
|
|
49
|
+
"justifyContent": "center",
|
|
50
|
+
"background": "#f5f5f5"
|
|
51
|
+
}}
|
|
71
52
|
>
|
|
72
|
-
<
|
|
73
|
-
type="text"
|
|
74
|
-
value={username}
|
|
75
|
-
onChange={handleUsernameChange}
|
|
76
|
-
placeholder="Username"
|
|
77
|
-
style={{
|
|
78
|
-
"width": "100%",
|
|
79
|
-
"padding": "10px",
|
|
80
|
-
"marginBottom": "12px",
|
|
81
|
-
"border": "1px solid #ddd",
|
|
82
|
-
"borderRadius": "4px",
|
|
83
|
-
"boxSizing": "border-box"
|
|
84
|
-
}}
|
|
85
|
-
/>
|
|
86
|
-
<input
|
|
87
|
-
type="password"
|
|
88
|
-
value={password}
|
|
89
|
-
onChange={handlePasswordChange}
|
|
90
|
-
placeholder="Password"
|
|
91
|
-
style={{
|
|
92
|
-
"width": "100%",
|
|
93
|
-
"padding": "10px",
|
|
94
|
-
"marginBottom": "12px",
|
|
95
|
-
"border": "1px solid #ddd",
|
|
96
|
-
"borderRadius": "4px",
|
|
97
|
-
"boxSizing": "border-box"
|
|
98
|
-
}}
|
|
99
|
-
/>
|
|
100
|
-
{errorDisplay}
|
|
101
|
-
<button
|
|
102
|
-
type="submit"
|
|
53
|
+
<div
|
|
103
54
|
style={{
|
|
104
|
-
"
|
|
105
|
-
"padding": "
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"borderRadius": "4px",
|
|
110
|
-
"cursor": "pointer",
|
|
111
|
-
"fontWeight": "600"
|
|
55
|
+
"background": "#ffffff",
|
|
56
|
+
"padding": "32px",
|
|
57
|
+
"borderRadius": "8px",
|
|
58
|
+
"width": "300px",
|
|
59
|
+
"boxShadow": "0 2px 8px rgba(0,0,0,0.1)"
|
|
112
60
|
}}
|
|
113
61
|
>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
62
|
+
<h2 style={{"marginBottom": "24px", "textAlign": "center"}}>
|
|
63
|
+
Sign Up
|
|
64
|
+
</h2>
|
|
65
|
+
<form onSubmit={handleSignup}>
|
|
66
|
+
<input
|
|
67
|
+
type="text"
|
|
68
|
+
value={username}
|
|
69
|
+
onChange={handleUsernameChange}
|
|
70
|
+
placeholder="Username"
|
|
71
|
+
style={{
|
|
72
|
+
"width": "100%",
|
|
73
|
+
"padding": "10px",
|
|
74
|
+
"marginBottom": "12px",
|
|
75
|
+
"border": "1px solid #ddd",
|
|
76
|
+
"borderRadius": "4px",
|
|
77
|
+
"boxSizing": "border-box"
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
<input
|
|
81
|
+
type="password"
|
|
82
|
+
value={password}
|
|
83
|
+
onChange={handlePasswordChange}
|
|
84
|
+
placeholder="Password"
|
|
85
|
+
style={{
|
|
86
|
+
"width": "100%",
|
|
87
|
+
"padding": "10px",
|
|
88
|
+
"marginBottom": "12px",
|
|
89
|
+
"border": "1px solid #ddd",
|
|
90
|
+
"borderRadius": "4px",
|
|
91
|
+
"boxSizing": "border-box"
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
{errorDisplay}
|
|
95
|
+
<button
|
|
96
|
+
type="submit"
|
|
97
|
+
style={{
|
|
98
|
+
"width": "100%",
|
|
99
|
+
"padding": "10px",
|
|
100
|
+
"background": "#3b82f6",
|
|
101
|
+
"color": "#ffffff",
|
|
102
|
+
"border": "none",
|
|
103
|
+
"borderRadius": "4px",
|
|
104
|
+
"cursor": "pointer",
|
|
105
|
+
"fontWeight": "600"
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
Sign Up
|
|
109
|
+
</button>
|
|
110
|
+
</form>
|
|
111
|
+
<p
|
|
112
|
+
style={{
|
|
113
|
+
"textAlign": "center",
|
|
114
|
+
"marginTop": "16px",
|
|
115
|
+
"fontSize": "14px"
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
Have an account?
|
|
119
|
+
{" "}
|
|
120
|
+
<Link to="/login">
|
|
121
|
+
Login
|
|
122
|
+
</Link>
|
|
123
|
+
</p>
|
|
124
|
+
</div>
|
|
125
|
+
</div>;
|
|
126
|
+
}
|
|
133
127
|
}
|