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,464 +0,0 @@
|
|
|
1
|
-
# Simple Authentication App with React Router
|
|
2
|
-
cl import from react {
|
|
3
|
-
useState,
|
|
4
|
-
useEffect
|
|
5
|
-
}
|
|
6
|
-
cl import from "@jac-client/utils" {
|
|
7
|
-
Router,
|
|
8
|
-
Routes,
|
|
9
|
-
Route,
|
|
10
|
-
Link,
|
|
11
|
-
Navigate,
|
|
12
|
-
useNavigate,
|
|
13
|
-
useLocation,
|
|
14
|
-
jacSignup,
|
|
15
|
-
jacLogin,
|
|
16
|
-
jacLogout,
|
|
17
|
-
jacIsLoggedIn
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
cl {
|
|
21
|
-
# Navigation Component
|
|
22
|
-
def Navigation -> any {
|
|
23
|
-
isLoggedIn = jacIsLoggedIn();
|
|
24
|
-
navigate = useNavigate();
|
|
25
|
-
|
|
26
|
-
def handleLogout(e: any) -> None {
|
|
27
|
-
e.preventDefault();
|
|
28
|
-
jacLogout();
|
|
29
|
-
navigate("/login");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if isLoggedIn {
|
|
33
|
-
return <nav
|
|
34
|
-
style={{
|
|
35
|
-
"padding": "16px 24px",
|
|
36
|
-
"background": "#667eea",
|
|
37
|
-
"display": "flex",
|
|
38
|
-
"justifyContent": "space-between",
|
|
39
|
-
"alignItems": "center"
|
|
40
|
-
}}
|
|
41
|
-
>
|
|
42
|
-
<div
|
|
43
|
-
style={{
|
|
44
|
-
"fontSize": "1.25rem",
|
|
45
|
-
"fontWeight": "600",
|
|
46
|
-
"color": "#ffffff"
|
|
47
|
-
}}
|
|
48
|
-
>
|
|
49
|
-
MyApp
|
|
50
|
-
</div>
|
|
51
|
-
<div
|
|
52
|
-
style={{"display": "flex", "gap": "16px"}}
|
|
53
|
-
>
|
|
54
|
-
<Link
|
|
55
|
-
to="/dashboard"
|
|
56
|
-
style={{"color": "#ffffff", "textDecoration": "none"}}
|
|
57
|
-
>
|
|
58
|
-
Dashboard
|
|
59
|
-
</Link>
|
|
60
|
-
<button
|
|
61
|
-
onClick={handleLogout}
|
|
62
|
-
style={{
|
|
63
|
-
"background": "none",
|
|
64
|
-
"color": "#ffffff",
|
|
65
|
-
"border": "1px solid #ffffff",
|
|
66
|
-
"padding": "4px 12px",
|
|
67
|
-
"borderRadius": "4px",
|
|
68
|
-
"cursor": "pointer"
|
|
69
|
-
}}
|
|
70
|
-
>
|
|
71
|
-
Logout
|
|
72
|
-
</button>
|
|
73
|
-
</div>
|
|
74
|
-
</nav>;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return <nav
|
|
78
|
-
style={{
|
|
79
|
-
"padding": "16px 24px",
|
|
80
|
-
"background": "#667eea",
|
|
81
|
-
"display": "flex",
|
|
82
|
-
"justifyContent": "space-between",
|
|
83
|
-
"alignItems": "center"
|
|
84
|
-
}}
|
|
85
|
-
>
|
|
86
|
-
<div
|
|
87
|
-
style={{"fontSize": "1.25rem", "fontWeight": "600", "color": "#ffffff"}}
|
|
88
|
-
>
|
|
89
|
-
MyApp
|
|
90
|
-
</div>
|
|
91
|
-
<div
|
|
92
|
-
style={{"display": "flex", "gap": "16px"}}
|
|
93
|
-
>
|
|
94
|
-
<Link
|
|
95
|
-
to="/login"
|
|
96
|
-
style={{"color": "#ffffff", "textDecoration": "none"}}
|
|
97
|
-
>
|
|
98
|
-
Login
|
|
99
|
-
</Link>
|
|
100
|
-
<Link
|
|
101
|
-
to="/signup"
|
|
102
|
-
style={{"color": "#ffffff", "textDecoration": "none"}}
|
|
103
|
-
>
|
|
104
|
-
Sign Up
|
|
105
|
-
</Link>
|
|
106
|
-
</div>
|
|
107
|
-
</nav>;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
# Login Page
|
|
111
|
-
def LoginPage -> any {
|
|
112
|
-
has username: str = "";
|
|
113
|
-
has password: str = "";
|
|
114
|
-
has error: str = "";
|
|
115
|
-
navigate = useNavigate();
|
|
116
|
-
|
|
117
|
-
async def handleLogin(e: any) -> None {
|
|
118
|
-
e.preventDefault();
|
|
119
|
-
error = "";
|
|
120
|
-
if not username or not password {
|
|
121
|
-
error = "Please fill in all fields";
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
success = await jacLogin(username, password);
|
|
125
|
-
if success {
|
|
126
|
-
navigate("/dashboard");
|
|
127
|
-
} else {
|
|
128
|
-
error = "Invalid credentials";
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
def handleUsernameChange(e: any) -> None {
|
|
133
|
-
username = e.target.value;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
def handlePasswordChange(e: any) -> None {
|
|
137
|
-
password = e.target.value;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
errorDisplay = None;
|
|
141
|
-
if error {
|
|
142
|
-
errorDisplay = <div
|
|
143
|
-
style={{"color": "#dc2626", "fontSize": "14px", "marginBottom": "12px"}}
|
|
144
|
-
>
|
|
145
|
-
{error}
|
|
146
|
-
</div>;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return <div
|
|
150
|
-
style={{
|
|
151
|
-
"minHeight": "calc(100vh - 56px)",
|
|
152
|
-
"display": "flex",
|
|
153
|
-
"alignItems": "center",
|
|
154
|
-
"justifyContent": "center",
|
|
155
|
-
"background": "#f5f5f5"
|
|
156
|
-
}}
|
|
157
|
-
>
|
|
158
|
-
<div
|
|
159
|
-
style={{
|
|
160
|
-
"background": "#ffffff",
|
|
161
|
-
"padding": "32px",
|
|
162
|
-
"borderRadius": "8px",
|
|
163
|
-
"width": "300px",
|
|
164
|
-
"boxShadow": "0 2px 8px rgba(0,0,0,0.1)"
|
|
165
|
-
}}
|
|
166
|
-
>
|
|
167
|
-
<h2
|
|
168
|
-
style={{"marginBottom": "24px", "textAlign": "center"}}
|
|
169
|
-
>
|
|
170
|
-
Login
|
|
171
|
-
</h2>
|
|
172
|
-
<form
|
|
173
|
-
onSubmit={handleLogin}
|
|
174
|
-
>
|
|
175
|
-
<input
|
|
176
|
-
type="text"
|
|
177
|
-
value={username}
|
|
178
|
-
onChange={handleUsernameChange}
|
|
179
|
-
placeholder="Username"
|
|
180
|
-
style={{
|
|
181
|
-
"width": "100%",
|
|
182
|
-
"padding": "10px",
|
|
183
|
-
"marginBottom": "12px",
|
|
184
|
-
"border": "1px solid #ddd",
|
|
185
|
-
"borderRadius": "4px",
|
|
186
|
-
"boxSizing": "border-box"
|
|
187
|
-
}}
|
|
188
|
-
/>
|
|
189
|
-
<input
|
|
190
|
-
type="password"
|
|
191
|
-
value={password}
|
|
192
|
-
onChange={handlePasswordChange}
|
|
193
|
-
placeholder="Password"
|
|
194
|
-
style={{
|
|
195
|
-
"width": "100%",
|
|
196
|
-
"padding": "10px",
|
|
197
|
-
"marginBottom": "12px",
|
|
198
|
-
"border": "1px solid #ddd",
|
|
199
|
-
"borderRadius": "4px",
|
|
200
|
-
"boxSizing": "border-box"
|
|
201
|
-
}}
|
|
202
|
-
/>
|
|
203
|
-
{errorDisplay}
|
|
204
|
-
<button
|
|
205
|
-
type="submit"
|
|
206
|
-
style={{
|
|
207
|
-
"width": "100%",
|
|
208
|
-
"padding": "10px",
|
|
209
|
-
"background": "#667eea",
|
|
210
|
-
"color": "#ffffff",
|
|
211
|
-
"border": "none",
|
|
212
|
-
"borderRadius": "4px",
|
|
213
|
-
"cursor": "pointer",
|
|
214
|
-
"fontWeight": "600"
|
|
215
|
-
}}
|
|
216
|
-
>
|
|
217
|
-
Login
|
|
218
|
-
</button>
|
|
219
|
-
</form>
|
|
220
|
-
<p
|
|
221
|
-
style={{
|
|
222
|
-
"textAlign": "center",
|
|
223
|
-
"marginTop": "16px",
|
|
224
|
-
"fontSize": "14px"
|
|
225
|
-
}}
|
|
226
|
-
>
|
|
227
|
-
Need an account?
|
|
228
|
-
<Link to="/signup">
|
|
229
|
-
Sign up
|
|
230
|
-
</Link>
|
|
231
|
-
</p>
|
|
232
|
-
</div>
|
|
233
|
-
</div>;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
# Signup Page
|
|
237
|
-
def SignupPage -> any {
|
|
238
|
-
has username: str = "";
|
|
239
|
-
has password: str = "";
|
|
240
|
-
has error: str = "";
|
|
241
|
-
navigate = useNavigate();
|
|
242
|
-
|
|
243
|
-
async def handleSignup(e: any) -> None {
|
|
244
|
-
e.preventDefault();
|
|
245
|
-
error = "";
|
|
246
|
-
if not username or not password {
|
|
247
|
-
error = "Please fill in all fields";
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
result = await jacSignup(username, password);
|
|
251
|
-
if result["success"] {
|
|
252
|
-
navigate("/dashboard");
|
|
253
|
-
} else {
|
|
254
|
-
error = result["error"] if result["error"] else "Signup failed";
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
def handleUsernameChange(e: any) -> None {
|
|
259
|
-
username = e.target.value;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
def handlePasswordChange(e: any) -> None {
|
|
263
|
-
password = e.target.value;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
errorDisplay = None;
|
|
267
|
-
if error {
|
|
268
|
-
errorDisplay = <div
|
|
269
|
-
style={{"color": "#dc2626", "fontSize": "14px", "marginBottom": "12px"}}
|
|
270
|
-
>
|
|
271
|
-
{error}
|
|
272
|
-
</div>;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
return <div
|
|
276
|
-
style={{
|
|
277
|
-
"minHeight": "calc(100vh - 56px)",
|
|
278
|
-
"display": "flex",
|
|
279
|
-
"alignItems": "center",
|
|
280
|
-
"justifyContent": "center",
|
|
281
|
-
"background": "#f5f5f5"
|
|
282
|
-
}}
|
|
283
|
-
>
|
|
284
|
-
<div
|
|
285
|
-
style={{
|
|
286
|
-
"background": "#ffffff",
|
|
287
|
-
"padding": "32px",
|
|
288
|
-
"borderRadius": "8px",
|
|
289
|
-
"width": "300px",
|
|
290
|
-
"boxShadow": "0 2px 8px rgba(0,0,0,0.1)"
|
|
291
|
-
}}
|
|
292
|
-
>
|
|
293
|
-
<h2
|
|
294
|
-
style={{"marginBottom": "24px", "textAlign": "center"}}
|
|
295
|
-
>
|
|
296
|
-
Sign Up
|
|
297
|
-
</h2>
|
|
298
|
-
<form
|
|
299
|
-
onSubmit={handleSignup}
|
|
300
|
-
>
|
|
301
|
-
<input
|
|
302
|
-
type="text"
|
|
303
|
-
value={username}
|
|
304
|
-
onChange={handleUsernameChange}
|
|
305
|
-
placeholder="Username"
|
|
306
|
-
style={{
|
|
307
|
-
"width": "100%",
|
|
308
|
-
"padding": "10px",
|
|
309
|
-
"marginBottom": "12px",
|
|
310
|
-
"border": "1px solid #ddd",
|
|
311
|
-
"borderRadius": "4px",
|
|
312
|
-
"boxSizing": "border-box"
|
|
313
|
-
}}
|
|
314
|
-
/>
|
|
315
|
-
<input
|
|
316
|
-
type="password"
|
|
317
|
-
value={password}
|
|
318
|
-
onChange={handlePasswordChange}
|
|
319
|
-
placeholder="Password"
|
|
320
|
-
style={{
|
|
321
|
-
"width": "100%",
|
|
322
|
-
"padding": "10px",
|
|
323
|
-
"marginBottom": "12px",
|
|
324
|
-
"border": "1px solid #ddd",
|
|
325
|
-
"borderRadius": "4px",
|
|
326
|
-
"boxSizing": "border-box"
|
|
327
|
-
}}
|
|
328
|
-
/>
|
|
329
|
-
{errorDisplay}
|
|
330
|
-
<button
|
|
331
|
-
type="submit"
|
|
332
|
-
style={{
|
|
333
|
-
"width": "100%",
|
|
334
|
-
"padding": "10px",
|
|
335
|
-
"background": "#667eea",
|
|
336
|
-
"color": "#ffffff",
|
|
337
|
-
"border": "none",
|
|
338
|
-
"borderRadius": "4px",
|
|
339
|
-
"cursor": "pointer",
|
|
340
|
-
"fontWeight": "600"
|
|
341
|
-
}}
|
|
342
|
-
>
|
|
343
|
-
Sign Up
|
|
344
|
-
</button>
|
|
345
|
-
</form>
|
|
346
|
-
<p
|
|
347
|
-
style={{
|
|
348
|
-
"textAlign": "center",
|
|
349
|
-
"marginTop": "16px",
|
|
350
|
-
"fontSize": "14px"
|
|
351
|
-
}}
|
|
352
|
-
>
|
|
353
|
-
Have an account?
|
|
354
|
-
<Link to="/login">
|
|
355
|
-
Login
|
|
356
|
-
</Link>
|
|
357
|
-
</p>
|
|
358
|
-
</div>
|
|
359
|
-
</div>;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
# Dashboard Page (Protected Route)
|
|
363
|
-
def DashboardPage -> any {
|
|
364
|
-
# Check if user is logged in, redirect if not
|
|
365
|
-
if not jacIsLoggedIn() {
|
|
366
|
-
return <Navigate to="/login" />;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
return <div
|
|
370
|
-
style={{
|
|
371
|
-
"minHeight": "calc(100vh - 56px)",
|
|
372
|
-
"padding": "40px 20px",
|
|
373
|
-
"background": "#f5f5f5"
|
|
374
|
-
}}
|
|
375
|
-
>
|
|
376
|
-
<div
|
|
377
|
-
style={{
|
|
378
|
-
"maxWidth": "800px",
|
|
379
|
-
"margin": "0 auto",
|
|
380
|
-
"background": "#ffffff",
|
|
381
|
-
"padding": "40px",
|
|
382
|
-
"borderRadius": "8px",
|
|
383
|
-
"boxShadow": "0 2px 8px rgba(0,0,0,0.1)"
|
|
384
|
-
}}
|
|
385
|
-
>
|
|
386
|
-
<h1
|
|
387
|
-
style={{"marginBottom": "16px"}}
|
|
388
|
-
>
|
|
389
|
-
🎉 Welcome to Your Dashboard
|
|
390
|
-
</h1>
|
|
391
|
-
<p
|
|
392
|
-
style={{"color": "#666", "lineHeight": "1.6"}}
|
|
393
|
-
>
|
|
394
|
-
You are now logged in and can access protected content.
|
|
395
|
-
</p>
|
|
396
|
-
<p
|
|
397
|
-
style={{"color": "#666", "lineHeight": "1.6", "marginTop": "16px"}}
|
|
398
|
-
>
|
|
399
|
-
This is a simple dashboard page demonstrating authenticationwith React Router in Jac. You can add your own content and functionality here.
|
|
400
|
-
</p>
|
|
401
|
-
<div
|
|
402
|
-
style={{
|
|
403
|
-
"marginTop": "24px",
|
|
404
|
-
"padding": "16px",
|
|
405
|
-
"background": "#f0f9ff",
|
|
406
|
-
"borderRadius": "4px",
|
|
407
|
-
"border": "1px solid #bae6fd"
|
|
408
|
-
}}
|
|
409
|
-
>
|
|
410
|
-
<h3
|
|
411
|
-
style={{"marginBottom": "8px", "color": "#0369a1"}}
|
|
412
|
-
>
|
|
413
|
-
Protected Route Demo
|
|
414
|
-
</h3>
|
|
415
|
-
<p
|
|
416
|
-
style={{"color": "#0c4a6e", "fontSize": "14px"}}
|
|
417
|
-
>
|
|
418
|
-
This page is only accessible to authenticated users. Try logging outand accessing this page - you'll be redirected to the login page!
|
|
419
|
-
</p>
|
|
420
|
-
</div>
|
|
421
|
-
</div>
|
|
422
|
-
</div>;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
# Home/Landing Page - auto-redirect based on auth status
|
|
426
|
-
def HomePage -> any {
|
|
427
|
-
if jacIsLoggedIn() {
|
|
428
|
-
return <Navigate to="/dashboard" />;
|
|
429
|
-
}
|
|
430
|
-
return <Navigate to="/login" />;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
# Main App with React Router
|
|
434
|
-
def:pub app -> any {
|
|
435
|
-
return <Router>
|
|
436
|
-
<div
|
|
437
|
-
style={{
|
|
438
|
-
"fontFamily": "system-ui, -apple-system, sans-serif",
|
|
439
|
-
"minHeight": "100vh"
|
|
440
|
-
}}
|
|
441
|
-
>
|
|
442
|
-
<Navigation />
|
|
443
|
-
<Routes>
|
|
444
|
-
<Route
|
|
445
|
-
path="/"
|
|
446
|
-
element={<HomePage />}
|
|
447
|
-
/>
|
|
448
|
-
<Route
|
|
449
|
-
path="/login"
|
|
450
|
-
element={<LoginPage />}
|
|
451
|
-
/>
|
|
452
|
-
<Route
|
|
453
|
-
path="/signup"
|
|
454
|
-
element={<SignupPage />}
|
|
455
|
-
/>
|
|
456
|
-
<Route
|
|
457
|
-
path="/dashboard"
|
|
458
|
-
element={<DashboardPage />}
|
|
459
|
-
/>
|
|
460
|
-
</Routes>
|
|
461
|
-
</div>
|
|
462
|
-
</Router>;
|
|
463
|
-
}
|
|
464
|
-
}
|