Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
import { useState } from "react";
import { KeyboardAvoidingView, Platform, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { router } from "expo-router";
import * as Haptics from "expo-haptics";
import { Text } from "@/components/ui/text";
import { TextField } from "@/components/ui/text-field";
import { Button } from "@/components/ui/button";
import { MulticaLogo } from "@/components/brand/multica-logo";
import { useAuthStore } from "@/data/auth-store";
import { i18n, useT } from "@/lib/i18n";
import { mapAuthError } from "@/lib/auth-error";
export default function Login() {
const { t } = useT("auth");
const sendCode = useAuthStore((s) => s.sendCode);
const [email, setEmail] = useState("");
const [submitting, setSubmitting] = useState(false);
const [error, setError] = useState<string | null>(null);
const onSubmit = async () => {
const trimmed = email.trim();
if (!trimmed) return;
void Haptics.selectionAsync();
setSubmitting(true);
setError(null);
try {
await sendCode(trimmed);
router.push({ pathname: "/verify", params: { email: trimmed } });
} catch (err) {
void Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error);
setError(mapAuthError(err, t("login.send_failed"), (key) => i18n.t(`auth:${key}`)));
} finally {
setSubmitting(false);
}
};
return (
<SafeAreaView className="flex-1 bg-background">
<KeyboardAvoidingView
className="flex-1"
behavior={Platform.OS === "ios" ? "padding" : undefined}
>
<View className="flex-1 justify-center px-6 gap-6">
<View className="items-center gap-3">
<MulticaLogo size={30} />
<View className="gap-1 items-center">
<Text className="text-2xl font-semibold text-foreground">
{t("login.title")}
</Text>
<Text className="text-sm text-muted-foreground text-center">
{t("login.subtitle")}
</Text>
</View>
</View>
<View className="gap-3">
<TextField
autoCapitalize="none"
autoComplete="email"
autoFocus
keyboardType="email-address"
placeholder={t("login.email_placeholder")}
value={email}
onChangeText={setEmail}
onSubmitEditing={onSubmit}
returnKeyType="send"
editable={!submitting}
invalid={!!error}
/>
{error ? (
<Text className="text-sm text-destructive">{error}</Text>
) : null}
</View>
<Button
size="lg"
disabled={submitting || !email.trim()}
onPress={onSubmit}
>
<Text>{submitting ? t("login.sending") : t("login.send_code")}</Text>
</Button>
</View>
</KeyboardAvoidingView>
</SafeAreaView>
);
}