create-better-t-stack 3.1.7 → 3.1.8-canary.932e5243

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.
Files changed (26) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/{src-DeOVz-ZI.js → src-EpWSiOd8.js} +51 -13
  4. package/package.json +1 -1
  5. package/templates/auth/better-auth/convex/backend/convex/auth.ts.hbs +10 -2
  6. package/templates/auth/better-auth/convex/native/base/lib/auth-client.ts.hbs +19 -0
  7. package/templates/auth/better-auth/convex/native/nativewind/components/sign-in.tsx.hbs +86 -0
  8. package/templates/auth/better-auth/convex/native/nativewind/components/sign-up.tsx.hbs +97 -0
  9. package/templates/auth/better-auth/convex/native/unistyles/components/sign-in.tsx.hbs +127 -0
  10. package/templates/auth/better-auth/convex/native/unistyles/components/sign-up.tsx.hbs +145 -0
  11. package/templates/auth/better-auth/native/{native-base → base}/lib/auth-client.ts.hbs +3 -2
  12. package/templates/auth/better-auth/web/react/next/src/app/dashboard/page.tsx.hbs +11 -0
  13. package/templates/frontend/native/nativewind/app/(drawer)/index.tsx.hbs +151 -100
  14. package/templates/frontend/native/nativewind/app/_layout.tsx.hbs +21 -0
  15. package/templates/frontend/native/unistyles/app/(drawer)/index.tsx.hbs +201 -91
  16. package/templates/frontend/native/unistyles/app/_layout.tsx.hbs +28 -0
  17. /package/templates/frontend/native/{native-base → base}/assets/images/android-icon-background.png +0 -0
  18. /package/templates/frontend/native/{native-base → base}/assets/images/android-icon-foreground.png +0 -0
  19. /package/templates/frontend/native/{native-base → base}/assets/images/android-icon-monochrome.png +0 -0
  20. /package/templates/frontend/native/{native-base → base}/assets/images/favicon.png +0 -0
  21. /package/templates/frontend/native/{native-base → base}/assets/images/icon.png +0 -0
  22. /package/templates/frontend/native/{native-base → base}/assets/images/partial-react-logo.png +0 -0
  23. /package/templates/frontend/native/{native-base → base}/assets/images/react-logo.png +0 -0
  24. /package/templates/frontend/native/{native-base → base}/assets/images/react-logo@2x.png +0 -0
  25. /package/templates/frontend/native/{native-base → base}/assets/images/react-logo@3x.png +0 -0
  26. /package/templates/frontend/native/{native-base → base}/assets/images/splash-icon.png +0 -0
@@ -1,13 +1,24 @@
1
1
  import { redirect } from "next/navigation";
2
2
  import Dashboard from "./dashboard";
3
3
  import { headers } from "next/headers";
