jac-client 0.2.10__py3-none-any.whl → 0.2.12__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 +340 -371
- jac_client/examples/all-in-one/pages/BudgetPlanner.jac +19 -12
- jac_client/examples/all-in-one/pages/FeaturesTest.jac +31 -15
- jac_client/examples/all-in-one/pages/LandingPage.jac +113 -90
- jac_client/examples/all-in-one/pages/budget_planner_ui.cl.jac +34 -39
- jac_client/examples/all-in-one/pages/features_test_ui.cl.jac +464 -352
- jac_client/examples/all-in-one/pages/loginPage.jac +114 -119
- jac_client/examples/all-in-one/pages/nestedDemo.jac +43 -50
- jac_client/examples/all-in-one/pages/notFound.jac +14 -15
- 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 +77 -73
- jac_client/examples/asset-serving/image-asset/main.jac +47 -46
- jac_client/examples/asset-serving/import-alias/main.jac +93 -95
- jac_client/examples/basic/main.jac +17 -15
- jac_client/examples/basic-auth/main.jac +246 -254
- jac_client/examples/basic-auth-with-router/main.jac +272 -285
- jac_client/examples/basic-full-stack/main.jac +245 -242
- jac_client/examples/css-styling/js-styling/main.jac +41 -62
- jac_client/examples/css-styling/material-ui/main.jac +90 -90
- jac_client/examples/css-styling/pure-css/main.jac +35 -44
- jac_client/examples/css-styling/sass-example/main.jac +35 -44
- jac_client/examples/css-styling/styled-components/main.jac +38 -47
- jac_client/examples/css-styling/tailwind-example/main.jac +54 -43
- jac_client/examples/full-stack-with-auth/main.jac +407 -433
- jac_client/examples/little-x/main.jac +306 -344
- jac_client/examples/little-x/src/submit-button.jac +15 -14
- jac_client/examples/nested-folders/nested-advance/main.jac +18 -27
- 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/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 +26 -26
- jac_client/examples/with-router/main.jac +186 -223
- jac_client/plugin/client_runtime.cl.jac +5 -3
- jac_client/plugin/impl/client_runtime.impl.jac +1 -1
- jac_client/plugin/plugin_config.jac +53 -99
- jac_client/plugin/src/__init__.jac +0 -2
- jac_client/plugin/src/compiler.jac +0 -1
- jac_client/plugin/src/impl/compiler.impl.jac +49 -17
- 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 +146 -84
- jac_client/plugin/src/targets/impl/desktop_target.impl.jac +54 -41
- jac_client/plugin/utils/__init__.jac +3 -0
- jac_client/plugin/utils/bun_installer.jac +16 -0
- jac_client/plugin/utils/client_deps.jac +14 -0
- jac_client/plugin/utils/impl/bun_installer.impl.jac +99 -0
- jac_client/plugin/utils/impl/client_deps.impl.jac +73 -0
- jac_client/templates/client.jacpack +0 -4
- jac_client/templates/fullstack.jacpack +1 -5
- jac_client/tests/conftest.py +56 -41
- 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 +71 -6
- jac_client/tests/test_helpers.py +11 -18
- jac_client/tests/test_it.py +1 -1
- {jac_client-0.2.10.dist-info → jac_client-0.2.12.dist-info}/METADATA +5 -5
- jac_client-0.2.12.dist-info/RECORD +115 -0
- {jac_client-0.2.10.dist-info → jac_client-0.2.12.dist-info}/WHEEL +1 -1
- jac_client/plugin/src/babel_processor.jac +0 -18
- jac_client/plugin/src/impl/babel_processor.impl.jac +0 -89
- jac_client/plugin/utils/impl/node_installer.impl.jac +0 -249
- jac_client/plugin/utils/node_installer.jac +0 -41
- jac_client-0.2.10.dist-info/RECORD +0 -115
- {jac_client-0.2.10.dist-info → jac_client-0.2.12.dist-info}/entry_points.txt +0 -0
- {jac_client-0.2.10.dist-info → jac_client-0.2.12.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
|
}
|
|
@@ -3,59 +3,52 @@ 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,19 +1,18 @@
|
|
|
1
|
-
cl import from "@jac
|
|
2
|
-
Link
|
|
3
|
-
}
|
|
1
|
+
cl import from "@jac/runtime" { Link }
|
|
4
2
|
cl import "..styles/notFoundPage/NotFoundstyle.css";
|
|
5
3
|
cl {
|
|
6
4
|
def:pub NotFound -> any {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
+
}
|
|
19
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
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# Utility functions for formatting
|
|
2
2
|
# Demonstrates: def:pub exports, string methods
|
|
3
|
-
|
|
4
3
|
cl {
|
|
5
4
|
# Format number as currency - demonstrates string methods
|
|
6
5
|
def:pub formatCurrency(amount: float) -> str {
|
|
@@ -12,11 +11,9 @@ cl {
|
|
|
12
11
|
# Format ISO date string to readable format
|
|
13
12
|
def:pub formatDate(dateStr: str) -> str {
|
|
14
13
|
date = Reflect.construct(Date, [dateStr]);
|
|
15
|
-
return date.toLocaleDateString(
|
|
16
|
-
"month": "short",
|
|
17
|
-
|
|
18
|
-
"year": "numeric"
|
|
19
|
-
});
|
|
14
|
+
return date.toLocaleDateString(
|
|
15
|
+
"en-US", {"month": "short", "day": "numeric", "year": "numeric"}
|
|
16
|
+
);
|
|
20
17
|
}
|
|
21
18
|
|
|
22
19
|
# Capitalize first letter of string
|
|
@@ -39,12 +36,12 @@ cl {
|
|
|
39
36
|
def:pub formatCompact(num: float) -> str {
|
|
40
37
|
if num >= 1000000 {
|
|
41
38
|
divided = num / 1000000;
|
|
42
|
-
rounded =
|
|
39
|
+
rounded = Math.round(divided * 10) / 10;
|
|
43
40
|
return (rounded.toString().concat("M"));
|
|
44
41
|
}
|
|
45
42
|
if num >= 1000 {
|
|
46
43
|
divided = num / 1000;
|
|
47
|
-
rounded =
|
|
44
|
+
rounded = Math.round(divided * 10) / 10;
|
|
48
45
|
return rounded.toString().concat("K");
|
|
49
46
|
}
|
|
50
47
|
return Math.round(num).toString();
|