create-croissant 0.1.43 → 0.1.45
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/dist/add.js +25 -0
- package/dist/index.js +20 -7
- package/package.json +5 -4
- package/template/.expo/README.md +13 -0
- package/template/.expo/devices.json +3 -0
- package/template/apps/desktop/.eslintcache +1 -0
- package/template/apps/mobile/app/(tabs)/_layout.tsx +21 -14
- package/template/apps/mobile/app/(tabs)/account.tsx +147 -0
- package/template/apps/mobile/app/(tabs)/explore.tsx +334 -104
- package/template/apps/mobile/app/(tabs)/index.tsx +102 -85
- package/template/apps/mobile/app/_layout.tsx +26 -7
- package/template/apps/mobile/app/index.tsx +136 -0
- package/template/apps/mobile/app/login.tsx +135 -0
- package/template/apps/mobile/app/signup.tsx +144 -0
- package/template/apps/mobile/app.json +3 -3
- package/template/apps/mobile/components/ui/button.tsx +86 -0
- package/template/apps/mobile/components/ui/input.tsx +56 -0
- package/template/apps/mobile/lib/auth-client.ts +14 -0
- package/template/apps/mobile/lib/orpc.ts +23 -0
- package/template/apps/mobile/package.json +17 -2
- package/template/apps/mobile/tsconfig.json +4 -1
- package/template/apps/platform/package.json +2 -1
- package/template/apps/platform/src/components/login-form.tsx +5 -4
- package/template/apps/platform/src/components/signup-form.tsx +12 -16
- package/template/apps/platform/src/routeTree.gen.ts +267 -264
- package/template/apps/platform/src/routes/__root.tsx +6 -2
- package/template/apps/platform/src/routes/_auth/account.tsx +13 -17
- package/template/apps/platform/src/routes/_auth/examples/client-orpc-auth.tsx +2 -6
- package/template/apps/platform/src/routes/_public/examples/client-orpc.tsx +16 -29
- package/template/apps/platform/src/routes/_public/examples/ssr-orpc.tsx +10 -14
- package/template/apps/platform/src/routes/api/auth/$.ts +23 -2
- package/template/apps/platform/src/routes/api/rpc.$.ts +18 -0
- package/template/package.json +2 -4
- package/template/packages/orpc/package.json +7 -1
- package/template/packages/orpc/src/lib/planets.ts +18 -18
- package/template/packages/orpc/src/lib/router.ts +3 -3
- package/template/packages/orpc/src/react/context.tsx +23 -0
- package/template/packages/orpc/src/react/general.ts +29 -0
- package/template/packages/orpc/src/react/index.ts +3 -0
- package/template/packages/orpc/src/react/planets.ts +90 -0
- package/template/tsconfig.json +2 -1
- package/template/apps/mobile/app/modal.tsx +0 -29
|
@@ -1,114 +1,344 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Alert,
|
|
4
|
+
FlatList,
|
|
5
|
+
Modal,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
Text,
|
|
8
|
+
View,
|
|
9
|
+
ActivityIndicator,
|
|
10
|
+
ScrollView,
|
|
11
|
+
} from "react-native";
|
|
12
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
13
|
+
import { useForm } from "@tanstack/react-form";
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
import { Button } from "@/components/ui/button";
|
|
16
|
+
import { Input } from "@/components/ui/input";
|
|
17
|
+
import { usePlanets, useCreatePlanet, useUpdatePlanet, useDeletePlanet } from "@workspace/orpc/react";
|
|
18
|
+
|
|
19
|
+
const planetSchema = z.object({
|
|
20
|
+
name: z.string().min(1, "Name is required"),
|
|
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 default function ExploreScreen() {
|
|
31
|
+
const [modalVisible, setModalVisible] = useState(false);
|
|
32
|
+
const [editingId, setEditingId] = useState<number | null>(null);
|
|
33
|
+
|
|
34
|
+
const { data: planets = [], isLoading } = usePlanets();
|
|
35
|
+
|
|
36
|
+
const form = useForm({
|
|
37
|
+
defaultValues: {
|
|
38
|
+
name: "",
|
|
39
|
+
description: "",
|
|
40
|
+
distance: "0",
|
|
41
|
+
diameter: "0",
|
|
42
|
+
},
|
|
43
|
+
validators: {
|
|
44
|
+
onChange: planetSchema,
|
|
45
|
+
},
|
|
46
|
+
onSubmit: async ({ value }) => {
|
|
47
|
+
const payload = {
|
|
48
|
+
name: value.name,
|
|
49
|
+
description: value.description || undefined,
|
|
50
|
+
distanceFromSun: parseFloat(value.distance) || 0,
|
|
51
|
+
diameter: parseFloat(value.diameter) || 0,
|
|
52
|
+
hasRings: false,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
if (editingId) {
|
|
57
|
+
await updateMutation.mutateAsync({ id: editingId, ...payload });
|
|
58
|
+
} else {
|
|
59
|
+
await createMutation.mutateAsync(payload);
|
|
60
|
+
}
|
|
61
|
+
closeModal();
|
|
62
|
+
} catch (err) {
|
|
63
|
+
// Error handled in mutation callbacks
|
|
23
64
|
}
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const resetForm = () => {
|
|
69
|
+
form.reset();
|
|
70
|
+
setEditingId(null);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const createMutation = useCreatePlanet({
|
|
74
|
+
onSuccess: () => {
|
|
75
|
+
Alert.alert("Success", "Planet added successfully");
|
|
76
|
+
},
|
|
77
|
+
onError: (err) => {
|
|
78
|
+
Alert.alert("Error", err.message || "Failed to add planet");
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const updateMutation = useUpdatePlanet({
|
|
83
|
+
onSuccess: () => {
|
|
84
|
+
Alert.alert("Success", "Planet updated successfully");
|
|
85
|
+
},
|
|
86
|
+
onError: (err) => {
|
|
87
|
+
Alert.alert("Error", err.message || "Failed to update planet");
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const deleteMutation = useDeletePlanet({
|
|
92
|
+
onSuccess: () => {
|
|
93
|
+
Alert.alert("Success", "Planet deleted successfully");
|
|
94
|
+
},
|
|
95
|
+
onError: (err) => {
|
|
96
|
+
Alert.alert("Error", err.message || "Failed to delete planet");
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const handleEdit = (planet: any) => {
|
|
101
|
+
setEditingId(planet.id);
|
|
102
|
+
form.setFieldValue("name", planet.name);
|
|
103
|
+
form.setFieldValue("description", planet.description || "");
|
|
104
|
+
form.setFieldValue("distance", planet.distanceFromSun.toString());
|
|
105
|
+
form.setFieldValue("diameter", planet.diameter.toString());
|
|
106
|
+
setModalVisible(true);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const handleDelete = (id: number) => {
|
|
110
|
+
deleteMutation.mutateAsync({id})
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const closeModal = () => {
|
|
114
|
+
setModalVisible(false);
|
|
115
|
+
resetForm();
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
if (isLoading) {
|
|
119
|
+
return (
|
|
120
|
+
<View style={styles.center}>
|
|
121
|
+
<ActivityIndicator size="large" color="#000" />
|
|
122
|
+
</View>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<View style={styles.container}>
|
|
128
|
+
<FlatList
|
|
129
|
+
data={planets}
|
|
130
|
+
keyExtractor={(item) => item.id.toString()}
|
|
131
|
+
contentContainerStyle={styles.listContent}
|
|
132
|
+
renderItem={({ item }) => (
|
|
133
|
+
<View style={styles.planetCard}>
|
|
134
|
+
<View style={styles.planetInfo}>
|
|
135
|
+
<Text style={styles.planetName}>{item.name}</Text>
|
|
136
|
+
<Text style={styles.planetDesc}>{item.description}</Text>
|
|
137
|
+
<Text style={styles.planetDetails}>
|
|
138
|
+
Distance: {item.distanceFromSun} AU • Diameter: {item.diameter} km
|
|
139
|
+
</Text>
|
|
140
|
+
</View>
|
|
141
|
+
<View style={styles.actions}>
|
|
142
|
+
<Button
|
|
143
|
+
variant="outline"
|
|
144
|
+
onPress={() => handleEdit(item)}
|
|
145
|
+
style={styles.actionBtn}
|
|
146
|
+
>
|
|
147
|
+
Edit
|
|
148
|
+
</Button>
|
|
149
|
+
<Button
|
|
150
|
+
variant="destructive"
|
|
151
|
+
onPress={() => handleDelete(item.id)}
|
|
152
|
+
style={styles.actionBtn}
|
|
153
|
+
>
|
|
154
|
+
Delete
|
|
155
|
+
</Button>
|
|
156
|
+
</View>
|
|
157
|
+
</View>
|
|
158
|
+
)}
|
|
159
|
+
ListEmptyComponent={
|
|
160
|
+
<Text style={styles.emptyText}>No planets found. Add one!</Text>
|
|
161
|
+
}
|
|
162
|
+
/>
|
|
163
|
+
|
|
164
|
+
<Button
|
|
165
|
+
onPress={() => setModalVisible(true)}
|
|
166
|
+
style={styles.fab}
|
|
167
|
+
>
|
|
168
|
+
Add Planet
|
|
169
|
+
</Button>
|
|
170
|
+
|
|
171
|
+
<Modal
|
|
172
|
+
visible={modalVisible}
|
|
173
|
+
animationType="slide"
|
|
174
|
+
onRequestClose={closeModal}
|
|
175
|
+
>
|
|
176
|
+
<View style={styles.modalContainer}>
|
|
177
|
+
<ScrollView contentContainerStyle={styles.modalContent}>
|
|
178
|
+
<Text style={styles.modalTitle}>
|
|
179
|
+
{editingId ? "Edit Planet" : "Add New Planet"}
|
|
180
|
+
</Text>
|
|
181
|
+
|
|
182
|
+
<form.Field name="name">
|
|
183
|
+
{(field: any) => (
|
|
184
|
+
<Input
|
|
185
|
+
label="Name"
|
|
186
|
+
value={field.state.value}
|
|
187
|
+
onChangeText={field.handleChange}
|
|
188
|
+
placeholder="Earth"
|
|
189
|
+
error={field.state.meta.errors?.[0]?.toString()}
|
|
190
|
+
/>
|
|
191
|
+
)}
|
|
192
|
+
</form.Field>
|
|
193
|
+
|
|
194
|
+
<form.Field name="description">
|
|
195
|
+
{(field: any) => (
|
|
196
|
+
<Input
|
|
197
|
+
label="Description"
|
|
198
|
+
value={field.state.value}
|
|
199
|
+
onChangeText={field.handleChange}
|
|
200
|
+
placeholder="The blue planet"
|
|
201
|
+
/>
|
|
202
|
+
)}
|
|
203
|
+
</form.Field>
|
|
204
|
+
|
|
205
|
+
<form.Field name="distance">
|
|
206
|
+
{(field: any) => (
|
|
207
|
+
<Input
|
|
208
|
+
label="Distance from Sun (AU)"
|
|
209
|
+
value={field.state.value}
|
|
210
|
+
onChangeText={field.handleChange}
|
|
211
|
+
keyboardType="numeric"
|
|
212
|
+
error={field.state.meta.errors?.[0]?.toString()}
|
|
213
|
+
/>
|
|
214
|
+
)}
|
|
215
|
+
</form.Field>
|
|
216
|
+
|
|
217
|
+
<form.Field name="diameter">
|
|
218
|
+
{(field: any) => (
|
|
219
|
+
<Input
|
|
220
|
+
label="Diameter (km)"
|
|
221
|
+
value={field.state.value}
|
|
222
|
+
onChangeText={field.handleChange}
|
|
223
|
+
keyboardType="numeric"
|
|
224
|
+
error={field.state.meta.errors?.[0]?.toString()}
|
|
225
|
+
/>
|
|
226
|
+
)}
|
|
227
|
+
</form.Field>
|
|
228
|
+
|
|
229
|
+
<View style={styles.modalActions}>
|
|
230
|
+
<Button
|
|
231
|
+
variant="outline"
|
|
232
|
+
onPress={closeModal}
|
|
233
|
+
style={styles.modalBtn}
|
|
234
|
+
>
|
|
235
|
+
Cancel
|
|
236
|
+
</Button>
|
|
237
|
+
<Button
|
|
238
|
+
onPress={form.handleSubmit}
|
|
239
|
+
loading={createMutation.isPending || updateMutation.isPending}
|
|
240
|
+
style={styles.modalBtn}
|
|
241
|
+
>
|
|
242
|
+
{editingId ? "Update" : "Create"}
|
|
243
|
+
</Button>
|
|
244
|
+
</View>
|
|
245
|
+
</ScrollView>
|
|
246
|
+
</View>
|
|
247
|
+
</Modal>
|
|
248
|
+
</View>
|
|
100
249
|
);
|
|
101
250
|
}
|
|
102
251
|
|
|
103
252
|
const styles = StyleSheet.create({
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
253
|
+
container: {
|
|
254
|
+
flex: 1,
|
|
255
|
+
backgroundColor: "#fff",
|
|
256
|
+
},
|
|
257
|
+
center: {
|
|
258
|
+
flex: 1,
|
|
259
|
+
justifyContent: "center",
|
|
260
|
+
alignItems: "center",
|
|
261
|
+
},
|
|
262
|
+
listContent: {
|
|
263
|
+
padding: 16,
|
|
264
|
+
paddingBottom: 100,
|
|
265
|
+
},
|
|
266
|
+
planetCard: {
|
|
267
|
+
padding: 16,
|
|
268
|
+
borderRadius: 12,
|
|
269
|
+
borderWidth: 1,
|
|
270
|
+
borderColor: "#eee",
|
|
271
|
+
marginBottom: 16,
|
|
272
|
+
backgroundColor: "#fff",
|
|
273
|
+
shadowColor: "#000",
|
|
274
|
+
shadowOffset: { width: 0, height: 2 },
|
|
275
|
+
shadowOpacity: 0.05,
|
|
276
|
+
shadowRadius: 4,
|
|
277
|
+
elevation: 2,
|
|
278
|
+
},
|
|
279
|
+
planetInfo: {
|
|
280
|
+
marginBottom: 16,
|
|
281
|
+
},
|
|
282
|
+
planetName: {
|
|
283
|
+
fontSize: 18,
|
|
284
|
+
fontWeight: "bold",
|
|
285
|
+
marginBottom: 4,
|
|
286
|
+
},
|
|
287
|
+
planetDesc: {
|
|
288
|
+
fontSize: 14,
|
|
289
|
+
color: "#666",
|
|
290
|
+
marginBottom: 8,
|
|
291
|
+
},
|
|
292
|
+
planetDetails: {
|
|
293
|
+
fontSize: 12,
|
|
294
|
+
color: "#999",
|
|
109
295
|
},
|
|
110
|
-
|
|
296
|
+
actions: {
|
|
111
297
|
flexDirection: "row",
|
|
112
298
|
gap: 8,
|
|
113
299
|
},
|
|
300
|
+
actionBtn: {
|
|
301
|
+
flex: 1,
|
|
302
|
+
height: 36,
|
|
303
|
+
},
|
|
304
|
+
emptyText: {
|
|
305
|
+
textAlign: "center",
|
|
306
|
+
marginTop: 40,
|
|
307
|
+
color: "#999",
|
|
308
|
+
fontStyle: "italic",
|
|
309
|
+
},
|
|
310
|
+
fab: {
|
|
311
|
+
position: "absolute",
|
|
312
|
+
bottom: 24,
|
|
313
|
+
left: 24,
|
|
314
|
+
right: 24,
|
|
315
|
+
height: 56,
|
|
316
|
+
borderRadius: 28,
|
|
317
|
+
shadowColor: "#000",
|
|
318
|
+
shadowOffset: { width: 0, height: 4 },
|
|
319
|
+
shadowOpacity: 0.2,
|
|
320
|
+
shadowRadius: 8,
|
|
321
|
+
elevation: 5,
|
|
322
|
+
},
|
|
323
|
+
modalContainer: {
|
|
324
|
+
flex: 1,
|
|
325
|
+
backgroundColor: "#fff",
|
|
326
|
+
},
|
|
327
|
+
modalContent: {
|
|
328
|
+
padding: 24,
|
|
329
|
+
paddingTop: 60,
|
|
330
|
+
},
|
|
331
|
+
modalTitle: {
|
|
332
|
+
fontSize: 24,
|
|
333
|
+
fontWeight: "bold",
|
|
334
|
+
marginBottom: 32,
|
|
335
|
+
},
|
|
336
|
+
modalActions: {
|
|
337
|
+
flexDirection: "row",
|
|
338
|
+
gap: 12,
|
|
339
|
+
marginTop: 32,
|
|
340
|
+
},
|
|
341
|
+
modalBtn: {
|
|
342
|
+
flex: 1,
|
|
343
|
+
},
|
|
114
344
|
});
|
|
@@ -1,99 +1,116 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { View, Text, StyleSheet, ScrollView, TouchableOpacity, Platform } from "react-native";
|
|
3
|
+
import { useRouter } from "expo-router";
|
|
4
|
+
import { authClient } from "@/lib/auth-client";
|
|
5
|
+
import { orpc } from "@/lib/orpc";
|
|
6
|
+
import { Button } from "@/components/ui/button";
|
|
3
7
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
export default function DashboardScreen() {
|
|
9
|
+
const router = useRouter();
|
|
10
|
+
const { data: session, isPending } = authClient.useSession();
|
|
11
|
+
const [secretData, setSecretData] = useState<string>("");
|
|
12
|
+
const [loadingSecret, setLoadingSecret] = useState(false);
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (!isPending && !session) {
|
|
16
|
+
router.replace("/login");
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (session) {
|
|
21
|
+
const fetchSecret = async () => {
|
|
22
|
+
setLoadingSecret(true);
|
|
23
|
+
try {
|
|
24
|
+
const res = await orpc.getSecretData();
|
|
25
|
+
setSecretData(res.secret);
|
|
26
|
+
} catch (err: any) {
|
|
27
|
+
setSecretData("Error: " + (err.message || "Unknown error"));
|
|
28
|
+
} finally {
|
|
29
|
+
setLoadingSecret(false);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
fetchSecret();
|
|
34
|
+
}
|
|
35
|
+
}, [session, isPending, router]);
|
|
36
|
+
|
|
37
|
+
const handleSignOut = async () => {
|
|
38
|
+
await authClient.signOut();
|
|
39
|
+
router.replace("/");
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
if (isPending) {
|
|
43
|
+
return (
|
|
44
|
+
<View style={styles.center}>
|
|
45
|
+
<Text>Loading dashboard...</Text>
|
|
46
|
+
</View>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
9
49
|
|
|
10
|
-
export default function HomeScreen() {
|
|
11
50
|
return (
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<HelloWave />
|
|
24
|
-
</ThemedView>
|
|
25
|
-
<ThemedView style={styles.stepContainer}>
|
|
26
|
-
<ThemedText type="subtitle">Step 1: Try it</ThemedText>
|
|
27
|
-
<ThemedText>
|
|
28
|
-
Edit <ThemedText type="defaultSemiBold">app/(tabs)/index.tsx</ThemedText> to see changes.
|
|
29
|
-
Press{" "}
|
|
30
|
-
<ThemedText type="defaultSemiBold">
|
|
31
|
-
{Platform.select({
|
|
32
|
-
ios: "cmd + d",
|
|
33
|
-
android: "cmd + m",
|
|
34
|
-
web: "F12",
|
|
35
|
-
})}
|
|
36
|
-
</ThemedText>{" "}
|
|
37
|
-
to open developer tools.
|
|
38
|
-
</ThemedText>
|
|
39
|
-
</ThemedView>
|
|
40
|
-
<ThemedView style={styles.stepContainer}>
|
|
41
|
-
<Link href="/modal">
|
|
42
|
-
<Link.Trigger>
|
|
43
|
-
<ThemedText type="subtitle">Step 2: Explore</ThemedText>
|
|
44
|
-
</Link.Trigger>
|
|
45
|
-
<Link.Preview />
|
|
46
|
-
<Link.Menu>
|
|
47
|
-
<Link.MenuAction title="Action" icon="cube" onPress={() => alert("Action pressed")} />
|
|
48
|
-
<Link.MenuAction
|
|
49
|
-
title="Share"
|
|
50
|
-
icon="square.and.arrow.up"
|
|
51
|
-
onPress={() => alert("Share pressed")}
|
|
52
|
-
/>
|
|
53
|
-
<Link.Menu title="More" icon="ellipsis">
|
|
54
|
-
<Link.MenuAction
|
|
55
|
-
title="Delete"
|
|
56
|
-
icon="trash"
|
|
57
|
-
destructive
|
|
58
|
-
onPress={() => alert("Delete pressed")}
|
|
59
|
-
/>
|
|
60
|
-
</Link.Menu>
|
|
61
|
-
</Link.Menu>
|
|
62
|
-
</Link>
|
|
51
|
+
<ScrollView style={styles.container} contentContainerStyle={styles.content}>
|
|
52
|
+
<Text style={styles.title}>Dashboard</Text>
|
|
53
|
+
<Text style={styles.welcome}>Welcome, {session?.user?.name}!</Text>
|
|
54
|
+
<Text style={styles.description}>
|
|
55
|
+
This is a protected page. Only authenticated users can see this.
|
|
56
|
+
</Text>
|
|
57
|
+
|
|
58
|
+
<View style={styles.secureBox}>
|
|
59
|
+
<Text style={styles.secureTitle}>Secure oRPC Data:</Text>
|
|
60
|
+
<Text style={styles.secureContent}>{secretData}</Text>
|
|
61
|
+
</View>
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<ThemedView style={styles.stepContainer}>
|
|
69
|
-
<ThemedText type="subtitle">Step 3: Get a fresh start</ThemedText>
|
|
70
|
-
<ThemedText>
|
|
71
|
-
{`When you're ready, run `}
|
|
72
|
-
<ThemedText type="defaultSemiBold">npm run reset-project</ThemedText> to get a fresh{" "}
|
|
73
|
-
<ThemedText type="defaultSemiBold">app</ThemedText> directory. This will move the current{" "}
|
|
74
|
-
<ThemedText type="defaultSemiBold">app</ThemedText> to{" "}
|
|
75
|
-
<ThemedText type="defaultSemiBold">app-example</ThemedText>.
|
|
76
|
-
</ThemedText>
|
|
77
|
-
</ThemedView>
|
|
78
|
-
</ParallaxScrollView>
|
|
63
|
+
<Button variant="destructive" onPress={handleSignOut} style={styles.signOutBtn}>
|
|
64
|
+
Sign Out
|
|
65
|
+
</Button>
|
|
66
|
+
</ScrollView>
|
|
79
67
|
);
|
|
80
68
|
}
|
|
81
69
|
|
|
82
70
|
const styles = StyleSheet.create({
|
|
83
|
-
|
|
84
|
-
|
|
71
|
+
container: {
|
|
72
|
+
flex: 1,
|
|
73
|
+
backgroundColor: "#fff",
|
|
74
|
+
},
|
|
75
|
+
content: {
|
|
76
|
+
padding: 24,
|
|
77
|
+
},
|
|
78
|
+
center: {
|
|
79
|
+
flex: 1,
|
|
80
|
+
justifyContent: "center",
|
|
85
81
|
alignItems: "center",
|
|
86
|
-
gap: 8,
|
|
87
82
|
},
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
title: {
|
|
84
|
+
fontSize: 28,
|
|
85
|
+
fontWeight: "bold",
|
|
90
86
|
marginBottom: 8,
|
|
91
87
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
88
|
+
welcome: {
|
|
89
|
+
fontSize: 18,
|
|
90
|
+
marginBottom: 8,
|
|
91
|
+
},
|
|
92
|
+
description: {
|
|
93
|
+
fontSize: 14,
|
|
94
|
+
color: "#666",
|
|
95
|
+
marginBottom: 24,
|
|
96
|
+
},
|
|
97
|
+
secureBox: {
|
|
98
|
+
padding: 16,
|
|
99
|
+
backgroundColor: "#f9f9f9",
|
|
100
|
+
borderRadius: 8,
|
|
101
|
+
borderWidth: 1,
|
|
102
|
+
borderColor: "#eee",
|
|
103
|
+
marginBottom: 24,
|
|
104
|
+
},
|
|
105
|
+
secureTitle: {
|
|
106
|
+
fontWeight: "600",
|
|
107
|
+
marginBottom: 8,
|
|
108
|
+
},
|
|
109
|
+
secureContent: {
|
|
110
|
+
fontFamily: Platform.OS === "ios" ? "Courier" : "monospace",
|
|
111
|
+
fontSize: 12,
|
|
112
|
+
},
|
|
113
|
+
signOutBtn: {
|
|
114
|
+
marginTop: 12,
|
|
98
115
|
},
|
|
99
116
|
});
|