import { useState, useCallback, useEffect } from "react"; import { View, Text, TouchableOpacity, TextInput, KeyboardAvoidingView, Platform, ScrollView, } from "react-native"; import { SafeAreaView } from "react-native-safe-area-context"; import { router } from "expo-router"; import { MaterialIcons } from "@expo/vector-icons"; import { saveClaudeSessionKey, loadClaudeSessionKey } from "@/lib/storage"; export default function OnboardingClaudeScreen() { const [savedKey, setSavedKey] = useState(null); const [pendingKey, setPendingKey] = useState(""); const [error, setError] = useState(null); useEffect(() => { loadClaudeSessionKey().then((k) => { if (k) setSavedKey(k); }); }, []); const canSave = pendingKey.trim().startsWith("sk-ant-"); const handleSave = useCallback(async () => { const trimmed = pendingKey.trim(); if (!trimmed.startsWith("sk-ant-")) { setError("Session key must start with sk-ant-"); return; } await saveClaudeSessionKey(trimmed); setSavedKey(trimmed); setPendingKey(""); setError(null); }, [pendingKey]); return ( {/* Top: back + step indicator */} router.back()} className="w-9 h-9 rounded-xl bg-neutral-900 items-center justify-center" > 2 {/* Content */} Connect Claude.ai Enter your session key to monitor your Claude.ai usage windows. {savedKey ? ( Connected {savedKey.slice(0, 16)}… { setSavedKey(null); setPendingKey(""); }} > Change ) : ( {error && ( {error} )} { setPendingKey(t); setError(null); }} placeholder="sk-ant-..." placeholderTextColor="#525252" autoCapitalize="none" autoCorrect={false} secureTextEntry className="border border-neutral-800 rounded-xl px-4 py-3.5 text-sm text-white bg-neutral-900 mb-3" /> Save Session Key How to find your session key Open Claude.ai in Chrome → DevTools (F12) → Application → Cookies → claude.ai → find{" "} sessionKey )} {/* Bottom actions */} router.push("/onboarding/done")} className="rounded-2xl py-4 items-center" style={{ backgroundColor: savedKey ? "#d97706" : "#1a1a1a" }} > Continue router.push("/onboarding/done")} className="py-3 items-center" > Skip for now ); }