create-launchrail 0.0.0-stage → 0.3.1
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/README.md +39 -2
- package/THIRD_PARTY_LICENSES +43 -0
- package/bin/create-launchrail.mjs +75 -0
- package/bin/project-directory.mjs +7 -0
- package/bin/scaffold.mjs +217 -0
- package/bin/tools.mjs +62 -0
- package/bin/versions.mjs +118 -0
- package/package.json +23 -4
- package/presets/headless/web/ui/button.tsx +16 -0
- package/presets/headless/web/ui/card.tsx +25 -0
- package/template/AGENTS.md +3 -0
- package/template/README.md +3 -0
- package/template/THIRD_PARTY_LICENSES +43 -0
- package/template/apps/mobile/AGENTS.md +11 -0
- package/template/apps/mobile/App.tsx +511 -0
- package/template/apps/mobile/app.json +14 -0
- package/template/apps/mobile/components.json +22 -0
- package/template/apps/mobile/global.css +54 -0
- package/template/apps/mobile/index.ts +4 -0
- package/template/apps/mobile/metro.config.js +7 -0
- package/template/apps/mobile/package.json +47 -0
- package/template/apps/mobile/src/auth.ts +19 -0
- package/template/apps/mobile/src/components/native-controls.tsx +12 -0
- package/template/apps/mobile/src/components/ui/button.tsx +108 -0
- package/template/apps/mobile/src/components/ui/card.tsx +66 -0
- package/template/apps/mobile/src/components/ui/input.tsx +33 -0
- package/template/apps/mobile/src/components/ui/text.tsx +89 -0
- package/template/apps/mobile/src/css.d.ts +1 -0
- package/template/apps/mobile/src/lib/utils.ts +6 -0
- package/template/apps/mobile/src/query.tsx +16 -0
- package/template/apps/mobile/src/server-url.ts +20 -0
- package/template/apps/mobile/src/trpc.tsx +47 -0
- package/template/apps/mobile/src/uniwind-types.d.ts +7 -0
- package/template/apps/mobile/tsconfig.json +21 -0
- package/template/apps/web/components.json +15 -0
- package/template/apps/web/drizzle/0000_auth.sql +53 -0
- package/template/apps/web/drizzle/meta/0000_snapshot.json +374 -0
- package/template/apps/web/drizzle/meta/_journal.json +13 -0
- package/template/apps/web/drizzle.config.ts +11 -0
- package/template/apps/web/next.config.ts +11 -0
- package/template/apps/web/package.json +48 -0
- package/template/apps/web/postcss.config.mjs +3 -0
- package/template/apps/web/src/app/api/auth/[...all]/route.ts +7 -0
- package/template/apps/web/src/app/api/trpc/[trpc]/route.ts +53 -0
- package/template/apps/web/src/app/globals.css +250 -0
- package/template/apps/web/src/app/layout.tsx +31 -0
- package/template/apps/web/src/app/page.tsx +35 -0
- package/template/apps/web/src/app/starter-demo.tsx +258 -0
- package/template/apps/web/src/components/ui/button.tsx +57 -0
- package/template/apps/web/src/components/ui/card.tsx +102 -0
- package/template/apps/web/src/lib/auth-client.ts +5 -0
- package/template/apps/web/src/lib/query.tsx +23 -0
- package/template/apps/web/src/lib/trpc.tsx +29 -0
- package/template/apps/web/src/lib/utils.ts +6 -0
- package/template/apps/web/src/server/auth.ts +44 -0
- package/template/apps/web/src/server/db.ts +38 -0
- package/template/apps/web/src/server/schema.ts +87 -0
- package/template/apps/web/tsconfig.json +31 -0
- package/template/compose.yaml +18 -0
- package/template/gitignore.template +32 -0
- package/template/package.json +22 -0
- package/template/packages/api/package.json +21 -0
- package/template/packages/api/src/hello.ts +5 -0
- package/template/packages/api/src/index.ts +45 -0
- package/template/packages/api/tsconfig.json +4 -0
- package/template/pnpm-workspace.yaml +5 -0
- package/template/theme/tokens.css +40 -0
- package/template/tsconfig.base.json +14 -0
- package/template/turbo.json +12 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 shadcn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
MIT License
|
|
24
|
+
|
|
25
|
+
Copyright (c) 2025 Founded Labs
|
|
26
|
+
|
|
27
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
28
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
29
|
+
in the Software without restriction, including without limitation the rights
|
|
30
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
31
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
32
|
+
furnished to do so, subject to the following conditions:
|
|
33
|
+
|
|
34
|
+
The above copyright notice and this permission notice shall be included in all
|
|
35
|
+
copies or substantial portions of the Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
|
+
SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Expo app
|
|
2
|
+
|
|
3
|
+
Read the root [AGENTS.md](../../AGENTS.md) first. Start at `App.tsx`. Use the documentation matching the installed Expo SDK for native APIs.
|
|
4
|
+
|
|
5
|
+
/* @if trpc */
|
|
6
|
+
- Set the server origin in `src/server-url.ts`. A physical device needs an address it can reach.
|
|
7
|
+
/* @end */
|
|
8
|
+
/* @if auth */
|
|
9
|
+
- Keep the Expo scheme and the server's trusted origin in sync. Use SecureStore for session cookies.
|
|
10
|
+
/* @end */
|
|
11
|
+
- For dependency changes, run `pnpm exec expo install --check`. For a native UI or networking change, run the affected flow on a device or simulator.
|
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
/* @if trpc */
|
|
2
|
+
import { helloInput } from "@launchrail/api/hello";
|
|
3
|
+
/* @end */
|
|
4
|
+
/* @if trpc */
|
|
5
|
+
import { useQuery } from "@tanstack/react-query";
|
|
6
|
+
/* @end */
|
|
7
|
+
import { StatusBar } from "expo-status-bar";
|
|
8
|
+
/* @if mobile-demo */
|
|
9
|
+
import type { PropsWithChildren } from "react";
|
|
10
|
+
/* @end */
|
|
11
|
+
/* @if auth */
|
|
12
|
+
import { useState } from "react";
|
|
13
|
+
/* @end */
|
|
14
|
+
/* @if mobile-ui */
|
|
15
|
+
import "./global.css";
|
|
16
|
+
/* @if mobile-actions */
|
|
17
|
+
import { Button } from "./src/components/ui/button";
|
|
18
|
+
/* @end */
|
|
19
|
+
import { Card, CardContent } from "./src/components/ui/card";
|
|
20
|
+
/* @if auth */
|
|
21
|
+
import { Input } from "./src/components/ui/input";
|
|
22
|
+
/* @end */
|
|
23
|
+
import { Text } from "./src/components/ui/text";
|
|
24
|
+
import { withUniwind } from "uniwind";
|
|
25
|
+
/* @end */
|
|
26
|
+
/* @if expo-ui */
|
|
27
|
+
import { NativeControls } from "./src/components/native-controls";
|
|
28
|
+
/* @end */
|
|
29
|
+
import {
|
|
30
|
+
/* @if auth */
|
|
31
|
+
ActivityIndicator,
|
|
32
|
+
/* @end */
|
|
33
|
+
/* @if !mobile-ui */
|
|
34
|
+
/* @if mobile-actions */
|
|
35
|
+
Pressable,
|
|
36
|
+
/* @end */
|
|
37
|
+
Text,
|
|
38
|
+
/* @if auth */
|
|
39
|
+
TextInput as Input,
|
|
40
|
+
/* @end */
|
|
41
|
+
/* @end */
|
|
42
|
+
ScrollView,
|
|
43
|
+
StyleSheet,
|
|
44
|
+
View,
|
|
45
|
+
} from "react-native";
|
|
46
|
+
import {
|
|
47
|
+
SafeAreaProvider,
|
|
48
|
+
SafeAreaView,
|
|
49
|
+
} from "react-native-safe-area-context";
|
|
50
|
+
/* @if auth */
|
|
51
|
+
import { authClient } from "./src/auth";
|
|
52
|
+
/* @end */
|
|
53
|
+
/* @if trpc */
|
|
54
|
+
import { ApiProvider, useTRPC } from "./src/trpc";
|
|
55
|
+
/* @end */
|
|
56
|
+
|
|
57
|
+
/* @if !trpc */
|
|
58
|
+
/* @if query */
|
|
59
|
+
import { QueryProvider, QueryDemo } from "./src/query";
|
|
60
|
+
/* @end */
|
|
61
|
+
/* @end */
|
|
62
|
+
|
|
63
|
+
/* @if auth */
|
|
64
|
+
type SessionState = ReturnType<typeof authClient.useSession>;
|
|
65
|
+
/* @end */
|
|
66
|
+
|
|
67
|
+
/* @if trpc */
|
|
68
|
+
const hello = helloInput.parse({ name: "Expo" });
|
|
69
|
+
/* @end */
|
|
70
|
+
|
|
71
|
+
/* @if mobile-ui */
|
|
72
|
+
const ThemedSafeAreaView = withUniwind(SafeAreaView);
|
|
73
|
+
/* @end */
|
|
74
|
+
|
|
75
|
+
export default function App() {
|
|
76
|
+
/* @if auth */
|
|
77
|
+
const session = authClient.useSession();
|
|
78
|
+
/* @end */
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<SafeAreaProvider>
|
|
82
|
+
{/* @if mobile-ui */}
|
|
83
|
+
<StatusBar style="auto" />
|
|
84
|
+
<ThemedSafeAreaView className="flex-1 bg-background">
|
|
85
|
+
{/* @else */}
|
|
86
|
+
<StatusBar style="dark" />
|
|
87
|
+
<SafeAreaView style={styles.page}>
|
|
88
|
+
{/* @end */}
|
|
89
|
+
{/* @if trpc */}
|
|
90
|
+
<ApiProvider
|
|
91
|
+
{/* @if auth */}
|
|
92
|
+
key={session.data?.user.id ?? "guest"}
|
|
93
|
+
{/* @end */}
|
|
94
|
+
>
|
|
95
|
+
{/* @else */}
|
|
96
|
+
{/* @if query */}
|
|
97
|
+
<QueryProvider>
|
|
98
|
+
{/* @end */}
|
|
99
|
+
{/* @end */}
|
|
100
|
+
{/* @if auth */}
|
|
101
|
+
<Home session={session} />
|
|
102
|
+
{/* @else */}
|
|
103
|
+
<Home />
|
|
104
|
+
{/* @end */}
|
|
105
|
+
{/* @if trpc */}
|
|
106
|
+
</ApiProvider>
|
|
107
|
+
{/* @else */}
|
|
108
|
+
{/* @if query */}
|
|
109
|
+
</QueryProvider>
|
|
110
|
+
{/* @end */}
|
|
111
|
+
{/* @end */}
|
|
112
|
+
{/* @if mobile-ui */}
|
|
113
|
+
</ThemedSafeAreaView>
|
|
114
|
+
{/* @else */}
|
|
115
|
+
</SafeAreaView>
|
|
116
|
+
{/* @end */}
|
|
117
|
+
</SafeAreaProvider>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* @if auth */
|
|
122
|
+
function Home({ session }: { session: SessionState }) {
|
|
123
|
+
/* @else */
|
|
124
|
+
function Home() {
|
|
125
|
+
/* @end */
|
|
126
|
+
/* @if trpc */
|
|
127
|
+
const trpc = useTRPC();
|
|
128
|
+
const greeting = useQuery(trpc.hello.queryOptions(hello));
|
|
129
|
+
/* @end */
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<ScrollView
|
|
133
|
+
automaticallyAdjustKeyboardInsets
|
|
134
|
+
contentContainerStyle={styles.content}
|
|
135
|
+
keyboardShouldPersistTaps="handled"
|
|
136
|
+
>
|
|
137
|
+
<View style={styles.header}>
|
|
138
|
+
<Text accessibilityRole="header" style={styles.title}>
|
|
139
|
+
__PROJECT_NAME__
|
|
140
|
+
</Text>
|
|
141
|
+
<Text style={styles.description}>
|
|
142
|
+
Your native app is ready to build on.
|
|
143
|
+
</Text>
|
|
144
|
+
</View>
|
|
145
|
+
|
|
146
|
+
{/* @if auth */}
|
|
147
|
+
{session.isPending ? (
|
|
148
|
+
<ActivityIndicator accessibilityLabel="Checking your session" />
|
|
149
|
+
) : session.data ? (
|
|
150
|
+
<Account session={session} />
|
|
151
|
+
) : (
|
|
152
|
+
<AuthForm session={session} />
|
|
153
|
+
)}
|
|
154
|
+
|
|
155
|
+
{/* @end */}
|
|
156
|
+
|
|
157
|
+
{/* @if trpc */}
|
|
158
|
+
<DemoCard>
|
|
159
|
+
<Text accessibilityRole="header" style={styles.heading}>
|
|
160
|
+
API connection
|
|
161
|
+
</Text>
|
|
162
|
+
<Text
|
|
163
|
+
accessibilityRole={greeting.isError ? "alert" : undefined}
|
|
164
|
+
{/* @if mobile-ui */}
|
|
165
|
+
className={greeting.isError ? "text-destructive" : "text-muted-foreground"}
|
|
166
|
+
{/* @end */}
|
|
167
|
+
style={greeting.isError ? styles.error : styles.description}
|
|
168
|
+
>
|
|
169
|
+
{greeting.data?.greeting ?? (greeting.isPending ? "Connecting to the API…" : "API unavailable")}
|
|
170
|
+
</Text>
|
|
171
|
+
{greeting.isError && (
|
|
172
|
+
<Action
|
|
173
|
+
label="Retry connection"
|
|
174
|
+
onPress={() => void greeting.refetch()}
|
|
175
|
+
secondary
|
|
176
|
+
/>
|
|
177
|
+
)}
|
|
178
|
+
</DemoCard>
|
|
179
|
+
{/* @else */}
|
|
180
|
+
{/* @if query */}
|
|
181
|
+
<QueryDemo />
|
|
182
|
+
{/* @end */}
|
|
183
|
+
{/* @end */}
|
|
184
|
+
{/* @if mobile-ui */}
|
|
185
|
+
{/* @if !auth */}
|
|
186
|
+
{/* @if !trpc */}
|
|
187
|
+
<DemoCard>
|
|
188
|
+
<Text accessibilityRole="header" style={styles.heading}>React Native Reusables</Text>
|
|
189
|
+
<Text className="text-muted-foreground">Edit the components in src/components/ui.</Text>
|
|
190
|
+
</DemoCard>
|
|
191
|
+
{/* @end */}
|
|
192
|
+
{/* @end */}
|
|
193
|
+
{/* @end */}
|
|
194
|
+
{/* @if expo-ui */}
|
|
195
|
+
<DemoCard>
|
|
196
|
+
<Text accessibilityRole="header" style={styles.heading}>Expo UI</Text>
|
|
197
|
+
<NativeControls />
|
|
198
|
+
</DemoCard>
|
|
199
|
+
{/* @end */}
|
|
200
|
+
</ScrollView>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* @if auth */
|
|
205
|
+
function AuthForm({ session }: { session: SessionState }) {
|
|
206
|
+
const [mode, setMode] = useState<"sign-in" | "sign-up">("sign-in");
|
|
207
|
+
const [name, setName] = useState("");
|
|
208
|
+
const [email, setEmail] = useState("");
|
|
209
|
+
const [password, setPassword] = useState("");
|
|
210
|
+
const [busy, setBusy] = useState(false);
|
|
211
|
+
const [error, setError] = useState<string>();
|
|
212
|
+
const signingUp = mode === "sign-up";
|
|
213
|
+
const canSubmit =
|
|
214
|
+
!busy && !!email.trim() && !!password && (!signingUp || !!name.trim());
|
|
215
|
+
|
|
216
|
+
async function submit() {
|
|
217
|
+
if (!canSubmit) return;
|
|
218
|
+
|
|
219
|
+
setBusy(true);
|
|
220
|
+
setError(undefined);
|
|
221
|
+
try {
|
|
222
|
+
const credentials = { email: email.trim(), password };
|
|
223
|
+
const result = signingUp
|
|
224
|
+
? await authClient.signUp.email({ ...credentials, name: name.trim() })
|
|
225
|
+
: await authClient.signIn.email(credentials);
|
|
226
|
+
|
|
227
|
+
if (result.error) {
|
|
228
|
+
setError(result.error.message ?? "Authentication failed.");
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
setPassword("");
|
|
233
|
+
await session.refetch();
|
|
234
|
+
} catch {
|
|
235
|
+
setError("Could not reach the authentication server. Try again.");
|
|
236
|
+
} finally {
|
|
237
|
+
setBusy(false);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return (
|
|
242
|
+
<DemoCard>
|
|
243
|
+
<Text accessibilityRole="header" style={styles.heading}>
|
|
244
|
+
{signingUp ? "Create an account" : "Sign in"}
|
|
245
|
+
</Text>
|
|
246
|
+
{signingUp && (
|
|
247
|
+
<View style={styles.field}>
|
|
248
|
+
<Text style={styles.label}>Name</Text>
|
|
249
|
+
<Input
|
|
250
|
+
accessibilityLabel="Name"
|
|
251
|
+
autoComplete="name"
|
|
252
|
+
{/* @if !mobile-ui */}
|
|
253
|
+
style={styles.input}
|
|
254
|
+
{/* @end */}
|
|
255
|
+
value={name}
|
|
256
|
+
onChangeText={setName}
|
|
257
|
+
/>
|
|
258
|
+
</View>
|
|
259
|
+
)}
|
|
260
|
+
<View style={styles.field}>
|
|
261
|
+
<Text style={styles.label}>Email</Text>
|
|
262
|
+
<Input
|
|
263
|
+
accessibilityLabel="Email"
|
|
264
|
+
autoCapitalize="none"
|
|
265
|
+
autoComplete="email"
|
|
266
|
+
inputMode="email"
|
|
267
|
+
{/* @if !mobile-ui */}
|
|
268
|
+
style={styles.input}
|
|
269
|
+
{/* @end */}
|
|
270
|
+
value={email}
|
|
271
|
+
onChangeText={setEmail}
|
|
272
|
+
/>
|
|
273
|
+
</View>
|
|
274
|
+
<View style={styles.field}>
|
|
275
|
+
<Text style={styles.label}>Password</Text>
|
|
276
|
+
<Input
|
|
277
|
+
accessibilityLabel="Password"
|
|
278
|
+
autoComplete={signingUp ? "new-password" : "current-password"}
|
|
279
|
+
secureTextEntry
|
|
280
|
+
{/* @if !mobile-ui */}
|
|
281
|
+
style={styles.input}
|
|
282
|
+
{/* @end */}
|
|
283
|
+
value={password}
|
|
284
|
+
onChangeText={setPassword}
|
|
285
|
+
onSubmitEditing={() => void submit()}
|
|
286
|
+
/>
|
|
287
|
+
</View>
|
|
288
|
+
{error && (
|
|
289
|
+
<Text style={styles.error} accessibilityRole="alert">
|
|
290
|
+
{error}
|
|
291
|
+
</Text>
|
|
292
|
+
)}
|
|
293
|
+
<Action
|
|
294
|
+
label={busy ? "Please wait…" : signingUp ? "Create account" : "Sign in"}
|
|
295
|
+
disabled={!canSubmit}
|
|
296
|
+
onPress={() => void submit()}
|
|
297
|
+
/>
|
|
298
|
+
<Action
|
|
299
|
+
label={signingUp ? "Back to sign in" : "Create an account"}
|
|
300
|
+
secondary
|
|
301
|
+
disabled={busy}
|
|
302
|
+
onPress={() => {
|
|
303
|
+
setError(undefined);
|
|
304
|
+
setMode(signingUp ? "sign-in" : "sign-up");
|
|
305
|
+
}}
|
|
306
|
+
/>
|
|
307
|
+
</DemoCard>
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function Account({ session }: { session: SessionState }) {
|
|
312
|
+
/* @if trpc */
|
|
313
|
+
const trpc = useTRPC();
|
|
314
|
+
const account = useQuery(trpc.account.me.queryOptions());
|
|
315
|
+
/* @end */
|
|
316
|
+
const [busy, setBusy] = useState(false);
|
|
317
|
+
const [error, setError] = useState<string>();
|
|
318
|
+
|
|
319
|
+
async function signOut() {
|
|
320
|
+
setBusy(true);
|
|
321
|
+
setError(undefined);
|
|
322
|
+
try {
|
|
323
|
+
const result = await authClient.signOut();
|
|
324
|
+
if (result.error) {
|
|
325
|
+
setError(result.error.message ?? "Could not sign out.");
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
await session.refetch();
|
|
329
|
+
} catch {
|
|
330
|
+
setError("Could not sign out. Check your connection and try again.");
|
|
331
|
+
} finally {
|
|
332
|
+
setBusy(false);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return (
|
|
337
|
+
<DemoCard>
|
|
338
|
+
<Text accessibilityRole="header" style={styles.heading}>
|
|
339
|
+
Your account
|
|
340
|
+
</Text>
|
|
341
|
+
{/* @if trpc */}
|
|
342
|
+
{account.isPending ? (
|
|
343
|
+
<Text style={styles.description}>Loading account…</Text>
|
|
344
|
+
) : account.isError ? (
|
|
345
|
+
<>
|
|
346
|
+
<Text style={styles.error} accessibilityRole="alert">
|
|
347
|
+
Could not load your account.
|
|
348
|
+
</Text>
|
|
349
|
+
<Action
|
|
350
|
+
label="Retry account"
|
|
351
|
+
onPress={() => void account.refetch()}
|
|
352
|
+
secondary
|
|
353
|
+
/>
|
|
354
|
+
</>
|
|
355
|
+
) : (
|
|
356
|
+
<View style={styles.field}>
|
|
357
|
+
<Text style={styles.label}>{account.data.name}</Text>
|
|
358
|
+
<Text style={styles.description}>{account.data.email}</Text>
|
|
359
|
+
</View>
|
|
360
|
+
)}
|
|
361
|
+
{/* @else */}
|
|
362
|
+
<Text style={styles.label}>{session.data?.user.name}</Text>
|
|
363
|
+
<Text style={styles.description}>{session.data?.user.email}</Text>
|
|
364
|
+
{/* @end */}
|
|
365
|
+
{error && (
|
|
366
|
+
<Text style={styles.error} accessibilityRole="alert">
|
|
367
|
+
{error}
|
|
368
|
+
</Text>
|
|
369
|
+
)}
|
|
370
|
+
<Action
|
|
371
|
+
label={busy ? "Signing out…" : "Sign out"}
|
|
372
|
+
disabled={busy}
|
|
373
|
+
onPress={() => void signOut()}
|
|
374
|
+
/>
|
|
375
|
+
</DemoCard>
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/* @end */
|
|
380
|
+
|
|
381
|
+
/* @if mobile-demo */
|
|
382
|
+
function DemoCard({ children }: PropsWithChildren) {
|
|
383
|
+
/* @if mobile-ui */
|
|
384
|
+
return <Card><CardContent className="gap-3">{children}</CardContent></Card>;
|
|
385
|
+
/* @else */
|
|
386
|
+
return <View style={styles.card}>{children}</View>;
|
|
387
|
+
/* @end */
|
|
388
|
+
}
|
|
389
|
+
/* @end */
|
|
390
|
+
|
|
391
|
+
/* @if mobile-actions */
|
|
392
|
+
function Action({
|
|
393
|
+
label,
|
|
394
|
+
onPress,
|
|
395
|
+
disabled = false,
|
|
396
|
+
secondary = false,
|
|
397
|
+
}: {
|
|
398
|
+
label: string;
|
|
399
|
+
onPress: () => void;
|
|
400
|
+
disabled?: boolean;
|
|
401
|
+
secondary?: boolean;
|
|
402
|
+
}) {
|
|
403
|
+
/* @if mobile-ui */
|
|
404
|
+
return (
|
|
405
|
+
<Button
|
|
406
|
+
accessibilityState={{ disabled }}
|
|
407
|
+
disabled={disabled}
|
|
408
|
+
onPress={onPress}
|
|
409
|
+
size="lg"
|
|
410
|
+
variant={secondary ? "outline" : "default"}
|
|
411
|
+
>
|
|
412
|
+
<Text>{label}</Text>
|
|
413
|
+
</Button>
|
|
414
|
+
);
|
|
415
|
+
/* @else */
|
|
416
|
+
return (
|
|
417
|
+
<Pressable
|
|
418
|
+
accessibilityRole="button"
|
|
419
|
+
accessibilityState={{ disabled }}
|
|
420
|
+
disabled={disabled}
|
|
421
|
+
onPress={onPress}
|
|
422
|
+
style={({ pressed }) => [
|
|
423
|
+
styles.action,
|
|
424
|
+
secondary && styles.secondaryAction,
|
|
425
|
+
(disabled || pressed) && styles.dimmed,
|
|
426
|
+
]}
|
|
427
|
+
>
|
|
428
|
+
<Text style={[styles.actionText, secondary && styles.secondaryText]}>
|
|
429
|
+
{label}
|
|
430
|
+
</Text>
|
|
431
|
+
</Pressable>
|
|
432
|
+
);
|
|
433
|
+
/* @end */
|
|
434
|
+
}
|
|
435
|
+
/* @end */
|
|
436
|
+
|
|
437
|
+
/* @if !mobile-ui */
|
|
438
|
+
const colors = {
|
|
439
|
+
page: "#f5f6f8",
|
|
440
|
+
ink: "#13233c",
|
|
441
|
+
muted: "#4d5e73",
|
|
442
|
+
outline: "#d5dce5",
|
|
443
|
+
accent: "#174ac6",
|
|
444
|
+
error: "#a42136",
|
|
445
|
+
white: "#ffffff",
|
|
446
|
+
};
|
|
447
|
+
/* @end */
|
|
448
|
+
|
|
449
|
+
const styles = StyleSheet.create({
|
|
450
|
+
/* @if !mobile-ui */
|
|
451
|
+
page: { flex: 1, backgroundColor: colors.page },
|
|
452
|
+
/* @end */
|
|
453
|
+
content: {
|
|
454
|
+
width: "100%",
|
|
455
|
+
maxWidth: 520,
|
|
456
|
+
alignSelf: "center",
|
|
457
|
+
gap: 16,
|
|
458
|
+
padding: 24,
|
|
459
|
+
paddingBottom: 40,
|
|
460
|
+
},
|
|
461
|
+
header: { gap: 6, paddingVertical: 16 },
|
|
462
|
+
/* @if mobile-ui */
|
|
463
|
+
title: { fontSize: 34, fontWeight: "700", lineHeight: 42 },
|
|
464
|
+
description: { fontSize: 15, lineHeight: 22 },
|
|
465
|
+
heading: { fontSize: 21, fontWeight: "700", lineHeight: 28 },
|
|
466
|
+
field: { gap: 6 },
|
|
467
|
+
label: { fontSize: 15, fontWeight: "600" },
|
|
468
|
+
error: { fontSize: 14, lineHeight: 20 },
|
|
469
|
+
/* @else */
|
|
470
|
+
title: { color: colors.ink, fontSize: 34, fontWeight: "700" },
|
|
471
|
+
description: { color: colors.muted, fontSize: 15, lineHeight: 22 },
|
|
472
|
+
card: {
|
|
473
|
+
gap: 14,
|
|
474
|
+
borderRadius: 16,
|
|
475
|
+
borderWidth: 1,
|
|
476
|
+
borderColor: colors.outline,
|
|
477
|
+
padding: 18,
|
|
478
|
+
backgroundColor: colors.white,
|
|
479
|
+
},
|
|
480
|
+
heading: { color: colors.ink, fontSize: 21, fontWeight: "700" },
|
|
481
|
+
field: { gap: 6 },
|
|
482
|
+
label: { color: colors.ink, fontSize: 15, fontWeight: "600" },
|
|
483
|
+
input: {
|
|
484
|
+
minHeight: 48,
|
|
485
|
+
paddingHorizontal: 12,
|
|
486
|
+
paddingVertical: 10,
|
|
487
|
+
borderColor: colors.outline,
|
|
488
|
+
borderRadius: 8,
|
|
489
|
+
borderWidth: 1,
|
|
490
|
+
color: colors.ink,
|
|
491
|
+
fontSize: 16,
|
|
492
|
+
},
|
|
493
|
+
error: { color: colors.error, fontSize: 14, lineHeight: 20 },
|
|
494
|
+
action: {
|
|
495
|
+
minHeight: 48,
|
|
496
|
+
alignItems: "center",
|
|
497
|
+
justifyContent: "center",
|
|
498
|
+
paddingHorizontal: 12,
|
|
499
|
+
borderRadius: 8,
|
|
500
|
+
backgroundColor: colors.accent,
|
|
501
|
+
},
|
|
502
|
+
actionText: { color: colors.white, fontSize: 15, fontWeight: "700" },
|
|
503
|
+
secondaryAction: {
|
|
504
|
+
backgroundColor: colors.white,
|
|
505
|
+
borderColor: colors.outline,
|
|
506
|
+
borderWidth: 1,
|
|
507
|
+
},
|
|
508
|
+
secondaryText: { color: colors.accent },
|
|
509
|
+
dimmed: { opacity: 0.58 },
|
|
510
|
+
/* @end */
|
|
511
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"expo": {
|
|
3
|
+
"name": "Launchrail",
|
|
4
|
+
"slug": "launchrail",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"scheme": "launchrail",
|
|
7
|
+
"platforms": ["ios", "android"],
|
|
8
|
+
"userInterfaceStyle": "light",
|
|
9
|
+
"ios": {
|
|
10
|
+
"supportsTablet": true
|
|
11
|
+
},
|
|
12
|
+
"plugins": ["expo-secure-store"]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "new-york",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "global.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true
|
|
11
|
+
},
|
|
12
|
+
"aliases": {
|
|
13
|
+
"components": "@/components",
|
|
14
|
+
"ui": "@/components/ui",
|
|
15
|
+
"utils": "@/lib/utils",
|
|
16
|
+
"lib": "@/lib",
|
|
17
|
+
"hooks": "@/hooks"
|
|
18
|
+
},
|
|
19
|
+
"registries": {
|
|
20
|
+
"@rnr": "https://reactnativereusables.com/r/uniwind/{name}.json"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "uniwind";
|
|
3
|
+
@import "../../theme/tokens.css";
|
|
4
|
+
|
|
5
|
+
@theme {
|
|
6
|
+
--radius-md: calc(var(--radius-launchrail) * 0.8);
|
|
7
|
+
--radius-lg: var(--radius-launchrail);
|
|
8
|
+
--radius-xl: calc(var(--radius-launchrail) * 1.4);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@layer theme {
|
|
12
|
+
:root {
|
|
13
|
+
@variant light {
|
|
14
|
+
--color-background: var(--color-brand-light-background);
|
|
15
|
+
--color-foreground: var(--color-brand-light-foreground);
|
|
16
|
+
--color-card: var(--color-brand-light-card);
|
|
17
|
+
--color-card-foreground: var(--color-brand-light-card-foreground);
|
|
18
|
+
--color-popover: var(--color-brand-light-popover);
|
|
19
|
+
--color-popover-foreground: var(--color-brand-light-popover-foreground);
|
|
20
|
+
--color-primary: var(--color-brand-light-primary);
|
|
21
|
+
--color-primary-foreground: var(--color-brand-light-primary-foreground);
|
|
22
|
+
--color-secondary: var(--color-brand-light-secondary);
|
|
23
|
+
--color-secondary-foreground: var(--color-brand-light-secondary-foreground);
|
|
24
|
+
--color-muted: var(--color-brand-light-muted);
|
|
25
|
+
--color-muted-foreground: var(--color-brand-light-muted-foreground);
|
|
26
|
+
--color-accent: var(--color-brand-light-accent);
|
|
27
|
+
--color-accent-foreground: var(--color-brand-light-accent-foreground);
|
|
28
|
+
--color-destructive: var(--color-brand-light-destructive);
|
|
29
|
+
--color-border: var(--color-brand-light-border);
|
|
30
|
+
--color-input: var(--color-brand-light-input);
|
|
31
|
+
--color-ring: var(--color-brand-light-ring);
|
|
32
|
+
}
|
|
33
|
+
@variant dark {
|
|
34
|
+
--color-background: var(--color-brand-dark-background);
|
|
35
|
+
--color-foreground: var(--color-brand-dark-foreground);
|
|
36
|
+
--color-card: var(--color-brand-dark-card);
|
|
37
|
+
--color-card-foreground: var(--color-brand-dark-card-foreground);
|
|
38
|
+
--color-popover: var(--color-brand-dark-popover);
|
|
39
|
+
--color-popover-foreground: var(--color-brand-dark-popover-foreground);
|
|
40
|
+
--color-primary: var(--color-brand-dark-primary);
|
|
41
|
+
--color-primary-foreground: var(--color-brand-dark-primary-foreground);
|
|
42
|
+
--color-secondary: var(--color-brand-dark-secondary);
|
|
43
|
+
--color-secondary-foreground: var(--color-brand-dark-secondary-foreground);
|
|
44
|
+
--color-muted: var(--color-brand-dark-muted);
|
|
45
|
+
--color-muted-foreground: var(--color-brand-dark-muted-foreground);
|
|
46
|
+
--color-accent: var(--color-brand-dark-accent);
|
|
47
|
+
--color-accent-foreground: var(--color-brand-dark-accent-foreground);
|
|
48
|
+
--color-destructive: var(--color-brand-dark-destructive);
|
|
49
|
+
--color-border: var(--color-brand-dark-border);
|
|
50
|
+
--color-input: var(--color-brand-dark-input);
|
|
51
|
+
--color-ring: var(--color-brand-dark-ring);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|