create-croissant 0.1.48 → 0.1.50
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/template/apps/desktop/electron.vite.config.ts +11 -1
- package/template/apps/desktop/package.json +19 -1
- package/template/apps/desktop/src/renderer/index.html +1 -1
- package/template/apps/desktop/src/renderer/src/components/app-sidebar.tsx +186 -0
- package/template/apps/desktop/src/renderer/src/components/login-form.tsx +154 -0
- package/template/apps/desktop/src/renderer/src/components/signup-form.tsx +201 -0
- package/template/apps/desktop/src/renderer/src/lib/auth-client.ts +3 -0
- package/template/apps/desktop/src/renderer/src/lib/orpc.ts +12 -0
- package/template/apps/desktop/src/renderer/src/main.tsx +15 -4
- package/template/apps/desktop/src/renderer/src/routeTree.gen.ts +240 -0
- package/template/apps/desktop/src/renderer/src/routes/__root.tsx +29 -0
- package/template/apps/desktop/src/renderer/src/routes/_auth/account.tsx +267 -0
- package/template/apps/desktop/src/renderer/src/routes/_auth/dashboard.tsx +46 -0
- package/template/apps/desktop/src/renderer/src/routes/_auth/examples/client-orpc-auth.tsx +35 -0
- package/template/apps/desktop/src/renderer/src/routes/_auth.tsx +35 -0
- package/template/apps/desktop/src/renderer/src/routes/_public/examples/client-orpc.tsx +306 -0
- package/template/apps/desktop/src/renderer/src/routes/_public/index.tsx +54 -0
- package/template/apps/desktop/src/renderer/src/routes/_public/login.tsx +16 -0
- package/template/apps/desktop/src/renderer/src/routes/_public/signup.tsx +16 -0
- package/template/apps/desktop/src/renderer/src/routes/_public.tsx +23 -0
- package/template/apps/desktop/tsconfig.web.json +1 -0
- package/template/apps/mobile/.vscode/extensions.json +1 -0
- package/template/apps/mobile/.vscode/settings.json +7 -0
- package/template/apps/mobile/README.md +50 -0
- package/template/apps/mobile/app/(tabs)/_layout.tsx +35 -0
- package/template/apps/mobile/app/(tabs)/explore.tsx +112 -0
- package/template/apps/mobile/app/(tabs)/index.tsx +98 -0
- package/template/apps/mobile/app/_layout.tsx +24 -0
- package/template/apps/mobile/app/modal.tsx +29 -0
- package/template/apps/mobile/app.json +48 -0
- package/template/apps/mobile/assets/images/android-icon-background.png +0 -0
- package/template/apps/mobile/assets/images/android-icon-foreground.png +0 -0
- package/template/apps/mobile/assets/images/android-icon-monochrome.png +0 -0
- package/template/apps/mobile/assets/images/favicon.png +0 -0
- package/template/apps/mobile/assets/images/icon.png +0 -0
- package/template/apps/mobile/assets/images/partial-react-logo.png +0 -0
- package/template/apps/mobile/assets/images/react-logo.png +0 -0
- package/template/apps/mobile/assets/images/react-logo@2x.png +0 -0
- package/template/apps/mobile/assets/images/react-logo@3x.png +0 -0
- package/template/apps/mobile/assets/images/splash-icon.png +0 -0
- package/template/apps/mobile/components/external-link.tsx +25 -0
- package/template/apps/mobile/components/haptic-tab.tsx +18 -0
- package/template/apps/mobile/components/hello-wave.tsx +19 -0
- package/template/apps/mobile/components/parallax-scroll-view.tsx +79 -0
- package/template/apps/mobile/components/themed-text.tsx +60 -0
- package/template/apps/mobile/components/themed-view.tsx +14 -0
- package/template/apps/mobile/components/ui/collapsible.tsx +45 -0
- package/template/apps/mobile/components/ui/icon-symbol.ios.tsx +32 -0
- package/template/apps/mobile/components/ui/icon-symbol.tsx +41 -0
- package/template/apps/mobile/constants/theme.ts +53 -0
- package/template/apps/mobile/hooks/use-color-scheme.ts +1 -0
- package/template/apps/mobile/hooks/use-color-scheme.web.ts +21 -0
- package/template/apps/mobile/hooks/use-theme-color.ts +21 -0
- package/template/apps/mobile/package.json +45 -0
- package/template/apps/mobile/scripts/reset-project.js +112 -0
- package/template/apps/mobile/tsconfig.json +20 -0
- package/template/package.json +14 -8
- package/template/packages/ui/package.json +4 -2
- package/template/pnpm-workspace.yaml +8 -0
- package/template/apps/desktop/src/renderer/src/App.tsx +0 -35
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
3
|
+
import { Check, Pencil, Plus, Trash2 } from "lucide-react";
|
|
4
|
+
import { toast } from "sonner";
|
|
5
|
+
import { useForm } from "@tanstack/react-form";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
|
|
8
|
+
import { Button } from "@workspace/ui/components/button";
|
|
9
|
+
import { Input } from "@workspace/ui/components/input";
|
|
10
|
+
import { Field, FieldError, FieldLabel } from "@workspace/ui/components/field";
|
|
11
|
+
|
|
12
|
+
import type { router } from "@workspace/orpc/router";
|
|
13
|
+
import type { InferRouterOutputs } from "@orpc/server";
|
|
14
|
+
import { usePlanets, useCreatePlanet, useUpdatePlanet, useDeletePlanet } from "@workspace/orpc/react";
|
|
15
|
+
|
|
16
|
+
type Outputs = InferRouterOutputs<typeof router>;
|
|
17
|
+
type Planet = Outputs["planets"]["getPlanets"][number];
|
|
18
|
+
|
|
19
|
+
const planetSchema = z.object({
|
|
20
|
+
name: z.string().min(1),
|
|
21
|
+
description: z.string(),
|
|
22
|
+
distance: z.string().refine((val) => !isNaN(parseFloat(val)), {
|
|
23
|
+
message: "Must be a number",
|
|
24
|
+
}),
|
|
25
|
+
diameter: z.string().refine((val) => !isNaN(parseFloat(val)), {
|
|
26
|
+
message: "Must be a number",
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const Route = createFileRoute("/_public/examples/client-orpc")({
|
|
31
|
+
component: ClientORPC,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
function ClientORPC() {
|
|
35
|
+
const [editingId, setEditingId] = React.useState<number | null>(null);
|
|
36
|
+
|
|
37
|
+
const { data: planets = [], isLoading } = usePlanets();
|
|
38
|
+
|
|
39
|
+
const form = useForm({
|
|
40
|
+
defaultValues: {
|
|
41
|
+
name: "",
|
|
42
|
+
description: "",
|
|
43
|
+
distance: "0",
|
|
44
|
+
diameter: "0",
|
|
45
|
+
},
|
|
46
|
+
validators: {
|
|
47
|
+
onChange: planetSchema,
|
|
48
|
+
},
|
|
49
|
+
onSubmit: async ({ value }) => {
|
|
50
|
+
if (editingId) {
|
|
51
|
+
await updateMutation.mutateAsync({
|
|
52
|
+
id: editingId,
|
|
53
|
+
name: value.name,
|
|
54
|
+
description: value.description,
|
|
55
|
+
distanceFromSun: parseFloat(value.distance),
|
|
56
|
+
diameter: parseFloat(value.diameter),
|
|
57
|
+
hasRings: false,
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
await createMutation.mutateAsync({
|
|
61
|
+
name: value.name,
|
|
62
|
+
description: value.description,
|
|
63
|
+
distanceFromSun: parseFloat(value.distance),
|
|
64
|
+
diameter: parseFloat(value.diameter),
|
|
65
|
+
hasRings: false,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const resetForm = () => {
|
|
72
|
+
form.reset();
|
|
73
|
+
setEditingId(null);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const createMutation = useCreatePlanet({
|
|
77
|
+
onSuccess: () => {
|
|
78
|
+
resetForm();
|
|
79
|
+
toast.success("Planet added successfully");
|
|
80
|
+
},
|
|
81
|
+
onError: (err) => {
|
|
82
|
+
toast.error(err.message || "Failed to add planet");
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const updateMutation = useUpdatePlanet({
|
|
87
|
+
onSuccess: () => {
|
|
88
|
+
resetForm();
|
|
89
|
+
toast.success("Planet updated successfully");
|
|
90
|
+
},
|
|
91
|
+
onError: (err) => {
|
|
92
|
+
toast.error(err.message || "Failed to update planet");
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const deleteMutation = useDeletePlanet({
|
|
97
|
+
onSuccess: () => {
|
|
98
|
+
toast.success("Planet deleted successfully");
|
|
99
|
+
},
|
|
100
|
+
onError: (err) => {
|
|
101
|
+
toast.error(err.message || "Failed to delete planet");
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const handleDelete = async (id: number) => {
|
|
106
|
+
if (!confirm("Are you sure you want to delete this planet?")) return;
|
|
107
|
+
await deleteMutation.mutateAsync({ id });
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const startEdit = (planet: Planet) => {
|
|
111
|
+
setEditingId(planet.id);
|
|
112
|
+
form.setFieldValue("name", planet.name);
|
|
113
|
+
form.setFieldValue("description", planet.description || "");
|
|
114
|
+
form.setFieldValue("distance", planet.distanceFromSun.toString());
|
|
115
|
+
form.setFieldValue("diameter", planet.diameter.toString());
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<div className="flex flex-col gap-8">
|
|
120
|
+
<div>
|
|
121
|
+
<h1 className="text-2xl font-bold mb-2">Client + oRPC CRUD</h1>
|
|
122
|
+
<p className="text-muted-foreground">
|
|
123
|
+
Manage planets directly from the client using TanStack Query, TanStack Form and oRPC.
|
|
124
|
+
</p>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<div className="rounded-lg border p-6 bg-muted/30 dark:bg-zinc-900/30">
|
|
128
|
+
<h2 className="font-semibold mb-4 flex items-center gap-2">
|
|
129
|
+
{editingId ? <Pencil className="h-4 w-4" /> : <Plus className="h-4 w-4" />}
|
|
130
|
+
{editingId ? "Edit Planet" : "Add New Planet"}
|
|
131
|
+
</h2>
|
|
132
|
+
<form
|
|
133
|
+
onSubmit={(e) => {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
e.stopPropagation();
|
|
136
|
+
form.handleSubmit();
|
|
137
|
+
}}
|
|
138
|
+
>
|
|
139
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
140
|
+
<form.Field
|
|
141
|
+
name="name"
|
|
142
|
+
children={(field) => (
|
|
143
|
+
<Field
|
|
144
|
+
data-invalid={field.state.meta.isTouched && field.state.meta.errors.length > 0}
|
|
145
|
+
>
|
|
146
|
+
<FieldLabel htmlFor={field.name}>Name</FieldLabel>
|
|
147
|
+
<Input
|
|
148
|
+
id={field.name}
|
|
149
|
+
name={field.name}
|
|
150
|
+
value={field.state.value}
|
|
151
|
+
onBlur={field.handleBlur}
|
|
152
|
+
onChange={(e) => field.handleChange(e.target.value)}
|
|
153
|
+
placeholder="Mars"
|
|
154
|
+
/>
|
|
155
|
+
{field.state.meta.isTouched && <FieldError errors={field.state.meta.errors} />}
|
|
156
|
+
</Field>
|
|
157
|
+
)}
|
|
158
|
+
/>
|
|
159
|
+
<form.Field
|
|
160
|
+
name="description"
|
|
161
|
+
children={(field) => (
|
|
162
|
+
<Field
|
|
163
|
+
data-invalid={field.state.meta.isTouched && field.state.meta.errors.length > 0}
|
|
164
|
+
>
|
|
165
|
+
<FieldLabel htmlFor={field.name}>Description</FieldLabel>
|
|
166
|
+
<Input
|
|
167
|
+
id={field.name}
|
|
168
|
+
name={field.name}
|
|
169
|
+
value={field.state.value}
|
|
170
|
+
onBlur={field.handleBlur}
|
|
171
|
+
onChange={(e) => field.handleChange(e.target.value)}
|
|
172
|
+
placeholder="The red planet"
|
|
173
|
+
/>
|
|
174
|
+
{field.state.meta.isTouched && <FieldError errors={field.state.meta.errors} />}
|
|
175
|
+
</Field>
|
|
176
|
+
)}
|
|
177
|
+
/>
|
|
178
|
+
<form.Field
|
|
179
|
+
name="distance"
|
|
180
|
+
children={(field) => (
|
|
181
|
+
<Field
|
|
182
|
+
data-invalid={field.state.meta.isTouched && field.state.meta.errors.length > 0}
|
|
183
|
+
>
|
|
184
|
+
<FieldLabel htmlFor={field.name}>Distance (M km)</FieldLabel>
|
|
185
|
+
<Input
|
|
186
|
+
id={field.name}
|
|
187
|
+
name={field.name}
|
|
188
|
+
type="number"
|
|
189
|
+
value={field.state.value}
|
|
190
|
+
onBlur={field.handleBlur}
|
|
191
|
+
onChange={(e) => field.handleChange(e.target.value)}
|
|
192
|
+
/>
|
|
193
|
+
{field.state.meta.isTouched && <FieldError errors={field.state.meta.errors} />}
|
|
194
|
+
</Field>
|
|
195
|
+
)}
|
|
196
|
+
/>
|
|
197
|
+
<form.Field
|
|
198
|
+
name="diameter"
|
|
199
|
+
children={(field) => (
|
|
200
|
+
<Field
|
|
201
|
+
data-invalid={field.state.meta.isTouched && field.state.meta.errors.length > 0}
|
|
202
|
+
>
|
|
203
|
+
<FieldLabel htmlFor={field.name}>Diameter (km)</FieldLabel>
|
|
204
|
+
<Input
|
|
205
|
+
id={field.name}
|
|
206
|
+
name={field.name}
|
|
207
|
+
type="number"
|
|
208
|
+
value={field.state.value}
|
|
209
|
+
onBlur={field.handleBlur}
|
|
210
|
+
onChange={(e) => field.handleChange(e.target.value)}
|
|
211
|
+
/>
|
|
212
|
+
{field.state.meta.isTouched && <FieldError errors={field.state.meta.errors} />}
|
|
213
|
+
</Field>
|
|
214
|
+
)}
|
|
215
|
+
/>
|
|
216
|
+
</div>
|
|
217
|
+
<div className="mt-6 flex gap-2">
|
|
218
|
+
<form.Subscribe
|
|
219
|
+
selector={(state) => [state.canSubmit, state.isSubmitting]}
|
|
220
|
+
children={([canSubmit, isSubmitting]) => (
|
|
221
|
+
<>
|
|
222
|
+
{editingId ? (
|
|
223
|
+
<>
|
|
224
|
+
<Button
|
|
225
|
+
type="submit"
|
|
226
|
+
className="flex items-center gap-2"
|
|
227
|
+
disabled={!canSubmit || isSubmitting || updateMutation.isPending}
|
|
228
|
+
>
|
|
229
|
+
<Check className="h-4 w-4" />{" "}
|
|
230
|
+
{isSubmitting || updateMutation.isPending ? "Saving..." : "Save Changes"}
|
|
231
|
+
</Button>
|
|
232
|
+
<Button
|
|
233
|
+
variant="outline"
|
|
234
|
+
type="button"
|
|
235
|
+
onClick={resetForm}
|
|
236
|
+
disabled={isSubmitting || updateMutation.isPending}
|
|
237
|
+
>
|
|
238
|
+
Cancel
|
|
239
|
+
</Button>
|
|
240
|
+
</>
|
|
241
|
+
) : (
|
|
242
|
+
<Button
|
|
243
|
+
type="submit"
|
|
244
|
+
className="flex items-center gap-2"
|
|
245
|
+
disabled={!canSubmit || isSubmitting || createMutation.isPending}
|
|
246
|
+
>
|
|
247
|
+
<Plus className="h-4 w-4" />{" "}
|
|
248
|
+
{isSubmitting || createMutation.isPending ? "Adding..." : "Add Planet"}
|
|
249
|
+
</Button>
|
|
250
|
+
)}
|
|
251
|
+
</>
|
|
252
|
+
)}
|
|
253
|
+
/>
|
|
254
|
+
</div>
|
|
255
|
+
</form>
|
|
256
|
+
</div>
|
|
257
|
+
|
|
258
|
+
<div className="space-y-4">
|
|
259
|
+
<h2 className="font-semibold text-lg">Current Planets</h2>
|
|
260
|
+
{isLoading ? (
|
|
261
|
+
<p>Loading planets...</p>
|
|
262
|
+
) : planets.length === 0 ? (
|
|
263
|
+
<p className="text-gray-500 italic">No planets found.</p>
|
|
264
|
+
) : (
|
|
265
|
+
<div className="grid grid-cols-1 gap-3">
|
|
266
|
+
{planets.map((planet) => (
|
|
267
|
+
<div
|
|
268
|
+
key={planet.id}
|
|
269
|
+
className="flex items-center justify-between rounded-lg border p-4 bg-background shadow-sm hover:shadow-md transition-shadow dark:bg-zinc-900"
|
|
270
|
+
>
|
|
271
|
+
<div className="flex-1">
|
|
272
|
+
<div className="flex items-center gap-2">
|
|
273
|
+
<span className="font-bold text-lg">{planet.name}</span>
|
|
274
|
+
<span className="text-xs bg-muted px-2 py-0.5 rounded-full text-muted-foreground">
|
|
275
|
+
ID: {planet.id}
|
|
276
|
+
</span>
|
|
277
|
+
</div>
|
|
278
|
+
<p className="text-sm text-muted-foreground">
|
|
279
|
+
{planet.description || "No description provided."}
|
|
280
|
+
</p>
|
|
281
|
+
<div className="mt-2 flex gap-4 text-xs text-muted-foreground font-mono">
|
|
282
|
+
<span>Distance: {planet.distanceFromSun} M km</span>
|
|
283
|
+
<span>Diameter: {planet.diameter} km</span>
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
<div className="flex gap-2 ml-4">
|
|
287
|
+
<Button variant="outline" size="icon" onClick={() => startEdit(planet)}>
|
|
288
|
+
<Pencil className="h-4 w-4" />
|
|
289
|
+
</Button>
|
|
290
|
+
<Button
|
|
291
|
+
variant="destructive"
|
|
292
|
+
size="icon"
|
|
293
|
+
onClick={() => handleDelete(planet.id)}
|
|
294
|
+
disabled={deleteMutation.isPending}
|
|
295
|
+
>
|
|
296
|
+
<Trash2 className="h-4 w-4" />
|
|
297
|
+
</Button>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
))}
|
|
301
|
+
</div>
|
|
302
|
+
)}
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
);
|
|
306
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Link, createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { Button } from "@workspace/ui/components/button";
|
|
3
|
+
import { useHello, usePlanets } from "@workspace/orpc/react";
|
|
4
|
+
|
|
5
|
+
export const Route = createFileRoute("/_public/")({
|
|
6
|
+
component: App,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
function App() {
|
|
10
|
+
const { data: helloData, isLoading: helloLoading } = useHello("Croissant Desktop");
|
|
11
|
+
const { data: planets, isLoading: planetsLoading } = usePlanets();
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div className="flex min-h-svh p-6">
|
|
15
|
+
<div className="flex max-w-lg min-w-0 flex-col gap-4 text-sm leading-loose">
|
|
16
|
+
<div>
|
|
17
|
+
<h1 className="font-medium text-2xl mb-4">Desktop Project ready!</h1>
|
|
18
|
+
<p>
|
|
19
|
+
oRPC integration: <span className="font-bold">{helloLoading ? "Loading..." : helloData?.message}</span>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<div className="mt-8">
|
|
23
|
+
<h2 className="text-xl font-semibold mb-2">Planets from Database:</h2>
|
|
24
|
+
{planetsLoading ? (
|
|
25
|
+
<p className="text-gray-500 italic">Loading planets...</p>
|
|
26
|
+
) : !planets || planets.length === 0 ? (
|
|
27
|
+
<p className="text-gray-500 italic">
|
|
28
|
+
No planets found in the database.
|
|
29
|
+
</p>
|
|
30
|
+
) : (
|
|
31
|
+
<ul className="grid grid-cols-1 gap-2">
|
|
32
|
+
{planets.map((planet) => (
|
|
33
|
+
<li key={planet.id} className="rounded-md border p-3 shadow-sm">
|
|
34
|
+
<span className="font-bold">{planet.name}</span> - {planet.description}
|
|
35
|
+
</li>
|
|
36
|
+
))}
|
|
37
|
+
</ul>
|
|
38
|
+
)}
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div className="mt-8 flex gap-2">
|
|
42
|
+
<Link to="/login">
|
|
43
|
+
<Button>Go to Login</Button>
|
|
44
|
+
</Link>
|
|
45
|
+
<Link to="/dashboard">
|
|
46
|
+
<Button variant="outline">Go to Dashboard</Button>
|
|
47
|
+
</Link>
|
|
48
|
+
</div>
|
|
49
|
+
<p className="mt-4 text-gray-500">You may now add components and start building.</p>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { LoginForm } from "@/components/login-form";
|
|
3
|
+
|
|
4
|
+
export const Route = createFileRoute("/_public/login")({
|
|
5
|
+
component: Login,
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
function Login() {
|
|
9
|
+
return (
|
|
10
|
+
<div className="flex min-h-svh items-center justify-center p-6">
|
|
11
|
+
<div className="w-full max-w-sm">
|
|
12
|
+
<LoginForm />
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { SignupForm } from "@/components/signup-form";
|
|
3
|
+
|
|
4
|
+
export const Route = createFileRoute("/_public/signup")({
|
|
5
|
+
component: Signup,
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
function Signup() {
|
|
9
|
+
return (
|
|
10
|
+
<div className="flex min-h-svh items-center justify-center p-6">
|
|
11
|
+
<div className="w-full max-w-sm">
|
|
12
|
+
<SignupForm />
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Outlet, createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { SidebarProvider, SidebarTrigger } from "@workspace/ui/components/sidebar";
|
|
3
|
+
import { PublicSidebar } from "@/components/app-sidebar";
|
|
4
|
+
|
|
5
|
+
export const Route = createFileRoute("/_public")({
|
|
6
|
+
component: PublicLayout,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
function PublicLayout() {
|
|
10
|
+
return (
|
|
11
|
+
<SidebarProvider>
|
|
12
|
+
<PublicSidebar />
|
|
13
|
+
<main className="flex flex-1 flex-col overflow-hidden">
|
|
14
|
+
<header className="flex h-16 shrink-0 items-center gap-2 border-b px-4">
|
|
15
|
+
<SidebarTrigger />
|
|
16
|
+
</header>
|
|
17
|
+
<div className="flex-1 overflow-auto p-4">
|
|
18
|
+
<Outlet />
|
|
19
|
+
</div>
|
|
20
|
+
</main>
|
|
21
|
+
</SidebarProvider>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "recommendations": ["expo.vscode-expo-tools"] }
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Welcome to your Expo app 👋
|
|
2
|
+
|
|
3
|
+
This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app).
|
|
4
|
+
|
|
5
|
+
## Get started
|
|
6
|
+
|
|
7
|
+
1. Install dependencies
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. Start the app
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx expo start
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
In the output, you'll find options to open the app in a
|
|
20
|
+
|
|
21
|
+
- [development build](https://docs.expo.dev/develop/development-builds/introduction/)
|
|
22
|
+
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
|
|
23
|
+
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
|
|
24
|
+
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo
|
|
25
|
+
|
|
26
|
+
You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).
|
|
27
|
+
|
|
28
|
+
## Get a fresh project
|
|
29
|
+
|
|
30
|
+
When you're ready, run:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm run reset-project
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.
|
|
37
|
+
|
|
38
|
+
## Learn more
|
|
39
|
+
|
|
40
|
+
To learn more about developing your project with Expo, look at the following resources:
|
|
41
|
+
|
|
42
|
+
- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
|
|
43
|
+
- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.
|
|
44
|
+
|
|
45
|
+
## Join the community
|
|
46
|
+
|
|
47
|
+
Join our community of developers creating universal apps.
|
|
48
|
+
|
|
49
|
+
- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
|
|
50
|
+
- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Tabs } from 'expo-router';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { HapticTab } from '@/components/haptic-tab';
|
|
5
|
+
import { IconSymbol } from '@/components/ui/icon-symbol';
|
|
6
|
+
import { Colors } from '@/constants/theme';
|
|
7
|
+
import { useColorScheme } from '@/hooks/use-color-scheme';
|
|
8
|
+
|
|
9
|
+
export default function TabLayout() {
|
|
10
|
+
const colorScheme = useColorScheme();
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Tabs
|
|
14
|
+
screenOptions={{
|
|
15
|
+
tabBarActiveTintColor: Colors[colorScheme ?? 'light'].tint,
|
|
16
|
+
headerShown: false,
|
|
17
|
+
tabBarButton: HapticTab,
|
|
18
|
+
}}>
|
|
19
|
+
<Tabs.Screen
|
|
20
|
+
name="index"
|
|
21
|
+
options={{
|
|
22
|
+
title: 'Home',
|
|
23
|
+
tabBarIcon: ({ color }) => <IconSymbol size={28} name="house.fill" color={color} />,
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
<Tabs.Screen
|
|
27
|
+
name="explore"
|
|
28
|
+
options={{
|
|
29
|
+
title: 'Explore',
|
|
30
|
+
tabBarIcon: ({ color }) => <IconSymbol size={28} name="paperplane.fill" color={color} />,
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</Tabs>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Image } from 'expo-image';
|
|
2
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { Collapsible } from '@/components/ui/collapsible';
|
|
5
|
+
import { ExternalLink } from '@/components/external-link';
|
|
6
|
+
import ParallaxScrollView from '@/components/parallax-scroll-view';
|
|
7
|
+
import { ThemedText } from '@/components/themed-text';
|
|
8
|
+
import { ThemedView } from '@/components/themed-view';
|
|
9
|
+
import { IconSymbol } from '@/components/ui/icon-symbol';
|
|
10
|
+
import { Fonts } from '@/constants/theme';
|
|
11
|
+
|
|
12
|
+
export default function TabTwoScreen() {
|
|
13
|
+
return (
|
|
14
|
+
<ParallaxScrollView
|
|
15
|
+
headerBackgroundColor={{ light: '#D0D0D0', dark: '#353636' }}
|
|
16
|
+
headerImage={
|
|
17
|
+
<IconSymbol
|
|
18
|
+
size={310}
|
|
19
|
+
color="#808080"
|
|
20
|
+
name="chevron.left.forwardslash.chevron.right"
|
|
21
|
+
style={styles.headerImage}
|
|
22
|
+
/>
|
|
23
|
+
}>
|
|
24
|
+
<ThemedView style={styles.titleContainer}>
|
|
25
|
+
<ThemedText
|
|
26
|
+
type="title"
|
|
27
|
+
style={{
|
|
28
|
+
fontFamily: Fonts.rounded,
|
|
29
|
+
}}>
|
|
30
|
+
Explore
|
|
31
|
+
</ThemedText>
|
|
32
|
+
</ThemedView>
|
|
33
|
+
<ThemedText>This app includes example code to help you get started.</ThemedText>
|
|
34
|
+
<Collapsible title="File-based routing">
|
|
35
|
+
<ThemedText>
|
|
36
|
+
This app has two screens:{' '}
|
|
37
|
+
<ThemedText type="defaultSemiBold">app/(tabs)/index.tsx</ThemedText> and{' '}
|
|
38
|
+
<ThemedText type="defaultSemiBold">app/(tabs)/explore.tsx</ThemedText>
|
|
39
|
+
</ThemedText>
|
|
40
|
+
<ThemedText>
|
|
41
|
+
The layout file in <ThemedText type="defaultSemiBold">app/(tabs)/_layout.tsx</ThemedText>{' '}
|
|
42
|
+
sets up the tab navigator.
|
|
43
|
+
</ThemedText>
|
|
44
|
+
<ExternalLink href="https://docs.expo.dev/router/introduction">
|
|
45
|
+
<ThemedText type="link">Learn more</ThemedText>
|
|
46
|
+
</ExternalLink>
|
|
47
|
+
</Collapsible>
|
|
48
|
+
<Collapsible title="Android, iOS, and web support">
|
|
49
|
+
<ThemedText>
|
|
50
|
+
You can open this project on Android, iOS, and the web. To open the web version, press{' '}
|
|
51
|
+
<ThemedText type="defaultSemiBold">w</ThemedText> in the terminal running this project.
|
|
52
|
+
</ThemedText>
|
|
53
|
+
</Collapsible>
|
|
54
|
+
<Collapsible title="Images">
|
|
55
|
+
<ThemedText>
|
|
56
|
+
For static images, you can use the <ThemedText type="defaultSemiBold">@2x</ThemedText> and{' '}
|
|
57
|
+
<ThemedText type="defaultSemiBold">@3x</ThemedText> suffixes to provide files for
|
|
58
|
+
different screen densities
|
|
59
|
+
</ThemedText>
|
|
60
|
+
<Image
|
|
61
|
+
source={require('@/assets/images/react-logo.png')}
|
|
62
|
+
style={{ width: 100, height: 100, alignSelf: 'center' }}
|
|
63
|
+
/>
|
|
64
|
+
<ExternalLink href="https://reactnative.dev/docs/images">
|
|
65
|
+
<ThemedText type="link">Learn more</ThemedText>
|
|
66
|
+
</ExternalLink>
|
|
67
|
+
</Collapsible>
|
|
68
|
+
<Collapsible title="Light and dark mode components">
|
|
69
|
+
<ThemedText>
|
|
70
|
+
This template has light and dark mode support. The{' '}
|
|
71
|
+
<ThemedText type="defaultSemiBold">useColorScheme()</ThemedText> hook lets you inspect
|
|
72
|
+
what the user's current color scheme is, and so you can adjust UI colors accordingly.
|
|
73
|
+
</ThemedText>
|
|
74
|
+
<ExternalLink href="https://docs.expo.dev/develop/user-interface/color-themes/">
|
|
75
|
+
<ThemedText type="link">Learn more</ThemedText>
|
|
76
|
+
</ExternalLink>
|
|
77
|
+
</Collapsible>
|
|
78
|
+
<Collapsible title="Animations">
|
|
79
|
+
<ThemedText>
|
|
80
|
+
This template includes an example of an animated component. The{' '}
|
|
81
|
+
<ThemedText type="defaultSemiBold">components/HelloWave.tsx</ThemedText> component uses
|
|
82
|
+
the powerful{' '}
|
|
83
|
+
<ThemedText type="defaultSemiBold" style={{ fontFamily: Fonts.mono }}>
|
|
84
|
+
react-native-reanimated
|
|
85
|
+
</ThemedText>{' '}
|
|
86
|
+
library to create a waving hand animation.
|
|
87
|
+
</ThemedText>
|
|
88
|
+
{Platform.select({
|
|
89
|
+
ios: (
|
|
90
|
+
<ThemedText>
|
|
91
|
+
The <ThemedText type="defaultSemiBold">components/ParallaxScrollView.tsx</ThemedText>{' '}
|
|
92
|
+
component provides a parallax effect for the header image.
|
|
93
|
+
</ThemedText>
|
|
94
|
+
),
|
|
95
|
+
})}
|
|
96
|
+
</Collapsible>
|
|
97
|
+
</ParallaxScrollView>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const styles = StyleSheet.create({
|
|
102
|
+
headerImage: {
|
|
103
|
+
color: '#808080',
|
|
104
|
+
bottom: -90,
|
|
105
|
+
left: -35,
|
|
106
|
+
position: 'absolute',
|
|
107
|
+
},
|
|
108
|
+
titleContainer: {
|
|
109
|
+
flexDirection: 'row',
|
|
110
|
+
gap: 8,
|
|
111
|
+
},
|
|
112
|
+
});
|