diff options
Diffstat (limited to 'app/(auth)/signin.tsx')
| -rw-r--r-- | app/(auth)/signin.tsx | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/app/(auth)/signin.tsx b/app/(auth)/signin.tsx index 1eac63b..e2d0eda 100644 --- a/app/(auth)/signin.tsx +++ b/app/(auth)/signin.tsx @@ -12,12 +12,18 @@ import { } from "react-native"; import { SafeAreaView } from "react-native-safe-area-context"; import { useAuth } from "../../lib/auth"; +import { useGoogleAuth } from "../../lib/google-auth"; import { t } from "../../lib/locales"; import { colors } from "../../lib/theme"; import { Button, H1, Muted, TextInput } from "../../lib/ui"; export default function SignIn() { const { signIn } = useAuth(); + const { + continueWithGoogle, + isLoading: googleLoading, + error: googleError, + } = useGoogleAuth(); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [loading, setLoading] = useState(false); @@ -55,7 +61,7 @@ export default function SignIn() { if (!result.success) { setError(result.reason || t("signInError")); } - } catch (e) { + } catch { setError(t("signInError")); } finally { setLoading(false); @@ -103,14 +109,36 @@ export default function SignIn() { error={passwordError} /> + <TouchableOpacity + onPress={() => router.push("/(auth)/reset-password")} + style={styles.forgotPasswordLinkContainer} + > + <Text style={styles.link}>{t("forgotPassword")}</Text> + </TouchableOpacity> + {error ? <Text style={styles.error}>{error}</Text> : null} <Button title={t("signIn")} onPress={handleSignIn} loading={loading} - disabled={loading} + disabled={loading || googleLoading} + /> + + <Button + title={t("continueWithGoogle")} + variant="secondary" + onPress={continueWithGoogle} + loading={googleLoading} + disabled={loading || googleLoading} /> + <Muted style={styles.googleHelp}> + {t("googleAuthUnifiedHint")} + </Muted> + + {googleError ? ( + <Text style={styles.error}>{googleError}</Text> + ) : null} </View> <View style={styles.footer}> @@ -151,6 +179,10 @@ const styles = StyleSheet.create({ fontSize: 14, textAlign: "center", }, + googleHelp: { + textAlign: "center", + paddingHorizontal: 8, + }, footer: { flexDirection: "row", justifyContent: "center", @@ -162,4 +194,8 @@ const styles = StyleSheet.create({ color: colors.primary, fontWeight: "700", }, + forgotPasswordLinkContainer: { + alignItems: "flex-end", + marginTop: -8, + }, }); |