4
+ {{#if (eq backend "self")}}
4
5
  import { auth } from "@{{projectName}}/auth";
6
+ {{/if}}
5
7
  import { authClient } from "@/lib/auth-client";
6
8
 
7
9
  export default async function DashboardPage() {
10
+ {{#if (eq backend "self")}}
8
11
  const session = await auth.api.getSession({
9
12
  headers: await headers(),
10
13
  });
14
+ {{else}}
15
+ const session = await authClient.getSession({
16
+ fetchOptions: {
17
+ headers: await headers(),
18
+ throw: true
19
+ }
20
+ });
21
+ {{/if}}
11
22
 
12
23
  if (!session?.user) {
13
24
  redirect("/login");
@@ -1,4 +1,4 @@
1
- import { View, Text, ScrollView } from "react-native";
1
+ import { View, Text, ScrollView, TouchableOpacity } from "react-native";
2
2
  import { Container } from "@/components/container";
3
3
  {{#if (eq api "orpc")}}
4
4
  import { useQuery } from "@tanstack/react-query";
@@ -16,112 +16,163 @@ import { api } from "@{{ projectName }}/backend/convex/_generated/api";
16
16
  import { useUser } from "@clerk/clerk-expo";
17
17
  import { SignOutButton } from "@/components/sign-out-button";
18
18
  {{else}}
19
+ {{#if (eq auth "better-auth")}}
20
+ import { useConvexAuth, useQuery } from "convex/react";
21
+ import { api } from "@{{ projectName }}/backend/convex/_generated/api";
22
+ import { authClient } from "@/lib/auth-client";
23
+ import { SignIn } from "@/components/sign-in";
24
+ import { SignUp } from "@/components/sign-up";
25
+ {{else}}
19
26
  import { useQuery } from "convex/react";
20
27
  import { api } from "@{{ projectName }}/backend/convex/_generated/api";
21
28
  {{/if}}
22
29
  {{/if}}
30
+ {{/if}}
23
31
 
24
32
  export default function Home() {
25
- {{#if (eq api "orpc")}}
26
- const healthCheck = useQuery(orpc.healthCheck.queryOptions());
27
- {{/if}}
28
- {{#if (eq api "trpc")}}
29
- const healthCheck = useQuery(trpc.healthCheck.queryOptions());
30
- {{/if}}
31
- {{#if (eq backend "convex")}}
32
- {{#if (eq auth "clerk")}}
33
- const { user } = useUser();
34
- const healthCheck = useQuery(api.healthCheck.get);
35
- const privateData = useQuery(api.privateData.get);
36
- {{else}}
37
- const healthCheck = useQuery(api.healthCheck.get);
38
- {{/if}}
39
- {{/if}}
33
+ {{#if (eq api "orpc")}}
34
+ const healthCheck = useQuery(orpc.healthCheck.queryOptions());
35
+ {{/if}}
36
+ {{#if (eq api "trpc")}}
37
+ const healthCheck = useQuery(trpc.healthCheck.queryOptions());
38
+ {{/if}}
39
+ {{#if (eq backend "convex")}}
40
+ {{#if (eq auth "clerk")}}
41
+ const { user } = useUser();
42
+ const healthCheck = useQuery(api.healthCheck.get);
43
+ const privateData = useQuery(api.privateData.get);
44
+ {{else}}
45
+ {{#if (eq auth "better-auth")}}
46
+ const healthCheck = useQuery(api.healthCheck.get);
47
+ const { isAuthenticated } = useConvexAuth();
48
+ const user = useQuery(api.auth.getCurrentUser, isAuthenticated ? {} : "skip");
49
+ {{else}}
50
+ const healthCheck = useQuery(api.healthCheck.get);
51
+ {{/if}}
52
+ {{/if}}
53
+ {{/if}}
40
54
 
41
- return (
42
- <Container>
43
- <ScrollView showsVerticalScrollIndicator={false} className="flex-1">
44
- <Text className="font-mono text-foreground text-3xl font-bold mb-4">
45
- BETTER T STACK
46
- </Text>
47
- <View className="bg-card border border-border rounded-xl p-6 mb-6 shadow-sm">
48
- {{#if (eq backend "convex")}}
49
- <View className="flex-row items-center gap-3">
50
- <View
51
- className={`h-3 w-3 rounded-full ${
52
- healthCheck ? "bg-green-500" : "bg-orange-500"
53
- }`}
54
- />
55
- <View className="flex-1">
56
- <Text className="text-sm font-medium text-card-foreground">
57
- Convex
58
- </Text>
59
- <Text className="text-xs text-muted-foreground">
60
- {healthCheck === undefined
61
- ? "Checking connection..."
62
- : healthCheck === "OK"
63
- ? "All systems operational"
64
- : "Service unavailable"}
65
- </Text>
66
- </View>
55
+ return (
56
+ <Container>
57
+ <ScrollView className="flex-1">
58
+ <View className="px-4">
59
+ <Text className="font-mono text-foreground text-3xl font-bold mb-4">
60
+ BETTER T STACK
61
+ </Text>
62
+ <View className="bg-card border border-border rounded-xl p-6 mb-6 shadow-sm">
63
+ {{#if (eq backend "convex")}}
64
+ {{#unless (eq auth "better-auth")}}
65
+ <View className="flex-row items-center gap-3">
66
+ <View className={`h-3 w-3 rounded-full ${ healthCheck ? "bg-green-500" : "bg-orange-500" }`} />
67
+ <View className="flex-1">
68
+ <Text className="text-sm font-medium text-card-foreground">
69
+ Convex
70
+ </Text>
71
+ <Text className="text-xs text-muted-foreground">
72
+ {healthCheck === undefined
73
+ ? "Checking connection..."
74
+ : healthCheck === "OK"
75
+ ? "All systems operational"
76
+ : "Service unavailable"}
77
+ </Text>
78
+ </View>
79
+ </View>
80
+ {{/unless}}
81
+ {{else}}
82
+ {{#unless (eq api "none")}}
83
+ <View className="flex-row items-center gap-3">
84
+ <View className={`h-3 w-3 rounded-full ${ healthCheck.data ? "bg-green-500" : "bg-orange-500" }`} />
85
+ <View className="flex-1">
86
+ <Text className="text-sm font-medium text-card-foreground">
87
+ {{#if (eq api "orpc")}}
88
+ ORPC
89
+ {{/if}}
90
+ {{#if (eq api "trpc")}}
91
+ TRPC
92
+ {{/if}}
93
+ </Text>
94
+ <Text className="text-xs text-muted-foreground">
95
+ {{#if (eq api "orpc")}}
96
+ {healthCheck.isLoading
97
+ ? "Checking connection..."
98
+ : healthCheck.data
99
+ ? "All systems operational"
100
+ : "Service unavailable"}
101
+ {{/if}}
102
+ {{#if (eq api "trpc")}}
103
+ {healthCheck.isLoading
104
+ ? "Checking connection..."
105
+ : healthCheck.data
106
+ ? "All systems operational"
107
+ : "Service unavailable"}
108
+ {{/if}}
109
+ </Text>
67
110
  </View>
68
- {{else}}
69
- {{#unless (eq api "none")}}
70
- <View className="flex-row items-center gap-3">
71
- <View
72
- className={`h-3 w-3 rounded-full ${
73
- healthCheck.data ? "bg-green-500" : "bg-orange-500"
74
- }`}
75
- />
76
- <View className="flex-1">
77
- <Text className="text-sm font-medium text-card-foreground">
78
- {{#if (eq api "orpc")}}
79
- ORPC
80
- {{/if}}
81
- {{#if (eq api "trpc")}}
82
- TRPC
83
- {{/if}}
84
- </Text>
85
- <Text className="text-xs text-muted-foreground">
86
- {{#if (eq api "orpc")}}
87
- {healthCheck.isLoading
88
- ? "Checking connection..."
89
- : healthCheck.data
90
- ? "All systems operational"
91
- : "Service unavailable"}
92
- {{/if}}
93
- {{#if (eq api "trpc")}}
94
- {healthCheck.isLoading
95
- ? "Checking connection..."
96
- : healthCheck.data
97
- ? "All systems operational"
98
- : "Service unavailable"}
99
- {{/if}}
100
- </Text>
101
- </View>
102
- </View>
103
- {{/unless}}
104
- {{/if}}
105
111
  </View>
106
- {{#if (and (eq backend "convex") (eq auth "clerk"))}}
107
- <Authenticated>
108
- <Text>Hello {user?.emailAddresses[0].emailAddress}</Text>
109
- <Text>Private Data: {privateData?.message}</Text>
110
- <SignOutButton />
111
- </Authenticated>
112
- <Unauthenticated>
113
- <Link href="/(auth)/sign-in">
114
- <Text>Sign in</Text>
115
- </Link>
116
- <Link href="/(auth)/sign-up">
117
- <Text>Sign up</Text>
118
- </Link>
119
- </Unauthenticated>
120
- <AuthLoading>
121
- <Text>Loading...</Text>
122
- </AuthLoading>
112
+ {{/unless}}
123
113
  {{/if}}
124
- </ScrollView>
125
- </Container>
126
- );
127
- }
114
+ </View>
115
+ {{#if (and (eq backend "convex") (eq auth "clerk"))}}
116
+ <Authenticated>
117
+ <Text>Hello {user?.emailAddresses[0].emailAddress}</Text>
118
+ <Text>Private Data: {privateData?.message}</Text>
119
+ <SignOutButton />
120
+ </Authenticated>
121
+ <Unauthenticated>
122
+ <Link href="/(auth)/sign-in">
123
+ <Text>Sign in</Text>
124
+ </Link>
125
+ <Link href="/(auth)/sign-up">
126
+ <Text>Sign up</Text>
127
+ </Link>
128
+ </Unauthenticated>
129
+ <AuthLoading>
130
+ <Text>Loading...</Text>
131
+ </AuthLoading>
132
+ {{/if}}
133
+ {{#if (and (eq backend "convex") (eq auth "better-auth"))}}
134
+ {user ? (
135
+ <View className="mb-6 p-4 bg-card rounded-lg border border-border">
136
+ <View className="flex-row justify-between items-center mb-2">
137
+ <Text className="text-foreground text-base">
138
+ Welcome,{" "}
139
+ <Text className="font-medium">{user.name}</Text>
140
+ </Text>
141
+ </View>
142
+ <Text className="text-muted-foreground text-sm mb-4">
143
+ {user.email}
144
+ </Text>
145
+
146
+ <TouchableOpacity className="bg-destructive py-2 px-4 rounded-md self-start" onPress={()=> {
147
+ authClient.signOut();
148
+ }}
149
+ >
150
+ <Text className="text-white font-medium">Sign Out</Text>
151
+ </TouchableOpacity>
152
+ </View>
153
+ ) : null}
154
+ <View className="mb-6 rounded-lg border border-border p-4">
155
+ <Text className="mb-3 font-medium text-foreground">API Status</Text>
156
+ <View className="flex-row items-center gap-2">
157
+ <View className={`h-3 w-3 rounded-full ${healthCheck ? "bg-green-500" : "bg-red-500" }`} />
158
+ <Text className="text-muted-foreground">
159
+ {healthCheck === undefined
160
+ ? "Checking..."
161
+ : healthCheck === "OK"
162
+ ? "Connected to API"
163
+ : "API Disconnected"}
164
+ </Text>
165
+ </View>
166
+ </View>
167
+ {!user && (
168
+ <>
169
+ <SignIn />
170
+ <SignUp />
171
+ </>
172
+ )}
173
+ {{/if}}
174
+ </View>
175
+ </ScrollView>
176
+ </Container>
177
+ );
178
+ }
@@ -2,7 +2,13 @@
2
2
  import "@/polyfills";
3
3
  {{/if}}
4
4
  {{#if (eq backend "convex")}}
5
+ {{#if (eq auth "better-auth")}}
6
+ import { ConvexReactClient } from "convex/react";
7
+ import { ConvexBetterAuthProvider } from "@convex-dev/better-auth/react";
8
+ import { authClient } from "@/lib/auth-client";
9
+ {{else}}
5
10
  import { ConvexProvider, ConvexReactClient } from "convex/react";
11
+ {{/if}}
6
12
  {{#if (eq auth "clerk")}}
7
13
  import { ClerkProvider, useAuth } from "@clerk/clerk-expo";
8
14
  import { ConvexProviderWithClerk } from "convex/react-clerk";
@@ -98,6 +104,21 @@ export default function RootLayout() {
98
104
  </ThemeProvider>
99
105
  </ConvexProviderWithClerk>
100
106
  </ClerkProvider>
107
+ {{else if (eq auth "better-auth")}}
108
+ <ConvexBetterAuthProvider client={convex} authClient={authClient}>
109
+ <ThemeProvider value={isDarkColorScheme ? DARK_THEME : LIGHT_THEME}>
110
+ <StatusBar style={isDarkColorScheme ? "light" : "dark"} />
111
+ <GestureHandlerRootView style=\{{ flex: 1 }}>
112
+ <Stack>
113
+ <Stack.Screen name="(drawer)" options=\{{ headerShown: false }} />
114
+ <Stack.Screen
115
+ name="modal"
116
+ options=\{{ title: "Modal", presentation: "modal" }}
117
+ />
118
+ </Stack>
119
+ </GestureHandlerRootView>
120
+ </ThemeProvider>
121
+ </ConvexBetterAuthProvider>
101
122
  {{else}}
102
123
  <ConvexProvider client={convex}>
103
124
  <ThemeProvider value={isDarkColorScheme ? DARK_THEME : LIGHT_THEME}>
@@ -1,4 +1,4 @@
1
- import { ScrollView, Text, View } from "react-native";
1
+ import { ScrollView, Text, View, TouchableOpacity } from "react-native";
2
2
  import { StyleSheet } from "react-native-unistyles";
3
3
  import { Container } from "@/components/container";
4
4
 
@@ -11,33 +11,47 @@ import { useQuery } from "@tanstack/react-query";
11
11
  import { trpc } from "@/utils/trpc";
12
12
  {{/if}}
13
13
  {{#if (eq backend "convex")}}
14
- {{#if (eq auth "clerk")}}
15
- import { Link } from "expo-router";
16
- import { Authenticated, AuthLoading, Unauthenticated, useQuery } from "convex/react";
17
- import { api } from "@{{ projectName }}/backend/convex/_generated/api";
18
- import { useUser } from "@clerk/clerk-expo";
19
- import { SignOutButton } from "@/components/sign-out-button";
20
- {{else}}
21
- import { useQuery } from "convex/react";
22
- import { api } from "@{{ projectName }}/backend/convex/_generated/api";
23
- {{/if}}
14
+ {{#if (eq auth "clerk")}}
15
+ import { Link } from "expo-router";
16
+ import { Authenticated, AuthLoading, Unauthenticated, useQuery } from "convex/react";
17
+ import { api } from "@{{ projectName }}/backend/convex/_generated/api";
18
+ import { useUser } from "@clerk/clerk-expo";
19
+ import { SignOutButton } from "@/components/sign-out-button";
20
+ {{else}}
21
+ {{#if (eq auth "better-auth")}}
22
+ import { useConvexAuth, useQuery } from "convex/react";
23
+ import { api } from "@{{ projectName }}/backend/convex/_generated/api";
24
+ import { authClient } from "@/lib/auth-client";
25
+ import { SignIn } from "@/components/sign-in";
26
+ import { SignUp } from "@/components/sign-up";
27
+ {{else}}
28
+ import { useQuery } from "convex/react";
29
+ import { api } from "@{{ projectName }}/backend/convex/_generated/api";
30
+ {{/if}}
31
+ {{/if}}
24
32
  {{/if}}
25
33
 
26
34
  export default function Home() {
27
35
  {{#if (eq api "orpc")}}
28
- const healthCheck = useQuery(orpc.healthCheck.queryOptions());
36
+ const healthCheck = useQuery(orpc.healthCheck.queryOptions());
29
37
  {{/if}}
30
38
  {{#if (eq api "trpc")}}
31
- const healthCheck = useQuery(trpc.healthCheck.queryOptions());
39
+ const healthCheck = useQuery(trpc.healthCheck.queryOptions());
32
40
  {{/if}}
33
41
  {{#if (eq backend "convex")}}
34
- {{#if (eq auth "clerk")}}
35
- const { user } = useUser();
36
- const healthCheck = useQuery(api.healthCheck.get);
37
- const privateData = useQuery(api.privateData.get);
38
- {{else}}
39
- const healthCheck = useQuery(api.healthCheck.get);
40
- {{/if}}
42
+ {{#if (eq auth "clerk")}}
43
+ const { user } = useUser();
44
+ const healthCheck = useQuery(api.healthCheck.get);
45
+ const privateData = useQuery(api.privateData.get);
46
+ {{else}}
47
+ {{#if (eq auth "better-auth")}}
48
+ const healthCheck = useQuery(api.healthCheck.get);
49
+ const { isAuthenticated } = useConvexAuth();
50
+ const user = useQuery(api.auth.getCurrentUser, isAuthenticated ? {} : "skip");
51
+ {{else}}
52
+ const healthCheck = useQuery(api.healthCheck.get);
53
+ {{/if}}
54
+ {{/if}}
41
55
  {{/if}}
42
56
 
43
57
  return (
@@ -54,86 +68,125 @@ export default function Home() {
54
68
  <Text style={styles.statusBadgeText}>LIVE</Text>
55
69
  </View>
56
70
  </View>
57
-
58
71
  {{#if (eq backend "convex")}}
59
- <View style={styles.statusRow}>
60
- <View
61
- style={[
62
- styles.statusDot,
63
- healthCheck === "OK"
64
- ? styles.statusDotSuccess
65
- : styles.statusDotWarning,
66
- ]}
67
- />
68
- <View style={styles.statusContent}>
69
- <Text style={styles.statusLabel}>Convex</Text>
70
- <Text style={styles.statusDescription}>
71
- {healthCheck === undefined
72
- ? "Checking connection..."
73
- : healthCheck === "OK"
74
- ? "All systems operational"
75
- : "Service unavailable"}
76
- </Text>
77
- </View>
78
- </View>
72
+ {{#unless (eq auth "better-auth")}}
73
+ <View style={styles.statusRow}>
74
+ <View
75
+ style={[
76
+ styles.statusDot,
77
+ healthCheck === "OK"
78
+ ? styles.statusDotSuccess
79
+ : styles.statusDotWarning,
80
+ ]}
81
+ />
82
+ <View style={styles.statusContent}>
83
+ <Text style={styles.statusLabel}>Convex</Text>
84
+ <Text style={styles.statusDescription}>
85
+ {healthCheck === undefined
86
+ ? "Checking connection..."
87
+ : healthCheck === "OK"
88
+ ? "All systems operational"
89
+ : "Service unavailable"}
90
+ </Text>
91
+ </View>
92
+ </View>
93
+ {{/unless}}
79
94
  {{else}}
80
95
  {{#unless (eq api "none")}}
81
- <View style={styles.statusRow}>
96
+ <View style={styles.statusRow}>
97
+ <View
98
+ style={[
99
+ styles.statusDot,
100
+ healthCheck.data
101
+ ? styles.statusDotSuccess
102
+ : styles.statusDotWarning,
103
+ ]}
104
+ />
105
+ <View style={styles.statusContent}>
106
+ <Text style={styles.statusLabel}>
107
+ {{#if (eq api "orpc")}}ORPC{{/if}}
108
+ {{#if (eq api "trpc")}}TRPC{{/if}}
109
+ </Text>
110
+ <Text style={styles.statusDescription}>
111
+ {(healthCheck.isLoading)
112
+ ? "Checking connection..."
113
+ : healthCheck.data
114
+ ? "All systems operational"
115
+ : "Service unavailable"}
116
+ </Text>
117
+ </View>
118
+ </View>
119
+ {{/unless}}
120
+ {{/if}}
121
+ </View>
122
+ {{#if (and (eq backend "convex") (eq auth "clerk"))}}
123
+ <Authenticated>
124
+ <Text>
125
+ Hello {user?.emailAddresses[0].emailAddress}
126
+ </Text>
127
+ <Text>
128
+ Private Data: {privateData?.message}
129
+ </Text>
130
+ <SignOutButton />
131
+ </Authenticated>
132
+ <Unauthenticated>
133
+ <Link href="/(auth)/sign-in">
134
+ <Text>Sign in</Text>
135
+ </Link>
136
+ <Link href="/(auth)/sign-up">
137
+ <Text>Sign up</Text>
138
+ </Link>
139
+ </Unauthenticated>
140
+ <AuthLoading>
141
+ <Text>Loading...</Text>
142
+ </AuthLoading>
143
+ {{/if}}
144
+ {{#if (and (eq backend "convex") (eq auth "better-auth"))}}
145
+ {user ? (
146
+ <View style={styles.userCard}>
147
+ <View style={styles.userHeader}>
148
+ <Text style={styles.userWelcome}>
149
+ Welcome,{" "}
150
+ <Text style={styles.userName}>{user.name}</Text>
151
+ </Text>
152
+ </View>
153
+ <Text style={styles.userEmail}>{user.email}</Text>
154
+ <TouchableOpacity
155
+ style={styles.signOutButton}
156
+ onPress={() => {
157
+ authClient.signOut();
158
+ }}
159
+ >
160
+ <Text style={styles.signOutText}>Sign Out</Text>
161
+ </TouchableOpacity>
162
+ </View>
163
+ ) : null}
164
+ <View style={styles.apiStatusCard}>
165
+ <Text style={styles.apiStatusTitle}>API Status</Text>
166
+ <View style={styles.apiStatusRow}>
82
167
  <View
83
168
  style={[
84
169
  styles.statusDot,
85
- healthCheck.data
170
+ healthCheck === "OK"
86
171
  ? styles.statusDotSuccess
87
172
  : styles.statusDotWarning,
88
173
  ]}
89
174
  />
90
- <View style={styles.statusContent}>
91
- <Text style={styles.statusLabel}>
92
- {{#if (eq api "orpc")}}
93
- ORPC
94
- {{/if}}
95
- {{#if (eq api "trpc")}}
96
- TRPC
97
- {{/if}}
98
- </Text>
99
- <Text style={styles.statusDescription}>
100
- {{#if (eq api "orpc")}}
101
- {healthCheck.isLoading
102
- ? "Checking connection..."
103
- : healthCheck.data
104
- ? "All systems operational"
105
- : "Service unavailable"}
106
- {{/if}}
107
- {{#if (eq api "trpc")}}
108
- {healthCheck.isLoading
109
- ? "Checking connection..."
110
- : healthCheck.data
111
- ? "All systems operational"
112
- : "Service unavailable"}
113
- {{/if}}
114
- </Text>
115
- </View>
175
+ <Text style={styles.apiStatusText}>
176
+ {healthCheck === undefined
177
+ ? "Checking..."
178
+ : healthCheck === "OK"
179
+ ? "Connected to API"
180
+ : "API Disconnected"}
181
+ </Text>
116
182
  </View>
117
- {{/unless}}
118
- {{/if}}
119
- </View>
120
- {{#if (and (eq backend "convex") (eq auth "clerk"))}}
121
- <Authenticated>
122
- <Text>Hello {user?.emailAddresses[0].emailAddress}</Text>
123
- <Text>Private Data: {privateData?.message}</Text>
124
- <SignOutButton />
125
- </Authenticated>
126
- <Unauthenticated>
127
- <Link href="/(auth)/sign-in">
128
- <Text>Sign in</Text>
129
- </Link>
130
- <Link href="/(auth)/sign-up">
131
- <Text>Sign up</Text>
132
- </Link>
133
- </Unauthenticated>
134
- <AuthLoading>
135
- <Text>Loading...</Text>
136
- </AuthLoading>
183
+ </View>
184
+ {!user && (
185
+ <>
186
+ <SignIn />
187
+ <SignUp />
188
+ </>
189
+ )}
137
190
  {{/if}}
138
191
  </ScrollView>
139
192
  </Container>
@@ -220,5 +273,62 @@ const styles = StyleSheet.create((theme) => ({
220
273
  statusDescription: {
221
274
  fontSize: theme.fontSize.xs,
222
275
  color: theme.colors.mutedForeground,
223
- }
224
- }));
276
+ },
277
+ userCard: {
278
+ backgroundColor: theme.colors.card,
279
+ borderWidth: 1,
280
+ borderColor: theme.colors.border,
281
+ borderRadius: theme.borderRadius.lg,
282
+ padding: theme.spacing.md,
283
+ marginBottom: theme.spacing.md,
284
+ },
285
+ userHeader: {
286
+ flexDirection: "row",
287
+ justifyContent: "space-between",
288
+ alignItems: "center",
289
+ marginBottom: theme.spacing.xs,
290
+ },
291
+ userWelcome: {
292
+ fontSize: theme.fontSize.base,
293
+ color: theme.colors.foreground,
294
+ },
295
+ userName: {
296
+ fontWeight: "500",
297
+ },
298
+ userEmail: {
299
+ fontSize: theme.fontSize.sm,
300
+ color: theme.colors.mutedForeground,
301
+ marginBottom: theme.spacing.md,
302
+ },
303
+ signOutButton: {
304
+ backgroundColor: theme.colors.destructive,
305
+ paddingVertical: theme.spacing.sm,
306
+ paddingHorizontal: theme.spacing.md,
307
+ borderRadius: theme.borderRadius.md,
308
+ alignSelf: "flex-start",
309
+ },
310
+ signOutText: {
311
+ color: theme.colors.destructiveForeground,
312
+ fontWeight: "500",
313
+ },
314
+ apiStatusCard: {
315
+ marginBottom: theme.spacing.md,
316
+ borderRadius: theme.borderRadius.lg,
317
+ borderWidth: 1,
318
+ borderColor: theme.colors.border,
319
+ padding: theme.spacing.md,
320
+ },
321
+ apiStatusTitle: {
322
+ marginBottom: theme.spacing.sm,
323
+ fontWeight: "500",
324
+ color: theme.colors.foreground,
325
+ },
326
+ apiStatusRow: {
327
+ flexDirection: "row",
328
+ alignItems: "center",
329
+ gap: theme.spacing.xs,
330
+ },
331
+ apiStatusText: {
332
+ color: theme.colors.mutedForeground,
333
+ },
334
+ }));