create-disposabl-app 0.14.14 → 0.14.16
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/disposabl.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/default/AGENTS.md +1 -0
- package/dist/templates/default/apps/mobile/eslint.config.js +24 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/account-billing.tsx +15 -11
- package/dist/templates/default/packages/disposabl-kit/mobile/components/account-profile.tsx +8 -23
- package/dist/templates/default/packages/disposabl-kit/mobile/components/appearance-settings.tsx +39 -44
- package/dist/templates/default/packages/disposabl-kit/mobile/components/auth-form.tsx +20 -19
- package/dist/templates/default/packages/disposabl-kit/mobile/components/auth-ui.tsx +22 -100
- package/dist/templates/default/packages/disposabl-kit/mobile/components/email-verification.tsx +6 -6
- package/dist/templates/default/packages/disposabl-kit/mobile/components/google-button.tsx +3 -27
- package/dist/templates/default/packages/disposabl-kit/mobile/components/google-sign-in.tsx +3 -4
- package/dist/templates/default/packages/disposabl-kit/mobile/components/settings-page.tsx +12 -22
- package/dist/templates/default/packages/disposabl-kit/mobile/design/avatar.tsx +1 -1
- package/dist/templates/default/packages/disposabl-kit/mobile/design/brand-mark.tsx +2 -10
- package/dist/templates/default/packages/disposabl-kit/mobile/design/nativewind.ts +11 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/design/preferences.tsx +30 -54
- package/dist/templates/default/packages/disposabl-kit/mobile/design/primitives.tsx +17 -39
- package/dist/templates/default/packages/disposabl-kit/mobile/design/themed-text.tsx +3 -5
- package/dist/templates/default/packages/disposabl-kit/mobile/global.css +1 -56
- package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +7 -10
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/account.tsx +3 -10
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/change-password.tsx +13 -19
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/forgot-password.tsx +17 -15
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/home.tsx +75 -120
- package/dist/templates/default/packages/disposabl-kit/mobile/typography.css +59 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/updates/update-prompt.tsx +69 -96
- package/dist/templates/default/packages/tests/components/mobile-google.test.mjs +1 -1
- package/dist/templates/default/packages/tests/components/mobile-updates.test.mjs +3 -1
- package/dist/templates/default/packages/tests/mobile-styling.test.ts +64 -0
- package/package.json +1 -1
package/dist/disposabl.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
8
8
|
import { Command, CommanderError } from "commander";
|
|
9
9
|
import * as p2 from "@clack/prompts";
|
|
10
10
|
// package.json
|
|
11
|
-
var version = "0.14.
|
|
11
|
+
var version = "0.14.16";
|
|
12
12
|
|
|
13
13
|
// ../disposabl-kit/platforms.ts
|
|
14
14
|
var platforms = [
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
- Keep code concise. Aim for roughly 300 lines per source file, but this is a guideline, not a hard limit. Keep related logic together; do not split files just to meet a line count.
|
|
4
4
|
- Simplify related code with each change.
|
|
5
|
+
- Use NativeWind classes and shared theme tokens for mobile UI. Do not add StyleSheet definitions or inline layout styles. Pass measured values through NativeWind CSS variables; keep native navigation and rendering API parameters at their integration boundary.
|
|
5
6
|
|
|
6
7
|
# Testing
|
|
7
8
|
|
|
@@ -6,5 +6,29 @@ module.exports = defineConfig([
|
|
|
6
6
|
expoConfig,
|
|
7
7
|
{
|
|
8
8
|
ignores: ["dist/*"],
|
|
9
|
+
rules: {
|
|
10
|
+
"no-restricted-imports": [
|
|
11
|
+
"error",
|
|
12
|
+
{
|
|
13
|
+
paths: [
|
|
14
|
+
{
|
|
15
|
+
name: "react-native",
|
|
16
|
+
importNames: ["StyleSheet"],
|
|
17
|
+
message:
|
|
18
|
+
"Use NativeWind classes and theme tokens for mobile styling.",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
"no-restricted-syntax": [
|
|
24
|
+
"error",
|
|
25
|
+
{
|
|
26
|
+
selector:
|
|
27
|
+
"JSXOpeningElement[name.name!='StatusBar'] > JSXAttribute[name.name='style'], JSXAttribute[name.name='contentContainerStyle']",
|
|
28
|
+
message:
|
|
29
|
+
"Use className/contentContainerClassName; pass runtime values through NativeWind CSS variables.",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
9
33
|
},
|
|
10
34
|
]);
|
|
@@ -3,7 +3,7 @@ import { makeFunctionReference } from "convex/server";
|
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { AppState, Linking, Platform, Text, View } from "react-native";
|
|
5
5
|
import type { PurchasesPackage } from "react-native-purchases";
|
|
6
|
-
import { AuthButton,
|
|
6
|
+
import { AuthButton, authClasses } from "../components/auth-ui";
|
|
7
7
|
import { billingSession } from "./session";
|
|
8
8
|
import { creditQuantity } from "../../payments/config";
|
|
9
9
|
|
|
@@ -144,16 +144,16 @@ export function AccountBilling({ customerId }: { customerId: string }) {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
return (
|
|
147
|
-
<View
|
|
148
|
-
<Text
|
|
149
|
-
<Text
|
|
147
|
+
<View className={authClasses.card}>
|
|
148
|
+
<Text className={authClasses.title}>Credits</Text>
|
|
149
|
+
<Text className={authClasses.body}>
|
|
150
150
|
Available: {data?.balance ?? "unavailable"}
|
|
151
151
|
</Text>
|
|
152
|
-
<Text
|
|
152
|
+
<Text className={authClasses.body}>
|
|
153
153
|
{creditQuantity("monthly")} credits each monthly billing cycle.
|
|
154
154
|
</Text>
|
|
155
155
|
{data?.hasMonthlyPlan && (
|
|
156
|
-
<Text
|
|
156
|
+
<Text className={authClasses.body}>
|
|
157
157
|
Your monthly plan is active or scheduled.
|
|
158
158
|
</Text>
|
|
159
159
|
)}
|
|
@@ -164,9 +164,11 @@ export function AccountBilling({ customerId }: { customerId: string }) {
|
|
|
164
164
|
onPress={() => void transact(false)}
|
|
165
165
|
/>
|
|
166
166
|
) : (
|
|
167
|
-
<Text
|
|
167
|
+
<Text className={authClasses.body}>
|
|
168
|
+
Store subscriptions are unavailable.
|
|
169
|
+
</Text>
|
|
168
170
|
)}
|
|
169
|
-
<Text
|
|
171
|
+
<Text className={authClasses.body}>
|
|
170
172
|
Native top-ups are not available yet. Existing credits work here.
|
|
171
173
|
</Text>
|
|
172
174
|
<AuthButton
|
|
@@ -183,7 +185,7 @@ export function AccountBilling({ customerId }: { customerId: string }) {
|
|
|
183
185
|
onPress={() => void transact(true)}
|
|
184
186
|
/>
|
|
185
187
|
)}
|
|
186
|
-
<Text
|
|
188
|
+
<Text className={authClasses.body}>
|
|
187
189
|
Cancel or manage your subscription with the provider you originally
|
|
188
190
|
paid. For a website purchase, use Manage website billing on the website
|
|
189
191
|
pricing page.
|
|
@@ -208,9 +210,11 @@ export function AccountBilling({ customerId }: { customerId: string }) {
|
|
|
208
210
|
}}
|
|
209
211
|
/>
|
|
210
212
|
))}
|
|
211
|
-
{!!refreshError &&
|
|
213
|
+
{!!refreshError && (
|
|
214
|
+
<Text className={authClasses.body}>{refreshError}</Text>
|
|
215
|
+
)}
|
|
212
216
|
{!!message && (
|
|
213
|
-
<Text accessibilityRole="alert"
|
|
217
|
+
<Text accessibilityRole="alert" className={authClasses.body}>
|
|
214
218
|
{message}
|
|
215
219
|
</Text>
|
|
216
220
|
)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, type ReactNode } from "react";
|
|
2
|
-
import { MenuView } from "
|
|
2
|
+
import { MenuView } from "../design/nativewind";
|
|
3
3
|
import { Alert, Platform, View } from "react-native";
|
|
4
4
|
import { Avatar } from "../design/avatar";
|
|
5
5
|
import { ThemedText } from "../design/themed-text";
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
PreferenceIconButton,
|
|
9
9
|
PreferenceSection,
|
|
10
10
|
PreferenceSeparator,
|
|
11
|
-
usePreferenceColors,
|
|
12
11
|
} from "../design/preferences";
|
|
13
12
|
|
|
14
13
|
export function AccountProfile({
|
|
@@ -28,7 +27,6 @@ export function AccountProfile({
|
|
|
28
27
|
title?: string;
|
|
29
28
|
onCopyEmail?: (email: string) => Promise<void>;
|
|
30
29
|
}) {
|
|
31
|
-
const colors = usePreferenceColors();
|
|
32
30
|
const [emailVisible, setEmailVisible] = useState(false);
|
|
33
31
|
const [local, domain] = email?.split("@") ?? [];
|
|
34
32
|
const masked = local && domain ? `${local[0]}••••@${domain}` : "••••••";
|
|
@@ -36,10 +34,7 @@ export function AccountProfile({
|
|
|
36
34
|
<>
|
|
37
35
|
<View className="items-center pb-1 pt-2">
|
|
38
36
|
<Avatar name={name} source={picture} />
|
|
39
|
-
<ThemedText
|
|
40
|
-
className="mt-4 text-center"
|
|
41
|
-
style={{ color: colors.text, fontSize: 22, fontWeight: "600" }}
|
|
42
|
-
>
|
|
37
|
+
<ThemedText className="mt-4 text-center text-[#18181b] dark:text-[#fafafa] text-[22px] font-semibold">
|
|
43
38
|
{name}
|
|
44
39
|
</ThemedText>
|
|
45
40
|
</View>
|
|
@@ -54,19 +49,13 @@ export function AccountProfile({
|
|
|
54
49
|
: { ios: "person", android: "person" }
|
|
55
50
|
}
|
|
56
51
|
/>
|
|
57
|
-
<ThemedText
|
|
58
|
-
className="ml-4"
|
|
59
|
-
style={{ color: colors.text, fontSize: 17 }}
|
|
60
|
-
>
|
|
52
|
+
<ThemedText className="ml-4 text-[#18181b] dark:text-[#fafafa] text-[17px]">
|
|
61
53
|
{email ? "Email" : "Username"}
|
|
62
54
|
</ThemedText>
|
|
63
|
-
<View
|
|
64
|
-
className="ml-auto flex-row items-center gap-1"
|
|
65
|
-
style={{ flexShrink: 1, minWidth: 0 }}
|
|
66
|
-
>
|
|
55
|
+
<View className="ml-auto flex-row items-center gap-1 shrink min-w-[0px]">
|
|
67
56
|
{email && onCopyEmail ? (
|
|
68
57
|
<MenuView
|
|
69
|
-
|
|
58
|
+
className="shrink"
|
|
70
59
|
actions={[{ id: "copy", title: "Copy email" }]}
|
|
71
60
|
onPressAction={() =>
|
|
72
61
|
void onCopyEmail(email).catch(() =>
|
|
@@ -82,11 +71,11 @@ export function AccountProfile({
|
|
|
82
71
|
pointerEvents={Platform.OS === "ios" ? "none" : "auto"}
|
|
83
72
|
accessibilityRole="button"
|
|
84
73
|
accessibilityLabel="Email options"
|
|
85
|
-
|
|
74
|
+
className="min-h-[44px] justify-center"
|
|
86
75
|
>
|
|
87
76
|
<ThemedText
|
|
88
77
|
numberOfLines={1}
|
|
89
|
-
|
|
78
|
+
className="text-[#71717a] dark:text-[#a1a1aa] text-[16px]"
|
|
90
79
|
>
|
|
91
80
|
{emailVisible ? email : masked}
|
|
92
81
|
</ThemedText>
|
|
@@ -96,11 +85,7 @@ export function AccountProfile({
|
|
|
96
85
|
<ThemedText
|
|
97
86
|
selectable={emailVisible || !email}
|
|
98
87
|
numberOfLines={1}
|
|
99
|
-
|
|
100
|
-
color: colors.secondary,
|
|
101
|
-
fontSize: 16,
|
|
102
|
-
flexShrink: 1,
|
|
103
|
-
}}
|
|
88
|
+
className="text-[#71717a] dark:text-[#a1a1aa] text-[16px] shrink"
|
|
104
89
|
>
|
|
105
90
|
{email ? (emailVisible ? email : masked) : username}
|
|
106
91
|
</ThemedText>
|
package/dist/templates/default/packages/disposabl-kit/mobile/components/appearance-settings.tsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VariableContextProvider } from "nativewind";
|
|
2
|
+
import type { MenuAction } from "@expo/ui/community/menu";
|
|
3
|
+
import { MenuView } from "../design/nativewind";
|
|
2
4
|
import { SymbolView, type SymbolViewProps } from "expo-symbols";
|
|
3
5
|
import { Platform, View } from "react-native";
|
|
4
6
|
import {
|
|
@@ -78,51 +80,44 @@ function PreferenceMenu({
|
|
|
78
80
|
}) {
|
|
79
81
|
const colors = usePreferenceColors();
|
|
80
82
|
return (
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
pointerEvents={Platform.OS === "ios" ? "none" : "auto"}
|
|
94
|
-
accessibilityRole="button"
|
|
95
|
-
accessibilityLabel={`${label}: ${value}`}
|
|
96
|
-
style={{
|
|
97
|
-
minHeight: 44,
|
|
98
|
-
flexDirection: "row",
|
|
99
|
-
alignItems: "center",
|
|
100
|
-
gap: 8,
|
|
101
|
-
}}
|
|
83
|
+
<VariableContextProvider
|
|
84
|
+
value={{ "--swatch": valueColor ?? "transparent" }}
|
|
85
|
+
>
|
|
86
|
+
<PreferenceRow
|
|
87
|
+
icon={icon}
|
|
88
|
+
label={label}
|
|
89
|
+
trailing={
|
|
90
|
+
<MenuView
|
|
91
|
+
testID={`${label}-menu`}
|
|
92
|
+
className="max-w-[55%] shrink"
|
|
93
|
+
actions={actions}
|
|
94
|
+
onPressAction={({ nativeEvent }) => onSelect(nativeEvent.event)}
|
|
102
95
|
>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
<View
|
|
97
|
+
collapsable={false}
|
|
98
|
+
pointerEvents={Platform.OS === "ios" ? "none" : "auto"}
|
|
99
|
+
accessibilityRole="button"
|
|
100
|
+
accessibilityLabel={`${label}: ${value}`}
|
|
101
|
+
className="min-h-[44px] flex-row items-center gap-[8px]"
|
|
102
|
+
>
|
|
103
|
+
{valueColor && (
|
|
104
|
+
<View className="size-[14px] rounded-full bg-[var(--swatch)]" />
|
|
105
|
+
)}
|
|
106
|
+
<ThemedText className="text-[#71717a] dark:text-[#a1a1aa] text-[16px] shrink">
|
|
107
|
+
{value}
|
|
108
|
+
</ThemedText>
|
|
109
|
+
<SymbolView
|
|
110
|
+
name={{
|
|
111
|
+
ios: "chevron.up.chevron.down",
|
|
112
|
+
android: "unfold_more",
|
|
110
113
|
}}
|
|
114
|
+
size={13}
|
|
115
|
+
tintColor={colors.secondary}
|
|
111
116
|
/>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
</ThemedText>
|
|
118
|
-
<SymbolView
|
|
119
|
-
name={{ ios: "chevron.up.chevron.down", android: "unfold_more" }}
|
|
120
|
-
size={13}
|
|
121
|
-
tintColor={colors.secondary}
|
|
122
|
-
/>
|
|
123
|
-
</View>
|
|
124
|
-
</MenuView>
|
|
125
|
-
}
|
|
126
|
-
/>
|
|
117
|
+
</View>
|
|
118
|
+
</MenuView>
|
|
119
|
+
}
|
|
120
|
+
/>
|
|
121
|
+
</VariableContextProvider>
|
|
127
122
|
);
|
|
128
123
|
}
|
|
@@ -20,12 +20,11 @@ import {
|
|
|
20
20
|
} from "react-native";
|
|
21
21
|
import { api } from "../lib/convex";
|
|
22
22
|
import { authErrorMessage } from "../../lib/auth-errors";
|
|
23
|
-
import { AuthButton, AuthScreen,
|
|
23
|
+
import { AuthButton, AuthScreen, authClasses } from "./auth-ui";
|
|
24
24
|
import { GoogleSignIn } from "./google-sign-in";
|
|
25
25
|
import { BrandMark } from "../design/brand-mark";
|
|
26
26
|
|
|
27
27
|
export function AuthForm({ mode }: { mode: "login" | "signup" }) {
|
|
28
|
-
const styles = useAuthStyles();
|
|
29
28
|
const { returnTo } = useLocalSearchParams<{ returnTo?: string }>();
|
|
30
29
|
const { signIn, pending: signingIn } = useSignInWithUsernamePassword(
|
|
31
30
|
api.auth,
|
|
@@ -86,7 +85,7 @@ export function AuthForm({ mode }: { mode: "login" | "signup" }) {
|
|
|
86
85
|
if (sent)
|
|
87
86
|
return (
|
|
88
87
|
<AuthScreen>
|
|
89
|
-
<Text
|
|
88
|
+
<Text className={authClasses.title}>Check your email</Text>
|
|
90
89
|
<EmailVerification />
|
|
91
90
|
</AuthScreen>
|
|
92
91
|
);
|
|
@@ -94,10 +93,10 @@ export function AuthForm({ mode }: { mode: "login" | "signup" }) {
|
|
|
94
93
|
return (
|
|
95
94
|
<AuthScreen>
|
|
96
95
|
<BrandMark />
|
|
97
|
-
<Text
|
|
96
|
+
<Text className={authClasses.title}>
|
|
98
97
|
{isSignup ? "Create your account" : "Welcome back"}
|
|
99
98
|
</Text>
|
|
100
|
-
<Text
|
|
99
|
+
<Text className={authClasses.body}>
|
|
101
100
|
{providers?.googleOnly
|
|
102
101
|
? "Continue with your Google account."
|
|
103
102
|
: isSignup
|
|
@@ -108,18 +107,20 @@ export function AuthForm({ mode }: { mode: "login" | "signup" }) {
|
|
|
108
107
|
</Text>
|
|
109
108
|
{providers?.google && <GoogleSignIn disabled={pending} />}
|
|
110
109
|
{providers?.googleOnly && !providers.google && (
|
|
111
|
-
<Text
|
|
110
|
+
<Text className={authClasses.error}>
|
|
112
111
|
Sign-in is temporarily unavailable. Please try again later.
|
|
113
112
|
</Text>
|
|
114
113
|
)}
|
|
115
114
|
{!providers?.googleOnly && (
|
|
116
115
|
<>
|
|
117
|
-
<View
|
|
118
|
-
<Text
|
|
116
|
+
<View className={authClasses.field}>
|
|
117
|
+
<Text className={authClasses.label}>
|
|
118
|
+
{email ? "Email" : "Username"}
|
|
119
|
+
</Text>
|
|
119
120
|
<TextInput
|
|
120
121
|
accessibilityLabel={email ? "Email" : "Username"}
|
|
121
122
|
keyboardType={email ? "email-address" : "default"}
|
|
122
|
-
|
|
123
|
+
className={authClasses.input}
|
|
123
124
|
value={username}
|
|
124
125
|
onChangeText={setUsername}
|
|
125
126
|
autoCapitalize="none"
|
|
@@ -132,12 +133,12 @@ export function AuthForm({ mode }: { mode: "login" | "signup" }) {
|
|
|
132
133
|
onSubmitEditing={() => passwordInput.current?.focus()}
|
|
133
134
|
/>
|
|
134
135
|
</View>
|
|
135
|
-
<View
|
|
136
|
-
<Text
|
|
136
|
+
<View className={authClasses.field}>
|
|
137
|
+
<Text className={authClasses.label}>Password</Text>
|
|
137
138
|
<TextInput
|
|
138
139
|
ref={passwordInput}
|
|
139
140
|
accessibilityLabel="Password"
|
|
140
|
-
|
|
141
|
+
className={authClasses.input}
|
|
141
142
|
value={password}
|
|
142
143
|
onChangeText={setPassword}
|
|
143
144
|
secureTextEntry
|
|
@@ -154,12 +155,12 @@ export function AuthForm({ mode }: { mode: "login" | "signup" }) {
|
|
|
154
155
|
/>
|
|
155
156
|
</View>
|
|
156
157
|
{isSignup && (
|
|
157
|
-
<View
|
|
158
|
-
<Text
|
|
158
|
+
<View className={authClasses.field}>
|
|
159
|
+
<Text className={authClasses.label}>Confirm password</Text>
|
|
159
160
|
<TextInput
|
|
160
161
|
ref={confirmationInput}
|
|
161
162
|
accessibilityLabel="Confirm password"
|
|
162
|
-
|
|
163
|
+
className={authClasses.input}
|
|
163
164
|
value={confirmation}
|
|
164
165
|
onChangeText={setConfirmation}
|
|
165
166
|
secureTextEntry
|
|
@@ -173,12 +174,12 @@ export function AuthForm({ mode }: { mode: "login" | "signup" }) {
|
|
|
173
174
|
</View>
|
|
174
175
|
)}
|
|
175
176
|
{email && isSignup && providers && !providers.emailDelivery && (
|
|
176
|
-
<Text
|
|
177
|
+
<Text className={authClasses.error}>
|
|
177
178
|
Email signup is temporarily unavailable.
|
|
178
179
|
</Text>
|
|
179
180
|
)}
|
|
180
181
|
{error && (
|
|
181
|
-
<Text accessibilityRole="alert"
|
|
182
|
+
<Text accessibilityRole="alert" className={authClasses.error}>
|
|
182
183
|
{error}
|
|
183
184
|
</Text>
|
|
184
185
|
)}
|
|
@@ -200,7 +201,7 @@ export function AuthForm({ mode }: { mode: "login" | "signup" }) {
|
|
|
200
201
|
onPress={() => void submit()}
|
|
201
202
|
/>
|
|
202
203
|
{providers?.emailDelivery && (
|
|
203
|
-
<Link href="/(auth)/forgot-password"
|
|
204
|
+
<Link href="/(auth)/forgot-password" className={authClasses.link}>
|
|
204
205
|
Forgot password?
|
|
205
206
|
</Link>
|
|
206
207
|
)}
|
|
@@ -211,7 +212,7 @@ export function AuthForm({ mode }: { mode: "login" | "signup" }) {
|
|
|
211
212
|
pathname: isSignup ? "/(auth)/login" : "/(auth)/signup",
|
|
212
213
|
params: { returnTo },
|
|
213
214
|
}}
|
|
214
|
-
|
|
215
|
+
className={authClasses.link}
|
|
215
216
|
>
|
|
216
217
|
{isSignup
|
|
217
218
|
? "Already have an account? Log in"
|
|
@@ -5,23 +5,21 @@ import {
|
|
|
5
5
|
Platform,
|
|
6
6
|
Pressable,
|
|
7
7
|
ScrollView,
|
|
8
|
-
StyleSheet,
|
|
9
8
|
Text,
|
|
10
9
|
} from "react-native";
|
|
11
10
|
import { useHeaderHeight } from "expo-router/react-navigation";
|
|
12
11
|
import { useTheme } from "../design/use-theme";
|
|
13
12
|
|
|
14
13
|
export function AuthScreen({ children }: PropsWithChildren) {
|
|
15
|
-
const styles = useAuthStyles();
|
|
16
14
|
const headerHeight = useHeaderHeight();
|
|
17
15
|
return (
|
|
18
16
|
<KeyboardAvoidingView
|
|
19
|
-
|
|
17
|
+
className="flex-1 bg-background"
|
|
20
18
|
behavior={Platform.OS === "ios" ? "padding" : undefined}
|
|
21
19
|
keyboardVerticalOffset={headerHeight}
|
|
22
20
|
>
|
|
23
21
|
<ScrollView
|
|
24
|
-
|
|
22
|
+
contentContainerClassName={authClasses.content}
|
|
25
23
|
keyboardShouldPersistTaps="handled"
|
|
26
24
|
keyboardDismissMode="on-drag"
|
|
27
25
|
>
|
|
@@ -42,110 +40,34 @@ export function AuthButton({
|
|
|
42
40
|
disabled?: boolean;
|
|
43
41
|
pending?: boolean;
|
|
44
42
|
}) {
|
|
45
|
-
const
|
|
43
|
+
const c = useTheme();
|
|
46
44
|
return (
|
|
47
45
|
<Pressable
|
|
48
46
|
accessibilityRole="button"
|
|
49
47
|
accessibilityState={{ disabled: disabled || pending, busy: pending }}
|
|
50
48
|
disabled={disabled || pending}
|
|
51
49
|
onPress={onPress}
|
|
52
|
-
|
|
53
|
-
styles.button,
|
|
54
|
-
(disabled || pending || pressed) && styles.dimmed,
|
|
55
|
-
]}
|
|
50
|
+
className={`min-h-[52px] flex-row items-center justify-center gap-[10px] rounded-[12px] bg-foreground p-[14px] active:opacity-60 ${disabled || pending ? "opacity-60" : ""}`}
|
|
56
51
|
>
|
|
57
|
-
{pending && <ActivityIndicator color={
|
|
58
|
-
<Text
|
|
52
|
+
{pending && <ActivityIndicator color={c.background} />}
|
|
53
|
+
<Text className="text-[17px] font-semibold text-background">{title}</Text>
|
|
59
54
|
</Pressable>
|
|
60
55
|
);
|
|
61
56
|
}
|
|
62
57
|
|
|
63
|
-
export
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
buttonText: { ...styles.buttonText, color: c.background },
|
|
80
|
-
link: { ...styles.link, color: c.primaryText },
|
|
81
|
-
error: { ...styles.error, color: c.destructive },
|
|
82
|
-
card: { ...styles.card, backgroundColor: c.card, borderColor: c.border },
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export const styles = StyleSheet.create({
|
|
87
|
-
screen: { flex: 1, backgroundColor: "#faf9f6" },
|
|
88
|
-
content: {
|
|
89
|
-
flexGrow: 1,
|
|
90
|
-
justifyContent: "center",
|
|
91
|
-
padding: 24,
|
|
92
|
-
paddingBottom: 48,
|
|
93
|
-
gap: 16,
|
|
94
|
-
width: "100%",
|
|
95
|
-
maxWidth: 480,
|
|
96
|
-
alignSelf: "center",
|
|
97
|
-
},
|
|
98
|
-
brandMark: { width: 56, height: 56, borderRadius: 14, marginBottom: 4 },
|
|
99
|
-
eyebrow: {
|
|
100
|
-
color: "#687080",
|
|
101
|
-
fontSize: 12,
|
|
102
|
-
fontWeight: "700",
|
|
103
|
-
letterSpacing: 1.5,
|
|
104
|
-
},
|
|
105
|
-
title: {
|
|
106
|
-
color: "#161b2e",
|
|
107
|
-
fontSize: 32,
|
|
108
|
-
fontWeight: "700",
|
|
109
|
-
letterSpacing: -0.7,
|
|
110
|
-
},
|
|
111
|
-
body: { color: "#495269", fontSize: 17, lineHeight: 25 },
|
|
112
|
-
label: { color: "#161b2e", fontSize: 14, fontWeight: "600" },
|
|
113
|
-
field: { gap: 8 },
|
|
114
|
-
input: {
|
|
115
|
-
minHeight: 52,
|
|
116
|
-
borderWidth: 1,
|
|
117
|
-
borderColor: "#d9dce3",
|
|
118
|
-
borderRadius: 12,
|
|
119
|
-
backgroundColor: "#fff",
|
|
120
|
-
padding: 14,
|
|
121
|
-
color: "#161b2e",
|
|
122
|
-
fontSize: 17,
|
|
123
|
-
},
|
|
124
|
-
button: {
|
|
125
|
-
minHeight: 52,
|
|
126
|
-
borderRadius: 12,
|
|
127
|
-
backgroundColor: "#161b2e",
|
|
128
|
-
flexDirection: "row",
|
|
129
|
-
alignItems: "center",
|
|
130
|
-
justifyContent: "center",
|
|
131
|
-
gap: 10,
|
|
132
|
-
padding: 14,
|
|
133
|
-
},
|
|
134
|
-
buttonText: { color: "#fff", fontSize: 17, fontWeight: "600" },
|
|
135
|
-
dimmed: { opacity: 0.6 },
|
|
136
|
-
link: {
|
|
137
|
-
color: "#2855c5",
|
|
138
|
-
fontSize: 15,
|
|
139
|
-
fontWeight: "600",
|
|
140
|
-
paddingVertical: 8,
|
|
141
|
-
},
|
|
142
|
-
error: { color: "#a31928", fontSize: 16, lineHeight: 23 },
|
|
143
|
-
card: {
|
|
144
|
-
backgroundColor: "#fff",
|
|
145
|
-
borderRadius: 16,
|
|
146
|
-
borderWidth: 1,
|
|
147
|
-
borderColor: "#e0e4ed",
|
|
148
|
-
padding: 20,
|
|
149
|
-
gap: 12,
|
|
150
|
-
},
|
|
151
|
-
});
|
|
58
|
+
export const authClasses = {
|
|
59
|
+
screen: "flex-1 bg-background",
|
|
60
|
+
content:
|
|
61
|
+
"w-full max-w-[480px] grow self-center justify-center gap-[16px] p-[24px] pb-[48px]",
|
|
62
|
+
brandMark: "mb-[4px] size-[56px] rounded-[14px]",
|
|
63
|
+
eyebrow: "text-[12px] font-bold tracking-[1.5px] text-muted-foreground",
|
|
64
|
+
title: "text-[32px] font-bold tracking-[-0.7px] text-foreground",
|
|
65
|
+
body: "text-[17px] leading-[25px] text-muted-foreground",
|
|
66
|
+
label: "text-[14px] font-semibold text-foreground",
|
|
67
|
+
field: "gap-[8px]",
|
|
68
|
+
input:
|
|
69
|
+
"min-h-[52px] rounded-[12px] border border-border bg-card p-[14px] text-[17px] text-foreground",
|
|
70
|
+
link: "py-[8px] text-[15px] font-semibold text-primary-text",
|
|
71
|
+
error: "text-[16px] leading-[23px] text-destructive",
|
|
72
|
+
card: "gap-[12px] rounded-[16px] border border-border bg-card p-[20px]",
|
|
73
|
+
};
|
package/dist/templates/default/packages/disposabl-kit/mobile/components/email-verification.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import { useEffect, useState } from "react";
|
|
|
5
5
|
import { Text, TextInput } from "react-native";
|
|
6
6
|
import { api } from "../lib/convex";
|
|
7
7
|
import { authErrorMessage } from "../../lib/auth-errors";
|
|
8
|
-
import { AuthButton,
|
|
8
|
+
import { AuthButton, authClasses } from "./auth-ui";
|
|
9
9
|
|
|
10
10
|
export function emailLinkCode(link: string): string {
|
|
11
11
|
try {
|
|
@@ -20,18 +20,17 @@ export function EmailLinkInput({
|
|
|
20
20
|
}: {
|
|
21
21
|
onContinue: (code: string) => void;
|
|
22
22
|
}) {
|
|
23
|
-
const styles = useAuthStyles();
|
|
24
23
|
const [link, setLink] = useState("");
|
|
25
24
|
return (
|
|
26
25
|
<>
|
|
27
|
-
<Text
|
|
26
|
+
<Text className={authClasses.body}>
|
|
28
27
|
Copy the link from your email and paste it here. Finish in this app on
|
|
29
28
|
the same device.
|
|
30
29
|
</Text>
|
|
31
30
|
<TextInput
|
|
32
31
|
accessibilityLabel="Email verification link"
|
|
33
32
|
placeholder="Paste email link"
|
|
34
|
-
|
|
33
|
+
className={authClasses.input}
|
|
35
34
|
value={link}
|
|
36
35
|
onChangeText={setLink}
|
|
37
36
|
autoCapitalize="none"
|
|
@@ -56,7 +55,6 @@ export function EmailVerification() {
|
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
function CompleteVerification({ code }: { code: string }) {
|
|
59
|
-
const styles = useAuthStyles();
|
|
60
58
|
const { returnTo } = useLocalSearchParams<{ returnTo?: string }>();
|
|
61
59
|
const state = useCompleteSignUp(api.authEmail, { emailCode: code });
|
|
62
60
|
useEffect(() => {
|
|
@@ -65,7 +63,9 @@ function CompleteVerification({ code }: { code: string }) {
|
|
|
65
63
|
return (
|
|
66
64
|
<Text
|
|
67
65
|
accessibilityRole={state.status === "error" ? "alert" : undefined}
|
|
68
|
-
|
|
66
|
+
className={
|
|
67
|
+
state.status === "error" ? authClasses.error : authClasses.body
|
|
68
|
+
}
|
|
69
69
|
>
|
|
70
70
|
{state.status === "error"
|
|
71
71
|
? authErrorMessage(state.userError)
|